Skip to content

S.M.A.Language.Compiler doesn't work on .NET Core 3.0 #8880

@KexyBiscuit

Description

@KexyBiscuit

Steps to reproduce

using var ps = PowerShell.Create();
var results = ps.AddScript("Get-Command Write-Output").Invoke();

Expected behavior

It works.

Actual behavior

System.TypeInitializationException
  HResult=0x80131534
  Message=The type initializer for 'System.Management.Automation.Language.Compiler' threw an exception.
  Source=System.Management.Automation
  StackTrace:
   at System.Management.Automation.SessionStateInternal..ctor(SessionStateInternal parent, Boolean linkToGlobal, ExecutionContext context)
   at System.Management.Automation.ExecutionContext.InitializeCommon(AutomationEngine engine, PSHost hostInterface)
   at System.Management.Automation.ExecutionContext..ctor(AutomationEngine engine, PSHost hostInterface, InitialSessionState initialSessionState)
   at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, InitialSessionState iss)
   at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
   at System.Management.Automation.Runspaces.LocalRunspace.OpenHelper(Boolean syncCall)
   at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
   at System.Management.Automation.Runspaces.RunspaceBase.Open()
   at System.Management.Automation.PowerShell.Worker.CreateRunspaceIfNeededAndDoWork(Runspace rsToUse, Boolean isSync)
   at System.Management.Automation.PowerShell.CoreInvokeHelper[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TInput,TOutput](PSDataCollection`1 input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.CoreInvoke[TOutput](IEnumerable input, PSDataCollection`1 output, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke(IEnumerable input, PSInvocationSettings settings)
   at System.Management.Automation.PowerShell.Invoke()
   (further stack trace is omitted)

Inner Exception 1:
TypeInitializationException: The type initializer for 'System.Management.Automation.Language.CachedReflectionInfo' threw an exception.

Inner Exception 2:
AmbiguousMatchException: Ambiguous match found.

Environment data

<TargetFramework>netcoreapp3.0</TargetFramework>
<PackageReference Include="Microsoft.PowerShell.SDK" Version="6.2.0-preview.4" />

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-AnsweredThe question is answered.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions