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
SimConnect Crash - Managed
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
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
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
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