Closed JonWeighell closed 2 years ago
Err, I may have been wrong over in #467 when I said this looked like a different problem. Not sure yet. The error message is clearly not the same, but you're on the net6 workloads, and iOS is so different from the other platforms, that it might be two symptoms of the same cause.
Having the same issue here (albeit in VS 2022 v17.1 Preview 3).
Using Microsoft.EntityFrameworkCore v6.0.1 and Microsoft.EntityFrameworkCore.Sqlite v6.0.1
Have the same issue here: https://github.com/dotnet/maui/issues/4490
If I use .NET Maui App on iPhone 12 iOS 15.2, Xcode 13.2.1, VS 17.1.0 Preview 5.0 on Windows 10 (connected to remote Mac) with this NuGet packages: `
I got an error:
{System.DllNotFoundException: e_sqlite3 at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() at SQLitePCL.raw.SetProvider(ISQLite3Provider imp) at SQLitePCL.Batteries_V2.Init() at MauiApp3.Data.BloggingContext..ctor() in D:\Temp\MauiApp3\MauiApp3\Data\BloggingContext.cs:line 18 at System.Reflection.RuntimeConstructorInfo.InternalInvoke(Object obj, Object[] parameters, Boolean wrapExceptions) at System.Reflection.RuntimeConstructorInfo.DoInvoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitConstructor(ConstructorCallSite constructorCallSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor
2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSiteMain(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.VisitRootCache(ServiceCallSite callSite, RuntimeResolverContext context) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteVisitor2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.RuntimeResolverContext, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].VisitCallSite(ServiceCallSite callSite, RuntimeResolverContext argument) at Microsoft.Extensions.DependencyInjection.ServiceLookup.CallSiteRuntimeResolver.Resolve(ServiceCallSite callSite, ServiceProviderEngineScope scope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.CreateServiceAccessor(Type serviceType) at System.Collections.Concurrent.ConcurrentDictionary
2[[System.Type, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Func2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.ServiceProviderEngineScope, Microsoft.Extensions.DependencyInjection, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60],[System.Object, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]].GetOrAdd(Type key, Func
2 valueFactory) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType, ServiceProviderEngineScope serviceProviderEngineScope) at Microsoft.Extensions.DependencyInjection.ServiceProvider.GetService(Type serviceType) at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) at Microsoft.Maui.MauiContext.WrappedServiceProvider.GetService(Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService(IServiceProvider provider, Type serviceType) at Microsoft.Extensions.DependencyInjection.ServiceProviderServiceExtensions.GetRequiredService[IApplication](IServiceProvider provider) at Microsoft.Maui.MauiUIApplicationDelegate.FinishedLaunching(UIApplication application, NSDictionary launchOptions) at UIKit.UIApplication.Main(String[] args, Type principalClass, Type delegateClass) at MauiApp3.Program.Main(String[] args) in D:\Temp\MauiApp3\MauiApp3\Platforms\iOS\Program.cs:line 13}`
I'm actually having trouble reproducing this, and I want to make sure I'm seeing the exact same problem described. Has anyone got a minimal repro sample they could post as an attachment?
I'm actually having trouble reproducing this, and I want to make sure I'm seeing the exact same problem described. Has anyone got a minimal repro sample they could post as an attachment?
Here is my example for .NET MAUI app with SQLite: MauiApp3.zip
And here is example for .NET MAUI app with EFCore SQLite: MauiApp2.zip
Run app on Android Emulator. Everything works OK. Run app on iPhone 12 iOS 15.2 remote iOS simulator (via connected Mac). App crashes at line: SQLitePCL.Batteries_V2.Init();
Platform versions: iPhone 12 iOS 15.2, Xcode 13.2.1, VS 17.1.0 Preview 5.0 on Windows 10 (connected to remote Mac)
@RaspeR87 And both of those examples show the problem? Or do you mean one shows the problem and does not?
@ericsink yes, both show same problem on iOS device and works well on Android device.
As a first attempt, I tried running the MauiApp3 example directly on a Mac. It works fine in the iOS simulator, meaning it does not reproduce the problem.
I am downloading and installing VS 17.1 preview to try it that way.
@ericsink Yes, if I am right only VS 17.1.0 Preview 4.0 and Preview 5.0 couses an error…
I can reproduce the error now, but I do not yet understand why it is happening.
The wrong instance of SQLitePCLRaw.batteries_v2.dll is ending up chosen. I am not sure why this is happening. The right one is in the nuget under lib\Xamarin.iOS10
, but the one under lib\netstandard2.0
is being chosen instead.
I have local nupkgs for the current development work I am doing with SQLitePCLRaw. If I update the bundle_green reference to my current builds, the problem is fixed. I presume this is because that version of bundle_green has a batteries assembly in lib\net6.0-ios15
.
The diagnostic build output seems to indicate that the build knows that Xamarin.iOS10 is the older form of net6.0-ios, so I'm still not sure why the problem is happening.
Interesting:
Building the project inside Visual Studio 17.1 preview, the wrong batteries_v2 assembly is chosen as mentioned just above.
But if I build from the command line (dotnet build --framework=net6.0-ios
), the result is correct, meaning that the batteries_v2 assembly that ends up in the bin output directory is the one it should be, the one from lib\xamarin.ios10\
in the bundle_green nuget package.
@ericsink ok, great finding.
But if you want to run that app on iOS simulator with that command dotnet build -t:Run -f net6.0-ios -p:_DeviceName=:v2:udid=A0859D94-CDC2-45D3-BDA8-7E5C85F76975
runs ok?
I tried this few days ago with no luck…
Preview release 2.1.0-pre20220207221914 has been pushed up to nuget.org. It contains attempted fixes for this issue. Testing feedback would be appreciated.
the app works on iOS but crashes on maccatalyst
Hmmm. I didn't do maccatalyst support. I'll try to fix that.
I also see the issue on Windows. Was this fix supposed to work there too?
@powerdude This issue is pretty much iOS-specific. If you're having a problem that looks similar, I'll need you to open a separate issue and post full details.
@ericsink The error also showed up in windows. I saw your response in #449 and i just tried the latest package by adding it directly to my app instead of relying on the one in EntityFramework.SqlLite and the error goes away. Thanks.
@VladislavAntonyuk
I can't build your app from within visual studio, got the newest preview version and .net 6.0.200 mauibuild.txt
Also when building from command line I get the dllnotfoundexception for e_sqlite3 for build target net6.0-maccatalyst
Did you explicitly test net6.0-maccatalyst? Btw I am running on an Apple M1 chip
@VladislavAntonyuk
I can't build your app from within visual studio, got the newest preview version and .net 6.0.200
Also when building from command line I get the dllnotfoundexception for e_sqlite3 for build target net6.0-maccatalyst
Did you explicitly test net6.0-maccatalyst?
Btw I am running on an Apple M1 chip
I left a comment that it crashes on MacCatalyst: https://github.com/ericsink/SQLitePCL.raw/issues/468#issuecomment-1032136588
This issue is for iOS only, that is why I mentioned that it works
I left a comment that it crashes on MacCatalyst: #468 (comment)
This issue is for iOS only, that is why I mentioned that it works
Could you in any environment get Entity Framework Core to run on maccatalyst?
It worked before preview 11. There were breaking changes. I will take a look again. I remember I was able to make it work with plain SQLite (without EFCore)
For status of maccatalyst support, see #471
I think the issues herein got fixed and are part of the 2.1.0 release, now on nuget.
I am having issues only on iOS Release mode , in Debug it is working fine. Is there any update on this?
Above example works fine without EF but our project has EF integrated, so it would be great if anyone cam share sample sample code solution which is working on iOS Release mode.
@IndexOutOfLimit Please open a new issue and include complete information about what issues you are seeing.
We're building an app using the previews of .net MAUI (specifically for maui-blazor). Trying to test the app on iOS results in a crash when initializing SQLite. We are using Entity Framework 6.0.1.
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.1" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.1" />
[0:] An error occurred: 'e_sqlite3'. Callstack: ' at SQLitePCL.SQLite3Provider_e_sqlite3.SQLitePCL.ISQLite3Provider.sqlite3_libversion_number() at SQLitePCL.raw.SetProvider(ISQLite3Provider imp) at SQLitePCL.Batteries_V2.Init()
We're using Visual Studio 2022 v17.1 Preview 4