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

2523
3
12-10-2018 06:42 AM
BryanRoth
New Contributor

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 hell 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.

0 Kudos
3 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Can you open Visual Studio > Help > About > 'Copy Info' and paste the contents in this thread? 

We're trying to diagnose the cause of this issue. 

Cheers

Mike

0 Kudos
BryanRoth
New Contributor

I'll paste that below but I've applied 2x VS updates (IIRC) since that time so it's not going to be accurate to when I originally wrote this up. However, creating a new ArcGISApp (Xamarin.Forms .NET Standard) as I did before still creates a default project with no ArcGIS NuGet package references in the platform specific projects. So from my POV the problem is still there.

Visual Studio > Help > About is below:

______________________________________________________

Microsoft Visual Studio Enterprise 2017
Version 15.9.5
VisualStudio.15.Release/15.9.5+28307.280
Microsoft .NET Framework
Version 4.7.03056

Installed Version: Enterprise

Architecture Diagrams and Analysis Tools   00369-60000-00001-AA225
Microsoft Architecture Diagrams and Analysis Tools

Visual C++ 2017   00369-60000-00001-AA225
Microsoft Visual C++ 2017

Application Insights Tools for Visual Studio Package   8.14.11009.1
Application Insights Tools for Visual Studio

ArcGIS Runtime SDK for .NET   100.4.0
ArcGIS Runtime SDK for .NET allows developers to build immersive, native mapping applications for Windows, Android, and iOS devices using C#.  It includes five APIs: WPF to create apps for Windows Desktop, UWP to create Universal Windows apps, Xamarin.Android and Xamarin.iOS for Android and iOS apps that need access to native functionality, and Xamarin.Forms to create apps that share UI layouts across Android, iOS, and UWP.

ASP.NET and Web Tools 2017   15.9.04012.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   15.8.31590
Provides languages services for ASP.NET Core Razor.

ASP.NET Web Frameworks and Tools 2017   5.2.60913.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.9.03024.0
Azure App Service Tools v3.0.0

C# Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Dotfuscator Community Edition   5.36.0.7050-e77ce80a6
PreEmptive Protection - Dotfuscator CE

Extensibility Message Bus   1.1.49 (remotes/origin/d15-8@ee674f3)
Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

GitExtensions   1.0
Git Extensions is a graphical user interface for Git that allows you to control Git without using the command-line

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

JetBrains ReSharper Ultimate 2018.3.1   Build 183.0.20181225.200351
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2019 JetBrains, Inc.

Microsoft Continuous Delivery Tools for Visual Studio   0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft Library Manager   1.0
Install client-side libraries easily to any web project

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio Tools for Containers   1.1
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

MLGen Package Extension   1.0
MLGen Package Visual Studio Extension Detailed Info

Mono Debugging for Visual Studio   4.13.12-pre (9bc9548)
Support for debugging Mono processes with Visual Studio.

NuGet Package Manager   4.6.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Productivity Power Tools 2017/2019   16.0
Installs the individual extensions of Productivity Power Tools 2017/2019

ProjectServicesPackage Extension   1.0
ProjectServicesPackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

ResourcePackage Extension   1.0
ResourcePackage Visual Studio Extension Detailed Info

SQL Server Data Tools   15.1.61901.03220
Microsoft SQL Server Data Tools

Test Adapter for Boost.Test   1.0
Enables Visual Studio's testing tools with unit tests written for Boost.Test.  The use terms and Third Party Notices are available in the extension installation directory.

Test Adapter for Google Test   1.0
Enables Visual Studio's testing tools with unit tests written for Google Test.  The use terms and Third Party Notices are available in the extension installation directory.

TypeScript Tools   15.9.20918.2001
TypeScript Tools for Microsoft Visual Studio

Visual Basic Tools   2.10.0-beta2-63501-03+b9fb1610c87cccc8ceb74a770dba261a58e39c4a
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

Visual C++ for Cross Platform Mobile Development (Android)   15.0.28107.00
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Cross Platform Mobile Development (iOS)   15.0.28016.00
Visual C++ for Cross Platform Mobile Development (iOS)

Visual F# Tools 10.2 for F# 4.5   15.8.0.0.  Commit Hash: 6e26c5bacc8c4201e962f5bdde0a177f82f88691.
Microsoft Visual F# Tools 10.2 for F# 4.5

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Spell Check Everywhere   VSSpellCheckEverywhere
An extension that enables spell checking within any Visual Studio file editor or tool window that uses WPF text boxes.
https://GitHub.com/EWSoftware/VSSpellChecker

Visual Studio Spell Checker   VSSpellChecker
An editor extension that checks the spelling of comments, strings, and plain text as you type or interactively with tool windows.
https://GitHub.com/EWSoftware/VSSpellChecker

Visual Studio Tools for CMake   1.0
Visual Studio Tools for CMake

Visual Studio Tools for Containers   1.0
Visual Studio Tools for Containers

Visual Studio Tools for Unity   3.9.0.3
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps   15.0.28307.208
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.

VisualStudio.Mac   1.0
Mac Extension for Visual Studio

Xamarin   4.12.3.78 (d15-9@a9bbf702f)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin Designer   4.16.13 (45a16efd4)
Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

Xamarin Templates   1.1.128 (6f5ebb2)
Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

Xamarin.Android SDK   9.1.5.0 (HEAD/4b951a3e7)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   12.2.1.12 (65ec520)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.

0 Kudos
dotMorten_esri
Esri Notable Contributor

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

Yes you are correct that you currently need to do this. You really shouldn't have to, but a default behavior of resolving the Nuget dependency graph causes this to happen when using bait'n'switch like we do. We're working with the NuGet team to make this a little easier in the future, so that the dependency graph can get resolved in a way that only requires you to reference the .NET Standard one in the shared class library.

0 Kudos