Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled property value type 'Kingsland.MofParser.Ast.ComplexValueAst' #83

Closed
raandree opened this issue May 23, 2024 · 3 comments
Closed

Comments

@raandree
Copy link

The method ParseMofFileInstances throws a NotImplementedException when dealing with instance types.

Exception calling "ParseMofFileInstances" with "1" argument(s): "Unhandled property value type 'Kingsland.MofParser.Ast.ComplexValueAst'"

Do you have by any chance extended the parser?

This is the PowerShell code I am using and below is a MOF file to reproduce the error.

Add-Type -Path $PSScriptRoot\MofParser\Kingsland.MofParser.dll

function Get-MofFileClasses
{
    param (
        [Parameter(Mandatory, ValueFromPipeline)]
        [string[]]$Path
    )

    begin
    {
        $mofClasses = @()
    }

    process
    {
        foreach ($p in $Path)
        {
            $p = Resolve-Path -Path $p
            $mofClasses += [Kingsland.MofParser.PowerShellDscHelper]::ParseMofFileInstances($p)
        }
    }

    end
    {
        $mofClasses
    }
}

$c = Get-MofFileClasses -Path D:\Git\DscBuildHelpersDebug\output\MOF\ClassBasedNode.mof
instance of CustomObject1 as $CustomObject11ref
{
Bool1 = True;
 String1 = "21Object1String1";

};

instance of ClassBasedResource2 as $ClassBasedResource21ref
{
Key = "2k1";
 ModuleVersion = "0.1.0";
 Object1 = $CustomObject11ref;
 Ensure = "Present";
 SourceInfo = "::3::1::ClassBasedResource2";
 ResourceID = "[ClassBasedResource2]2k1::[ClassBasedResources2]ClassBasedResources2";
 ModuleName = "ClassBased";

 ConfigurationName = "RootConfiguration";

};
instance of OMI_ConfigurationDocument


                    {
 Version="2.0.0";


                        MinimumCompatibleVersion = "1.0.0";


                        CompatibleVersionAdditionalProperties= {"Omi_BaseResource:ConfigurationName"};


                        Author="randr";


                        GenerationDate="05/23/2024 14:06:44";


                        GenerationHost="RAANDREE0";


                        Name="MOF__ NA";


                    };
@mikeclayton
Copy link
Member

Hello. Just a quick reply to let you know I've seen this issue. I'll have a proper look over the weekend and give you an update after...

mikeclayton added a commit that referenced this issue May 27, 2024
@mikeclayton
Copy link
Member

mikeclayton commented May 27, 2024

I've just published a new nuget package - v8.0.0 which is bumped to dotnet 8.

It's also got a new implementation for domain objects (just Instances for now, but potentially Classes, Enumerations, etc at a later date) and a slightly different way of parsing, but it should be a drop-in replacement for what you've got at the moment.

It's not 100% feature complete across the whole MOF spec, but if you give that a go and let me know if there's any problems I'll take another look...

@mikeclayton
Copy link
Member

Closing ticket on the assumption the new release fixes it. Will re-open if there's any problems reported...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants