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

ArgumentNullException from NuGet calls in Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.ResolveAsync #974

Closed
jkoritzinsky opened this issue Mar 21, 2022 · 6 comments · Fixed by #977

Comments

@jkoritzinsky
Copy link
Member

We recently hit an ArgumentNullException that stemmed from us using the ReferenceAssemblies API in dotnet/runtime. This occurred in dotnet/runtime#66952 on macOS x64 (Helix Log here).

This looks like it may have been a one-off failure, but I wanted to report it in case it's reproducible as even one-off-style failures can cause significant issues keeping dotnet/runtime green.

@jkoritzinsky
Copy link
Member Author

@jkoritzinsky
Copy link
Member Author

We're hitting this pretty often in dotnet/runtime, so it's definitely not a one-off failure.

@danmoseley
Copy link
Member

This is now happening 10x a day in dotnet/runtime @jaredpar @sharwell could someone please take a look?

TestResults
| join kind=inner WorkItems on WorkItemId
| join kind=inner Jobs on JobId
| where Finished >= now(-2d)
| where Result == "Fail"
| where Message startswith "System.ArgumentNullException : Value cannot be null. (Parameter 'package"
| project Type, Method,
  Pipeline = tostring(parse_json(Properties).DefinitionName),//WorkItemFriendlyName,
  Pipeline_Configuration = tostring(parse_json(Properties).configuration),
  OS = QueueName,
  Arch = tostring(parse_json(Properties).architecture),
 Finished,
 Build
Type Method Pipeline Pipeline_Configuration OS Arch Finished Build
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug ubuntu.1804.amd64.open.rt x64 2022-04-03 05:47:00.2100000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 11:07:44.0470000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 11:45:31.8160000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 13:10:04.4850000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 14:21:22.3510000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 14:49:27.0420000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 15:00:33.7380000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 15:00:40.0250000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 15:32:33.8270000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 17:41:13.1510000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 21:28:47.8030000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 21:29:03.7300000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-03 21:38:53.4540000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-04 07:38:32.3100000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Release osx.1200.amd64.open x64 2022-04-04 08:49:46.4760000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-04 09:40:50.5660000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-04 10:20:12.4610000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-04 10:32:02.6900000
LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub SkipLocalsInitOnDownlevelTargetFrameworks runtime Debug osx.1200.amd64.open x64 2022-04-04 15:17:13.2330000

@danmoseley
Copy link
Member

pasting stack

LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub.SkipLocalsInitOnDownlevelTargetFrameworks(targetFramework: Net6, expectSkipLocalsInit: True) [FAIL]
      System.ArgumentNullException : Value cannot be null. (Parameter 'packageStream')
      Stack Trace:
           at NuGet.Packaging.PackageExtractor.ExtractPackageAsync(String source, Stream packageStream, PackagePathResolver packagePathResolver, PackageExtractionContext packageExtractionContext, CancellationToken token, Guid parentId)
        /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs(358,0): at Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.ResolveCoreAsync(String language, CancellationToken cancellationToken)
        /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs(197,0): at Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.ResolveAsync(String language, CancellationToken cancellationToken)
        /_/src/Microsoft.CodeAnalysis.Testing/Microsoft.CodeAnalysis.Analyzer.Testing/ReferenceAssemblies.cs(174,0): at Microsoft.CodeAnalysis.Testing.ReferenceAssemblies.ResolveAsync(String language, CancellationToken cancellationToken)
        /_/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs(228,0): at LibraryImportGenerator.UnitTests.TestUtils.ResolveReferenceAssemblies(ReferenceAssemblies referenceAssemblies)
        /_/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs(174,0): at LibraryImportGenerator.UnitTests.TestUtils.GetReferenceAssemblies(TestTargetFramework targetFramework)
        /_/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/TestUtils.cs(132,0): at LibraryImportGenerator.UnitTests.TestUtils.CreateCompilation(SyntaxTree[] sources, TestTargetFramework targetFramework, OutputKind outputKind)
        /_/src/libraries/System.Runtime.InteropServices/tests/LibraryImportGenerator.UnitTests/AdditionalAttributesOnStub.cs(143,0): at LibraryImportGenerator.UnitTests.AdditionalAttributesOnStub.SkipLocalsInitOnDownlevelTargetFrameworks(TestTargetFramework targetFramework, Boolean expectSkipLocalsInit)
        --- End of stack trace from previous location ---
    LibraryImportGenerator.UnitTests.Compiles.ValidateSnippetsWithMarshalType [SKIP]
      No current scenarios to test.
  Finished:    LibraryImportGenerator.Unit.Tests
=== TEST EXECUTION SUMMARY ===
   LibraryImportGenerator.Unit.Tests  Total: 332, Errors: 0, Failed: 1, Skipped: 1, Time: 18.079s
/private/tmp/helix/working/AFBA09FC/w/9A0808EB/e

@danmoseley
Copy link
Member

I am not familiar with this code or NuGet code. But I see that GetDownloadResourceResultAsync can succeed and return a DownloadResourceResult with a null packageStream.

https://github.com/nuget/nuget.client/blob/0ff5f67097522299620f34bd13f92d3d58e41f93/src/NuGet.Core/NuGet.PackageManagement/PackageDownloader.cs#L351

I am not sure what that means (unless it's just another kind of error). Should the code at the point of the exception above treat result.Status == DownloadResourceResultStatus.AvailableWithoutStream as an error?

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 a pull request may close this issue.

2 participants