Dotnet run does not preserve colors in child processes
See original GitHub issue@mattwarren in BenchmarkDotNet brought this to my attention
Steps to reproduce
dotnet new
make Program.cs
using System;
namespace ConsoleApplication
{
public class Program
{
public static void Main(string[] args)
{
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("Hello World!");
}
}
}
dotnet restore
dotnet run
Expected behavior
Outputs gray text
Actual behavior
Environment data
dotnet --version
output:
C:\Users\brthor\code\repro\run-color>dotnet --version
.NET Command Line Tools (1.0.0-beta-001828)
Product Information:
Version: 1.0.0-beta-001828
Commit Sha: N/A
Runtime Environment:
OS Name: Windows
OS Version: 10.0.10586
OS Platform: Windows
Runtime Id: win10-x64
I’d expect this to be present anywhere because we don’t do anything special to handle Console.SetColor or Console.ForegroundColor calls in child processes.
cc @anurse any ideas on how we could handle this?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:6
- Comments:42 (35 by maintainers)
Top Results From Across the Web
Dotnet run does not preserve colors in child processes #5432
To be clear, run is fine. Stuff that is outside/wrapping run doesn't. See the screenshot. Test and Watch (the ones folks will use...
Read more >preserve color when executing child_process.spawn
I'm trying to execute a windows command through cmd.exe in node.js using child_process.spawn. It executes correctly, but only displays in ...
Read more >Cannot debug net6.0-macos Apps - Developer Community
This is a regression. I can no longer debug net6.0-macos apps. It also fails for net6.0-maccatalyst apps. When I hit debug, the following ......
Read more >Call JavaScript functions from .NET methods in ASP. ...
This article explains how to invoke JavaScript (JS) functions from .NET. For information on how to call .NET methods from JS, see Call...
Read more >dotnet watch command - .NET CLI
The dotnet watch command is a file watcher that runs a dotnet command when changes in source code are detected.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Has this fix been released? I’m still seeing uncolored output when using
dotnet watch
.This is a problem, it seems, with all things that wrap
dotnet run
, likedotnet test
anddotnet watch
.I am seeing this even today with 1.0.0-preview2-003119. That’s pretty new. We need to fix this soon IMHO, it’s super annoying. @Eilon