2

When I ran my C# WinForms executable outside of the Visual Studio IDE for the very first time, I received the following dialog:

"<Application> has stopped working, Windows can check online..."

So I attached to the process using Visual Studio's Attach to Process, which showed that the program had suspended within InitializeComponent() (but did not provide further clues).

I edited the application, placed a try/catch block around the aforementioned code, which allowed me to print the following MessageBox output:

As you can see, this showed that the application is not able to find a DLL it needs.

My question: Could I have achieved this result without modifying the application (that is, without the try/catch block printing out the specifics)? Could Visual Studio Attach to Process functionality guide me to the specific problem being the missing DLL? If so, how?

Sabuncu
  • 5,095
  • 5
  • 55
  • 89
  • Check if you have the same referenced assembly in your windows application not only in the root folder, but also in the GAC... If you installed this assembly - it could be that the one in your global assembly cache is outdated and you need to delete/update it. – Mez Feb 08 '15 at 20:01
  • @Mez I understand, but my question is not about the missing DLL. It is about how to use VS to arrive at that solution. – Sabuncu Feb 08 '15 at 20:02
  • This appears to be a duplicate: http://stackoverflow.com/questions/7572995/how-can-i-get-winforms-to-stop-silently-ignoring-unhandled-exceptions or at least very relevant. – Mike Zboray Feb 08 '15 at 20:10
  • Check out the Application Object. There are some methods in there to catch uncaught exceptions and put your message box stacktrace over there. This is a better approach for this i guess. – Philip Stuyck Feb 08 '15 at 20:10

1 Answers1

3

This information can be found from fusion logs, if you enable them. Fusion logs are helpful in diagnosing if an assembly load fails because of missing dependencies.

Also, sometimes event viewer has useful information.

https://msdn.microsoft.com/en-us/library/e74a18c4%28v=vs.110%29.aspx

Erti-Chris Eelmaa
  • 25,338
  • 6
  • 61
  • 78