clx
clx

Reputation: 824

Reporting missing dependencies

Say there is a wpf-application, which uses different dlls. When the executable gets started, it loads the needed dlls as they are defined in the project's references.

When I now delete some of these dlls, the executable will crash showing the common dialog "... has stopped working" with the options close and debug the program. Similar to this one:enter image description here

This is not enough for me. I want my own dialog, showing some more information.

According to the debug output, there is a FileNotFoundException thrown in the App.Main() which is automatically generated. How can I handle this exception?

Upvotes: 0

Views: 122

Answers (1)

Patrick Hofman
Patrick Hofman

Reputation: 157068

You can handle the Application.DispatcherUnhandledException event.

When handling that event, you can give a custom message.

It is also possible to handle the AppDomain.AssemblyResolve event to catch assemblies that couldn't be loaded.

Upvotes: 3

Related Questions