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

Analzyers will not be loaded due to errors #644

Closed
CDTR-MattConroy opened this issue May 16, 2024 · 9 comments · Fixed by #646
Closed

Analzyers will not be loaded due to errors #644

CDTR-MattConroy opened this issue May 16, 2024 · 9 comments · Fixed by #646

Comments

@CDTR-MattConroy
Copy link

Installing various packages that come with analyzers produce the following errors:

Assembly 'Packages/nuget-packages/InstalledPackages/AWSSDK.S3.3.7.203.2/analyzers/dotnet/cs/AWSSDK.S3.CodeAnalysis.dll' will not be loaded due to errors:
Unable to resolve reference 'Microsoft.CodeAnalysis'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.

Assembly 'Packages/nuget-packages/InstalledPackages/AWSSDK.Kinesis.3.7.200.27/analyzers/dotnet/cs/SharedAnalysisCode.dll' will not be loaded due to errors:
Unable to resolve reference 'Microsoft.CodeAnalysis'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'System.Collections.Immutable'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.
Unable to resolve reference 'Microsoft.CodeAnalysis.CSharp'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.

Assembly 'Packages/nuget-packages/InstalledPackages/AWSSDK.Kinesis.3.7.200.27/analyzers/dotnet/cs/AWSSDK.Kinesis.CodeAnalysis.dll' will not be loaded due to errors:
Unable to resolve reference 'Microsoft.CodeAnalysis'. Is the assembly missing or incompatible with the current platform?
Reference validation can be disabled in the Plugin Inspector.

Tried deleting the restored packages and restoring again, and restarting Unity to no avail.

  • NuGet Package: AWSSDK.S3.3.7.203.2, AWSSDK.Kinesis.3.7.200.27
  • NuGetForUnity Version: 4.1.0
  • Unity Version: 2023.2.20f1
  • Operating System: Windows 11 23H2
@CDTR-MattConroy
Copy link
Author

This seems to be exclusive to Unity 2023. Rolling back to Unity 2022.3.9, removes the problem.

@xaroth8088
Copy link

This also seems to affect Unity 6000.x. See Cysharp/MemoryPack#275 for an example of where this is happening.

@CDTR-MattConroy
Copy link
Author

Interesting, is there's a known workaround at all?
I've had this issue intermittently on Unity 2022, but restarting the Editor always seemed to clear it out.

@xaroth8088
Copy link

None that I'm aware of. 😞

@igor84
Copy link
Collaborator

igor84 commented May 17, 2024

Unity documentation here https://docs.unity3d.com/Manual/roslyn-analyzers.html says: Your source generator must use Microsoft.CodeAnalysis 3.8 to work with Unity.

I think all these packages are using much newer version and are thus not supported by Unity. Even if it seems they work in earlier Unity versions there is no guarantee they will work correctly.

@JoC0de
Copy link
Collaborator

JoC0de commented May 17, 2024

I can imagine the the new editor vs runtime assembly compatibility level setting could be the cause, did you try setting both to netstandard 2?

@xaroth8088
Copy link

I can imagine the the new editor vs runtime assembly compatibility level setting could be the cause, did you try setting both to netstandard 2?

Alas, no dice. Problem persists with both API and editor assemblies set to .NET Standard 2.1 (tested in 6000.0.2f1, attempting to install MemoryPack).

@CDTR-MattConroy
Copy link
Author

Would it be possible to an add option to ignore analyzers from packages? Not ideal I know, but if they don't work in newer versions of Unity, but the actual package does it should only be the developer experience that's affected? As it stands this seems to be blocking me from upgrading past 2022 unnecessarily?

@JoC0de
Copy link
Collaborator

JoC0de commented Jun 1, 2024

@CDTR-MattConroy I found the error. Basically the whole analyzer dll re-configuring process was skipped. I fixed it in #646 and tested it with unity 2023.2.20f1 and the package AWSSDK.S3.3.7.308.7.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants