From 02133c8d4cc55138d4a0a845413bcf8bcbae3612 Mon Sep 17 00:00:00 2001 From: Adam Boniecki <20281641+abonie@users.noreply.github.com> Date: Wed, 29 Jul 2026 21:37:07 +0200 Subject: [PATCH] Run ilverify via the tool manifest instead of a hard-coded cache path The EmittedIL IL-verification tests ran ilverify by exec'ing a hard-coded NuGet cache path ({NUGET_PACKAGES}/dotnet-ilverify/9.0.0/tools/net9.0/any/ILVerify.dll). On the net11 CI SDK that guessed path was not populated after `dotnet tool restore`, so ~215 EmittedIL tests failed with a missing ILVerify.dll. Invoke the tool through the local manifest with `dotnet tool run ilverify` so the SDK resolves it wherever it was restored, independent of the NuGet cache layout, tool version, or target framework. Verified on the net11 SDK (11.0.100-preview.6) with the existing pinned tool: the previously failing Regression_Specialize_ConstraintVerification tests pass 16/16. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 422b6203-341b-4e72-8f93-9d6da463addc --- tests/FSharp.Test.Utilities/ILVerifierModule.fs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/tests/FSharp.Test.Utilities/ILVerifierModule.fs b/tests/FSharp.Test.Utilities/ILVerifierModule.fs index 30ff766287e..c570b4cc150 100644 --- a/tests/FSharp.Test.Utilities/ILVerifierModule.fs +++ b/tests/FSharp.Test.Utilities/ILVerifierModule.fs @@ -26,13 +26,10 @@ module ILVerifierModule = Commands.executeProcess dotnetExe arguments workingDirectory let private verifyPEFileCore peverifierArgs (dllFilePath: string) = - let nuget_packages = - match Environment.GetEnvironmentVariable("NUGET_PACKAGES") with - | null -> - let profile = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) - $"""{profile}/.nuget/packages""" - | path -> path - let peverifyFullArgs = [ yield "exec"; yield $"""{nuget_packages}/dotnet-ilverify/9.0.0/tools/net9.0/any/ILVerify.dll"""; yield "--verbose"; yield dllFilePath; yield! peverifierArgs ] + // Resolve ilverify through the local tool manifest (.config/dotnet-tools.json) rather than a + // hard-coded NuGet cache path. `dotnet tool run` locates the tool wherever it was restored, so + // verification does not depend on the NuGet cache layout, tool version, or target framework. + let peverifyFullArgs = [ yield "tool"; yield "run"; yield "ilverify"; yield "--"; yield "--verbose"; yield dllFilePath; yield! peverifierArgs ] let workingDirectory = Path.GetDirectoryName dllFilePath let exitCode, outputText, errorText = let peverifierCommandPath = Path.ChangeExtension(dllFilePath, ".peverifierCommandPath.cmd")