Skip to content

dotnet CLI commands no longer work in .NET 7/8 with detached console #98441

@Wedgetable

Description

@Wedgetable

Describe the bug

We have some Azure pipelines that run some .NET commands through Wine on Linux agents. Upon trying to upgrade from .NET 6 to .NET 8, we can no longer run any dotnet command from Wine (for example, /opt/wine-stable/bin/wine64 $HOME/win-dotnet/dotnet.exe --version) on our pipelines. Instead we get an exception:

Unhandled exception. System.IO.IOException: Invalid access.
   at System.ConsolePal.SetConsoleOutputEncoding(Encoding enc)
   at System.Console.set_OutputEncoding(Encoding value)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

I'm using dotnet --version as an example in this bug, but it happens for dotnet *anything*.

  • Running /path/to/wine64 /path/to/dotnet.exe --version from the Azure agent pipeline job works on .NET 5/6
  • Running /path/to/wine64 /path/to/dotnet.exe --version in a regular Terminal on the same agent works on .NET 5/6/7/8
  • Native Linux .NET 8 commands work from the pipeline, if dotnet-sdk is installed

In Wine, we get the following warning when running from an Azure agent:
0024:warn:console:console_ioctl Incorrect access to Shell-no-window console (ioctl=50403c)

Which possibly was not a problem until hitting this code that was added: dotnet/sdk@697d62c

To Reproduce

Prereq: an Azure agent that runs on Linux

  1. Install the latest version of wine-stable on the agent
  2. Download and unzip the latest version of .NET 7 or .NET 8 for Windows somewhere on the agent, for example $HOME/win-dotnet
  3. In a pipeline script targeting the agent, run /opt/wine-stable/bin/wine64 $HOME/win-dotnet/dotnet.exe --version
  4. Run pipeline -> hit exception.

Example pipeline file: https://gist.github.com/Wedgetable/e75b08ae1eb3b2fb10cc2a53a9953745

Exceptions (if any)

Unhandled exception. System.IO.IOException: Invalid access.
   at System.ConsolePal.SetConsoleOutputEncoding(Encoding enc)
   at System.Console.set_OutputEncoding(Encoding value)
   at Microsoft.DotNet.Cli.Program.Main(String[] args)

Further technical details

  • Agent version: 3.232.1
  • OS: Ubuntu 20.04.6 LTS 64-bit
  • wine64 version: wine-9.0
  • .NET SDK for Windows version(s): 7.0.405, 8.0.101

Not sure if this is a .NET bug, a Wine bug, or an Azure pipelines agent bug. We are currently getting technical support from CodeWeavers on this issue as well.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions