Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1215
When MapTileSource fails
posted

I have written my own MapTileSource class that enables the xamMap to use a WMS. This works excellent and gives us access to all map sources we need.

However, now and then the WMS may fail on a single request for a tile and return an empty response. When this happens I receive the following exception:

System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  InnerException:

The result of the exception is that my Silverlight application crashes and terminates.

Since no stack trace or other information is available I am at a loss how to proceed. From what I have managed to figure out it seems that the xamMap control fails when the response for a tile request is empty. My GetTileLayers method fills the tileImageLayerSources list with the appropriate urls, but have no means of validating the request before it is performed. The urls are well formed, but as said the WMS sometimes fails on a single request.

Do yoy have any suggestions on how to handle this problem? If I somehow could trap the exception, hence avoiding the application crash, everything would be fine.