SceneView Crashes When Graphics First Come Into View

480
4
08-10-2019 07:21 PM
RobBever
New Contributor III

I'm having a problem where I have maybe 100 or so Graphics, and maybe 10-20 are moving around continuously (5-10Hz). I have a MapView and a SceneView, and I duplicate the items in both to create a consistent view. I can switch between the views in the main viewing area.

When I switch to the SceneView and drag the globe to where my data is, or switch from the MapView to the SceneView when the data is already in view, it often crashes with the following error:

Esri.ArcGISRuntime.ArcGISRuntimeException: 'Internal error exception. Buffer_loader_cache::map_buffer ERROR, cannot create staging resource!: c:\daily_r\rtc\runtimecore\c_api\src\mapping\map_view\geo_view.cpp (209) : error : Exception caught in RT_GeoView_pulse'

It seems to be related to many Graphics coming into view at the same time. The more Graphics there are the easier it seems to be to get this error. I had this error previously, less frequently, even when none of the Graphics were changing.

In the SceneView, I only have two GraphicsOverlays, one that's clamped and one that's absolute elevation. There are only a few Graphics in the clamped GraphicsOverlay, the vast majority are in the non-clamped one.

I tried using Static mode for my non-clamped GraphicsOverlay, but it made my application unusably slow. I'm guessing that's because some of the items are moving frequently and that doesn't work well.

If it doesn't crash upon loading, it works great. The crashes are pretty frequent and relatively easy to cause; if I just switch back and forth between MapView and SceneView I can pretty much always cause a crash. This isn't a memory allocation issue, the machine has plenty of available RAM left.

What can I do differently to avoid this crash? Does it help to split my Graphics out into multiple GraphicsOverlays? Some of them could probably go into a Static GraphicsOverlay, but I don't know ahead of time how many Graphics I'm going to have, it depends on the data. Unless I'm just putting X number of Graphics into each GraphicsOverlay, I don't know how well I would be able to even the Graphics out.

Thanks for your help.

0 Kudos
4 Replies
RobBever
New Contributor III

I sort of fixed this. The issue is that my application has a 2D/3D switch, and when the switch happens, the SceneView gets copies of all the existing layers.

Whenever data comes in, I create the Graphics for that data for 2D and 3D, regardless of what's currently being displayed. When my application switches to 3D, all the layers of the SceneView get cloned and added, since they're already owned.

When this happens rapidly for several layers with lots of data in them, apparently you can get the above crash. When I put a 100ms sleep in between the layer clone operations, the crash started happening much less frequently, to the point that it's mostly solved.

I don't like having an arbitrary sleep, especially since I can still cause the crash by switching 2D to 3D rapidly, and I don't know how stable this "fix" will be. I wish there was a way to wait until the layer was fully loaded; apparently processing is happening in the background after I clone and add the layer that I'm not able to wait on. However this is an 80% or so solution for the problem.

0 Kudos
MichaelBranscomb
Esri Frequent Contributor

Hi,

Please can you go to Visual Studio > Help > About > DxDiag then export the results and attach here?

Thanks

Mike

0 Kudos
RobBever
New Contributor III

Sure, I'll attach the result.

0 Kudos
RobBever
New Contributor III

Result is attached to the original question. Note sure how to attach things to a reply.

0 Kudos