Code inspection: Typeof is prohibited in Burst
This inspection reports the use of typeof(...) expressions inside code compiled by the Burst compiler.
Burst targets a high-performance, restricted subset of C# and does not support typeof expressions. These expressions often imply access to managed metadata or System.Type objects, which are not available in the restricted Burst execution environment.
How it works
The analyzer monitors typeof expressions within a Burst-compiled context (e.g., a method or job marked with the [BurstCompile] attribute).
The restriction applies whether typeof is used directly (e.g., to assign to a variable) or indirectly when calling an API that expects a System.Type argument, such as SharedStatic<T>.GetOrCreate(typeof(int)).
Example
In this example, the typeof(int) expression is used inside the Execute method of a Burst-compiled job. This is not supported and will be flagged.
Quick-fix
This inspection does not provide a dedicated quick-fix. Fix it manually by removing the typeof expression from Burst-compiled code or by replacing it with Burst-compatible generic or compile-time alternatives.