plane icon Welcome to Microsoft Flight Simulator’s SDK Q&A Platform!

You have questions regarding the SDK? DevMode Tools? SimConnect? You would like to submit an idea for future improvements, seek help or exchange knowledge? You’re in the right place.


Please take a moment to read the platform’s guidelines before you get started!


question

Cammac avatar image
Cammac asked Cammac commented

CTD when using debug release.

Using Visual studio we can release code versions for users with and without debug (allows us to step through each line of code, to see where issues are). All was fine till SU9 whereby if you select debug version and compile, upon building within the sim it crashes via CTD.

https://devsupport.flightsimulator.com/questions/4851/always-ctd-when-running-wasm-compiled-in-debug-ver.html Advice given in this post was also tried but still causes a CTD.

Code base for our project had no change from SU8 to SU9. In SU8 we had no issues but with SU9 this causes a CTD each time.

Many thanks,



aircraftwasm
1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Arzop avatar image
Arzop answered Cammac commented

Can you please send it using DevSupport instead? (By following this article 3rd section: https://devsupport.flightsimulator.com/articles/5483/how-to-report-a-bug-or-crash.html)

Thanks


Maxime / Asobo

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Cammac avatar image
Cammac answered

Just as a follow up. This is what WinDBG outputs for the crash dump. Hope this helps. 1651588627873.png


1651588627873.png (626.8 KiB)
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Arzop avatar image
Arzop answered

Hi,

If it possible for you to send us your package?

Actually, there is nothing much we can do without it.


Best Regards
Maxime / Asobo

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Cammac avatar image
Cammac answered Cammac edited

Hi,

We can send this over.

Please could you send over an email or Discord ID that we can pass that on. Many thanks.

Below is a write up of how to replicate we have also checked with 2 developers our end same results.

"Basically you change the configuration in in Visual Studio 2019 to "Debug" instead of a "Release" build which builds the code to the "Panel" folder, then you go into the sim click rebuild all and click "fly now" in the simulator and once the code starts compiling it crashes CTD


10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Simbol avatar image
Simbol answered RXP commented

following.. I am using WASM in debug mode and so far no CTDs.. so wondering why you guys are suffering from this.

R.

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

We tracked it down! I will post below what the issue was in case anyone else has this.

There was a double definition of the function rescale_value in our LinearInterpolator.cpp and in our General.h which is included everywhere.

This apparently crashed the code but I can't give any further info as I don't know more about it. I removed the definition of the function in the General.h file because and moved the function from LinearInterpolator.cpp to the header file LinearInterpolator.h which is included in General.h which fixed the issue but this did work in SU8."

Following on from this they had one more question and a possible explanation too why it used to work

"We had 2 function declarations for the same symbol ("function"). Now my thought is that in order to optimize compile time, now in SU9, once a function definition was linked to a function declaration I believe that the function definition address was deleted from a list. So when the other function declaration with the same symbol came to link, it found an invalid address."

Many thanks,

1 Like 1 ·
Right, thank you so much for taking the time to provide this information..


R.

0 Likes 0 ·

Thank you for sharing the info, this is much appreciated.

Do you mean that the compiler wasn't enforcing ODR ?!?

Or is this something different here?

0 Likes 0 ·
Arzop avatar image
Arzop answered Arzop edited

Glad we find it

We made a lot of changes between SU8 and SU9 (reducing compilation time, improving debug...). One of the changes we made is about the link between functions found in dwarf (In the wasm file) and the c++ function we create. Before SU9, there was no link at all, so some functions may have debugging issues (in very very specific situations). Then, this link is checked by llvm's functions (which check if C++ code that we create if well made) and in your situation, find two functions with the same address and raise an error. That's why it works in SU8 and failed in SU9.


Best Regards

Maxime / Asobo

3 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Hi Maxime,


So on this regard, can we still overload a function? let's say you create a function with 1 parameter.. and a second function with the same name but 2 parameters..

Will this lead to the situation you are describing above? or it would be fine since it is an overload of the function?

Best,

Raul

0 Likes 0 ·

Hi,

There is no problem with that.

You're right, I misspoke in my previous posts. I talked about same name but it was same signature.

Function overload is allowed and works. For instance, that will work

void Toto(int a)
{
    // ...
}

void Toto(int a, int b)
{
    // ...
}


Best Regards

Maxime / Asobo

0 Likes 0 ·

Hi,

Thanks very much for the comprehensive reply.

Many thanks,

0 Likes 0 ·
inibuilds avatar image
inibuilds answered Cammac edited

Hey team.


We are getting a crash again in debug mode..

Code base for our project again have had no changes from yesterday and it was loading fine.. Constant CTD's now...

If we could get some support, on finding the crash, that would be super appreciated.

Many thanks





1 comment
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Hello @inibuilds

Can you provide us with a full dump file please.
Follow these guidelines: How to report a bug or crash - MSFS DevSupport (flightsimulator.com)

Regards,
Sylvain

1 Like 1 ·
inibuilds avatar image
inibuilds answered

Thanks @Cammac is sending it now like last time.

10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

FlyingRaccoon avatar image
FlyingRaccoon answered Cammac commented

Hello @Cammac @inibuilds

Unfortunately, we are not able to reproduce the crash here using your compiled wasm module.
The dump tells us it happens when the module is compiled but not why.

Some additional questions:

- Have you tried loading your package on a different machine? Do you have the CTD as well or it depends on the hardware?

- Do you have fast wasm enabled? disabled? Does it make a difference when changing this?

- Can you try to clear the cache that is generated in your AppData Microsoft Flight Simulator directory?
MS Store path: C:\Users\<yourusername>\AppData\Local\Packages\Microsoft.FlightSimulator_8wekyb3d8bbwe\LocalCache\packages\inibuilds...
Steam path: C:\Users\<yourusername>\AppData\Roaming\Microsoft Flight Simulator\packages\inibuilds...

- Our last option would be to have a look at your module sources and project configuration and look for a potential issue here.

Regards,
Sylvain

8 comments
10 |10000

Up to 5 attachments (including images) can be used with a maximum of 4.8 MiB each and 23.8 MiB total.

Hi,

Thanks for getting back to us, I have passed this on to the team and I am sure a longer reply will come shortly.

Many thanks,

1 Like 1 ·

Hey Sylvian.


Multiple team members have tried and its crashing on both fast-WASM, and normal.


We have also followed all the steps outlined in your message but with no success.

0 Likes 0 ·

Hi,

You said in your previous message that you crash in debug mode. Is it possible for you to send us a "working" wasm file and a "non-working" one?

Can you also check your project configuration in debug and release mode and tell us what differ. (If you could provide us your source code it would be ideal)


Best Regards

Maxime / Asobo

1 Like 1 ·
Show more comments
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 5 attachments (including images) can be used with a maximum of 19.1 MiB each and 23.8 MiB total.