Question

When I attempt to open my Windows Forms application (I'll call it MyApplication.exe) on a machine other than my dev machine, a dialog window pops up saying:


MyApplication has stopped working

Windows can check online for a solution to the problem

  • Check online for a solution and close the program
  • Close the program

Details

Problem signature:

  Problem Event Name:   CLR20r3
  Problem Signature 01: myapplication
  Problem Signature 02: 1.2.0.0
  Problem Signature 03: 51c34395
  Problem Signature 04: mscorlib
  Problem Signature 05: 4.0.0.0
  Problem Signature 06: 50484bd7
  Problem Signature 07: 1204
  Problem Signature 08: 89
  Problem Signature 09: System.TypeLoadException
  OS Version:   6.1.7600.2.0.0.256.48
  Locale ID:    1033
  Additional Information 1: 0a9e
  Additional Information 2: 0a9e372d3b4ad19135b953a78882e789
  Additional Information 3: 0a9e
  Additional Information 4: 0a9e372d3b4ad19135b953a78882e789

It's important to note that I use ILMerge to merge the MyApplication.exe and a referenced MyLibrary.dll assemblies together into one assembly (the name of the output is MyApplication.exe).

Also, it's important to note that the testing machines were able to run the .exe with no problems until I released an update that added an extension method to the MyApplication project.

In other words, after I added the extension method to MyApplication, then used ILMerge to combine the .exe and .dll, the testing machines would receive the above error (Interestingly, my dev machine could run the merged .exe with no problems).

Is there a known issue w/ ILMerge and Extension Methods? That sounds odd, but that's the only thing that has changed in my code.

Since I cannot reproduce the problem on my dev machine, do you have any advice on how I can go about troubleshooting the System.TypeLoadException error that occurs on the test machines?

System Info

  • Targeting .NET Framework 4.0 (all my test machines have this installed)
  • ILMerge Version 2.12.803
  • Dev Machine: Windows 2008 Server R2; Visual Studio 2010 Pro
  • Client Machines: XP, Win7, and Win8 (all of them get the error)
Was it helpful?

Solution

If you have .net 4.5 installed on your build machine, it would break if your not careful.

Basically Microsoft changed where 1 attribute was located (from System.Core to mscorlib).

Matt Wrock in his post explains how to workaround it with ILMerge. Although this is for the beta, it should work with the release.

OTHER TIPS

Matt Wrocks post (thanks @Daniel White for that) had the information that I was looking for. However, the /targetplatform path that he specifies didn't work for me.

Instead of Wrocks path

/targetplatform:"v4,C:\Program Files\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"

I had to use

/targetplatform:"v4,C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0"
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top