Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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' #33

Open
earloc opened this issue Nov 19, 2022 · 7 comments · Fixed by #34
Labels
bug Something isn't working workaround
Milestone

Comments

@earloc
Copy link
Owner

earloc commented Nov 19, 2022

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
Copy link
Owner Author

earloc commented Nov 19, 2022

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

@earloc
Copy link
Owner Author

earloc commented Nov 24, 2022

#37 did not work as intended

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

@earloc earloc reopened this Nov 24, 2022
@earloc earloc added this to the v0.6 milestone Nov 24, 2022
@earloc earloc closed this as completed Nov 24, 2022
@earloc
Copy link
Owner Author

earloc commented Jan 20, 2023

re-introduced in v0.8.2

@earloc earloc reopened this Jan 20, 2023
@earloc earloc modified the milestones: v0.6, v0.9 Jan 20, 2023
@earloc
Copy link
Owner Author

earloc commented Feb 7, 2023

dotnet/roslyn#41421

@earloc
Copy link
Owner Author

earloc commented Feb 8, 2023

I think this would solve the initial problem:
dotnet/roslyn-sdk#107

@earloc
Copy link
Owner Author

earloc commented Feb 8, 2023

asked the pros over at
dotnet/roslyn-sdk#1056

@earloc
Copy link
Owner Author

earloc commented Feb 8, 2023

This one here looks promising:
dotnet/sdk#20355

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant