Bug 35121 - Exception when running UWP release build (.NET Native)
Summary: Exception when running UWP release build (.NET Native)
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 1.5.1
Hardware: PC Windows
: --- normal
Target Milestone: UWP
Assignee: E.Z. Hart [MSFT]
URL:
Depends on:
Blocks:
 
Reported: 2015-10-20 20:04 UTC by Dominik Weber
Modified: 2015-11-11 18:28 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Dominik Weber 2015-10-20 20:04:44 UTC
When running a UWP app built with release configuration and .NET Native toolchain enabled an exception is thrown in Xamarin.Forms.Forms.Init(e).

System.IndexOutOfRangeException: Arg_IndexOutOfRangeException
   at Xamarin.Forms.Registrar.RegisterAll(Type[] attrTypes)
   at Xamarin.Forms.Forms.Init(LaunchActivatedEventArgs launchActivatedEventArgs)
   at App1.App.OnLaunched(LaunchActivatedEventArgs e) in C:\Users\Dominik\Documents\Salesperformer\joey\Clients\wunderapp\App1\App.xaml.cs:line 42
   at Xamarin.Forms.TriggerAction.DoInvoke(Object sender)
   at Windows.UI.Xaml.IApplicationOverrides__Impl.Vtbl.OnLaunched__STUB(IntPtr pComThis, Vtbl** unsafe_args) in c:\Users\Dominik\Documents\Salesperformer\joey\Clients\wunderapp\App1\obj\x86\Release\ilc\intermediate\App1.Interop\ImplTypes.g.cs:line 111718

Just create a new UWP app, add Xamarin.Forms and add the call to Forms.Init() to reproduce the problem. Build and run using x86 release configuration with .NET native enabled (is enabled by default).

I tried using both the current UWP preview release (1.5.1.6466-pre2) and the newest Forms release (1.5.2.6469-pre1).
Comment 1 Dominik Weber 2015-10-20 20:11:22 UTC
The problem might originate from the implementation of WindowsBasePlatformServices.GetAssemblies:

This method searches the installation path for dll and exe files and loads them. With .Net native enabled only two main assemblies are created: <Appname>.exe and <Appname>.dll. (no Xamarin.Forms.dll etc)
The implementation of GetAssemblies tries to load them without the file extension, which unfortunately makes them indistinguishable.
Comment 2 E.Z. Hart [MSFT] 2015-11-11 18:28:38 UTC
Fixed in next UWP release