aspire-plugin icon indicating copy to clipboard operation
aspire-plugin copied to clipboard

Colors in Aspire logs are missing

Open tjementum opened this issue 1 year ago • 4 comments

Small visual bug. After upgrading to Rider 2024.1 and Aspire PlugIn 0.5.0, I've noticed that there are no colors on, e.g., info and warn in the Aspire Log files.

Here are two screenshots for running using the PlugIn vs. just running with the .NET project.

Running with .NET default (without using PlugIn):

CleanShot 2024-04-18 at 10 47 11

Running with using PlugIn (notice no colors):

CleanShot 2024-04-18 at 10 48 39

tjementum avatar Apr 18 '24 08:04 tjementum

Any update on this? I know it’s just a visual thing, but it used to work, and I would speculate that it’s a simple fix.

tjementum avatar Jun 12 '24 12:06 tjementum

There are no updates, and unfortunately it's not the easy one. It depends on how the IDE handles process output, and there is no convenient API to receive output with colors

rafaelldi avatar Jun 12 '24 12:06 rafaelldi

There are no updates, and unfortunately it's not the easy one. It depends on how the IDE handles process output,

Hmm… But the colors are not missing in the IDE, but in the Aspire Dashboard. I’m not even sure how the Rider add-in can have an effect on how the Aspire Dashboard renders log output, but that is the case.

Again, I’m pretty sure this used to work sometime before April 18th, when I reported this.

tjementum avatar Jun 12 '24 21:06 tjementum

Can this please be addressed? If I debug the apphost project without this plugin, I get colors in console logs but can't hit breakpoints or view console logs within the IDE. If I debug with this plugin, the console logs in the IDE and the aspire dashboard don't have any formatting or colors. This has to be just a random bug, given the colors come through when debugging apphost without the plugin.

A little more information. When debugging with this plugin, the console output in the Debug window works perfectly. However, in the Aspire section of the Services window, when viewing an individual resource (not the apphost), the console output there and in the aspire dashboard is messed up beyond just colors and formatting. It doesn't show console logs as they happen and instead shows them all at once when the application ends and sometimes is just missing some with blank lines. The structured logs through open telemetry in aspire dashboard have the same issue. These issues don't exist when debugging the aspire host without the plugin

mtrainham avatar Sep 21 '24 03:09 mtrainham

As far as I can tell, in .NET 9 with plugin version 1.6.4 this works in the dashboard for me.

However, for executables but only in the (services tab) console window, it shows the printed ascii color codes.

2024-11-19T00:13:30.0430000Z [40m[32minfo[39m[22m[49m: StackExchange.Redis.ConnectionMultiplexer[0]
2024-11-19T00:13:30.0430000Z       Total connect time: 53 ms

Juulsn avatar Nov 19 '24 13:11 Juulsn

As far as I can tell, in .NET 9 with plugin version 1.6.4 this works in the dashboard for me.

Can you share a screenshot? After reading your comment, I eagerly updated to version 1.6.4, but I still don't have any colors in the Aspire Dashboard when starting to use this plugin.

Your issue with ASCII colors is likely related to the new improved support for ANSI escape codes in the Aspire 9 feature:

https://learn.microsoft.com/en-us/dotnet/aspire/whats-new/dotnet-aspire-9?tabs=windows#colorful-console-log

@rafaelldi It would be awesome if you could look into this. I'm pretty sure this used to work in the very first versions of this plug-in.

tjementum avatar Nov 20 '24 06:11 tjementum

As I said, unfortunately, this is not an easy task, it will take quite a bit of time to implement, and I don't have enough resources for now. You can check the logs in the Services tool windows and Run/Debug tool windows, they should look okay.

image image

rafaelldi avatar Nov 20 '24 08:11 rafaelldi

Can you share a screenshot? After reading your comment, I eagerly updated to version 1.6.4, but I still don't have any colors in the Aspire Dashboard when starting to use this plugin.

I'm sorry, you are right. For normal projects it's still not working in Aspire dashboard. Executables though do seem to work. Projects however do work in the Services tool window.

I'm pretty sure this used to work in the very first versions of this plug-in.

I thought so.

Juulsn avatar Nov 20 '24 10:11 Juulsn

@tjementum Probably, I've found a way to fix that, so after #313 it should work fine. At least, in my tests I don't see any problems

rafaelldi avatar Dec 04 '24 08:12 rafaelldi

@tjementum Probably, I've found a way to fix that, so after #313 it should work fine. At least, in my tests I don't see any problems

Awesome... I can confirm that I now see colors. Thank you!

tjementum avatar Dec 09 '24 22:12 tjementum