CodeGen issue when upgrading from 1.3.1 to 1.5.1
See original GitHub issueDescription
After upgrading from 1.3.1 to 1.5.1 I get this error in the console
Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)
Reproduce Steps
I don’t have any reproduction steps other than the package upgrade but I don’t know which part of our codebase is triggering this. The project is huge and we probably cannot send it due to company policy.
Is there any way I can get a better stack trace?
Actual Outcome
The codegen has this exception and the project cannot run.
Expected Outcome
A smooth upgrade or an error message saying what serialization code should change.
Environment
- OS: [Windows 10]
- Unity Version: [2022.3]
- Netcode Version: [1.5.1]
Additional Context
I’ll try to find what part of our serialization code might be causing this but it would be good if there was a way to see where it breaks or what serialization code-gen changes happend. And again this is the error log
Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP: (0,0): error - System.NullReferenceException: Object reference not set to an instance of an object.|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly) at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.GenerateVariableInitialization(TypeDefinition type)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.ProcessNetworkBehaviour(TypeDefinition typeDefinition, String[] assemblyDefines)|| at System.Collections.Generic.List`1.ForEach(Action`1 action)|| at Unity.Netcode.Editor.CodeGen.NetworkBehaviourILPP.Process(ICompiledAssembly compiledAssembly)
I noticed one code-gen feature is added for initialization and that might be the cause? I assume there is no regression in the other serialization codes of course.
Issue Analytics
- State:
- Created 3 months ago
- Comments:5 (1 by maintainers)
Top GitHub Comments
I found out what was the problem in our case. We had a
class Singleton<T>:NetworkBehaviour
class which we were not even using and it was causing this.I’ll close this since it is a duplicate.