VContainer icon indicating copy to clipboard operation
VContainer copied to clipboard

SourceGenerators on Unity 6.1.3 are broken

Open BaalEvan opened this issue 7 months ago • 1 comments

Importing VContainer.SourceGenerator.Roslyn3.dll or VContainer.SourceGenerator.dll into the project created using Unity 6000.1.3f1 and marking it as RoslynAnalyzer causes breaks in PluginImporter. It's most likely a Unity Issue, but I think you should know about it ;)

Sometimes (for example, when you bump UnityVersion without changing dll settings), you need to reimport the dll to reproduce the problem.

Image

See "Script Serialization" page in the Unity Manual for further details.
UnityEditorInternal.InternalEditorUtility.GetUnityVersionDigits () (at <f94d23feabb04bb4b93f81d724b016ac>:0)
UnityEditorInternal.InternalEditorUtility.GetUnityVersion () (at <f94d23feabb04bb4b93f81d724b016ac>:0)
UnityEditor.Help.GetShortReleaseVersion () (at <f94d23feabb04bb4b93f81d724b016ac>:0)
UnityEditor.BuildTargetDiscovery..cctor () (at <f94d23feabb04bb4b93f81d724b016ac>:0)
Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.BuildTargetDiscovery' threw an exception.
UnityEditor.PluginImporterInspector..cctor () (at <f94d23feabb04bb4b93f81d724b016ac>:0)
Rethrow as TypeInitializationException: The type initializer for 'UnityEditor.PluginImporterInspector' threw an exception.

BaalEvan avatar May 15 '25 13:05 BaalEvan

I tried with Unity 6000.1.9f1 and could not reproduce the reported error.

From the error description, I cannot determine if it is from VContainer.SourceGenerator.dll, would removing this dll fix the problem?

Also, just to be safe, please make sure that .SourceGenerator.dll is not set as an import target for the platform in inspector.

hadashiA avatar Jul 26 '25 06:07 hadashiA