Exceptions thrown in EndBuild can mask failures in build
Open
Area: Debuggability
Area: Engine
triaged
- Dominant language
- C#
- Stars
- 5.5k
- Forks
- 1.5k
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 133
Description
### Steps to reproduce
This came up when debugging #3047. Assume a bug that runs MSBuild out of memory in the command-line invocation of `ExecuteBuild`.
https://github.com/Microsoft/msbuild/blob/06d9ad104648fbc33cdfbdd4015cdc9655bc31a2/src/MSBuild/XMake.cs#L1130-L1141
That exception is then caught and the inner `finally` runs. But if `EndBuild()` throws, _that_ exception is the one that gets logged.
### Expected behavior
Log the first fatal unhandled exception, not anything that might occur when trying to do minimal cleanup.
I have a fix for this, just need to put it in.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.