(Repost) Unity/Mono bug exposed - How to break Unity in under 20 lines of code

I found a mono bug in the 5.4 version of Unity. It takes less than a minute to repro (paste the code anywhere into your project).

I’d test it myself but (I’m too lazy) I figured there’d be little harm in sharing it with someone who has the appropriate version of Unity installed.

Thanks for reporting this bug, we will investigate it!

1 Like

Thanks for checking it out. :slight_smile:

I see the issue has been listed here: Unity Issue Tracker - [Mono] Using interfaces and generic classes results in "ReflectionTypeLoadException: The classes in the module cannot be loaded"

It’s marked as “Postponed”. Purely out of curiousity (as yes, I can work around it), any insight onto why this was happening or what it would take to fix it you’d be willing to share?

Also, I noticed in the fogbugz tracker it is marked as “closed”.

Thanks again.

A lot of compiler bugs I have sent in have gotten postponed with the message “This is postponed until after the Mono upgrade”. I’m assuming it’s because the bug’s probably fixed in newer versions of Mono, so the devs have chosen to wait until the fix comes “for free” with the upgrade rather than to backport the fix.

This bug is actually related to the way Mono lays out the vtable for the type. This this case it ends up being wrong. There is a good bit of risk in changing the vtable layout in the existing versions of Mono Unity uses, so we thought it would be better to leave the bug in as-is.

In the new version of the Mono runtime that we have been shipped via experimental previews (and will ship in a supported release), this vtable layout problem has been corrected.

Sorry, we should have notified you via the bug report when we closed the bug though.

No worries, thanks for the info. :slight_smile: