Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>It isn't related to the C# compiler, the IL is identical. You found a bug in the .NET 4.0 jitter optimizer. You can repro it in Visual Studio. Tools + Options, Debugging, General, untick the "Suppress JIT optimization on module load" option and run the Release build to repro the failure.</p> <p>I haven't looked at it closely enough yet to identify the bug. It looks very strange, it inlines the method and completely omits the code for the boxing conversion. The machine code is substantially different from the code generated by the version 2 jitter.</p> <p>A clean workaround isn't that easy, you can do it by suppressing inlining. Like this:</p> <pre><code> [System.Runtime.CompilerServices.MethodImpl(System.Runtime.CompilerServices.MethodImplOptions.NoInlining)] public bool IsDateTime(object o) { return o is DateTime; } </code></pre> <p>You can report the bug at connect.microsoft.com. Let me know if you don't want to and I'll take care of it.</p> <hr> <p>Never mind, that was <a href="https://connect.microsoft.com/VisualStudio/feedback/details/558649/c-is-type-check-on-struct-odd-net-4-0-x86-optimization-behavior" rel="nofollow">already done</a>. It wasn't fixed in the maintenance release that was included with VS2010 SP1.</p> <hr> <p>This bug has been fixed, I can no longer repro it. My current version of clrjit.dll is 4.0.30319.237 dated May 17th 2011. I can't tell exactly what update repaired it. I got a security update on Aug 5th 2011 that updated clrjit.dll to revision 235 with a date of Apr 12, that would be the earliest.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload