Jump to content
The simFlight Network Forums

Recommended Posts

Posted

Hello,

 

Seeing this error from some clients:

Quote

V:0728 14:18:03 Disposing SimConnect client
E:0728 14:18:03 UnhandledException: UncaughtException::System.NullReferenceException
System.NullReferenceException: Object reference not set to an instance of an object.
   at FSUIPC.MSFSVariableServices.receiveValuesCallback(String name, Double value)
   at FSUIPC.WAPI.fsuipcw_getLvarValues(ReceiveValuesCallback ReceiveFunction)
   at FSUIPC.MSFSVariableServices.refreshData()
   at FSUIPC.MSFSVariableServices.lvarsValueChanged(IntPtr id, IntPtr Value)

V:0728 14:18:03 Disposal completed, marked for gc
I:0728 14:18:03 Sim client disconnected

This is my (shortened) shutdown code, but I'm sometimes seeing this error (pulling from crash logs)

if (VS.IsRunning) {
  VS.Stop();
}

// Remove the handler
if (callbackAdded) {
  Log.Verbose("Removing callbacks");
  VS.OnValuesChanged -= VS_OnValuesChanged;
  VS.OnLogEntryReceived -= VS_OnLogEntryReceived;
  callbackAdded = false;
}

try {
  Log.Verbose("Disposing SimConnect client");
  _simconnect?.Dispose();

  Log.Verbose("Disposal completed, marked for gc");
  _simconnect = null;
} catch (COMException) {
  // ignore - sim already said bye bye
}

 

Posted

I've had a look - The Stop() method wasn't entirely thread-safe, so that might be causing this issue.

I've fixed this in 3.3.17-beta, now on Nuget. (Tick the box that says "Show Pre-Release").

Let me know if it's still a problem and I'll look into it some more.

Paul

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.