• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

C++ Breakpoint Crashes FSX

Messages
16
Country
poland
Hi,

First of all I would like to say hi to all of you guys as this is my first post! :)

I'm struggling to debug an C++ gauge I'm working on. It's more like an interface to an external app, but it has to be implemented as a gauge to have access to the L vars.

When any breakpoint gets hit the FSX crashes. Or I should say quites, as there are no feedback from the system? It just closes.

I use the following flow:
1. Copy the .dll and .pdb files to the Gauges folder.
2. Run FSX.
3. Start the flight with any default aircraft that doesn't use my gauge.
4. Attach the process from the Visual Studio to the FSX.
5. Load the aircraft using my gauge.
6. Whenever any breakpoint get hit FSX just quits and there is no feedback either from the sim or the Visual Studio..

My system config:
Visual Studio 2015
Windows 8.1 Pro 64-bit

Any idea?

Best,
Bartek
 
Czesc Bartek ;)

hard to tell from your description, because everything you do is correct.

Maybe try another way. In DLL project properties, specify post build action to copy DLL to ./gauges just to make sure you are debugging the right binaries, and then specify to start FSX in the debug options. Then VS automatically attach to this process once you press F5 to start debugging. This is what I prefer to do when debugging.

best regards (pozdrawiam)

Marcin
 
I have never copied .pdb files to the gauges folder, I just leave them in the folder they are generated in.
This got me to wondering - do you have FSX installed in the default location? If so, the crashes may be the result of insufficient file modification rights in the gauges folder.
 
I have found that if the breakpoint is in any callback function created for FSX (module init/deinit, gauge callbacks, simconnect callbacks) and the version of VS is greater than 2010, it will crash. The only suggestion I can make is to debug in P3D or FSX SE.
 
I have found that if the breakpoint is in any callback function created for FSX (module init/deinit, gauge callbacks, simconnect callbacks) and the version of VS is greater than 2010, it will crash. The only suggestion I can make is to debug in P3D or FSX SE.

That's odd. I've never seen that issue with VS2012.
 
Correction....Greater than VS 2012. Its 2013 and up that crashes.
 
Thanks for your replies guys!

Czesc Bartek ;)

hard to tell from your description, because everything you do is correct.

Maybe try another way. In DLL project properties, specify post build action to copy DLL to ./gauges just to make sure you are debugging the right binaries, and then specify to start FSX in the debug options. Then VS automatically attach to this process once you press F5 to start debugging. This is what I prefer to do when debugging.

best regards (pozdrawiam)

Marcin

Cześć Marcin.

I tried your way and it didn't solve the issue. However it's possible I did specify the debugger path wrong as it wasn't able to load the symbols. I will give it another try this evening.

Dzięki! :)

I have never copied .pdb files to the gauges folder, I just leave them in the folder they are generated in.
This got me to wondering - do you have FSX installed in the default location? If so, the crashes may be the result of insufficient file modification rights in the gauges folder.

I have the FSX installed in the C:\FSX
I will play with the permissions tonight. I remember that at some point I configured FSX to always open it as an administrator as recommended by PMDG. Maybe that's the issue?

Correction....Greater than VS 2012. Its 2013 and up that crashes.

If all of the above fail, I will try to downgrade the VS to 2012.

Thanks!
 
I have an offtopic question.
Do you know how to make an gauge launch when the aircraft is loaded?

The gauge I'm working on will serve as an bridge between an external simconnect app and the sim to extract and set some L:Vars and I need it be launched when the aircraft is started.
Currently when I load the aircraft, to start the gauge I have to open it via the Instrument Panels menu. Once launched I can close the gauge view and it continues to run (Update is being called).

Thanks,
Bartek
 
It would have to be on the main panel/VC panel. Popup windows don't load automatically.
 
It would have to be on the main panel/VC panel. Popup windows don't load automatically.
But can I make it invisible then? I don't want it to be visible by default, I just need to make it running in the background.

Btw. I think it's a big design fail from Microsoft that you can't direct things like L:Vars externally via SimConnect :/
 
If it's image is a 0,0,0 bitmap... yes, it's invisible.

I think supporting XML is a design fail... so... :D
 
To make a gauge load "invisible" put the gauge in any VC section of Panel.cfg (preferable VC01) and use 0,0,1,1 as coordinate/size parameters in gaugeNN= line.

BTW, I'm curious about how you intend to retrieve LVars from an external program with Simconnect.
I guess you are not using shared memory/memory file mapping because in this case Simconnect would't be necessary.
Perhaps you're using SimConnect_CreateClientData and sister functions?

Tom
 
...
Btw. I think it's a big design fail from Microsoft that you can't direct things like L:Vars externally via SimConnect :/

I've been working on a module to allow access to L:Vars through Named Pipes. I have to admit that I haven't been working on it very quickly...
 
Actually I have some sketches of code that handles LVars export/import through Simconnect functions included in XMLTools.
Working with ClientAreas is rather simple but needs to take care of basic issues.

Tom
 
To make a gauge load "invisible" put the gauge in any VC section of Panel.cfg (preferable VC01) and use 0,0,1,1 as coordinate/size parameters in gaugeNN= line.

BTW, I'm curious about how you intend to retrieve LVars from an external program with Simconnect.
I guess you are not using shared memory/memory file mapping because in this case Simconnect would't be necessary.
Perhaps you're using SimConnect_CreateClientData and sister functions?

Tom
Thanks, I will give it a try.

What I try to achieve is to have a control over a several controls of the Majestic Software Dash 8 Q400 to interface it to a hardware I'm working on.
They provide a list of vars that you can access/modify via get_named_variable_value() set_named_variable_value() from the Panels & Gauges SDK. So I assume you can access those only by implementing an gauge and this is what I've been told by Majestic itself.

I have an external MFC app that communicates with the hardware and I want to establish the communication with the gauge we're talking about.
The SimConnect will be used to handle the communication between the app and the gauge using SimConnect_CreateClientData, SimConnect_SetClientData, SimConnect_RequestClientData etc.

That's also why I need the gauge to be running from the beginning, to handle the communication all the time.

Best,
Bartek
 
The SimConnect will be used to handle the communication between the app and the gauge using SimConnect_CreateClientData, SimConnect_SetClientData, SimConnect_RequestClientData etc.

Ok thanks, I supposed those were the functions involved.

Tom
 
With VS 2012 it crashes as well :/
I have no more ideas how to solve this..
Did you try first launching FSX and select an aircraft with your gauge, then launch the debugger with "Attach to Process..." (and attach to FSX.exe obviously)? Only then set the breakpoints.
 
Did you try first launching FSX and select an aircraft with your gauge, then launch the debugger with "Attach to Process..." (and attach to FSX.exe obviously)? Only then set the breakpoints.
Yes I did. It does the same.

Now I got into even more problems. FSX started to crash on startup after loading my dll.
Even if I revert all the changes to the version that worked before, it still crashes:

'...fsx.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
 
Now I got into even more problems. FSX started to crash on startup after loading my dll.
Even if I revert all the changes to the version that worked before, it still crashes:

'...fsx.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.
Yes, welcome to the fun world of addon development.

Can you make your code into an .exe? Then you can launch it through the debugger, set breakpoints at the start, run FSX and step through where it fails exactly.
 
Back
Top