Select to view content in your preferred language

Unhandled exceptions in ArcGIS Runtime SDK for .NET (WPF) Windows app (and also cannot run any templates from Runtime SDK in VS Community)

2440
13
10-15-2019 08:11 AM
AlexMenkes
Emerging Contributor

I have an open ticket with ESRI Support on this, but they don't seem to know what's going on, so maybe someone here can help.  I'm guessing this is specific to the computer I am trying to run this on, I'm not having problems when using it on my laptop.

I cannot create/run any of the templates for ArcGIS Runtime SDK .NET in Visual Studio Community 2019.  They throw exception errors.  This is the out-of-the-box apps that are created in a new solution/project.  I then loaded the ArcGIS Runtime SDK for .NET (WPF) from the Microsoft Store to see if I could get a sample to test.  That also throws exception errors.  Here's an example:

I have tried uninstalling EVERYTHING, including .NET, VS, ArcGIS Runtime nuget packages and reinstalling with no luck.

I am not running any anti-virus other than Windows Security.  Turning off all Windows Security didn't fix it.  ESRI Support tech had me downsize my screen resolution on 4k monitor and that didn't change anything either.  He seems to think this is related to display/monitors since this happens when the mapview is called from a template app.

Thoughts?  Other things to check?

0 Kudos
13 Replies
dotMorten_esri
Esri Notable Contributor

If you create a completely new WPF Application, add the Esri.ArcGISRuntime.WPF nuget package, then just add this code:

   Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize()

what happens?

When you run the template-based apps, what happens? (ie what exception, and where?)

Also could you try creating a .NET Core 3.0 WPF Application and do the same thing?

Do you also have the required VCLibs installed on your PC?

Which version of Windows are you using?

0 Kudos
AlexMenkes
Emerging Contributor

I will try what you recommend creating an app and report back shortly.  I'm trying another install of VS Community 2019 right now.

Is this what you mean by VClibs?

System info:

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Alex,

To help rule out display-related issues - can you re-run DxDiag and click the `Save All Information...` button then attach the resulting text file?

Thanks

Mike

0 Kudos
AlexMenkes
Emerging Contributor

DXDIAG.txt attached

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Alex,

Thanks for sharing. The graphics card looks capable and the driver is up to date. 

I'd appreciate it if you could try using internal method below to force Windows software rendering (as opposed to the default GPU hardware rendering) because this should finally rule out any issues with the GPU. In the WPF template, you could add this code in the App.Xaml.cs initialization:

API to force software rendering:

 

```

// Force software rendering

var forceWarpMethod = typeof(ArcGISRuntimeEnvironment)

    .GetMethod("ForceDxSoftwareRendering", BindingFlags.NonPublic | BindingFlags.Static);

forceWarpMethod.Invoke(null, null);

```

 

Cheers

Mike

0 Kudos
AlexMenkes
Emerging Contributor

Unchanged, still getting the same exception errors.

0 Kudos
AlexMenkes
Emerging Contributor

>If you create a completely new WPF Application, add the Esri.ArcGISRuntime.WPF nuget package, then just add this code:  Esri.ArcGISRuntime.ArcGISRuntimeEnvironment.Initialize()

>>what happens?

***Edited to add that I get the same result in the Core version as well, no error.

The app runs.  No errors.  Here's where I put the code:

>>When you run the template-based apps, what happens? (ie what exception, and where?)

Error shows on this line in the code editor:

When run in debug mode:

0 Kudos
AlexMenkes
Emerging Contributor

When I try following the steps in the first video on this page Develop your first map app—ArcGIS Runtime SDK for .NET | ArcGIS for Developers   here are the results:

0 Kudos
dotMorten_esri
Esri Notable Contributor

Thank you! Since Initialize succeeds, it means the deployment worked fine and you pre-reqs are met.

It appears the application crashes when trying to create the native view, which I haven't seen before.

One more thing you could try is:

 - Go to the project settings and under debug tab, check on "Enable native code debugging".

 - Set up the symbols server as described here: https://community.esri.com/community/developers/native-app-developers/arcgis-runtime-sdk-for-net/blo... 

Then re-run the application, and you should get a much better stacktrace of where it crashes.

Once it does crash, go to the Debug section in VS's file menu, and select "Save dump as...". If possible could you share that somewhere for me to download and send me a link (mnielsen (at) esri.com), and we can try and debug what is really happening.

Thank you for helping troubleshooting this.

0 Kudos