Commbus self call events not received when fired from module_init

MSFS Version: 1.2.8.0
SDK Version: 1.1.2

Frequency: Consistently

Severity: High - Feature not functioning as intended, or if by design not a documented limitation

Bug description:
When using fsCommBusCall in module_init using the FsCommBusBroadcast_AllWasm broadcast flags, the event is never received.

Calling fsCommBusCall later (eg. when SIMCONNECT_RECV_ID_OPEN is received) works as expected.

Small incomplete example:

const char* TestEventName = "test_event_name";

void EventCallback( const char* buf, unsigned int bufSize, void* ctx )
{
	std::string Data( buf, bufSize );
	std::cout << Data;
}

void CALLBACK CallDispatch( SIMCONNECT_RECV* pData, DWORD cbData, void* pContext )
{
	switch ( pData->dwID )
	{
	case SIMCONNECT_RECV_ID_OPEN:
		// Fire event to self after the SimConnect connection has opened - EventCallback is called in this case
		std::string Data( "Event data from DispatchProc" );
		fsCommBusCall( TestEventName, Data.c_str(), Data.size(), FsCommBusBroadcast_AllWasm );
		break;
	}
}
extern "C" MSFS_CALLBACK void module_init()
{
   	// SimConnect connection code omitted for brevity

   	// Commbus init
	fsCommBusRegister( TestEventName, &EventCallback, nullptr );

	// Fire event to self from module_init - EventCallback never called with this data
	std::string Data( "Event data from module_init" );
	fsCommBusCall( TestEventName, Data.c_str(), Data.size(), FsCommBusBroadcast_AllWasm );
}

Repro steps:

  1. Place the attached package in your community folder
  2. Launch MSFS 2024
  3. Open the dev mode console
  4. Search for CommbusModuleInit.wasm
  5. Observe that Event data from module_init is not present in the log, and Event data from DispatchProc is present

Attachments:
A complete minimal package with an example of this is attached:
CommbusModuleInit.zip (818.0 KB)

Hello @ThievinFrost

This is fixed in the current version of SU2 beta

Regards,
Sylvain

2 Likes

This topic has been automatically closed after 60 days of inactivity since it was marked as fixed.

If there is important new information about this same report, you can use the “Request reopen” button below to ask the moderation team to review it again.
For other issues or broader discussion, please open a new topic in the appropriate category.