Skip to content

Commit

Permalink
Don't let System.CommandLine swallow exceptions (#110851)
Browse files Browse the repository at this point in the history
Apparently System.CommandLine will hijack unhandled exceptions by default so that it can print the stack trace in red. The price to pay for red stack traces is no crash dumps. It's not a very good tradeoff.
  • Loading branch information
MichalStrehovsky authored Dec 20, 2024
1 parent cf4d2b0 commit 64f5b0a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/coreclr/tools/ILVerify/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,8 @@ public PEReader Resolve(string simpleName)
private static int Main(string[] args) =>
new CliConfiguration(new ILVerifyRootCommand().UseVersion())
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
}.Invoke(args);
}
}
3 changes: 2 additions & 1 deletion src/coreclr/tools/aot/ILCompiler/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,8 @@ private static int Main(string[] args) =>
.UseVersion()
.UseExtendedHelp(ILCompilerRootCommand.GetExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
}.Invoke(args);
}
}
3 changes: 2 additions & 1 deletion src/coreclr/tools/aot/crossgen2/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -915,7 +915,8 @@ private static int Main(string[] args) =>
.UseVersion()
.UseExtendedHelp(Crossgen2RootCommand.GetExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
}.Invoke(args);
}
}
3 changes: 2 additions & 1 deletion src/coreclr/tools/dotnet-pgo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ private static int Main(string[] args) =>
.UseVersion()
.UseExtendedHelp(PgoRootCommand.GetExtendedHelp))
{
ResponseFileTokenReplacer = Helpers.TryReadResponseFile
ResponseFileTokenReplacer = Helpers.TryReadResponseFile,
EnableDefaultExceptionHandler = false,
}.Invoke(args);

public static void PrintWarning(string warning)
Expand Down

0 comments on commit 64f5b0a

Please sign in to comment.