dependabot-core icon indicating copy to clipboard operation
dependabot-core copied to clipboard

Update .NET SDKs

Open martincostello opened this issue 1 year ago • 7 comments

What are you trying to accomplish?

Update .NET 8 and 9 SDKs to their latest versions - the main motivation to use the latest .NET 9 release candidate.

Anything you want to highlight for special attention from reviewers?

No.

How will you know you've accomplished your goal?

The build is green.

Checklist

  • [ ] I have run the complete test suite to ensure all tests and linters pass.
  • [ ] I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • [x] I have written clear and descriptive commit messages.
  • [x] I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • [x] I have ensured that the code is well-documented and easy to understand.

martincostello avatar Oct 08 '24 17:10 martincostello

I'm not sure why the tests are failing - will take a look tomorrow.

martincostello avatar Oct 08 '24 22:10 martincostello

@martincostello it looks like we might have been working around a bug you logged upstream, that has since been fixed: https://github.com/dotnet/msbuild/issues/10682. In nuget/spec/dependabot/nuget/native_helpers_spec.rb

 it "contains the expected output" do
  # In CI when the terminal logger is disabled by default in .NET 9 there is no
  # output from the test runner: https://github.com/dotnet/msbuild/issues/10682.
  # Instead we have to rely on the cmd invocation failing with a non-zero exit code
  # if any tests fail. Locally when the terminal logger is enabled we can check
  # there is an absence of any evidence of test failures in the output.
  # expect(dotnet_test).to include("Passed!")
  expect(dotnet_test).not_to include("Build failed")
end

JamieMagee avatar Oct 08 '24 22:10 JamieMagee

Well, well, well, if it isn't the consequences of my own actions 😆

I'll fix that up in the morning.

martincostello avatar Oct 08 '24 22:10 martincostello

Still debugging, but it looks like it's not the issue being fixed (it's still open, which makes sense), but that because of the bug, we can't see why the tests are failing.

Running them locally, one fails:

