Code inspection: Burst: The variable resolves to System.String, which may result in invalid managed method calls at the Burst-compiled call stack
This inspection reports local var declarations that resolve to System.String inside code compiled by the Burst compiler.
Burst does not safely support regular managed strings in local variables. This inspection triggers when type inference turns a local variable into string inside a [BurstCompile] method or job.
Example
In this example, the var text declaration is inferred as a string. The quick-fix automatically converts the declaration to an explicit FixedString... type.
using Unity.Burst;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
public void Execute()
{
// Reported: Local var inferred as string is not supported in Burst
var text = "Hello";
}
}
using Unity.Burst;
using Unity.Collections;
using Unity.Jobs;
[BurstCompile]
public struct ExampleJob : IJob
{
public void Execute()
{
// After fix: Use Burst-compatible FixedString types
FixedString32Bytes text = "Hello";
}
}
Quick-fix
The quick-fix converts the declaration to an explicit FixedString... type (e.g., FixedString32Bytes, FixedString64Bytes, etc.) that keeps the code Burst-compatible and avoids inferred string locals.
26 March 2026