question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CodeGen issue when upgrading from 1.3.1 to 1.5.1

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 3 months ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
ashkan-saeedi-mazdehcommented, Jul 5, 2023

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.

0reactions
ashkan-saeedi-mazdehcommented, Jul 10, 2023

I’ll close this since it is a duplicate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why Netcode for GameObjects 1.5.1 doesn't target 2022.3
I tried to upgrade the Unity version from 2021.3 to 2022.3 after Netcode 1.5.1 upgrade but I got this error: Code (CSharp):. Unity.Netcode....
Read more >
Unable to find template plugin matching 'typescript- ...
Hey,. At some point in my project while upgrading some packages I started getting this issue with my @graphql-codgen . I've looked around ......
Read more >
Changelog | Netcode for GameObjects | 1.5.2
Fixed: Fixed a null reference in codegen in some projects (#2581); Fixed issue where the OnClientDisconnected client identifier was incorrect after a ...
Read more >
All versions of codegen
Version Release Notes Install Downloads 1.4.1 6 years ago Ignore wrong class path. haxelib install codegen 1.4.1 9 1.4.0 6 years ago haxelib install codegen...
Read more >
Room kapt error when upgrading kotlin or gradle
I have solved this issue by Upgrading Gradle Version to the latest version by following official docs. In android studio got to File>Project ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found