[xUnit.net 00:21:18.64]   Finished:    NuGetUpdater.Core.Test
  NuGetUpdater.Core.Test test failed with 1 error(s) (1280.0s)
    /home/martin/coding/dependabot/dependabot-core/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs(304): error TESTERROR:
      NuGetUpdater.Core.Test.Update.UpdateWorkerTests+Sdk.UpdateVersionAttribute_InProjectFile_ForPackageR
      eferenceInclude_Windows (1s 505ms): Error Message: Assert.Equal() Failure
                                       ↓ (pos 257)
      Expected: ···e.Package" Version="13.0.1" />\n  </ItemGroup>\n</Project>
      Actual:   ···e.Package" Version="9.0.1" />\n  </ItemGroup>\n</Project>
                                       ↑ (pos 257)
      Stack Trace:
         at NuGetUpdater.Core.Test.Update.UpdateWorkerTestBase.AssertContainsFiles(ValueTuple`2[] expected
      , ValueTuple`2[] actual) in /home/martin/coding/dependabot/dependabot-core/nuget/helpers/lib/NuGetUp
      dater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs:line 304
         at NuGetUpdater.Core.Test.Update.UpdateWorkerTestBase.TestUpdateForProject(String dependencyName,
       String oldVersion, String newVersion, ValueTuple`2 projectFile, String expectedProjectContents, Boo
      lean isTransitive, ValueTuple`2[] additionalFiles, ValueTuple`2[] additionalFilesExpected, MockNuGet
      Package[] packages, UpdateOperationResult expectedResult) in /home/martin/coding/dependabot/dependab
      ot-core/nuget/helpers/lib/NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTestBase.cs:line 15
      1
         at NuGetUpdater.Core.Test.Update.UpdateWorkerTests.Sdk.UpdateVersionAttribute_InProjectFile_ForPa
      ckageReferenceInclude_Windows() in /home/martin/coding/dependabot/dependabot-core/nuget/helpers/lib/
      NuGetUpdater/NuGetUpdater.Core.Test/Update/UpdateWorkerTests.Sdk.cs:line 246
      --- End of stack trace from previous location ---
  NuGetUpdater.Cli.Test succeeded (0.3s) → artifacts/bin/NuGetUpdater.Cli.Test/debug/NuGetUpdater.Cli.Test.dll
[xUnit.net 00:00:00.00] xUnit.net VSTest Adapter v2.4.5+1caef2f33e (64-bit .NET 9.0.0-rc.2.24473.5)
[xUnit.net 00:00:00.80]   Discovering: NuGetUpdater.Cli.Test
[xUnit.net 00:00:00.85]   Discovered:  NuGetUpdater.Cli.Test
[xUnit.net 00:00:00.85]   Starting:    NuGetUpdater.Cli.Test
[xUnit.net 00:01:23.65]   Finished:    NuGetUpdater.Cli.Test
  NuGetUpdater.Cli.Test test succeeded (84.4s)

Test summary: total: 357, failed: 1, succeeded: 356, skipped: 0, duration: 1364.5s
Build failed with 1 error(s) and 24 warning(s) in 1373.7s

martincostello avatar Oct 09 '24 08:10 martincostello

Just saw, the issue is fixed, but it didn't make it into RC2 so will be in 9.0.100.

martincostello avatar Oct 09 '24 12:10 martincostello

I'm not sure why the lockfile smoke test is failing.

The error is:

updater | /tmp/package-dependency-resolution_kuH1Yp/Project.csproj : error NU1102: Unable to find package Microsoft.WindowsDesktop.App.Ref with version (= 8.0.10)
updater | /tmp/package-dependency-resolution_kuH1Yp/Project.csproj : error NU1102:   - Found 120 version(s) in nuget.org [ Nearest version: 9.0.0-preview.1.24081.3 ]

but the package is in NuGet.org: [email protected].

Maybe the test depends on whatever version of the .NET SDK happens to be installed on the hosted runner?

martincostello avatar Oct 09 '24 14:10 martincostello

From the build logs:

#10 [ 5/15] RUN dotnet --list-runtimes
#10 0.181 Microsoft.AspNetCore.App 8.0.10 [/usr/local/dotnet/current/shared/Microsoft.AspNetCore.App]
#10 0.181 Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [/usr/local/dotnet/current/shared/Microsoft.AspNetCore.App]
#10 0.181 Microsoft.NETCore.App 8.0.10 [/usr/local/dotnet/current/shared/Microsoft.NETCore.App]
#10 0.181 Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [/usr/local/dotnet/current/shared/Microsoft.NETCore.App]
#10 DONE 0.2s

When I do the same locally on my Windows machine:

Microsoft.AspNetCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 9.0.0-rc.2.24474.3 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.NETCore.App 9.0.0-rc.2.24473.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 6.0.35 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 8.0.10 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Microsoft.WindowsDesktop.App 9.0.0-rc.2.24474.4 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Maybe the issue is that Microsoft.WindowsDesktop.App isn't being installed? Though, if that is the case, I'd have thought the tests would be broken already?

martincostello avatar Oct 17 '24 15:10 martincostello

@brettfo @JamieMagee Do either of you have any idea what's going on with the end-to-end tests? I'm not sure what I'm missing - feels like the tests depend on a version of .NET that's not present in the Docker image.

martincostello avatar Nov 14 '24 12:11 martincostello

@martincostello It looks like the packages weren't yet present on nuget.org. The publish date says otherwise, but maybe a replication issue? I've restarted the failing jobs to see what happens now.

error NU1102: Unable to find package Microsoft.WindowsDesktop.App.Ref with version (= 8.0.11)

brettfo avatar Nov 14 '24 15:11 brettfo

Well the re-run didn't work. I thought I remembered something about the smoke tests caching some network calls which means the cache won't know about that 8.0.11, etc. packages. Let me see if I can track down if there is a cache and if so how to clear or regenerate it.

brettfo avatar Nov 14 '24 16:11 brettfo

I notice that the original one I had issues with was the lockfiles test, which is now passing with the re-runs, so there's now 2 failing instead of 3. Caching sounds like a good avenue to solve the mystery.

martincostello avatar Nov 14 '24 16:11 martincostello

Got it! It was the cache. The results of querying the Microsoft.WindowsDesktop.App.Ref was cached and didn't have the 8.0.11 result, but re-running the cache captured that. All green now, I'll talk to the powers that be to get this merged.

brettfo avatar Nov 14 '24 16:11 brettfo