System.IO.FileLoadException on windows 32 bit (Windows 7 professional)
My Application using .net 4.6.1 framework. Using SQLite as the database. Compile to release x86 platform
To access the SQLIte, I using the library sqlite-net-pcl v1.7.335 from nuget and sqlite-net-sqlcipher v1.7.335 to encrypt the database. I can run on the 64 bit without problem.
Now I facing the System.IO.FileLoadException when run the application on windows 7 32 bit.
Inside the bin/release folder. I sure that all the folder
- runtimes\win-arm\native
- runtimes\win-x64\native
- runtimes\win-x86\native
has been created, and each folder got e_sqlite3.dll and e_sqlcipher.dll.
Here the log from EventViewer
Application: AzriTech.EasyWorkshop.POS.exe
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.IO.FileLoadException
at SQLitePCL.NativeLibrary.WhichLoader()
at SQLitePCL.NativeLibrary.MyLoad(System.String, System.Reflection.Assembly, Int32, System.Action`1<System.String>)
at SQLitePCL.NativeLibrary.Load(System.String, System.Reflection.Assembly, Int32)
at SQLitePCL.Batteries_V2.MakeDynamic(System.String, Int32)
at SQLitePCL.Batteries_V2.DoDynamic_cdecl(System.String, Int32)
at SQLitePCL.Batteries_V2.Init()
at SQLite.SQLiteConnection..cctor() Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateInstance(System.Func`1<System.__Canon>)
at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].CreateInstanceWithNullCheck()
at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].GetInterceptedInstance()
at SimpleInjector.Lifestyles.SingletonLifestyle+SingletonLifestyleRegistration`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].BuildExpression()
at SimpleInjector.InstanceProducer.BuildExpressionInternal()
at SimpleInjector.Internals.LazyEx`1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].get_Value()
at SimpleInjector.InstanceProducer.BuildExpression()
Exception Info: SimpleInjector.ActivationException
at SimpleInjector.InstanceProducer.BuildExpression()
at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()
Exception Info: System.InvalidOperationException
at SimpleInjector.InstanceProducer.VerifyExpressionBuilding()
at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt(SimpleInjector.InstanceProducer[])
at SimpleInjector.Container.VerifyThatAllExpressionsCanBeBuilt()
at SimpleInjector.Container.VerifyInternal(Boolean)
at SimpleInjector.Container.Verify()
at AzriTech.EasyWorkshop.POS.Program.Bootstrap()
at AzriTech.EasyWorkshop.POS.Program.Main()
I also notice that my application using framework 4.6.1, and already install the framework to the machine. But I not sure why show as Framework Version: v4.0.30319
Any idea what the root of cause? It is because of the framework version?
Not sure if this is the cause of the problem, but one issue here is that you should not have both SQLite and sqlcipher at the same time. Those are alternatives were you typically choose one or the other, but never both.
May bad, I uninstall sqlcipher nuget from my project and seems the issues has been fix
Solved!
@ericsink , I no idea why only selected windows 7 happens. I can use on windows 7 SP 1 without problem (Virtual box), but some machine when I install it throw this exception.
I suspect is relate with System.Runtime.InteropServices.RuntimeInformation.
Let me figure out why
Closing old/stale issue.