-
Notifications
You must be signed in to change notification settings - Fork 252
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
Using System.Text.Json for assets file parsing is failing .NET SDK tests #13248
Comments
I only checked one test, Microsoft.NET.Build.Tests.GivenThatWeWantDiagnosticsWhenAssetsFileCannotBeRead.It_reports_corrupt_file, but its failure is:
My understanding is that this means The test name makes it clear it's testing error scenarios, so it's not a "serious" failure (maybe the new code correctly handles all happy cases?), but the error handling appears to have changed with our STJ implementation. |
NuGet/NuGet.Client#5637 fixed the
|
@zivkan @jgonz120 I extracted the test into a standalone repro:
with this file: failing.lock.json It looks like it's failing to parse the file, e.g. Version is |
The lock file contains a string for the warning level when it's supposed to be a number. The test needs to be updated to create a properly formatted file. |
@jgonz120 shouldn't |
I can confirm it parses when I change the warningLevel to be a number instead of a string so this should unblock the sdk code flow. I agree though that throwing some exception during parsing would be better. |
Agreed, but the previous code flow behaves this way so I feel like updating it would be out of scope for this change. |
Interesting. That also means code like this doesn't make sense since we'll never get an exception: https://github.com/dotnet/sdk/blob/302ca4c93537954c056289cde3a2c4faac0d9ce2/src/Cli/Microsoft.DotNet.Cli.Utils/Extensions/LockFileFormatExtensions.cs#L25 |
Yea seems like it. In the LockFileCache class there's a logger that throws an error when LogError is called, something like that could be used to make that code make sense. https://github.com/dotnet/sdk/blob/302ca4c93537954c056289cde3a2c4faac0d9ce2/src/Tasks/Microsoft.NET.Build.Tasks/LockFileCache.cs#L79 |
Actually I take that back, this calls I think we can close this issue. |
See: dotnet/sdk#38774.
The text was updated successfully, but these errors were encountered: