xamarin/Xamarin.Forms

Application crashes with MissingMethodException - Default constructor not found for type System.Array

开放

#3,790 创建于 2018年9月14日

 (1 条评论) (0 个反应) (1 位负责人)C# (1,926 个派生)batch import
a/Xaml </>e/3 :clock3:help wantedi/highinactivet/bug :bug:up-for-grabs

仓库指标

星标
 (5,644 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

Description

iOS application crashes when using the x:Array XAML markup extension, when XAML compilation is turned off and linker set to Link Framework SDKs only.

Not really sure if this bug reports belongs here or in https://github.com/xamarin/xamarin-macios

Steps to Reproduce

  1. Download the FormsGallery sample https://developer.xamarin.com/samples/xamarin-forms/FormsGallery/
  2. Comment out the global XAML compilation directive [assembly: XamlCompilation(XamlCompilationOptions.Compile] in App.xaml.cs. This disables XAML compilation.
  3. Set the iOS project as startup project.
  4. Configure the app to target a physical iOS device. Alternatively, change the Debug build configuration to Link Framework SDKs Only and target a simulator
  5. Build the app
  6. Run it in debug mode
  7. Choose the XAML Pages tab (not the C# code samples tab)
  8. Scroll down in the list and tap on the ListView sample
  9. The app will crash

Expected Behavior

The ListView XAML example page is displayed.

Actual Behavior

The application crashes. See https://gist.github.com/valentinba/a1716c4fd7b5e4f76901bf2ce28f1b5e for the crash details.

Basic Information

Screenshots

N/A

Reproduction Link

Download it from here https://developer.xamarin.com/samples/xamarin-forms/FormsGallery/

Additional information

Some investigation revealed that the problem happens consistently with an application which is:

  • larger in size (not trivial)
  • configured the iOS build linker to Link framework SDKs Only
  • not using XAML compilation

The problem can be mitigated by:

  • avoid using x:Array markup extension and instead populate the list view from code
  • using XAML compilation or
  • configuring the linker to not link (shrink) any assemblies

Other people have run into this or something similar https://github.com/alexrainman/CarouselView/issues/100 and have chosen to work around the issue. And one more https://github.com/alexrainman/CarouselView/issues/418.

贡献者指南