Skip to content

Linux: NullReferenceException in C# (mono v1) kills the entire server process — same code catches fine on Windows #4055

Description

@Forces2222

What happened?

Artifacts: Linux build b31689/Lin & 25770/Lin, · Runtime: C# v1 (CitizenFX.Core), started via txAdmin

Expected: A null dereference inside try/catch throws a catchable System.NullReferenceException (works on Windows).
Actual: On Linux the whole fxserver process terminates instantly with no managed error output — the catch block never runs. Looks like the crash handler intercepts mono's SIGSEGV before it can convert it to a managed exception (see mono docs on signal handlers and third-party crash reporters).

Windows prints caught: System.NullReferenceException; Linux: process dies immediately.

Expected result

Linux: process dies immediately

Reproduction steps

Minimal repro (single server-only resource):

using CitizenFX.Core;
using static CitizenFX.Core.Native.API;
public class Repro : BaseScript {
    public Repro() {
        RegisterCommand("nretest", new System.Action<int, System.Collections.Generic.List<object>, string>((src, args, raw) => {
            try { string s = null; s.ToLower(); }
            catch (System.Exception e) { Debug.WriteLine("caught: " + e.GetType().FullName); }
        }), false);
    }
}

Importancy

Crash

Area(s)

FXServer

Specific version(s)

b31689/Lin & 25770/Lin tested

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcrashtriageNeeds a preliminary assessment to determine the urgency and required action

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions