Code inspection: Try statement is not supported
This inspection reports try statements inside code compiled by the Burst compiler.
Burst does not support exception handling constructs such as try, catch, and finally.
Example
In this example, the Execute method of a Burst-compiled job contains a try-finally block. This is not supported and will be flagged.
using Unity.Burst;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
public void Execute()
{
// Reported: try-finally is not supported in Burst
try
{
}
finally
{
}
}
}
using Unity.Burst;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
public void Execute()
{
// Correct: Remove exception handling and use explicit checks
var isValid = true;
if (!isValid)
return;
}
}
Quick-fix
This inspection does not provide a dedicated quick-fix. Fix it manually by removing the try statement from Burst-compiled code.
26 March 2026