See dotnet/coreclr#18865
cc @xPaw
unbox of a struct produces a managed pointer (type &) so the local here needs to be declared as a ByRef. Otherwise the jit won't track the pointer and report it to GC, leading to eventual badness when GC moves things.
https://github.com/StackExchange/Dapper/blob/1cd3efd89485ccd0bdcc6036eaa5a12a311189fd/Dapper/SqlMapper.cs#L2410-L2426
- il.DeclareLocal(type.MakePointerType());
+ il.DeclareLocal(type.MakeByRefType());