Some of the methods inside the mscorlib.dll seem to be empty when I look through them.

I was reading about the MSIL and was using the IL DASM in Visual Studio to look through some of the class methods. Out of curiosity I went probing into some of the Math class methods and found some of them to be empty.

Here is the code from the Math.ABS()...

.method public hidebysig static int32  Abs(int32 'value') cil managed
  .custom instance void __DynamicallyInvokableAttribute::.ctor() = ( 01 00 00 00 ) 
  // Code size       13 (0xd)
  .maxstack  8
  IL_0000:  ldarg.0
  IL_0001:  ldc.i4.0
  IL_0002:  blt.s      IL_0006
  IL_0004:  ldarg.0
  IL_0005:  ret
  IL_0006:  ldarg.0
  IL_0007:  call       int32 System.Math::AbsHelper(int32)
  IL_000c:  ret
} // end of method Math::Abs

And here is the code found in the Math.Sin()...

.method public hidebysig static float64  Sin(float64 a) cil managed internalcall
  .custom instance void System.Security.SecuritySafeCriticalAttribute::.ctor() = ( 01 00 00 00 ) 
  .custom instance void __DynamicallyInvokableAttribute::.ctor() = ( 01 00 00 00 ) 
} // end of method Math::Sin

I have a suspicion it has to do with that System.Security.SecuritySafeCriticalAttribute constuctor, but I am not sure what that does even after reading the MSDN page on it, or why it would hide IL code.

Does anyone have any insight to what I am seeing?

Thanks for your help.

1 Answers

Cory Nelson On

internalcall indicates the method is implemented by the CLR directly rather than in IL.