Version: 1.1.7.0
Frequency: Consistently
Severity: High
Marketplace package name: n/a
Context: Flight logger in C# managed simconnect using SubscribeToSystemEvent “AircraftLoaded”
Similar MSFS 2020 issue: works fine in MSFS2020
Bug description:
It seems like MSFS2024 is triggering the AircraftLoaded SystemEvent before the file given in the filepath is available to read.
Using a Visual Studio compiled C# simconnect external .exe application which after connecting to the sim issues:
sim?.SubscribeToSystemEvent(SIMEVENT_ID.AircraftLoaded, "AircraftLoaded");
this will result in a callback to
OnRecvEventFilename(SimConnect sender, SIMCONNECT_RECV_EVENT_FILENAME ev)
In my case, the file path returned in that ‘ev’ struct for the a320neo is:
c:\users\fripl\appdata\roaming\microsoft flight simulator 2024\streamedpackages\microsoft-aircraft-a320neo\content\simobjects\airplanes\microsoft-a320neo\presets\inibuilds\a20n\config\aircraft.cfg
but file_contents = File.ReadAllText(file_path);
results in the C# System.IO.DirectoryNotFoundException
:
System.IO.DirectoryNotFoundException: Could not find a part of the path 'c:\users\fripl\appdata\roaming\microsoft flight simulator 2024\streamedpackages\microsoft-aircraft-a320neo\content\simobjects\airplanes\microsoft-a320neo\presets\inibuilds\a20n\config\aircraft.cfg'
Repro steps:
- use a Windows C# simconnect program to subscribe to the AircraftLoaded SystemEvent (in my case I’m using NB21 Logger)
- try reading the file referenced by the provided filepath.