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

Add binlog message in case of failure to add embedded file #10212

Conversation

JanProvaznik
Copy link
Contributor

Fixes #9450

Context

in #9307 an empty catch was added in ProjectImportsCollector.cs

Changes Made

create an event that adds a low priority message if an exception occurs there

Testing

an exception in that place occurs only if weird things are happening with the files (e.g. they are edited while read)
did not manage to create an end-to-end test
looking for ideas to make an unit test

Notes

@JanKrivanek
Copy link
Member

FYI @KirillOsenkov

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!

I left couple of comments for consideration.

It's fine to skip unit test here - but please make sure to simulate the scenario manually (e.g. under the debugger) to have a binlog produced and verify that the build finishes just fine and that the log can be opened in binlog viewer

src/Build/Logging/BinaryLogger/ProjectImportsCollector.cs Outdated Show resolved Hide resolved
src/Build/Logging/BinaryLogger/ProjectImportsCollector.cs Outdated Show resolved Hide resolved
src/Build/Logging/BinaryLogger/ProjectImportsCollector.cs Outdated Show resolved Hide resolved
@JanProvaznik
Copy link
Contributor Author

I conducted a manual test for this fix: placed a breakpoint in AddFileCore and deleted the file which is being read in it.
Result: The exception was caught and the message appeared in the binlogfile as expected.

Copy link
Member

@YuliiaKovalova YuliiaKovalova left a comment

Choose a reason for hiding this comment

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

Thank you!

@rainersigwald
Copy link
Member

@dotnet-policy-service rerun

@JanProvaznik JanProvaznik merged commit 3deec2f into dotnet:main Jun 12, 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.

Add binlog message in case of failure to add embedded file(s)
5 participants