dotnet / sdk

Core functionality needed to create .NET Core projects, that is shared between Visual Studio and CLI
https://dot.net/core
MIT License
2.65k stars 1.06k forks source link

[NETSDKE2E][Intermittent]error MSB4242: SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.SDK.WorkloadAutoIm..." displays when running command quickly in CLI #42269

Open vdanche opened 1 month ago

vdanche commented 1 month ago

Build: Pull request 525797: .NET 9 insertion into VS with .NET 9 included by default - Repos (visualstudio.com) Pipelines - Run main-35119.143 (visualstudio.com) on win11-x64

In CLI, copy and paste below all commands: dotnet new console -o pubc cd pubc dotnet publish -o 1p0 dotnet publish --self-contained=false -o 2p0 dotnet publish --runtime win-x64 --self-contained=false -o 3p0 dotnet publish --runtime linux-x64 --self-contained=false -o 4p0

Expected Result: No error happen

Actual Result: Below error happens image C:\Program Files\dotnet\sdk\9.0.100-preview.6.24328.19\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Sdk.ImportWorkloads.props(14,38): error MSB4242: SDK Resolver Failure: "The SDK resolver "Microsoft.DotNet.MSBuildWorkloadSdkResolver" failed while attempting to resolve the SDK "Microsoft.NET.SDK.WorkloadAutoIm portPropsLocator". Exception: "System.IO.IOException: The process cannot access the file 'C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.wo rkload.mono.toolchain.net8\9.0.0-preview.6.24327.7\WorkloadManifest.json' because it is being used by another process. at Microsoft.Win32.SafeHandles.SafeFileHandle.CreateFile(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options) at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocation Size, Nullable1 unixCreateMode) at System.IO.Strategies.OSFileStreamStrategy..ctor(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize , Nullable1 unixCreateMode) at System.IO.Strategies.FileStreamHelpers.ChooseStrategyCore(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallo cationSize, Nullable1 unixCreateMode) at System.IO.File.OpenRead(String path) at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.LoadManifestsFromProvider(IWorkloadManifestProvider manifestProvider) at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.InitializeManifests() at Microsoft.NET.Sdk.WorkloadManifestReader.WorkloadResolver.GetInstalledWorkloadPacksOfKind(WorkloadPackKind kind)+MoveNext() at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.CachingWorkloadResolver.Resolve(String sdkReferenceName, IWorkloadManifestProvider manifestProvider, IWorkloadR esolver workloadResolver) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.CachingWorkloadResolver.Resolve(String sdkReferenceName, String dotnetRootPath, String sdkVersion, String userP rofileDir, String globalJsonPath) at Microsoft.NET.Sdk.WorkloadMSBuildSdkResolver.WorkloadSdkResolver.Resolve(SdkReference sdkReference, SdkResolverContext resolverContext, SdkResultFactory fac tory) at Microsoft.Build.BackEnd.SdkResolution.SdkResolverService.TryResolveSdkUsingSpecifiedResolvers(IReadOnlyList1 resolvers, Int32 submissionId, SdkReference sd k, LoggingContext loggingContext, ElementLocation sdkReferenceLocation, String solutionPath, String projectPath, Boolean interactive, Boolean isRunningInVisualStu dio, SdkResult& sdkResult, IEnumerable1& errors, IEnumerable1& warnings)""

dotnet --info .NET SDK: Version: 9.0.100-preview.6.24328.19 Commit: ef4c241666 Workload version: 9.0.100-manifests.69688f42 MSBuild version: 17.11.0-preview-24318-05+4a45d5633

Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\9.0.100-preview.6.24328.19\

.NET workloads installed: Configured to use loose manifests when installing new manifests. [maui-windows] Installation Source: VS 17.12.35119.143 Manifest Version: 9.0.0-preview.6.24327.7/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.maui\9.0.0-preview.6.24327.7\WorkloadManifest.json Install Type: Msi

[maccatalyst] Installation Source: VS 17.12.35119.143 Manifest Version: 17.2.9714-net9-p6/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.maccatalyst\17.2.9714-net9-p6\WorkloadManifest.json Install Type: Msi

[ios] Installation Source: VS 17.12.35119.143 Manifest Version: 17.2.9714-net9-p6/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.ios\17.2.9714-net9-p6\WorkloadManifest.json Install Type: Msi

[android] Installation Source: VS 17.12.35119.143 Manifest Version: 34.99.0-preview.6.340/9.0.100-preview.6 Manifest Path: C:\Program Files\dotnet\sdk-manifests\9.0.100-preview.6\microsoft.net.sdk.android\34.99.0-preview.6.340\WorkloadManifest.json Install Type: Msi

[aspire] Installation Source: VS 17.12.35119.143 Manifest Version: 8.0.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.0.0\WorkloadManifest.json Install Type: FileBased

Host: Version: 9.0.0-preview.6.24327.7 Architecture: x64 Commit: static

.NET SDKs installed: 9.0.100-preview.6.24328.19 [C:\Program Files\dotnet\sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 9.0.0-preview.6.24328.4 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 9.0.0-preview.6.24327.7 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 6.0.30 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.19 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.5 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 9.0.0-preview.6.24327.6 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]

Environment variables: Not set

global.json file: Not found

Learn more: https://aka.ms/dotnet/info

Download .NET: https://aka.ms/dotnet/download

marcpopMSFT commented 1 month ago

@vdanche does this repro with the stand-alone sdk? I can't imagine there's anything different about VS that would cause it to repro in the insertion PR rather than in the lone SDK.

vdanche commented 1 month ago

@vdanche does this repro with the stand-alone sdk? I can't imagine there's anything different about VS that would cause it to repro in the insertion PR rather than in the lone SDK.

@marcpopMSFT It's intermittent, we did not run into this issue recently with the stand-alone sdk.

marcpopMSFT commented 1 month ago

Thanks, I don't think this is a blocker and we aren't sure how to fix it. There's basically a parallelism problem with the template engine and workloads hence why it doesn't happen every time and only happens if you're doing a lot of template engines activities in a short timeframe.

MrChevere commented 1 week ago

BAD PROGRAMMING