phil
phil

Reputation: 1446

C# and WPF - 'System.Reflection.TargetInvocationException' occurred in PresentationFramework.dll

I am working on a wpf application with visual studio 2012. The program had been starting up just fine until now. I had just finished adding a decent amount of code, and I hadn't started the program in a while. When I attempted to, I got a System.Reflection.TargetInvocationException. I tried to step into the code, but I got the message "PresentationFramework.pdb not loaded".

I tried 'Start without debugging'. This time I got no exception, but it just didn't do anything. I have tried commenting out portions of my code to find the problem points, but I made no progress.

The code I had just added had nothing to do with wpf, if that has anything to with it.

Upvotes: 2

Views: 8935

Answers (2)

John Koffee
John Koffee

Reputation: 9

Try to start debugging from Window.Initialized event

private void Window_Initialized(object sender, EventArgs e) {
    int a; //put breakpoint here
}

XAML code:

<Window x:Class="ProjectName.MainWindow" ... Initialized="Window_Initialized">

Upvotes: 0

nyconing
nyconing

Reputation: 1136

Make sure your xaml code is correct and clear all syntax at

public MainWindow()
{
   InitializeComponent();       
}

Upvotes: 2

Related Questions