Error when stopping play mode

Description, details and error message(s)

When I’m in editor and stop play mode, there is an error.

The error occurs in Coherence.Toolkit/CoroutineRunner.cs:20 because SharedInstance is null.

It looks like there is something that tries to start a coroutine because the connection gets disconnected, but since the application is closing, this doesn’t make much sense to do. Also, I’m guessing SharedInstance has probably been made null because the application is closing.

Here is the full stack trace

15:15:29.526 (coherence) ClientCore: Exception in handler. 	caller=OnDisconnect exception=System.NullReferenceException: Object reference not set to an instance of an object
  at Coherence.Toolkit.CoroutineRunner.StartCoroutine (System.Collections.IEnumerator coroutine) [0x00000] in .\Library\PackageCache\io.coherence.sdk@0c19ca391290\Coherence.Toolkit\CoroutineRunner.cs:20 
  at Coherence.Toolkit.CoherenceClientConnectionManager.CleanUp () [0x00049] in .\Library\PackageCache\io.coherence.sdk@0c19ca391290\Coherence.Toolkit\CoherenceClientConnectionManager.cs:228 
  at Coherence.Toolkit.CoherenceBridge.HandleDisconnected (Coherence.Connection.ConnectionCloseReason closeReason) [0x00031] in .\Library\PackageCache\io.coherence.sdk@0c19ca391290\Coherence.Toolkit\CoherenceBridge.cs:1472 
  at (wrapper delegate-invoke) System.Action`1[Coherence.Connection.ConnectionCloseReason].invoke_void_T(Coherence.Connection.ConnectionCloseReason)
  at Coherence.Core.ClientCore.OnDisconnect (Coherence.Connection.ConnectionCloseReason reason) [0x00002] in .\Library\PackageCache\io.coherence.sdk@0c19ca391290\Coherence.Core\ClientCore.cs:351  logId=CoreClientHandlerException
UnityEngine.Debug:LogError (object,UnityEngine.Object)
Coherence.Log.Targets.UnityConsoleTarget:Log (Coherence.Log.LogLevel,string,System.ValueTuple`2<string, object>[],Coherence.Log.Logger) (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Log/LogTargets/UnityConsoleTarget.cs:86)
Coherence.Log.Logger:BuildAndPrintLog (Coherence.Log.LogLevel,string,System.ValueTuple`2<string, object>[])
Coherence.Log.Logger:LogImpl (Coherence.Log.LogLevel,string,System.ValueTuple`2<string, object>[])
Coherence.Log.Logger:Error (Coherence.Log.Error,System.ValueTuple`2<string, object>[])
Coherence.Log.UnityLogger:Error (Coherence.Log.Error,System.ValueTuple`2<string, object>[])
Coherence.Core.ClientCore:OnDisconnect (Coherence.Connection.ConnectionCloseReason) (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Core/ClientCore.cs:355)
Coherence.Brisk.Brisk:Disconnect (Coherence.Connection.ConnectionCloseReason,bool) (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Brisk/Brisk.cs:168)
Coherence.Core.ClientCore:Disconnect (Coherence.Connection.ConnectionCloseReason,bool) (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Core/ClientCore.cs:431)
Coherence.Core.ClientCore:Disconnect () (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Core/ClientCore.cs:420)
Coherence.Toolkit.CoherenceBridge:Disconnect () (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Toolkit/CoherenceBridge.cs:672)
Coherence.Toolkit.CoherenceBridge:DisposeSharedStart () (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Toolkit/CoherenceBridge.cs:1212)
Coherence.Toolkit.CoherenceBridge:System.IDisposable.Dispose () (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Toolkit/CoherenceBridge.cs:1187)
Coherence.Toolkit.CoherenceBridge:OnApplicationQuit () (at ./Library/PackageCache/io.coherence.sdk@0c19ca391290/Coherence.Toolkit/CoherenceBridge.cs:1423)

Expected behaviour

Should be able to stop play mode without errors

How to reproduce

Rate: (Choose one, or describe it yourself)
Every time

Steps:

  1. This happens every time I stop play mode while in local RS testing with client + sim game scene open

Environment

SDK: 1.8
Unity: 6.0.54f1
OS/Platform: Win10

I think this is a bug. I’ll create a report for it. I don’t expect this will cause any problems for you but it should not be bombing on that property and throwing errors like that. Thanks for the detailed info!

1 Like

And I see that this has already been fixed in master so it should show up in our next patch or release version.

1 Like

Yes, not causing any issue, but as you say, just noisy. Thanks for the quick response!