dotnet / msbuild

The Microsoft Build Engine (MSBuild) is the build platform for .NET and Visual Studio.
https://docs.microsoft.com/visualstudio/msbuild/msbuild
MIT License
5.22k stars 1.35k forks source link

[Bug]: Fail to load the project successfully with errors about "[MSBuild]::StableStringHash..." #9765

Closed v-Judy closed 8 months ago

v-Judy commented 8 months ago

Issue Description

Fail to load the project successfully with errors about [MSBuild]::StableStringHash image

Steps to Reproduce

  1. Install the latest 9.0.100-preview.2 SDK from https://github.com/dotnet/installer
  2. Install the latest version of VSCodev1.86.2 and C# Dev Kitv1.3.10.
  3. Create a new console project and open it using VSCode.
  4. Wait for the project load completely

Expected Behavior

After the project load completely, the terminal without any errors or warnings.

Actual Behavior

Fail to load the project successfully with errors about "[MSBuild]::StableStringHash..." image

[error] (C:\Users\v-wakang\BlazorServer\BlazorServer.csproj): The expression "[MSBuild]::StableStringHash(BlazorServer.csproj)" cannot be evaluated. Could not load type 'Microsoft.NET.StringTools.FowlerNollVo1aHash' from assembly 'Microsoft.NET.StringTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.
[error] Failed to load project 'C:\Users\v-wakang\BlazorServer\BlazorServer.csproj'. One or more errors occurred. (The expression "[MSBuild]::StableStringHash(BlazorServer.csproj)" cannot be evaluated. Could not load type 'Microsoft.NET.StringTools.FowlerNollVo1aHash' from assembly 'Microsoft.NET.StringTools, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.  C:\Program Files\dotnet\sdk\9.0.100-preview.2.24120.18\Microsoft.Common.CurrentVersion.targets)

Analysis

  1. This issue reproduces on Windows/Linux/Mac OS.
  2. This issue does not repro on the sdk 9.0.100-preview.2.24116.21.
  3. There is a known closed issue #9538 on sdk 8.0.200, it fixed by #9572

Versions & Configurations

dotnet --info:

.NET SDK:
Version:           9.0.100-preview.2.24120.16
Commit:            1415dfd3e2
Workload version:  9.0.100-manifests.01ad020e
MSBuild version:   17.10.0-preview-24120-03+53c4f4986

Runtime Environment:
OS Name:     Mac OS X
OS Version:  14.0
OS Platform: Darwin
RID:         osx-x64
Base Path:   /usr/local/share/dotnet/sdk/9.0.100-preview.2.24120.16/

.NET workloads installed:
There are no installed workloads to display.

Host:
  Version:      9.0.0-preview.2.24120.8
  Architecture: x64
  Commit:       2756c94062

.NET SDKs installed:
  9.0.100-preview.2.24120.16 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 9.0.0-preview.2.24120.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 9.0.0-preview.2.24120.8 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
ladipro commented 8 months ago

The latest release version of CDK is 1.3.10 and it contains CPS at commit 38bd321c which has changes up to Jan 10th.

@JanKrivanek it looks like #9721 was merged before CDK shipped the assembly load context fix. Should we revert?

JanKrivanek commented 8 months ago

Yeah - too early :-/ Let's revert and wait for the fix to be backported to 1.3.x (or 1.3.x to age out)

JanKrivanek commented 8 months ago

@v-Judy can you confirm the issue is not present with the same setup with C# DevKit 1.4.2? We're going to temporarily revert the change and reintroduce once 1.3.x gets out of support, but want to be double sure that that's enough. Thanks

v-Judy commented 8 months ago

@v-Judy can you confirm the issue is not present with the same setup with C# DevKit 1.4.2?

This issue does not repro on the same setup with C# DevKit 1.4.2.