XamlParseException in WPF

>When hacking WPF one sometimes get
System.Windows.Markup.XamlParseException was unhandled
Message=”Cannot create instance of ‘FormMain’ defined in assembly ‘Kopain2, Version=, Culture=neutral, PublicKeyToken=null’. Exception has been thrown by the target of an invocation. Error in markup file ‘Forms/FormMain.xaml’ Line 1 Position 9.

which does not give much of a clue.

So copy exception details to your favourite editor (Copy exception detail to the clipboard…) and scroll down. Typically at the second last row you can read something like
at Kopain2.FormMain..ctor() in C:\Data\Projects\Kopain2\Kopain2\Forms\FormMain.xaml.cs:line 101
which is a magnitude more helpful.

2 Responses to “XamlParseException in WPF”

  1. Dan Lamping says:

    >You can always put MarkupSource tracing on. This tends to help.


Leave a Reply