Skip to content

UNI011: Boxing allocation detected

What and why

Value type boxed to reference type (object, interface, virtual call).

Boxing allocates on the heap and can pressure the GC in hot paths.

How to fix: use generics, concrete types, or avoid implicit boxing to object/interfaces.

Fix guidance

Avoid boxing value types; use generics or concrete types instead.

Tags

performance, gc-pressure

Suppression

Use // unilyze-disable-next-line UNI011 -- reason immediately before the reported line. These detector findings are line-based, so separate overload occurrences can be suppressed independently. For project-wide suppression, use "rules": { "UNI011": "off" }; use a baseline to freeze existing findings while reporting new ones.