TypealizR icon indicating copy to clipboard operation
TypealizR copied to clipboard

The analyzer assembly 'TypealizR.SourceGenerators.dll' references version '4.4.0.0' of the compiler, which is newer than the currently running version '4.3.0.0'

Open earloc opened this issue 3 years ago • 7 comments

latest version 0.5.2 is not compatible with clients which do not have the latest and greates .net-version installed.

This article here mostly describes the exact same situation: https://www.damirscorner.com/blog/posts/20221014-VersionsOfSourceGeneratorDependencies.html

I also tried to just bundle the used version of Microsoft.CodeAnalysis.CSharp with the analyzer (see this commit) but this then may fail due to multiple assemblies loaded within the same app-domain, where types cannot be interchanged.

Unhandled Exception: System.InvalidCastException: 
[A]Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax cannot be cast to 
[B]Microsoft.CodeAnalysis.CSharp.Syntax.CompilationUnitSyntax. 
Type A originates from 'Microsoft.CodeAnalysis.CSharp, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'Default' at location 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\MSBuild\Current\Bin\Roslyn\Microsoft.CodeAnalysis.CSharp.dll'. 
Type B originates from 'Microsoft.CodeAnalysis.CSharp, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' in the context 'LoadFrom' at location 'C:\Users\[USERNAME]\.nuget\packages\typealizr\0.8.3\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.dll'.
To reproduce, just reference the (unlisted) [version 0.8.3 of my TypealizR-package](https://www.nuget.org/packages/TypealizR/0.8.3) in a fresh console-project on a machine, where the installed sdk already utilize 'Microsoft.CodeAnalysis.CSharp, Version=4.4.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'

earloc avatar Nov 19 '22 15:11 earloc

version 0.5.3 will fix this, at least to be buildable by recent .net6-sdk versions

earloc avatar Nov 19 '22 15:11 earloc

https://github.com/earloc/TypealizR/pull/37 did not work as intended

Issue wil pop-up again if v0.6.x is released wiothout a proper fix for this.

earloc avatar Nov 24 '22 07:11 earloc

re-introduced in v0.8.2

earloc avatar Jan 20 '23 09:01 earloc

https://github.com/dotnet/roslyn/issues/41421

earloc avatar Feb 07 '23 15:02 earloc

I think this would solve the initial problem: https://github.com/dotnet/roslyn-sdk/issues/107

earloc avatar Feb 08 '23 17:02 earloc

asked the pros over at https://github.com/dotnet/roslyn-sdk/issues/1056

earloc avatar Feb 08 '23 17:02 earloc

This one here looks promising: https://github.com/dotnet/sdk/issues/20355

earloc avatar Feb 08 '23 18:02 earloc