当我在与Visual Studio 2019同步的Mac上在iPhone上启动我的应用程序时,出现错误:
error: * Assertion at ../../../../../mono/metadata/class-init.c:4109, condition `klass' not met
我认为它与我的页面有关,因为它在App.cs中的MainPage = new myPage();
崩溃。
如果需要,我可以添加整个错误打印。
有帮助吗?
编辑:有关代码的更多信息:
页面的构造函数执行以下操作:
InitializeComponent();
WebRequest
,StreamWriter
,WebResponse
JObject
来解析anwser并更新一些Label Grid
添加到我的Layout
中:Grid
正在使用:
AbsoluteLayout
,StackLayout
,Frame
,TapGestureRecognizer
,Image
,Button
,Label
xaml:
<ContentPage.Content>
<StackLayout x:Name="stackMainWrapper"
BackgroundColor="White">
<StackLayout x:Name="stackPageHeader"
Padding="20,10,20,0" >
<StackLayout x:Name="stackHeaderNavigation"
Orientation="Horizontal">
<myApp:SvgIcon x:Name="svgBtnUser"
ResourceId="myApp.assets.icons.svg.menu.svg"
WidthRequest="25"
Margin="0,0,10,0"
VerticalOptions="Center">
<myApp:SvgIcon.GestureRecognizers>
<TapGestureRecognizer Tapped="GoToMenu" />
</myApp:SvgIcon.GestureRecognizers>
</myApp:SvgIcon>
<Label x:Name="labelPageName"
Text=""
Style="{StaticResource TitleLabelStyle}"
VerticalOptions="Center" />
<Button x:Name="btncreate"
Text=""
Style="{StaticResource ButtonRegularBlue}"
Margin="0,10"
Clicked=""
HorizontalOptions="EndAndExpand"/>
<myApp:SvgIcon x:Name="svgBtnFilterResults"
ResourceId="myApp.assets.icons.svg.search.svg"
WidthRequest="25"
Margin="10,0,0,0"
CornerRadius="50"
Padding="10,0"
IsVisible="False"
BackgroundColor="{StaticResource LightGreyStyled}"
HorizontalOptions="End"
VerticalOptions="Center">
<myApp:SvgIcon.GestureRecognizers>
<TapGestureRecognizer
Tapped="BtnFilterResults_Clicked" />
</myApp:SvgIcon.GestureRecognizers>
</myApp:SvgIcon>
</StackLayout>
</StackLayout>
<controls:ShadowLine />
<ScrollView x:Name="scrollPageBody"
Margin="0">
<StackLayout x:Name="PageBody"
Padding="20" >
<Label x:Name=""
Text=""
Style="{StaticResource RegularLabelStyle}"
HorizontalTextAlignment="Center"
Margin="0,0,0,20"/>
</StackLayout>
</ScrollView>
</StackLayout>
</ContentPage.Content>
</ContentPage>
编辑:添加异常跟踪:
2019-06-13 11:25:52.743 myapp.iOS [682:181626]错误:*断言为 ../../../../../mono/metadata/class-init.c:4109,条件不是“ klass” 遇见
================================================ ==================本机崩溃报告 ================================================ ===============执行本机代码时获得了SIGABRT。这通常表示致命 Mono运行时或您的
使用的本机库之一错误应用程序。
================================================ =================基本故障地址报告 ================================================== ===============本地指令指针(0x1d3bb20dc):0x1d3bb20cc fd周围的内存 7b c1 a8 c0 03 5f d6 10 29 80 d2 01 10 00 d4。{...._ ..)......
0x1d3bb20dc c3 00 00 54 fd 7b bf a9 fd 03 00 91 55 d6 ff 97 ... T。{...... U ...
0x1d3bb20ec bf 03 00 91 fd 7b c1 a8 c0 03 5f d6 90 29 80 d2 ..... {.. .._ ..).. 0x1d3bb20fc 01 10 00 d4 c3 00 00 54 fd 7b bf a9 fd 03 00 91 ....... T。{.... ..
================================================ ==================本机堆栈跟踪: ================================================== ============== 0x1005752fc- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x10056bc1c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x1d3c259ec-/usr/lib/system/libsystem_platform.dylib: 0x1d3c2b094-/usr/lib/system/libsystem_pthread.dylib: 0x1d3b0bea8-/usr/lib/system/libsystem_c.dylib:中止 0x1006f1c7c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_find_protocol_wrapper_type 0x1006d2018- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x1006d20a4- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x1005adc78- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x100713638- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_应用程序的总执行期限。 localized_string_format_9 0x100710edc- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100702b78- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100706ad8- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100706ad8- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100703a80- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100701e50- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x10057c294- / var /容器/捆绑/应用 ation / B332FB94-B5DA-4627-8D03-5471B0CE66FC / myapp.iOS.app / myapp.iOS: mono_pmip 0x10061794c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x10061af84- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x10047904c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x100479844- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x2007d0594- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: Échecde l'arrêtde l'application:发生错误 客户端IDB1610517,同时执行对主题的答复 xvs / idb / 16.1.0.517 / stop-app 0x2007d5d20- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x2000992dc- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 实施期限终止。 0x2000a1874- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x200098f60- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x200099850- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x200097b9c- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x200097864- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x20009c3a4- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x20009d188- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: _performActionsWithDelayForTransitionContext 0x20009c25c-/System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x2007cee30- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x2000a0f5c- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x2007d4328- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x2003d0ba8- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: 0x1d69909fc- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d699a40c- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d6999c14- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d3a557d4-/usr/lib/system/libdispatch.dylib: 0x1d39fa5d8-/usr/lib/system/libdispatch.dylib: 0x1d69cb040- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d69cacdc- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d69cb294- /System/Library/PrivateFrameworks/FrontBoardServices.framework/FrontBoardServices :0x1d3fa7018- /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation: 0x1d3fa6f98- /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation: 0x1d3fa6880- /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation: 0x1d3fa17bc- /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation: 0x1d3fa10b0- /System/Library/Frameworks/CoreFoundation.framework/CoreFoundation: CFRunLoopRunSpecific 0x1d61a179c- /System/Library/PrivateFrameworks/GraphicsServices.framework/GraphicsServices :GSEventRunModal 0x2007d7978- /System/Library/PrivateFrameworks/UIKitCore.framework/UIKitCore: UIApplicationMain 0x10071128c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x10070343c- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100703a80- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100703a80- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100703a80- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100703a80- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x100701e50- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x10057c294- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x10061794c- / var /容器/捆绑/应用程序/ B332FB94-B5DA-4627-8D03-5471B0CE66FC / enVisit 4>在<0xffffffff>在 UIKit.UIApplication:UIApplicationMain <0x000bc>在 UIKit.UIApplication:Main上的UIKit.UIApplication:Main <0x0002a> myapp.iOS上的<0x0006a>应用程序:主机上的<0x00016> :runtime_invoke_direct_void_string [] <0x00082> =============================================== ============== e360.iOS.app/myapp.iOS:mono_pmip 0x10061cf68- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :mono_pmip 0x100560c64- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x100700be0- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :xamarin_localized_string_format_9 0x10052adfc- /var/containers/Bundle/Application/B332FB94-B5DA-4627-8D03-5471B0CE66FC/myapp.iOS.app/myapp.iOS :(空)0x1d3a668e0-/usr/lib/system/libdyld.dylib:
================================================ ==================托管堆栈跟踪: ================================================== ===============在myapp的<0xffffffff>上App:.ctor在<0x0002c> myapp.iOS.AppDelegate:FinishedLaunching <0x0006e>位于 :runtime_invoke_direct_bool__this ___ UIApplication_NSDictionary <0x000b
答案 0 :(得分:0)
您必须先初始化页面,然后才能分配给mainPage。
MainPage = new myPage();
答案 1 :(得分:0)
我设法分解了崩溃的代码,并逐行取消注释以查看崩溃的原因,显然,在Xamarin iOS上使用dynamic
使应用程序崩溃了。
很好..我想避免使用dynamic