[C# - Server] Server crashes when starting another resource while stopping the executing resource

FXServer version: Windows 5584

While calling API.StartResource("xxx"); in onResourceStop event the server crashes.

Repro:
cstest.zip (99.7 KB)

! in the included repro resource the hardcap resource has to be available.

  • start server
  • start cstest resource
  • stop cstest resource

Such also happens in an old fivemqueue resource

This regression was addressed by reverting the problematic commit in question:
Revert “tweak(scripting/mono): use ‘fast’ code path for Windows server” · citizenfx/fivem@784088f (github.com)

The fix is available in builds 5611 onwards, with the first stable release being 5625