Issues with SimConnect data areas

Version: 1.4.14.0

Frequency: /Consistently

Severity: High

Context: Aerosoft CRJ and PMDG 737 FMC APIs using SimConnect Client Data Areas being read from a C# client using the latest SDK SimConnect libraries.

Bug description: This may not be an issue with the simulator itself but with incompatible libraries on the products’ end. Just leaving this here to notify anyone interested.

When reading the ClientDataAreas of the aforementioend aircraft with SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED, the data areas either don’t update or they don’t notify the client when they are being changed on the server side. After a few minutes, the simulator freezes, especially when pressing buttons on the FMC.

Did some more tests. It is not only with the CHANGED option. Running the data area read with SIMCONNECT_CLIENT_DATA_PERIOD.VISUAL_FRAME crashes the simulator immediately.

The same code has been working flawlessly for quite some time in MSFS.

Sample code:

        [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
        public struct cduDataStruct
        {
            [MarshalAs(UnmanagedType.ByValArray, SizeConst = 720)]
            public byte[] cdu;
        };






                    this.Sim.ClearClientDataDefinition(DEFINITIONS.ASCRJ_CDU_DEFINITION);
                    this.Sim.MapClientDataNameToID("ASCRJ CDU1 Data", CLIENT_DATA_AREAS.ASCRJ_CDU_0_ID);
                    this.Sim.MapClientDataNameToID("ASCRJ CDU2 Data", CLIENT_DATA_AREAS.ASCRJ_CDU_1_ID);
                    uint size = Convert.ToUInt32(Marshal.SizeOf(typeof(cduDataStruct)));
                    this.Sim.AddToClientDataDefinition(DEFINITIONS.ASCRJ_CDU_DEFINITION, 0, size, 0, 0);
                    this.RegisterClientDataDefineStruct<cduDataStruct>(DEFINITIONS.ASCRJ_CDU_DEFINITION);
                    this.Sim.RequestClientData(CLIENT_DATA_AREAS.ASCRJ_CDU_0_ID, DATA_REQUESTS.READ_ASCRJ_CDU_0, DEFINITIONS.ASCRJ_CDU_DEFINITION,
                        SIMCONNECT_CLIENT_DATA_PERIOD.ONCE, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.DEFAULT);
                    this.Sim.RequestClientData(CLIENT_DATA_AREAS.ASCRJ_CDU_1_ID, DATA_REQUESTS.READ_ASCRJ_CDU_1, DEFINITIONS.ASCRJ_CDU_DEFINITION,
                        SIMCONNECT_CLIENT_DATA_PERIOD.ONCE, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.DEFAULT);
                    this.Sim.RequestClientData(CLIENT_DATA_AREAS.ASCRJ_CDU_0_ID, DATA_REQUESTS.READ_ASCRJ_CDU_0, DEFINITIONS.ASCRJ_CDU_DEFINITION,
                        SIMCONNECT_CLIENT_DATA_PERIOD.ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED);
                    this.Sim.RequestClientData(CLIENT_DATA_AREAS.ASCRJ_CDU_1_ID, DATA_REQUESTS.READ_ASCRJ_CDU_1, DEFINITIONS.ASCRJ_CDU_DEFINITION,
                        SIMCONNECT_CLIENT_DATA_PERIOD.ON_SET, SIMCONNECT_CLIENT_DATA_REQUEST_FLAG.CHANGED);

Hello @LorbySI

I’ve made some tests with both managed and unmanaged dll but could not replicate the issue so far.
Let us know if you are able to isolate the problem into a replicable context we can investigate.
Also, if you can collect dump files when this leads to CTDs, we are interested as well.

Regards,
Sylvain

Hello @FlyingRaccoon,

Thank you for your response. I will try my best - what files would you be interested in for the CTD? Those that are associated with the Windows Event Log or are there custom ones in the sim itself? The trouble with the CRJ is that the sim is just freezing up, it is not forcibly closed. The process is apparently still busy (CPU hovering around 10%, 10,5 GB memory in use) but I can no longer interact with it. Regarding the PMDG, it looks like a forced recompile of the WASM modules may have cured it. I will keep an eye on it.

Incidentally, the issue where the simulator freezes when you pop out an instrument, has that already been reported?

Best regards
Oliver

Another question if you don’t mind - is there a way to force a recompile of the aircrafts’ WASM modules (LocalState\Packages - \WASM) from within the simulator?

That seems to do the trick and clean up the issue(s) with the data areas.

You will find some guidelines on how to collect and send us the dump files here (section 2&3):
How to report a bug or crash - [MSFS 2020] Bug Reports - MSFS DevSupport

For the freeze occurrences, it’s not guaranteed to give us the root cause, but you can manually generate a dump file through the Task Manager by right clicking the process:

I see bug reports regarding performance drop but not about freeze.
If you have reliable repro steps, feel free to create a dedicated bug report and we will have a look.

Regards,
Sylvain