"The invocation of the constructor on type 'TestWPF.MainWindow' that matches the specified binding constraints threw an exception."- how to fix this? "The invocation of the constructor on type 'TestWPF.MainWindow' that matches the specified binding constraints threw an exception."- how to fix this? wpf wpf

"The invocation of the constructor on type 'TestWPF.MainWindow' that matches the specified binding constraints threw an exception."- how to fix this?


If you click on View Detail... from the exception window you can look at the InnerException. Expand that node and you will see exactly what went wrong.


In my specific case, I was getting this because I had a few of my referencing assemblies mismatched between x64 and x86. Apparently I was binding to something that needed to be loaded by the runtime.

I mention this here as a reminder to check your build configurations if you've looked everywhere else!


I fixed the problem by adding the below content in app.config,

<configuration> <startup useLegacyV2RuntimeActivationPolicy="true" /> </configuration>

I found this via a community addition by user FCAA below the article "Troubleshooting Exceptions: System.IO.FileLoadException" on MSDN.