.netpostsharp.net-sdkmetalama

MetaLama and Razor.Compiler issues after updating .Net SDK


After an update of .net SDK into 9.0300+, Compilation of every metalama related library in a Blazor or RCL (library) project will give this error:

An instance of analyzer  Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor cannot be created from C:\Program Files\dotnet\sdk\9.0.301\Sdks\Microsoft.NET.Sdk.Razor\source-generators\Microsoft.CodeAnalysis.Razor.Compiler.dll

After an investigation I found the issue is related to the file (probably a version mismatch/conflict) with the original ones in the device.

I hope to see an update that can support all the future versions automatically.

I also provided all the versions of Microsoft.CodeAnalysis.Razor.Compiler.dll located in my device (temp folder should not be important.)

: Method 'get_SupportedSuppressions' in type 'Microsoft.CodeAnalysis.Razor.Compiler.Analyzers.ComponentParameterNullableWarningSuppressor' from assembly 'Microsoft.CodeAnalysis.Razor.Compiler,
    
Version=9.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'  does not have an implementation..

enter image description here


Solution

  • You should update Metalama to a version that supports 9.0.3xx SDK (or more specifically Roslyn 4.14). In this case, the first version that supports it is 2025.1.7.