using scope like this will generate invalid IL code.
public struct SomeDisposable : IDisposable
{
public void Dispose()
{
//Dispose something
}
}
[BurstCompile]
public unsafe struct SomeJob : IJob
{
public void Execute()
{
using(var handle=new SomeDisposable())
{
//Do something
}
}
}
It should be caused by boxing “SomeDisposable” to IDisposable. But console output did not pin where the invalid IL code is from. And as far as I know, no Document has mentioned this case. So be noted.
This should at least be mentioned in doc. Or maybe burst can avoid this boxing behavior when compiling.