Volodymyr
Volodymyr

Reputation: 1255

EF Core 7 and iOS for .Net MAUI

When starting application with EF Core getting next output log:

Loaded assembly: data-0x1611d8000 [External]
Loaded assembly: data-0x16178c000 [External]
Thread started: <Thread Pool> #7
2023-06-29 00:27:45.546 Xamarin.PreBuilt.iOS[49768:3128527] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

2023-06-29 00:27:45.553 Xamarin.PreBuilt.iOS[49768:3128527] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:423 [0x00000].
Loaded assembly: /private/var/containers/Bundle/Application/5440EC53-4C5F-4E22-B690-E5E921E53C5B/FP.app/System.Text.Encodings.Web.dll [External]
2023-06-29 00:27:45.765 Xamarin.PreBuilt.iOS[49768:3128527] Could not resolve assembly Xamarin.HotReload.Contracts, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Xamarin.HotReload.Contracts.dll' or one of its dependencies.

2023-06-29 00:27:45.774 Xamarin.PreBuilt.iOS[49768:3128527] Could not resolve assembly Microsoft.VisualStudio.DesignTools.TapContract, Version=17.0.0.0, Culture=neutral, PublicKeyToken=null. Details: Could not load file or assembly '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' or one of its dependencies.

Resolved pending breakpoint for 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' to D:\a\_work\1\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:418 [0x00000].
Resolved pending breakpoint at 'MainContext.cs:114,1' to void FP.Repository.SQLite.Context.MainContext.<InitStorageIfNeededAsync>d__30.MoveNext () [0x0002a].
The app has been terminated.

iOS application just starts, hit breakpoint, stays for few seconds and terminates. Disabled Hot Reload but this not works anyway. For Android and Windows it's working good without any exceptions. Problem present only for iOS. Tried to search but can't find something with the same behavior.

Looked at this(Why EFCore 6 does not work on iOS anymore?), this(Entity Framework Core in .NET MAUI/Xamarin.Forms), and this(Xamarin Android Entity Framework Core linker issue) questions without any luck.

iOS version is 15.7.6, iPhone 7 hardware. VS version: Version 17.6.0 Preview 1.0, MAUI workload versions:

Installed Workload Id      Manifest Version       Installation Source
--------------------------------------------------------------------------------
maui-android               7.0.86/7.0.100         SDK 7.0.200, VS 17.6.33417.168
maui-ios                   7.0.86/7.0.100         SDK 7.0.200, VS 17.6.33417.168
maui-maccatalyst           7.0.86/7.0.100         SDK 7.0.200, VS 17.6.33417.168
maui-tizen                 7.0.86/7.0.100         SDK 7.0.200
tvos                       16.4.7060/7.0.100      VS 17.6.33417.168
maccatalyst                16.4.7060/7.0.100      VS 17.6.33417.168
ios                        16.4.7060/7.0.100      VS 17.6.33417.168
android                    33.0.46/7.0.100        VS 17.6.33417.168
macos                      13.3.7060/7.0.100      VS 17.6.33417.168
wasm-tools                 7.0.5/7.0.100          VS 17.6.33417.168
runtimes-windows           7.0.5/7.0.100          VS 17.6.33417.168
maui-windows               7.0.86/7.0.100         VS 17.6.33417.168

Upvotes: 0

Views: 349

Answers (2)

Volodymyr
Volodymyr

Reputation: 1255

Disabling everything that was related to Hot Reload removed related assemblies crashes from the output. Full migration to PCL lib removed need to deal with EF Core. PCL lib functionality is much more limited compared to EF, it also appears to me as much fragile, however was able to start application the first time by creating separate database file, not using already existing one that was preconfigured for copying into output folder.

Upvotes: 0

Jessie Zhang -MSFT
Jessie Zhang -MSFT

Reputation: 13861

What's your version of iOS system? Did you build on a real machine?

But you can first try the following method:

Try to add a new entitlements file to your .NET Multi-platform App UI (.NET MAUI) app project, and add a new XML file named Entitlements.plist to the Platforms\iOS\ folder of your app project. Then add the following XML to the file:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
</dict>
</plist>

Upvotes: 0

Related Questions