Application crashes with MissingMethodException - Default constructor not found for type System.Array
#3790 aperta il 14 set 2018
Metriche repository
- Star
- (5644 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
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
- Download the FormsGallery sample https://developer.xamarin.com/samples/xamarin-forms/FormsGallery/
- Comment out the global XAML compilation directive [assembly: XamlCompilation(XamlCompilationOptions.Compile] in App.xaml.cs. This disables XAML compilation.
- Set the iOS project as startup project.
- Configure the app to target a physical iOS device. Alternatively, change the Debug build configuration to Link Framework SDKs Only and target a simulator
- Build the app
- Run it in debug mode
- Choose the XAML Pages tab (not the C# code samples tab)
- Scroll down in the list and tap on the ListView sample
- 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
- Version with issue: 3.1.0.697729
- Last known good version: Did not try older versions.
- IDE:
Windows https://gist.github.com/valentinba/6f04accd67b5a034865d39187ad2957f
Mac https://gist.github.com/valentinba/a9887f57ef6c20cfd396a721578660bd - Platform Target Frameworks:
- iOS: 11.14.0.14
- Nuget Packages: Xamarin.Forms" Version="3.1.0.697729"
- Affected Devices:
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.