英文:
EF Core 7 and iOS for .Net MAUI
问题
在使用 EF Core 启动应用程序时,出现以下输出日志:
已加载程序集:data-0x1611d8000 [External]
已加载程序集:data-0x16178c000 [External]
已启动线程:<Thread Pool> #7
2023-06-29 00:27:45.546 Xamarin.PreBuilt.iOS[49768:3128527] 无法解析程序集 Microsoft.VisualStudio.DesignTools.TapContract,版本=17.0.0.0,文化=neutral,公钥标记=null 的引用。详细信息:无法加载文件或程序集 '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' 或其任何依赖项。
2023-06-29 00:27:45.553 Xamarin.PreBuilt.iOS[49768:3128527] 无法解析程序集 Xamarin.HotReload.Contracts,版本=1.0.0.0,文化=neutral,公钥标记=null 的引用。详细信息:无法加载文件或程序集 '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Xamarin.HotReload.Contracts.dll' 或其任何依赖项。
已解析 'Xamarin.HotReload.HotReloadAgent.BreakpointSendToIde(System.String)' 的待定断点至 D:\a\_work\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:423 [0x00000]。
已加载程序集:/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] 无法解析程序集 Xamarin.HotReload.Contracts,版本=1.0.0.0,文化=neutral,公钥标记=null 的引用。详细信息:无法加载文件或程序集 '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Xamarin.HotReload.Contracts.dll' 或其任何依赖项。
2023-06-29 00:27:45.774 Xamarin.PreBuilt.iOS[49768:3128527] 无法解析程序集 Microsoft.VisualStudio.DesignTools.TapContract,版本=17.0.0.0,文化=neutral,公钥标记=null 的引用。详细信息:无法加载文件或程序集 '/var/mobile/Containers/Data/Application/7B9D6681-A646-430C-A453-1D831127C8A2/Documents/FP.content/Microsoft.VisualStudio.DesignTools.TapContract.dll' 或其任何依赖项。
已解析 'Xamarin.HotReload.HotReloadAgent.BreakpointCheckpoint()' 的待定断点至 D:\a\_work\s\HotReload\Source\Xamarin.HotReload.Agent\HotReloadAgent.cs:418 [0x00000]。
已解析 'MainContext.cs:114,1' 处的待定断点至 void FP.Repository.SQLite.Context.MainContext.<InitStorageIfNeededAsync>d__30.MoveNext () [0x0002a]。
应用程序已终止。
iOS 应用程序刚刚启动,触发了断点,停留了几秒钟,然后终止。已禁用 Hot Reload,但无论如何都不起作用。对于 Android 和 Windows,都可以正常工作,没有任何异常。问题只存在于 iOS。尝试搜索但找不到相同行为的解决方案。
查看了这些问题(https://stackoverflow.com/questions/70556930/why-efcore-6-does-not-work-on-ios-anymore)、这些问题(https://stackoverflow.com/questions/72598734/entity-framework-core-in-net-maui-xamarin-forms)以及这个问题([Xamarin Android Entity Framework Core linker issue][1]),但都没有运气。
iOS 版本为 15.7.6,iPhone 7 硬件。
VS 版本:Version 17.6.0 Preview 1.0,
MAUI 工作负载版本:
已安装的工作负载 ID Manifest 版本 安装源
--------------------------------------------------------------------------------
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
[1]: https://stackoverflow.com/a/56197426/2832586
英文:
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\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\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(https://stackoverflow.com/questions/70556930/why-efcore-6-does-not-work-on-ios-anymore), this(https://stackoverflow.com/questions/72598734/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
答案1
得分: 0
什么是你的iOS系统版本?你是在真实设备上构建的吗?
但你可以首先尝试以下方法:
尝试为你的.NET Multi-platform App UI
(.NET MAUI)应用项目添加一个新的授权文件,并将一个名为Entitlements.plist
的新XML文件添加到应用项目的Platforms\iOS\
文件夹中。然后在文件中添加以下XML内容:
<?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>
请按照上述步骤进行操作。
英文:
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>
答案2
得分: 0
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.
英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论