Open Meligy opened 4 months ago
Hi @Meligy, nice to hear from you :wave:
Is this a potential improvement to dotnet watch
, i.e. ignoring ANSI escape sequences when looking for the Now listening on:
log line?
IIRC, dotnet watch
uses a simple regex to find this line, so although it could turn out to be a fairly odd looking regex, it might be reasonable just to extend it to ignore ANSI escapes. If it turns out that's the case it'd likely have benefits to other logging systems also :-)
Hello,
Sorry, I've just realised that this is a question not just a comment.
Is this a potential improvement to dotnet watch, i.e. ignoring ANSI escape sequences when looking for the Now listening on: log line?
This is a default behaviour of dotnet run
itself actually, and dotnet watch
supports it. I'm not sure how it works under the hood.
I think you might find some info about that here: https://github.com/dotnet/aspnetcore/issues/25317#issuecomment-751824330
In the past I remember disabling browser launch with an environment variable to allow for console colors.
Hello,
First, thanks a lot for the defacto standard dotnet logger that countless apps depend on.
Sorry for only getting to say this while contacting for a small-ish bug.
This bug is about how applying theme to redirected output seems to stop
dotnet watch run
from starting a browser if the dotnet app is a web application.I'll use the template provided, just as headers so that I don't have to indent my input:
The exact package id and version you're using
"Serilog.Sinks.Console" v5.0.0
Your
dotnet
toolchain version, target framework, and operating system,The current behavior
I have run the following steps:
Then I modified the "Program.cs" file to be:
Then I ran:
The app raun, but the browser did not start, instead, I got a non blocking negative message in the console:
The only
AnsiConsoleTheme
that lets the browser open when I restartdotnet watch run
isAnsiConsoleTheme.None
, which loses all console colours. You also lose all console colours if you leaveapplyThemeToRedirectedOutput
asfalse
.What you expect or want to happen instead
Ideally the browser would start, the console colouring would still work, and I wouldn't see the message that treats the URL as a file.
Additional Notes
It looks from the message as if the
dotnet run
is trying to start the URL as a process, and the redirection treats that as running an executable file or something. But I am not sure.Again, thanks for all the great work.
Cheers,