Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are the differences in the disassembly of two .NET executables built from the same source code?

Set up:

  • same source code is used build a .NET 4 executable (console application) on two different machines.
  • Microsoft Visual Studio 2010 SP1 .NET 4 settings are identical on the two machines
  • ildasm projectName.exe /out:test.txt is performed on the .exe's from both machines.
  • ildasm output differs beyond expected differences (mvid, privateimplementationdetails).

Question:
I have spent some time creating an application to get the CRC of a .NET executable and have succeeded in ignoring all differing build-time data.

I am removing all data above the // =============== CLASS MEMBERS DECLARATION =================== line in ildasm.exe output. This ignores the MVID. I am building the .exe without debug information. And lastly, I parse the output for <PrivateImplementationDetails>{GUID} and ignore those.

I then CRC the remaining text file.

The CRCs are the same when the same project is built on the same computer, but differ when the same project is built on a different computer with identical source code and MSVS 2010 settings.

Does anyone know of any machine-dependent information stored in the assembly of a .NET executable?

Below is an example of the differences. It appears that different IDs are being assigned each object and class, but I find it odd that this would only differ when they code is build on different machines...

         `class DSC_PI.MainWindow/'<>c__DisplayClass21' V_2,`
         `class DSC_PI.MainWindow/'<>c__DisplayClass10' V_2,`  

         `class DSC_PI.MainWindow/'<>c__DisplayClass1e' V_3,`
         `class DSC_PI.MainWindow/'<>c__DisplayClassd' V_3,`  

Any insight would be much much appreciated.

like image 737
ZayJay Avatar asked Jun 02 '11 18:06

ZayJay


1 Answers

Do both systems have the same number of cores? I could imagine, that when it comes to counting up the variable name suffix, the result can differ depending on the number of threads used for the compiler.

like image 87
matthias.lukaszek Avatar answered Nov 16 '22 00:11

matthias.lukaszek