citizenfx / fivem

The source code for the Cfx.re modification frameworks, such as FiveM, RedM and LibertyM, as well as FXServer.
https://cfx.re/
3.52k stars 2.07k forks source link

[MonoV2] deferrals.presentCard in PlayerConnecting event leads to a crash #2593

Closed Keyinator closed 2 months ago

Keyinator commented 3 months ago

What happened?

The following code:

[EventHandler("PlayerConnecting")]
private async Coroutine HandleConnecting([Source] Player player, string playerName, dynamic setKickReason, dynamic deferrals) {
  deferrals.defer();
  deferrals.presentCard(AdaptiveCardText, new Action<dynamic, string>((data, rawData) => {
    //Do nothing
  })
}

leads to the crash * Assertion at sgen-alloc.c:378, condition `*p == NULL' not met

(An example adaptive card can be obtained from https://adaptivecards.io/designer/ using the content of the card payload editor)

Expected result

The card should be shown to the client

Reproduction steps

[EventHandler("PlayerConnecting")]
private async Coroutine HandleConnecting([Source] Player player, string playerName, dynamic setKickReason, dynamic deferrals) {
  deferrals.defer();
  deferrals.presentCard(AdaptiveCardText, new Action<dynamic, string>((data, rawData) => {
    //Do nothing
  })
}

Importancy

Crash

Area(s)

FiveM, FXServer, ScRT: C#

Specific version(s)

Version: FXServer-master v1.0.0.8552 linux with OneSync enabled

Additional information

No response

FabianTerhorst commented 2 months ago

Try again on latest server build.

Keyinator commented 2 months ago

Try again on latest server build.

Fixed 👍🏻