我使用热重启直接调试到我的IPhone。该应用程序仅在Emulator中使用热重启时崩溃。使用云解决方案,该应用程序运行良好。
我有一个.Resx文件AppResources,我正在使用Xamarin社区工具包提供的翻译扩展,以便能够使用我的.Resx中的密钥。我使用了文本模板,该模板用它们的名称生成密钥,以便能够像这样调用它们:
<Label Text="{toolkit:Translate Text={Static t4:AppResources.Key}}" FontSize="Large" HorizontalOptions="CenterAndExpand"/>
<Label Text="{Static t4:AppResources.Key}" FontSize="Large" HorizontalOptions="CenterAndExpand"/>
该应用程序崩溃了一个我试图使用
静态t4:AppResources.Key
我不知道自己做错了什么。我上传了解决方案GitHub:GitHub链接
是否有解决问题的方法,或者从.Resx文件获取密钥的其他方法。
感谢您的帮助
这是事故报告。
=======================================本机崩溃报告=======================================在执行本机代码时获得segov。这通常表示致命mono运行库或您的应用程序
=============================================
本机堆栈:=============================================0x102370120-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_dump_native_crash_info
0x102366cbc-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_handle_native_crash 0x102373a60-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_sigsev_signal_handler_debug 0x1d06bc29c-/usr/lib/system/libsystem_platform.dylib:0x102514ec4-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_exec_method_full
0x102514 ec4-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_exec_method_full 0x102514ec4-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_exec_method_full 0x10250eb0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_runtime_invoke 0x102376d3c-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_jit_runtime_invoke 0x1024252c0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_invoke_checked 0x102428728-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_invoke 0x102508ccc-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:xamarininvoke_trampoline 0x10250e0cc-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:Xamarin_arch_trampoline 0x10250ec70-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:Xamarin_arm64_common_trampoline 0x1874cf7a8-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1874d123c-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1874d7388-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186b2ac98-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x187093f58-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:_UIScenePerformActionsWithLifecycleActionMask 0x186b2b830-/System/Library/Pr-ivateFrameworks/UIKitCore.framework/UIKitCore:0x186b2b2f0-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186b2b640-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186b2ae7c-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186b333c0-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186传真1970-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1870acd68-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:_UISceneSettings DiffActionPerformChanges With TransitionContext 0x186b330b8-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x18695afa0-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186959920-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x18695abc8-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1874d5528-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x186fcafd0-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1940775d8-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1940a2d44-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1940866a4-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1940a2a0c-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1846d281c-/usr/lib/system/libdispatch.dylib:0x1846d630c-/usr/lib/system/libdispatch.dylib:0x1940 cafa0-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1940cac30-/系统/图书馆/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices:0x1940cb184-/System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoard Services:0x184a5f9e8-/系统/库/框架/CoreFoundation.framework/CoreFoundation:0x184a5f8e4-/系统/库/框架/CoreFoundation.framework/CoreFoundation:0x184a5ebe8-/系统/库/框架/CoreFoundation.framework/CoreFoundation:0x184a58bc8-/系统/库/框架/CoreFoundation.framework/CoreFoundation:0x184a58360-/系统/库/框架/CoreFoundation.framework/CoreFoundation:CFRunLoopRunSpecific 0x19c096734-/System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices:GSEventRunModal 0x1874d3584-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:0x1874d8df4-/系统/库/PrivateFrameworks/UIKitCore.framework/UIKitCore:UIApplicationMain 0x10251c8fc-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:do_icall 0x10251b010-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:do_icall_wrapper 0x102511a8c-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_exec_method_full 0x10250eb0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_runtime_invoke 0x102376d3c-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_jit_runtime_invoke 0x1024252c0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_invoke_checked 0x10242b974-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_try_invoke_array 0x1023d39c4-/private/var/containers/捆绑包/应用程序/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:ves_icall_InteralInvoke 0x1023e3b68-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:ves_icall_InternalInvoke_raw 0x10251c8fc-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:do_icall 0x10251b010-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:do_icall_wrapper 0x102511a8c-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_exec_method_full 0x10250eb0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:interp_runtime_invoke 0x102376d3c-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_jit_runtime_invoke 0x1024252c0-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_invoke_checked 0x10242a564-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_runtime_exec_min_checked 0x10235b8f4-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:mono_jit_exec 0x10250d984-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:Xamarin_main 0x102323c34-/private/var/containers/Bundle/Application/95CE4E70-9227-43D7-A04D-AD08B0B10CC9/TF4FileIphoneTest.iOS.app/Xamarin.PreBuilt.iOS:main 0x184714cf8-/usr/lib/system/libdy.dylib:
===============================================================基本故障地址报告=============================================本机指令指针周围的内存(0x102517878):0x102517868 2001 1f d6 18 0b 00 91 48 83 5f f8 08 10 00 b4。。。。。。。H.。。。。。0x102517878 08 11 40 b9 48 83 1 f b8 08 03 40 79 a9 0 f 00 b0..@.H..@y.…0x102517888 29 a1 33 91 28 79 68 f8 00 01 1f d6 4883 5f f8).3.(yh…..H.0x102517898 e8 0e 00 b4 08 01 40 f9 08 0140 f9 08 69 40 39……@@..i@9
=========================================托管堆栈跟踪:========================================位于<0xfffffffff>在UIKit上。UIApplication:UIApplicationMain<0x000b8>在UIKit上。UIApplication:Main<0x00020>在UIKit。UIApplication:Main<0x00038>在TF4FileIphoneTest.iOS.Application:Main<0x00012>在:runtime_invoke_direct_void_string[]<0x00092>在<0xfffffffff>位于System.Reflection.RuntimeMethodInfo:InternalInvoke<0x00030>在System.Reflection。运行时方法信息:调用<0x000fc>在System.Reflection.MethodBase:Invoke<0x0001a>在Xamarin.PreBuilt.iOS.应用程序:Main<0x00254>在:runtime_invoke_direct_void_string[]<0x00092>
应用程序已终止。
不支持静态iOS库和框架,如果您的应用程序尝试加载这些库和框架时,您可能会看到运行时错误或崩溃。使用HOTRESTART预处理器符号来阻止执行此代码。支持动态iOS库。有关详细信息,请参阅(https://learn.microsoft.com/en-us/xamarin/xamarin-forms/deploy-test/hot-restart)
我通过更改键的生成方式解决了这个问题。
从更改
internal static string <#= entry.Name #>
{
get { return nameof(<#= entry.Name #>); }
}
至
internal static string <#= entry.Name #> = "<#= entry.Name #>";
应用程序停止崩溃