Unbox must support the verifier. The verifier does not particularly understand that a parameter of type T will always be a reference type, so the C # compiler emits unnecessary unnecessary unnecessary files.
If you search the Roslyn source code for Unbox_any and IsVerifierReference, you will see that this happens in several places around the code generator.
Jitter will know when it generates code whether the type parameter is a reference or not, and should generate decent code regardless of what seems like an unnecessary instruction.
source share