spectre.console icon indicating copy to clipboard operation
spectre.console copied to clipboard

Windows 2012R2 Error System.NotSupportedException

Open jsreynolds opened this issue 4 years ago • 2 comments

Information

  • OS: Windows 2012 R2
  • Terminal: Windows Terminal

I feel a bit dumb having gone this far without considering the impacts. I developed my console app using dotnet 5 on Windows 10. The deployment target is Windows 2012R2 (has dotnet Core installed appropriately, runs other dotnet core apps just fine).

My semi-educated guess is that I simply cannot use Spectre.Console in the Windows 2012 world.

When I run it and use the SelectionPrompt(), I get the following error:

Unhandled Exception. System.NotSupportedException: Cannot show selection prompt since current terminal does not support ANSI escape sequences.

It's basically this:

            string f = AnsiConsole.Prompt(
                new SelectionPrompt<string>()
                    .Title("Select fruit?")
                    .Mode (SelectionMode.Independent)
                    .HighlightStyle(Style.Plain)
                    .AddChoices( new[] {"Apple", "Pear"})
            );

image

jsreynolds avatar Jul 22 '21 23:07 jsreynolds

@jsreynolds Some functionality in Spectre.Console, such as some prompts, requires a terminal that knows how to interpret VT/ANSI sequences. Sadly, cmd.exe in versions prior to Windows 10 (build 16257) does not support that.

patriksvensson avatar Jul 24 '21 08:07 patriksvensson

Note: Revisit this once we've shipped 1.0. We might be able to support this scenario using the VT/ANSI emulation layer in https://github.com/spectreconsole/terminal

patriksvensson avatar Aug 07 '21 09:08 patriksvensson

Hi,

Is there any fix for this, we are facing same issue in Windows Server 2012R2 .

chukkalasandeep avatar Jan 11 '24 06:01 chukkalasandeep

@chukkalasandeep Sadly, there is no fix for this. We would need some kind of ANSI command sequence emulator for this, and we don't have one.

Since Windows Server 2012(R2) is out of official support as well, I don't see us adding support for this at this point.

patriksvensson avatar Jan 11 '24 07:01 patriksvensson