Home

IL generation in 32 vs 64 bit

Hi

This script produces different results in linqpad32 and linqpadany.
void Main()
{
switch (new long?(1))
{
case 1:
throw new ApplicationException("64 bit");
default:
throw new ApplicationException("32 bit");
}

}

According to this bug:
https://github.com/dotnet/roslyn/issues/7625
the IL is not valid, and seems to be the cause.

But in linqpad, I get the exact same IL in both versions, even though the result is reproducable. Am I missing something?

Comments

  • The emitted IL is identical in each scenario because the query compiles to a library whose target is AnyCPU (as is usually the case with DLLs).

    The difference between X86 and X64 is a function of the host process.

    Could it be that the lack of conv.i8 occurs in both cases, but matters only in the 32-bit scenario?
Sign In or Register to comment.