Select to view content in your preferred language

Closing page errors "loadLayersInView"

641
6
02-10-2013 02:13 PM
DamianBrede
Emerging Contributor
Hi,

Just to summarise, we are using the v3.0 API for Silverlight (v5).  The app does a lot of custom Dispose work to get memory at a minimum as users are constantly opening and closing new maps in the same application instance.  When a user closes a tab with and ESRI control on it and the user has done so before the map has finished rendering, a "Error:Object reference not set to an instance of an object" is triggered in :

ESRI.ArcGIS.Client.Map.loadLayersInView
stack trace :
- ESRI.ArcGIS.Client.Map.<>c_DisplayClass22.<beginZoomToExtent>b_21()
- ESRI.ArcGIS.Client.ThrottleTimer
- MS.Internal.CoreInvokeHandler.InvokeEventHandler
- MS.Internal.JoltHelper.FireEvent

Understandably this is because I am flushing ESRI's layer contents on close and a 'Extent = {new map location}' is being triggered right before a tab is closed.

Is there a way to suppress this error (or perhaps get a null check added into the next rev of ESRI API)?


Omad
0 Kudos
6 Replies
DominiqueBroux
Esri Frequent Contributor
I am not able to reproduce this issue. Could you share a repro case?

The app does a lot of custom Dispose work to get memory at a minimum as users are constantly opening and closing new maps in the same application instance


Sidenote: ArcGIS Silverlight API is already releasing the memory as soon as it's no more useful. So I am not sure you gain that much by doing it yourself (though I am not aware of your context, so...)
0 Kudos
DamianBrede
Emerging Contributor
I am not able to reproduce this issue. Could you share a repro case?


1. Map.Extent = Envelope(1,2,1,2) // Replace 1s and 2s with co-ords of a full extent multi-layered map.
- at this point ESRI will ask the server for more information against a very large data set, think in context of the ESRI control using up an extra 30MB to show all the layers (like 30 detailed layers) and taking many seconds to pull all the data down say over a WAN (1Mbit speed).  Also lots of custom shapes are added to these layers for enhancing overlays and feature selection/hi-lighting.

2.  User has clicked close triggering :
foreach( var eachLayer in EsriMaps.Layers)
{
  if (eachLayer is GraphicsLayer && ((GraphicsLayer)eachLayer).Graphics != null)
        ((GraphicsLayer)eachLayer).Graphics.Clear();
}
Map.Layers.Clear();

3.  ESRI still has not completed its downloading of the maps (imagine closing the app while the Progress bar is half way).  This is where you will see an error in the event mentioned in OP.  The code in this event requires a null check, it might be easier to pull the code up than re-create, but if need be I can provide video of this happening using the steps above.

Addendum : I have noticed when viewing large maps like in my example, the ESRI code lingers around in memory as if its holding on to the layer information that was downloaded from the map server.  One work around I have put in is to set the extent on closing to something way off so no maps are in memory.  Perhaps a 'Dispose' method could be made public so I can alert the map control when I want it out of memory?  Another thread another day, lets focus on the error the customers are getting seems there is no way to suppress it.


Damian
0 Kudos
DamianBrede
Emerging Contributor
Bump

Not that I see how it would help, but should I post a video on youtube of this happening?
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Not that I see how it would help, but should I post a video on youtube of this happening?


Sorry I can't reproduce.

If you could share a simple repro case, that would be the best. I don't think the video would help.

Did you try with the version 3.1? It contains some enhancements in loadLayersInView to avoid exceptions in some cases with tiled layers. Not sure it's the same case as yours but it might worth the test.
0 Kudos
DamianBrede
Emerging Contributor
Sorry I can't reproduce.

If you could share a simple repro case, that would be the best. I don't think the video would help.

Did you try with the version 3.1? It contains some enhancements in loadLayersInView to avoid exceptions in some cases with tiled layers. Not sure it's the same case as yours but it might worth the test.


FYI the 'API Silverlight Download' only talks about 3.0 and not 3.1 :
http://help.arcgis.com/en/webapi/silverlight/index.html

Anyway, I tried running with 3.1 but regretfully this version is more unstable.  When I have some selected features on the map (with overlays to act as tablet friendly markers but these may not be the problem) and zoom in and out quickly using the mouse wheel (so selected features go on and off the screen) then I get a Null Reference that crashes the entire browser ('Unhandled Exception' followed by the browser going completely blank).

😞

I guess I will wait for version 3.2.  Thanks for trying anyway.
0 Kudos
DominiqueBroux
Esri Frequent Contributor
Anyway, I tried running with 3.1 but regretfully this version is more unstable.

Sorry for that.
We are not aware of such issues, so if you had the opportunity to share a repro case that would be very helpful.

Thanks for your help.
0 Kudos