SimConnect Crash - Managed

Discuss on the SimConnect SDK can be used by programmers to write add-on components for Prepar3D
Locked
vertigo
Posts: 40
Joined: Mon Sep 13, 2010 5:08 pm

Post by vertigo »

Hey Guys,



Just started a few tests with the Managed code and I may have found a condition that causes an application crash.



I'm working with the Managed Facility Request. Around line 245 is the following code:

Code:
try
{
// the constructor is similar to SimConnect_Open in the native API
simconnect = new SimConnect("Managed Facilities Data Request", this.Handle, WM_USER_SIMCONNECT, null, 3);
initDataRequest();
setButtons(false, true, true);
}

catch (COMException)
{
displayText("Unable to connect");
}



When generating a new instance of SimConnect() with a call to index 3 of the SinConnect.cfg file the application crashes if the .cfg file is not located.



See screen shot:



http://www.freedomworks.ca/P3D-pics/



How should I handle this error?



Thanks!



Christian







beatle
Posts: 88
Joined: Thu Sep 16, 2010 8:34 pm

Post by beatle »

Hey Christian,



I think this error is actually occuring in the unmanaged part of the SimConnect client (the managed client included in the SDK is just a managed C++ wrapper around the unmanaged client library) which is why your try/catch block isn't catching it.



Not sure there is a way to handle this gracefully unfortunately - one of the reasons I really hate the whole SimConnect.cfg thing and why I don't use it in my own managed client lib. There are other issues, sometimes index 0 won't work on certain machines (never was able to track down exactly what caused this issue).



Tim
vertigo
Posts: 40
Joined: Mon Sep 13, 2010 5:08 pm

Post by vertigo »

Tim,



We are having a real problem getting this to work on one machine. Our test code works on a different network but the network in our lab does not work.



We have turned off Firewalls on Windows 7 but still have connection issues.



Any general SimConnect recommendations?



Christian



beatle
Posts: 88
Joined: Thu Sep 16, 2010 8:34 pm

Post by beatle »

Hey Christian,



Are the machines in your lab using static IP addresses or DHCP? In your SimConnect.cfg files, are you using IPv4 or IPv6, and are you using IP addresses or machine names? Where do you have your SimConnect.cfg files (if they aren't currently in the same directory as your SimConnect client apps, try placing them there, I have much better luck with that than the other two possible locations)? Does the SimConnect.XML file on the SimConnect server machine (ie the P3D machine) have IP ports (v4 or v6) defined as global?



Try switching between IPv4 and IPv6 and machine names/IP addresses and see if that makes any differences. I'm fairly certain that machine names will work with the SimConnect.cfg file (I know it works with my replacement managed client lib :->). If you are using DHCP, then machine names is generally the safer option (since IP addresses could change, with most DHCP servers these days they don't, but sometimes they still do :->).



Tim
Locked