Skip to content

System.CommandLine doesn't work with Wasm #2195

@richlander

Description

@richlander

I tried using System.CommandLine with the wasiconsole app type/template

I get this:

Unhandled Exception:
System.PlatformNotSupportedException: Operation is not supported on this platform.
   at System.ConsolePal.IsOutputRedirectedCore()
   at System.Console.<get_IsOutputRedirected>g__EnsureInitialized|36_0()
   at System.Console.get_IsOutputRedirected()
   at System.CommandLine.IO.SystemConsole.get_IsOutputRedirected()
   at System.CommandLine.IO.SystemConsole.GetWindowWidth()
   at System.CommandLine.CommandLineConfiguration.DefaultHelpBuilderFactory(BindingContext context, Nullable`1 requestedMaxWidth)
   at System.CommandLine.Builder.CommandLineBuilder.<GetHelpBuilderFactory>g__CreateHelpBuilder|26_0(BindingContext bindingContext)
   at System.CommandLine.Invocation.ServiceProvider.<>c__DisplayClass1_0.<.ctor>b__3(IServiceProvider _)
   at System.CommandLine.Invocation.ServiceProvider.GetService(Type serviceType)
   at System.CommandLine.Binding.BindingContext.get_HelpBuilder()
   at System.CommandLine.Help.HelpResult.Apply(InvocationContext context)
   at System.CommandLine.Invocation.ParseErrorResult.Apply(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.GetExitCode(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.<Invoke>g__FullInvocationChain|3_0(InvocationContext context)
   at System.CommandLine.Invocation.InvocationPipeline.Invoke(IConsole console)
   at System.CommandLine.CommandExtensions.Invoke(Command command, String[] args, IConsole console)
   at Program.<Main>$(String[] args)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions