Skip to content

CodeGen issue when upgrading from 1.3.1 to 1.5.1 #2605

@ashkan-saeedi-mazdeh

Description

@ashkan-saeedi-mazdeh

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions