Skip to content
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

BuildCheck has better message when Check fails on Initialize #10612

Merged
merged 5 commits into from
Sep 6, 2024

Conversation

maridematte
Copy link
Contributor

Partial fix of #10522

Context

When a Check throws an exception it falls with an internal logger exception and crashes the build. This is not ideal. It decided that when a Check fails, we do not fail the build, just give a warning and deregister the check.

Changes Made

Changed the BuildCheck logger to catch initialization exceptions, and dispatch them as warnings and not errors.

Testing

Added end to end test with a sample custom check that throws an exception.

Notes

This is just a catch for exception on Check initialization. There are tests added for other cases but the fix will be different for them, so it will be done in another PR.

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/Build/BackEnd/Components/Logging/EventSourceSink.cs Outdated Show resolved Hide resolved
Copy link
Member

@AR-May AR-May left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maridematte maridematte merged commit 2206a05 into dotnet:main Sep 6, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants