0

I have 2 dlls ('original' and 'new') and for one method the IL is very different inside these 2 dlls (not talking about the nop alone but lot of differences). But when I decompile these two dlls then the C# produced is exactly same for these two.

Why it is happening? Is it OK and valid scenario? Can I assume the functionality is same based on decompiled C# code (though the IL are lot different)?

Other Info:

  1. Visual Studio 2008 (3.5).
  2. Method contains long chain of switch...case statements.
  3. I can not modify the 'original' dll (c# code) but I can modify the C# code of 'new' dll to regenerate the dll and compare again.
  4. IL sample is very big otherwise I could have pasted here.

I am unable to find a way to make the IL of 'new' dll (by modifying the C# code) exact same as 'original' dll. Any suggestion to achieve this?

Utkash
  • 1
  • 7
    You've observed that two different compilers may choose to produce subtly different outputs for the same input, with the same overall result. So what's the problem? – Rowland Shaw Sep 24 '14 at 20:37
  • While I agree with Rowland's observation, it would be interesting to see an excerpt of the two IL images. – 500 - Internal Server Error Sep 24 '14 at 21:01
  • 1
    `switch`/`case` constructs usually compile into very different IL depending on the complexity. My guess is that the decompilers have different level of support for recognizing these optimizations. – Brian Rasmussen Sep 24 '14 at 21:04
  • Problem is I need to replace this 'new' dll in Production server with 'original' dll. Now the IL of these 2 dll is different so i am concerned if the functionality/behavior will be different (if we check the IL code)? I thought when I decompile these dll I will be able to see the C# differences but I see no difference in C# produced by decompiler for these 2 dlls. So, my real concern is that IL is different so I am scared to replace the 'new' dll in production with 'original' dll. Find the IL in - http://wikisend.com/download/231918/new.txt and http://wikisend.com/download/674382/original.txt – Utkash Sep 25 '14 at 15:13

0 Answers0