THIS XAMLParseException IS DRIVING ME CRAZY!! I am using .NET 3.5 in Visual Studio 1020 This is my xaml:
I know that this is an old question but hopefully this will help someone.
I had a property of the main window that was a Business Object... so when the window initialized, the Business Object attempted to initialize... great, but the Data access layer had not been setup, therefore it threw an error...
So c# called that an XML parse error because it happened so early... really it was thrown in code.
I don't think this is really a XamlParseException: I think it's a TargetInvocationException which has gotten wrapped in a XamlParseException. Take a look at the ultimate inner exception:
NLog.Config.NLogConfigurationException Message=Exception occured when loading configuration from 'C:\Users\Mohit\Documents\Visual Studio 2010\Projects\Notepad\Notepad\bin\Debug\NLog.config'
It looks like you have a borked configuration file, possibly due to invalid XML or possibly for some more specific reason.
When you get a mysterious XamlParseException, it's always worth checking the InnerException for a TargetInvocationException (and drilling in from there if there is one). Yes, it is very confusing and misleading!
Solved the same issue by including the referenced dll and config files in the same folder as the exe file. Trying to run the exe alone will cause a windows level exception.