Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Exception is not being caught when program installed with a msi file

Tags:

c#

.net

wpf

I made a WPF program that works in the VIsual studio when run. I made an installer for my program with Visual Installer Projects 2017. At one part the program crashes and I get the following dialog:

An unhandled Microsoft.NET Framework exception occured in Program1.exe [10204].

My catch block looks like this

Dispatcher.Invoke(new Action(() =>
            {
                EnableContent();
            }));
        }
        catch (AggregateException e)
        {
            MessageBox.Show(e.ToString());
            Dispatcher.Invoke(new Action(() =>
            {
                UpdateLoadMsg("No internet connection.", MsgType.FAIL);
            }));
        }
        catch (Exception e)
        {
            MessageBox.Show(e.ToString());
            Dispatcher.Invoke(new Action(() =>
            {
                UpdateLoadMsg("Something went wrong.", MsgType.FAIL);
            }));
        }

Messagebox is never showed! apparently the exception isn't being catched. How to debug this?

like image 525
Nahro Avatar asked Apr 28 '17 15:04

Nahro


1 Answers

Relevant

I found the causing exception by looking at the system logs http://www.dummies.com/computers/operating-systems/windows-10/how-to-use-event-viewer-in-windows-10/ .

Non-relevant

The exception that was being thrown was a FileNotFoundException. Setting buildaction = embedded resource wasn't enough, I had to add the file as additional installation file.

like image 145
Nahro Avatar answered Nov 20 '22 21:11

Nahro