Forum Cross Platform with Xamarin

How to integrate esri arcgis to master detail page? It always show fatal exception

I can not post link, so please add slash and dot to make the link work and 2 default link in XAML

XAML:

<ContentPage            
             xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
             xmlns:mapping="clr-namespace:Esri.ArcGISRuntime.Mapping;assembly=Esri.ArcGISRuntime" 
             x:Class="ArcGISRuntimeXamarin.Samples.ArcGISMapImageLayerUrl.ArcGISMapImageLayerUrl">
  <Grid>
    <esriUI:MapView x:Name="MyMapView">
      <mapping:Map/>
    </esriUI:MapView>
  </Grid>
</ContentPage>

Code:
using Esri.ArcGISRuntime.Mapping;
using System;
using Xamarin.Forms;

namespace ArcGISRuntimeXamarin.Samples.ArcGISMapImageLayerUrl
{
    public partial class ArcGISMapImageLayerUrl : ContentPage
    {
        public ArcGISMapImageLayerUrl()
        {
            InitializeComponent();

            Title = "ArcGIS map image layer (URL)";

            // Create the UI, setup the control references and execute initialization 
            Initialize();
        }

        private void Initialize()
        {
            // Create new Map
            Map myMap = new Map();

            // Create uri to the map image layer
            var serviceUri = new Uri(
               "https sampleserver5 arcgisonline com/arcgis/rest/services/Elevation/WorldElevations/MapServer");

            // Create new image layer from the url
            ArcGISMapImageLayer imageLayer = new ArcGISMapImageLayer(serviceUri);

            // Add created layer to the basemaps collection
            myMap.Basemap.BaseLayers.Add(imageLayer);

            // Assign the map to the MapView
            MyMapView.Map = myMap;
        }
    }
}

If I start project with this content page then it works but if I start it as a detail page from Master Detail page, it always show fatal error:

03-27 22:01:14.245 E/mono    (17463): Unhandled Exception:
03-27 22:01:14.245 E/mono    (17463): System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.TypeInitializationException: The type initializer for 'Esri.ArcGISRuntime.Mapping.Map' threw an exception. ---> System.DllNotFoundException: libRuntimeCoreNet
03-27 22:01:14.245 E/mono    (17463):   at (wrapper managed-to-native) RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.CoreRT_ArcGISRuntimeEnvironment_enableBreakOnException(bool,intptr&)
03-27 22:01:14.245 E/mono    (17463):   at RuntimeCoreNet.GeneratedWrappers.CoreArcGISRuntimeEnvironment.EnableBreakOnException (System.Boolean enable) [0x00000] in <84667c495ff6447f8e4d5cd00873da3a>:0 
03-27 22:01:14.245 E/mono    (17463):   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize () [0x00035] in <84667c495ff6447f8e4d5cd00873da3a>:0 
03-27 22:01:14.245 E/mono    (17463):   at Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.OnBeforeFirstUseOfGeneratedWrapper () [0x00013] in <84667c495ff6447f8e4d5cd00873da3a>:0 
03-27 22:01:14.245 E/mono    (17463):   at Esri.ArcGISRuntime.Mapping.Map..cctor () [0x00000] in <84667c495ff6447f8e4d5cd00873da3a>:0 
03-27 22:01:14.245 E/mono    (17463):    --- End of inner exception stack trace ---
Sign In or Register to comment.