Version: 1.6.7.0
Frequency: Consistently
Severity: High
(Low - quality of life, workflow optimization, rare enough to not impact production, etc…
High - critical but workarounds are available, important feature not working as expected, frequent enough to impact production
Blocker - prevents from working on the project, prevents from releasing the product)
Marketplace package name: N/A
Context: The bug was found in the FBW A32NX and A380X. Likely to be a problem for others too.
Similar MSFS 2020 issue: N/A
Bug description:
If a write handle is open on a file, attempting to call opendir on it’s parent directory fails in the SU4 beta. This means you cannot enumerate a directory if some other gauge or even your own gauge has an open handle on a child item. It works fine on SU3 and all prior versions (including FS2020).
Repro steps:
Make a copy of the SimpleWasmAircraft sample, edit C:\MSFS 2024 SDK\Samples\DevmodeProjects\SimObjects\Aircraft\WasmAircraftCopy\Sources\code\WasmModules\GaugeModule\Demo.cpp, adding the following function:
#include <dirent.h>
void testReaddir()
{
FILE* fd = fopen("\\work\\foo.fdr", "w");
if (!fd) {
fprintf(stderr, "[testReaddir] Failed to open \\work\\foo.fdr!");
return;
}
fprintf(fd, "bar");
struct dirent* directoryEntry;
DIR* directory = opendir("\\work");
if (!directory) {
fprintf(stderr, "[testReaddir] Failed to open \\work");
fclose(fd);
return;
}
fprintf(stdout, "[testReaddir] Enumerating \\work");
// read directory until end
while ((directoryEntry = readdir(directory)) != NULL) {
if (directoryEntry->d_name) {
fprintf(stdout, "[testReaddir] Dir Ent: %s", directoryEntry->d_name);
}
}
fprintf(stdout, "[testReaddir] Finished enumerating \\work");
fclose(fd);
}
and in Demo_gauge_init add testReaddir(); before the return.
Build the solution, build the aircraft package, and run the Gauge preset in the sim. Note the results below in attachments. The opendir call fails in MSFS2024 SU4 beta.
Due to improper error checking in the FBW planes + the WASI readdir implementation, this additionally caused an infinite loop on spawn in SU4 beta.
Attachments:
MSFS2024 SU3:
MSFS2024 SU4 beta:
Private attachments: Send a PM to @PrivateContent with the link to this topic and the link to download your content

