Linker NullReferenceException with Mono.Data.Sqlite.Portable

HGiritzerHGiritzer ATMember ✭✭

See original post here: https://forums.xamarin.com/discussion/comment/286803/#Comment_286803

Excerpt:
Having the Mono.Data.Sqlite.Portable NuGet package referenced I can't create builds with Linker behavior "SDK assemblies only", neither for Android nor for iOS.

Android:

Error  The "LinkAssemblies" task failed unexpectedly.
System.NullReferenceException: Object reference not set to an instance of an object.
   at Mono.Linker.Steps.ResolveFromAssemblyStep.ProcessLibrary(LinkContext context, AssemblyDefinition assembly)
   at Mono.Tuner.CustomizeActions.ProcessUserAssembly(AssemblyDefinition assembly)
   at Mono.Tuner.CustomizeActions.ProcessAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.BaseStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Run(Pipeline pipeline, LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()
C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets line 1569

iOS:

* "Link Framework SDK only":  
    Error Could not link assemblies. Reason: Object reference not set to an instance of an object   
    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets line 747
* "Don't link" produces a huge file and (much worse) makes the AppStore think that any existing 
    app permission is in use, therefore requiring permission request strings for anything.
* "Link All" produces a too small file which crashes immediately on launch.

Can't produce a working build for the iOS AppStore right now - any ideas or workarounds are appreciated!
Unfortunately I can't kick the package out, as it is heavily in use...

Posts

  • HGiritzerHGiritzer ATMember ✭✭

    Update: I restructured my solution and moved all SQLite implementations into the native projects.
    That way, the Mono.Data.Sqlite.Portable NuGet package was no longer necessary and I could remove it.
    Now I can compile and link all configurations flawlessly. Finally!

Sign In or Register to comment.