Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WebToolsE2E][Aspire] There are some garbled characters in the Aspire dashboard Console log after installing SDK 9.0 RC2 #5716

Closed
Rita003 opened this issue Sep 14, 2024 · 18 comments · Fixed by #5798
Assignees
Labels
external Issues that represent work that's external to this repo.
Milestone

Comments

@Rita003
Copy link

Rita003 commented Sep 14, 2024

REGRESSION INFO:
Work in SDK 8.0.401 + Aspire 8.2.0
Work in SDK 9.0 RC1 + Aspire 9.0 P4

INSTALL STEPS

  1. Clean machine: Win11 x64 23h2 ENU

  2. Install SDK 9.0.100-rc.2.24463.45

    • Apply feed for SDK 9.0 RC2
  3. Install Aspire 9.0.0-preview.4.24463.11

    • Apply the dotnet8 feed for Aspire 9.0P4

REPRO STEPS

  1. Open CMD, create an Aspire Starter App using following commands:
dotnet new aspire-starter -o AspireStarterApp
cd AspireStarterApp/AspireStarterApp.AppHost
  1. Dotnet run the project in CMD, and open URL in the browser.
    dotnet run
  2. Click the "Console" option on the Aspire dashboard left, and select the apiservice/webfrontend resource.

Note:

  1. This issue also repro on SDK 8.0.401 + SDK 9.0 RC2 + Aspire 8.2.0.
  2. This issue doesn't repro when running the Aspire Starter App in VS/VSCode

ACTUAL
There are some garbled characters in the console log
Screenshot 2024-09-14 172119

EXPECTED
There is no garbled code in the console log
Screenshot 2024-09-14 164442

@dotnet-issue-labeler dotnet-issue-labeler bot added the needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners label Sep 14, 2024
@davidfowl davidfowl added bug and removed needs-area-label An area label is needed to ensure this gets routed to the appropriate area owners labels Sep 14, 2024
@davidfowl
Copy link
Member

Does this happen on every project and only at the beginning?

@davidfowl davidfowl added this to the 9.0 milestone Sep 15, 2024
@Rita003
Copy link
Author

Rita003 commented Sep 18, 2024

Does this happen on every project and only at the beginning?

@davidfowl This issue happens on every project every time

@davidfowl
Copy link
Member

@JamesNK can you look at this?

@JamesNK
Copy link
Member

JamesNK commented Sep 18, 2024

I searched for some of the garbled characters and they match up with some ANSI escape sequences

https://gist.github.com/fnky/458719343aabd01cfb17a3a4f7296797#common-private-modes

ESC[?25h = show cursor
ESC[?25l = hide cursor

Hmm, is .NET 9 doing some funky stuff when the console starts up now? Introduced in RC2?

@davidfowl
Copy link
Member

cc @stephentoub ?

@stephentoub
Copy link
Member

Hmm, is .NET 9 doing some funky stuff when the console starts up now? Introduced in RC2?

Not to my knowledge. And I don't see any meaningful changes in System.Console in the last several months.

Plus if this is actually Windows as cited, System.Console on Windows doesn't emit ANSI escape sequences; it uses the Win32 APIs for interactions. It only uses ANSI escape sequences on Unix.

@JamesNK
Copy link
Member

JamesNK commented Sep 18, 2024

DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION is set to true.

Maybe the new output is added in the Microsoft.Extensions.Logging layer?

Regardless of where the output is added from, the Aspire console UI shouldn't print them. If there is an unknown/unsupport sequence then it should be ignored. And to avoid blank lines, perhaps ignore adding the line of output if it is 100% unsupported control characters.

@JamesNK JamesNK self-assigned this Sep 18, 2024
@JamesNK
Copy link
Member

JamesNK commented Sep 18, 2024

Some of the strings didn't look like the ANSI codes as I know them. I searched more to see if I could find them and got:

https://conemu.github.io/en/AnsiEscapeCodes.html#ConEmu_specific_OSC

ESC]9;4;3;0\ in the garbage text is for setting progress state in the taskbar.

@JamesNK
Copy link
Member

JamesNK commented Sep 18, 2024

I think the console output is coming from here:

https://github.com/dotnet/msbuild/blob/5bab860b2477f03050f170473a2563c5217d546f/src/Framework/Logging/AnsiCodes.cs#L95-L123

How could msbuild logging leak into the app's console output?

@rainersigwald
Copy link
Member

Are y'all invoking the dotnet run command and piping its output into this? That might repro this (dotnet/msbuild#10579, fix just approved for RC2).

@davidfowl
Copy link
Member

Yes!

@davidfowl davidfowl added external Issues that represent work that's external to this repo. and removed area-dashboard labels Sep 19, 2024
@Rita003
Copy link
Author

Rita003 commented Sep 25, 2024

@JamesNK Verify this bug shows blank lines after installing the latest SDK 9.0.100-rc.2.24474.11 + Aspire 9.0.0-preview.4.24474.5 in today's validation. Do we expect blank lines not to be displayed?
Screenshot 2024-09-25 180335

@JamesNK
Copy link
Member

JamesNK commented Sep 25, 2024

Yes, that is expected. My fix removed the bad characters, but adding a new line isn't considered bad.

The complete fix is inside .NET SDK. Try out the version suggested in this comment (or later).

@v-elenafeng
Copy link

@JamesNK Rita used a newer build than the one in the comment, not sure why the lines were not removed completely.

Btw, this issue is also reproduced in SDK 9.0 RC2 + Aspire 8.2.1, are we considering fixing it for Aspire 8.2.1 as well? cc: @joperezr @balachir

@JamesNK
Copy link
Member

JamesNK commented Sep 25, 2024

I don't think so. It's not a high impact bug. And it should be fixed in the SDK to remove the root cause before 9 ships.

@v-elenafeng
Copy link

@JamesNK The msbuild issue 10579 has been fixed. But this issue is still reproducible with SDK 9.0 RC2 + Aspire 8.2.1 / Aspire 9.0 rc1 (fixed the garbled characters but left lines with the time but no content in the console). Is this a different issue? What can we do to fix this at its root? Open an another bug in the dotnet/msbuild repo?

@JamesNK
Copy link
Member

JamesNK commented Sep 27, 2024

Looks like dotnet/msbuild#10579 isn’t completely fixed according to comments on it.

Blank lines are coming from the sdk, not Aspire. We can only wait until it is fixed there.

@v-elenafeng
Copy link

From what I‘ve read, the issue 10579 is now only reproes with Win server 2012 which doesn't support VT100. Not sure if there will be a deeper fix for that and the issue has also been closed.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
external Issues that represent work that's external to this repo.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants