[1.5.5, 2020.3.15f2.723] Throwing an exception in Direct Call crashes the Editor

As the title suggests, this simple code will cause a crash:

using System;
using Unity.Burst;
using UnityEngine;

[BurstCompile]
public class NewBehaviourScript : MonoBehaviour
{
    void Start()
    {
        ThrowException();
    }

    [BurstCompile]
    public static void ThrowException()
    {
        throw new Exception("Oops");
    }
}

After reading the docs, I’m pretty sure this is not expected behavior. Am I missing something?

Thanks for reporting this @Pavel_Tibekin - we’re investigating and we’ll get back to you once we know more.

We’ve dug into this - it looks like a specific issue to the Mono in 2020.3. 2021.2 doesn’t appear to exhibit this problem.

Burst DirectCall goes through a slightly different execution path to normal function pointers (using a calli to do the call), so it might be related to that. We’ve raised this with the VM team and are trying to work it out further.