I was able to fix the original issue by moving all php files out of directories and to the root of the project in my peachpie library project.
System.ArgumentNullException: Value cannot be null in Microsoft.Data.Sqlite when compiling with .Net native toolchain
Everything works without .Net native toolchain then I was getting this error when building with .net native toolchain:
Error RHBIND : error RHB0011: Internal error: 'pchTypeNameEnd[0] == L'>'' at 'f:\dd\ndp\rh\src\tools\rhbind\makepdb.cpp:968' appname.UWP Error ILT0005: '...\packages\runtime.win10-x86.microsoft.net.native.compiler\2.2.10-rel-29722-00\tools\x86\ilc\Tools\rhbind.exe @"...\obj\x86\Release\ilc\intermediate\rhbindargs.appname.UWP.rsp"'
I was able to fix that by altering default.rd.xml by removing <Assembly Name="*Application*" Dynamic="Required All">
And adding assemblie references by hand and adding DoNotOptimize="True" for example:
<Assembly Name="System" Dynamic="Required All" DoNotInline="true" DoNotOptimize="true" />
After doing that i keep getting this error with Sqlite:
System.TypeInitializationException: A type initializer threw an exception. To determine which type, inspect the InnerException's StackTrace property. ---> System.ArgumentNullException: Value cannot be null.
Parameter name: type
at System.Reflection.IntrospectionExtensions.GetTypeInfo(Type) + 0x7b
at Microsoft.Data.Sqlite.Utilities.BundleInitializer.Initialize() + 0xb3
at Microsoft.Data.Sqlite.SqliteConnection..cctor() + 0x8
at System.Runtime.CompilerServices.ClassConstructorRunner.Call(IntPtr) + 0x89
at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x247
--- End of inner exception stack trace ---
at System.Runtime.CompilerServices.ClassConstructorRunner.EnsureClassConstructorRun(StaticClassConstructionContext*) + 0x351
at System.Runtime.CompilerServices.ClassConstructorRunner.CheckStaticClassConstruction(Void*, StaticClassConstructionContext*) + 0x17
at Microsoft.Data.Sqlite.SqliteConnection..ctor(String) + 0x44
at noobcloud.local_data.init(String) + 0x19e
connection was null.
I've noticed that i get:
Exception thrown: 'System.IO.FileNotFoundException' in System.Private.Reflection.Core.dll
With e_sqlite3, but it's copied to the output directory. Maybe that's related to this issue.
I've tried adding assemblies to Xamarin.Forms.Init(e, assemblies) and adding assemblies to default.rd.xml without success. My first thoughts since the type is null is that the assembly is not getting loaded correctly, but i have no idea how to confirm that and it seems to make no difference if i include Microsoft.Data.Sqlite in default.rd.xml or not.
Any help is appreciated. Thanks.