Abdul Ahad Abdul Ahad - 1 month ago 14
C# Question

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

I'm working with WPF. When I'm trying to declare

SQLiteConnection
in the code, the problem arises-

The invocation of the constructor on type 'TestWPF.MainWindow' that matches the specified binding constraints threw an exception.

InnerException: Make sure that the file is a valid .NET Framework assembly.


can anyone tell me, how to fix it?

Answer

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.