SQLitePCL.raw icon indicating copy to clipboard operation
SQLitePCL.raw copied to clipboard

System.IO.FileLoadException on windows 32 bit (Windows 7 professional)

Open chuki2 opened this issue 5 years ago • 3 comments

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?

chuki2 avatar Sep 07 '20 09:09 chuki2

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.

ericsink avatar Sep 07 '20 15:09 ericsink

May bad, I uninstall sqlcipher nuget from my project and seems the issues has been fix

Solved!

chuki2 avatar Sep 08 '20 07:09 chuki2

@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

chuki2 avatar Sep 15 '20 06:09 chuki2

Closing old/stale issue.

ericsink avatar Sep 22 '22 21:09 ericsink