Skip to content

ConvertTo-SplatExpression: Cannot find type for custom attribute 'EditorCommand' #42

Description

@ArtisanByteCrafter

Working with the newest Powershell Preview extension (tested on v2019.11.0), ConvertTo-SplatExpression fails with the following error. Non-preview powershell extension works as intended.

Exception             : 
    ErrorRecord : 
        Exception             : 
            Message : Cannot find the type for custom attribute 'EditorCommand'. Make sure that the assembly that contains this type is loaded.
            HResult : -2146233087
        TargetObject          : [EditorCommand(DisplayName='Convert Command to Splat Expression')]
        CategoryInfo          : InvalidOperation: ([EditorCommand(Disp…Splat Expression')]:AttributeAst) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : CustomAttributeTypeNotFound
        InvocationInfo        : 
            ScriptLineNumber : 10
            OffsetInLine     : 5
            HistoryId        : -1
            ScriptName       : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1
            Line             : [EditorCommand(DisplayName='Convert Command to Splat Expression')]
            PositionMessage  : At C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1:10 char:5
                               +     [EditorCommand(DisplayName='Convert Command to Splat Expression') …
                               +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            PSScriptRoot     : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public
            PSCommandPath    : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1
            CommandOrigin    : Internal
        ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1
    TargetSite  : 
        Name          : GetAttribute
        DeclaringType : System.Management.Automation.Language.Compiler
        MemberType    : Method
        Module        : System.Management.Automation.dll
    StackTrace  : 
   at System.Management.Automation.Language.Compiler.GetAttribute(AttributeAst attributeAst)
   at System.Management.Automation.Language.ScriptBlockAst.System.Management.Automation.Language.IParameterMetadataProvider.GetScriptBlockAttributes()+MoveNext()
   at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
   at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
   at System.Management.Automation.CompiledScriptBlockData.InitializeMetadata()
   at System.Management.Automation.CompiledScriptBlockData.Compile(Boolean optimized)
   at System.Management.Automation.PSScriptCmdlet..ctor(ScriptBlock scriptBlock, Boolean useNewScope, Boolean fromScriptFile, ExecutionContext context)
   at System.Management.Automation.CommandProcessor.Init(IScriptCommandInfo scriptCommandInfo)
   at System.Management.Automation.CommandDiscovery.GetScriptAsCmdletProcessor(IScriptCommandInfo scriptCommandInfo, ExecutionContext context, Boolean useNewScope, Boolean fromScriptFile, 
SessionStateInternal sessionState)
   at System.Management.Automation.CommandDiscovery.CreateCommandProcessorForScript(FunctionInfo functionInfo, ExecutionContext context, Boolean useNewScope, SessionStateInternal sessionState) 
   at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(CommandInfo commandInfo, CommandOrigin commandOrigin, Nullable`1 useLocalScope, SessionStateInternal sessionState)    
   at System.Management.Automation.CommandDiscovery.LookupCommandProcessor(String commandName, CommandOrigin commandOrigin, Nullable`1 useLocalScope)
   at System.Management.Automation.ExecutionContext.CreateCommand(String command, Boolean dotSource)
   at System.Management.Automation.PipelineOps.AddCommand(PipelineProcessor pipe, CommandParameterInternal[] commandElements, CommandBaseAst commandBaseAst, CommandRedirection[] redirections,  
ExecutionContext context)
   at System.Management.Automation.PipelineOps.InvokePipeline(Object input, Boolean ignoreInput, CommandParameterInternal[][] pipeElements, CommandBaseAst[] pipeElementAsts,
CommandRedirection[][] commandRedirections, FunctionContext funcContext)
   at System.Management.Automation.Interpreter.ActionCallInstruction`6.Run(InterpretedFrame frame)
   at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
    Message     : Cannot find the type for custom attribute 'EditorCommand'. Make sure that the assembly that contains this type is loaded.
    Data        : System.Collections.ListDictionaryInternal
    Source      : System.Management.Automation
    HResult     : -2146233087
TargetObject          : [EditorCommand(DisplayName='Convert Command to Splat Expression')]
CategoryInfo          : InvalidOperation: ([EditorCommand(Disp…Splat Expression')]:AttributeAst) [], RuntimeException
FullyQualifiedErrorId : CustomAttributeTypeNotFound
InvocationInfo        : 
    ScriptLineNumber : 10
    OffsetInLine     : 5
    HistoryId        : -1
    ScriptName       : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1
    Line             : [EditorCommand(DisplayName='Convert Command to Splat Expression')]
    PositionMessage  : At C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1:10 char:5
                       +     [EditorCommand(DisplayName='Convert Command to Splat Expression') …
                       +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    PSScriptRoot     : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public
    PSCommandPath    : C:\Users\ntwebb\Documents\PowerShell\Modules\EditorServicesCommandSuite\0.4.0\Public\ConvertTo-SplatExpression.ps1
    CommandOrigin    : Internal
ScriptStackTrace      : at <ScriptBlock>, <No file>: line 1

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions