1

I have a WPF application that references dll from GAC. Is there a way to detect (on startup), if some/all of those dlls are missing?

Currently, if there are missing dlls, the application just crashes. I'm overriding OnStartup, so I thought it could be possible to catch it there. I tried AppDomain.CurrentDomain.UnhandeledException (based on this post Catching missing DLL in XamlParseException), but with no success.

Ideally I would like to show a simple MessageBox informing user, that there are missing dlls.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
JanW
  • 11
  • 1
  • What's your code, cause the link you provide is the answer of your question – Guilhem Prev Jul 11 '19 at 08:09
  • 1
    Override `AppDomain.CurrentDomain.AssemblyResolve` as mentioned [here](https://stackoverflow.com/questions/9180638/working-with-appdomain-assemblyresolve-event). Catch any errors and display in a message box accordingly –  Jul 11 '19 at 08:16
  • @GuilhemPrev I found the problem. I was using that missing dll in the OnStartup function. Once I removed it, the solution worked. However I have another problem. The MessageBox appears only briefly, before it closes along with the application. What would be the correct way to close the application only after user closes the MessageBox? – JanW Jul 11 '19 at 10:12
  • Could you show some code? This will help us help you. [mcve] –  Jul 13 '19 at 05:06

0 Answers0