Skip to content

Console.WriteLine not showing up from AspNetCore http handler #4860

Open
@mxschmitt

Description

Repro:

  1. git clone https://github.com/mxschmitt/dotnet-nunit-asp-console-writeline
  2. cd dotnet-nunit-asp-console-writeline
  3. dotnet test --logger:"console;verbosity=detailed"

Expected: All the 8 WriteLine calls are getting shown

Actual: they are not getting shown

Notes:

  • It looks like that the ExecutionContext is getting lost
  • I have a "hack" inside which makes it work and demonstrates the bug, maybe its a known limitation:

https://github.com/mxschmitt/dotnet-nunit-asp-console-writeline/blob/a889dae8286c6fd0fc8383668a498303e9a1beeb/UnitTest1.cs#L24-L28

It seems related to #4728 - when I apply the same fix to the repro of #4728 its also working as expected.

Feel free to move / fold it into another issue. I filed it mostly for the sake of sharing the research.

Metadata

Assignees

No one assigned

    Labels

    InvestigateWe will look into this

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions