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.

Obscure null reference exception without project context

See original GitHub issue

I get this exception in some condition I can’t fully isolate. Once this throws, it starts throwing every single update/tick. After throwing in play mode, it even starts throwing outside of play mode during layout repaint. There is no reference to any of my own scripts. Can someone from the developers take a look?

NullReferenceException: Object reference not set to an instance of an object
Unity.Netcode.FastBufferWriter.get_Length () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Serialization/FastBufferWriter.cs:69)
Unity.Netcode.MessagingSystem.ProcessSendQueues () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Messaging/MessagingSystem.cs:786)
Unity.Netcode.NetworkManager.OnNetworkPostLateUpdate () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkManager.cs:1488)
Unity.Netcode.NetworkManager.NetworkUpdate (Unity.Netcode.NetworkUpdateStage updateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkManager.cs:1381)
Unity.Netcode.NetworkUpdateLoop.RunNetworkUpdateStage (Unity.Netcode.NetworkUpdateStage updateStage) (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkUpdateLoop.cs:185)
Unity.Netcode.NetworkUpdateLoop+NetworkPostLateUpdate+<>c.<CreateLoopSystem>b__0_0 () (at ./Library/PackageCache/com.unity.netcode.gameobjects@1.4.0/Runtime/Core/NetworkUpdateLoop.cs:268)

Reference from the last stack element: https://github.com/Unity-Technologies/com.unity.netcode.gameobjects/blob/54666c3454a3a5468bca0e1575a0b3059653c64e/com.unity.netcode.gameobjects/Runtime/Serialization/FastBufferWriter.cs#L69

I do not have experience with unsafe code, so I can’t really reverse engineer the problem.

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
powersupersportcommented, Jul 16, 2023

@NoelStephensUnity

Since updating to v1.5.1 the issue doesn’t seem to appear anymore. I haven’t done anything too different, so I still can’t confirm what was the exact cause. I’ll make sure to reopen if the issue appears again.

0reactions
powersupersportcommented, Jul 12, 2023

Are you able to provide the series of steps you go through to get this issue to happen?

I wish I could. I would’ve honestly tried to solve the problem on my own if it was consistent.

It rarely happens if I connect a client to the server, load a scene, then quickly disconnect them. Though none of that info is very helpful at all.

I am not sure if I can even reproduce the issue in a fresh project, as again, if I could I would’ve probably resolved it.

With all respect, I do not wish to send my entire project to Unity, especially using the bug reporter (sends a lot of unnecessary data about my running processes). If you can’t assist me further that’s totally fine. Thank you for your time.

you might try to update to v1.5.1

I will try doing that and monitor if it fixes it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c# - What is a NullReferenceException, and how do I fix it?
Since the problem is an object reference which is Nothing , the answer is to examine them to find out which one. Then...
Read more >
How to Stop NullReferenceExceptions in .NET
This article gives you a toolset for stopping NullReferenceExceptions in .NET code. The article centers around Nullable Reference Types ...
Read more >
Completely devoid of details · Issue #3858 · dotnet/runtime ...
The way i think of this is trying to infer context from identifiers than the methods. Identifiers tell you what is null, but...
Read more >
Null reference exception in the console: Can you see ...
When I get a null reference exception, is there anyway to see which reference exactly is null? console just shows me the line,...
Read more >
Null Reference Exceptions
Null Reference Exceptions. A NullReferenceException happens when you try to access a reference variable that isn't referencing any object.
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