MSFS crashed after debugging using VS2022

Hi,

I can attach VS2022 code to MSFS2020 and do the debugging step by step.

However, after hitting the stop button in VS2022, there are usually two cases of crashing:
1, the MSFS2020 suddenly crashes after hitting the button.
2, the MSFS2020 can still run but will crash after I tried to build the package again in MSFS2020.

May I ask if I have any wrong configurations? Thanks!

Hello,
Did you set the argument -AllowDebugger to the .exe ?
https://docs.flightsimulator.com/html/Additional_Information/Tools/VS_Wasm_Debugger_Extension.htm

Regards,
Boris

2 Likes

@Kuailun

Just like @Boris said, you must pass the -AllowDebugger command-line argument to the sim before launching. I found a straightforward way to launch the sim with the argument passing, and it works for the MS Store version. I honestly didn’t know about it until now that I made a quick reseach on Google. For the Steam version, you can find where the executable is (because it is accessible), and in the same way, locate the core app files directory in the Command Prompt, and type flightsimulator.exe -AllowDebugger.

For the MS Store version, run Windows Terminal (cmd.exe mode) or the Command Prompt on your system. Then type the command, like in the shot below, and press Enter.

This is the result, if you check the sim’s process against tools like Process Explorer.

After that, you can attach the VS2022 debugger to the simulation.

I hope this works for you.

Regards,
Carlos Gonzalez
NextGen Simulations

1 Like

Thank you guys! That works for me!

Actually, I saw the suggestion that we should pass this parameter, otherwise, we cannot debug the code. However, I found that I still can debug with occasionally crashing, so I did not pass the parameter…

The problem is solved!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.