microsoft / microsoft/vscode-dotnettools

[BUG] ASP.NET Core log lines are printed double in different formats in VS Code debugger making the log very hard to read.

Open
#2,018 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

area-debugging bug
Dominant language
No language data
Stars
321
Forks
54
Avg merge
2d 19h
Merged PRs (30d)
2

Description

Describe the Issue

When I run my ASP.NET Core apps in the debugger in C# Dev Kit, every log line produced by the application is printed out twice, with two different log line formattings. This makes the log very hard to read, both because there is double the amount of text there should be, and because each line has a different format making it very hard to quickly scan the log.

Steps To Reproduce

When I run a new ASP.NET Core project from the console, each log message is printed fine like this:

$ dotnet new webapi
The template "ASP.NET Core Web API" was created successfully.
Processing post-creation actions...
Restoring ***/logtest.csproj:
  Determining projects to restore...
  Restored ***/logtest.csproj (in 1.56 sec).
Restore succeeded.
$ dotnet new sln
The template "Solution File" was created successfully.
$ dotnet sln . add .
Project `logtest.csproj` added to the solution.
$ dotnet run
Building...
info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5050
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
info: Microsoft.Hosting.Lifetime[0]
      Content root path: ***/logtest

However when I run the same thing in the C# Dev Kit debugger in VS Code I get the following output where each log line is printed twice with different formatting, making the log very hard to read:

info: Microsoft.Hosting.Lifetime[14]
      Now listening on: http://localhost:5050
Microsoft.Hosting.Lifetime: Information: Now listening on: http://localhost:5050
info: Microsoft.Hosting.Lifetime[0]
      Application started. Press Ctrl+C to shut down.
Microsoft.Hosting.Lifetime: Information: Application started. Press Ctrl+C to shut down.
info: Microsoft.Hosting.Lifetime[0]
      Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Hosting environment: Development
Microsoft.Hosting.Lifetime: Information: Content root path: ****
info: Microsoft.Hosting.Lifetime[0]
      Content root path: ****
Expected Behavior

Each log line should only be printed once, and each log line should be printed in the same format as other log lines, the same way it is done when using dotnet run

Environment Information

Windows 11 with WSL remote in Ubuntu distribution.
VS Code: 1.100.0
C# Dev Kit: 1.19.63
.NET SDK: 8

It looks like i am not the first person who have experienced this bug, but I couldn't find it reported here, therefore I created it. https://stackoverflow.com/questions/62083612/different-and-multiple-logging-outputs https://stackoverflow.com/questions/63872967/duplicate-log-lines-in-vscode-when-debugging-asp-net-core-app

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the issue by creating an ASP.NET Core Web API with dotnet new webapi and running it in the C# Dev Kit debugger in VS Code, using the reported Windows 11 and WSL Ubuntu setup if available. Compare debugger output with dotnet run; done means each application log appears once and uses one consistent format.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, vscode
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.