AnsweredAssumed Answered

ArcGIS Runtime SDK for .NET references missing in Docs/Samples? (Xamarin Xamarin.Forms)

Question asked by brothhypertherm on Dec 10, 2018
Latest reply on Jan 28, 2019 by mnielsen-esristaff

I've got some questions about how the .NET SDK (I'm using 100.4) was intended to be delivered because I've been having some problems with crashing and didn't find the Docs (online reference pages) or the Samples clear WRT SDK integration. I've been using .NET technologies for many years (desktop/embedded) but I'm pretty green with the Cross-Platform Xamarin space. I've got an existing Xamarin.Forms app running that I wanted to add a mapping element to and decided to pull down and experiment with/evaluate the ESRI mapping SDK. I spent a decent amount of time reading through the online information and linked examples starting here:

ArcGIS Runtime SDK for .NET (latest) | ArcGIS for Developers

 

Unfortunately for me this didn't really discuss how to bootstrap the mapping SDK into an existing app but it did discuss some simple use/feature situations. So I moved on and downloaded and installed the SDK and the Visual Studio Extension using the following info: Install the SDK—ArcGIS Runtime SDK for .NET | ArcGIS for Developers 

As described there, the extension allowed me to create a default Cross-Platform ArcGIS app from within the New Project function of Visual Studio. Success, I got a map to appear on the screen of an Android/UWP app (don't have iOS setup) and could manipulate it.

 

Seeing success I decided to use that default app as a roadmap for integration of the SDK into my app and copied the NuGet referencing established within. And for a bit this was successful. Eventually I started getting crashes in my UWP (unhanded Win32 exceptions) as soon as the map view was loaded and was having a **** of a time tracing it. Since it would work just fine in Android and the default application (created above) I figured I was doing something wrong integrating in layers with GraphicOverlays.

 

I've been driving around in circles for days trying to figure out what I was doing wrong. Eventually went with slowly building out an example testing for when I started to crash. This (long story) lead me to NuGet reference changes in the Core Project. At this time I realized that many other Xamarin SDKs required NuGet references in the Core and Platform projects. Where Platform specific ArcGIS NuGet packages were obviously referenced from the platform specific projects (.Android/.iOS.UWP). So I reviewed the docs about SDK references at Add ArcGIS Runtime SDK references—ArcGIS Runtime SDK for .NET | ArcGIS for Developers. I didn't find these particularly clear about installing packages into each platform (which I can talk to if you'd like to understand) project. More importantly, since the Visual Studio ArcGIS New Project template DOES NOT specifically reference platform specific NuGet packages in the platform specific projects of a Xamarin.Forms Cross-Platform application I figured that was ultimately the correct configuration.

 

[The project type selected here is Xamarin.Forms .NET Standard, I've not tried Xamarin.Forms Shared]

 

Well, it seems it is not. I found that by adding the platform specific projects I am no longer getting any crashes. So my question after all this is - Am I correct in assuming that all the platform specific ArcGIS NuGet packages need added to the platform specific projects of a Xamarin.Forms Cross-Platform application?  Also, should I reference the Esri.ArcGISRuntime.Xamarin.Forms NuGet from each platform project as well? ( Fundamentally, could you be specific about which NuGet Projects need referenced by each project in a X-plat Xamarin solution?)

 

I'm not sure why the New Project Template would be setup without these references but it generated a lot of confusion for me (being new to Xamarin). Even the "Sample Code" page Sample Code—ArcGIS Runtime SDK for .NET Samples | ArcGIS for Developers  pushes through to a GitHub project that's all based upon .NET Shared Projects. So that didn't help clarify the situation either.

Outcomes