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

properly report failure to deserialize job file #11780

Merged

Conversation

brettfo
Copy link
Contributor

@brettfo brettfo commented Mar 10, 2025

If the C# NuGet updater fails to deserialize the job.json file, the error handler goes into a method that attempts to turn the exception into a dependabot-specific type. One of the exception types listed, however, is from an MSBuild binary which means that MSBuild needs to have been resolved first.

This PR builds on the findings of @rhyskoedijk and forces MSBuild to have been loaded before the first time the job file is parsed. This behavior is really complicated to unit-test because by definition, all unit test runs have already loaded MSBuild. Subsequent calls to the updater don't need MSBuild pre-loaded in this way because if we get that far we already know the file is formatted correctly.

This also contains a fix to the end-to-end updater (code not live) to not attempt any filesystem operations if the clone command failed, which can also happen if the job file failed to parse correctly. The error reporting in the clone handler doesn't rely on MSBuild pre-loads.

@github-actions github-actions bot added the L: dotnet:nuget NuGet packages via nuget or dotnet label Mar 10, 2025
@brettfo brettfo marked this pull request as ready for review March 10, 2025 22:33
@brettfo brettfo requested a review from a team as a code owner March 10, 2025 22:33
@randhircs randhircs force-pushed the dev/brettfo/nuget-job-deserialization-error-reporting branch from 40d0ce4 to 9d85162 Compare March 11, 2025 16:16
@randhircs randhircs merged commit 0d65b50 into main Mar 11, 2025
77 checks passed
@randhircs randhircs deleted the dev/brettfo/nuget-job-deserialization-error-reporting branch March 11, 2025 16:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
L: dotnet:nuget NuGet packages via nuget or dotnet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants