ILCode . ridiculous statements after decompilation

76 Views Asked by At

Consider I have the following code:

try
{
    using (var scope = CreateDependencies())
    {
        ...
    }
}

When I decompile it:

try
{
    ILifetimeScope scope;
    int num1;
    if ((uint) (num1 - 1) > 2U)
        scope = Host.CreateDependencies();
    try
    {
        ...
    }
    ...
}
....

Why the hell there is addtional if that makes completely no sense?

The ILCode produced by ILDasm:

.try
{
    IL_00b8:  ldloc.0
    IL_00b9:  ldc.i4.1
    IL_00ba:  sub
    IL_00bb:  ldc.i4.2
    IL_00bc:  ble.un.s   IL_00ca
    IL_00be:  ldarg.0
    IL_00bf:  ldloc.1
    IL_00c0:  call       instance class [Autofac]Autofac.ILifetimeScope MyApp.Host::CreateDependencies()
    IL_00c5:  stfld      class [Autofac]Autofac.ILifetimeScope MyApp.Host/'<RunAsync>d__7'::'<scope>5__2'
    IL_00ca:  nop
    .try
    {
        ...
    }
    ....
}
0

There are 0 best solutions below