-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Log before unregistering Fixes #9455 #9571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JanKrivanek
approved these changes
Dec 28, 2023
Member
JanKrivanek
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected order of messages seems less harm then losing the exception info - so the change looks good to me.
I'm just wondering whether the rethrowing info wouldn't be helpful as well
YuliiaKovalova
approved these changes
Jan 12, 2024
This was referenced Jul 29, 2025
Closed
Closed
This was referenced Oct 15, 2025
Closed
Closed
This was referenced Oct 26, 2025
This was referenced Nov 14, 2025
Open
This was referenced Nov 22, 2025
This was referenced Dec 1, 2025
This was referenced Dec 9, 2025
Open
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9455
Context
If we crash very early—like in the midst of setting up the ProjectLoggingContext—we have all the machinery set up to log information like that the build started, but then we unregister the relevant handlers before we actually log that we'd failed.
Changes Made
Do not unregister handlers until shutdown
Testing
I tested with the repro from #9455, and it now looks like this:
(with a full stack trace).
Notice that it finds the real exception—just an ordinary System.Exception with no message in this case.
Notes
I went directly against the advice of a comment to make this change. I tried to see what motivated that comment, but it came with the initial commit along with all the code next to it. Regardless, it does not make me feel good to do so. I don't understand why the comment should be true, but please do read it and let me know if this is a horrible idea.
I also intentionally reused MSB4017 because this feels like the same exception, and I didn't want to confuse people. I just added some extra formatting around it. Like with going against the comment, I can find a new number if reviewers don't like that idea.