Bug 46188 - UWP Xamarin.Forms.Maps doesn't work in release mode
Summary: UWP Xamarin.Forms.Maps doesn't work in release mode
Status: RESOLVED FIXED
Alias: None
Product: Forms
Classification: Xamarin
Component: Windows ()
Version: 2.3.3
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-10-31 15:18 UTC by Jan Nepras
Modified: 2016-11-07 12:32 UTC (History)
2 users (show)

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


Attachments
The project replicating the bug (372.36 KB, application/x-zip-compressed)
2016-10-31 15:18 UTC, Jan Nepras
Details


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 Jan Nepras 2016-10-31 15:18:58 UTC
Created attachment 18274 [details]
The project replicating the bug

I have a UWP map that comes from Xamarin.Forms.Maps namespace. I generated my key and set it like this:

Xamarin.FormsMaps.Init("INSERT_AUTHENTICATION_TOKEN_HERE");

In debug mode everything works, but in release mode there is just blank space. 

REPO STEPS:

1/ Generate your own key.
2/ Set the key in UWP project MainPage.xaml.cs
3/ Run project in debug mode - should be ok
4/ Run project in release mode - no map

There is topic on the forums.xamarin.com:
https://forums.xamarin.com/discussion/73132/map-doesnt-work-in-release-mode-uwp
Comment 1 Jan Nepras 2016-11-07 12:32:44 UTC
I added this to my App.xaml.cs in UWP project and it solved the problem.

using System.Reflection;
...
// For .NET Native compilation, you have to tell Xamarin.Forms which assemblies it should scan for custom controls and renderers
var rendererAssemblies = new []
{
    typeof(Xamarin.Forms.Maps.UWP.MapRenderer).GetTypeInfo().Assembly
};
Xamarin.Forms.Forms.Init(e, rendererAssemblies);