Closed JayPeet closed 2 years ago
I get a similar one with preview 9 and 2021.3.2f1
error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in C:\Users\ashka\Projects\NeoDemoDev\Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.9\Editor\CodeGen\INetworkSerializableILPP.cs:line 116 at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in C:\Users\ashka\Projects\NeoDemoDev\Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.9\Editor\CodeGen\INetworkSerializableILPP.cs:line 116
I don't get this in an empty project so something in my project is triggering it.
Also based on this post https://forum.unity.com/threads/null-reference-exception-after-add-script.1280162/ It seems to be at least one case it happens is generic constraints.
Similar issue with preview 9 and 2020.3.15f2 over here as well university requiring the use of 2020.3.15f2, still trying to encourage them to update the version they have installed
(0,0): error - System.NullReferenceException: Object reference not set to an instance of an object|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process (Unity.CompilationPipeline.Common.ILPostProcessing.ICompiledAssembly compiledAssembly) [0x00161] in <c68a31db69ca400d86b2009bda4cd3b4>:0 at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process (Unity.CompilationPipeline.Common.ILPostProcessing.ICompiledAssembly compiledAssembly) [0x00161] in <c68a31db69ca400d86b2009bda4cd3b4>:0
Also having an issue with pre-9. This repo by Dilmer works on pre-3 but fails on pre-9.
https://github.com/dilmerv/UnityMultiplayerPlayground
With this error:
(0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in D:\repos\bombbomb\Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.9\Editor\CodeGen\INetworkSerializableILPP.cs:line 116 at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) in D:\repos\bombbomb\Library\PackageCache\com.unity.netcode.gameobjects@1.0.0-pre.9\Editor\CodeGen\INetworkSerializableILPP.cs:line 116
Its fixed locally for me, however my remote CI (ubuntu) can only get one build out before hitting this error. Deleting the library folder "fixes" it.
Its still an issue, here is the error log output during build
`Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(611,69): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'Resolve' and no accessible extension method 'Resolve' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(619,55): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'IsGenericInstance' and no accessible extension method 'IsGenericInstance' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(621,61): error CS0030: Cannot convert type 'Mono.Cecil.GenericParameterConstraint' to 'Mono.Cecil.GenericInstanceType'
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(624,84): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'FullName' and no accessible extension method 'FullName' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(755,69): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'Resolve' and no accessible extension method 'Resolve' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(764,55): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'IsGenericInstance' and no accessible extension method 'IsGenericInstance' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(766,61): error CS0030: Cannot convert type 'Mono.Cecil.GenericParameterConstraint' to 'Mono.Cecil.GenericInstanceType'
Library/PackageCache/com.unity.netcode.gameobjects@fddb7cd920/Editor/CodeGen/NetworkBehaviourILPP.cs(769,84): error CS1061: 'GenericParameterConstraint' does not contain a definition for 'FullName' and no accessible extension method 'FullName' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)`
This happens every build, unless the Library folder is deleted
Tracked in our backlog MTT-4087
Hi @JayPeet
error CS1061: 'GenericParameterConstraint' does not contain a definition for 'Resolve' and no accessible extension method 'Resolve' accepting a first argument of type 'GenericParameterConstraint' could be found (are you missing a using directive or an assembly reference?)
This only happens on specific versions of 2022.2.x
I believe this is fixed now. Could you please try the latest 2022.2.x Unity with Netcode for GameObjects 1.0. Let us know if you have any other errors. Thanks!
Heya @ashwinimurt
I get the same issue on 2022.2.0b2, on the latest Netcode version
Looking at my build log, I notice that CECIL_CONSTRAINTS_ARE_TYPE_REFERENCES is set. Yet on my local machine its not. Going to investigate to find out where its being set
Worked around it for now by using my fork, with the defines disabled https://github.com/JayPeet/com.unity.netcode.gameobjects
Hi @JayPeet These issues have been fixed on the Unity side. If you try with latest Unity 2022 patch release, you should not get any compile errors. I have verified this locally. Closing as completed. Please reopen if you are still seeing the same issue on latest 2022. Thanks!
Description
On Unity 2022.2.0a12, Latest version of NGO (hash: 6d54e2878bc80b92f32a618473162763b56b38ce), the package fails to compile.
I feel this is related to https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/pull/1920 , I tried with different versions of the Mono.Cecil package with no luck (1.10.1 through 1.11.4).
Reproduce Steps
Actual Outcome
Unity prints the error
Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP: (0,0): error - System.InvalidCastException: Unable to cast object of type 'Mono.Cecil.ArrayType' to type 'Mono.Cecil.GenericInstanceType'.|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.ResolveGenericType(TypeReference type, List
1 typeStack)|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.ResolveGenericType(TypeReference type, List1 typeStack)|| at Unity.Netcode.Editor.CodeGen.INetworkSerializableILPP.Process(ICompiledAssembly compiledAssembly)
Expected Outcome
The project should compile
Environment