Hi Dennis,
Thanks for your information, but we cannot get more information only from it, it looks this exception is thrown when multiply tiles were drawn.
Please check whether your user open cache and the path is valid.
Do you means you run your application with the same setting like your user but you hadn’t reproduced that? I think if that maybe the environment should be another variable.
Regards,
Don
Exception - Object Reference Not Set
Don,
The users have no control over such things as opening a cache or not as it is all performed through configuration which they have no access to. The path is correct since that is part of the set configuration and is not changeable by any user.
I was able to create an another ‘Object Reference Not Set…’ exception. I was zooming out two levels at a time when I got down to approximately Level 9 and received the exception. Attached is what I captured in the logs.
This exception occurs too often and is multiplied by the fact that the application runs on multiple workstations.
Your help is appreciated.
Thanks,
Dennis
ParameterNotValueException20151110.txt (3.14 KB)
Don,
I was just able to create another of these exceptions, which is attached. This is a different layer. Both of the layers are SQLiteFeatureLayer.
In order to improve performance I recently added both these layers (Tranportation_123 & Transportaion) to their own cached overlay. The properties of the LayerOverlay are attached.
This exception occurred when I was zooming in.
These don’t always happen when zooming, one time I can do it and it’s fine, another time is crashes. These problems are not discreet bugs anywhere in the SDK, but rather timing issues being exposed from a con-flux and events occurring on the threads.
Thanks,
Dennis
ParameterNotValueException20151110-2.txt (5.67 KB)
LayerOverlayTransportationProperties.txt (285 Bytes)
Don,
Another piece of information is that the user target machines are Windows XP. I seem to be able to reproduce this exception under XP. However, I am not able to create this on my development machine which is Windows 7. I also just installed on another Windows-7 machine and also does not encounter the exception there.
Is there any insight you might be able to offer in differences between running under XP and 7?
Thanks,
Dennis
Hi Dennis,
Sorry I don’t have any insights based on those information. Would you mind to send us your application so that we can find a window XP machine to recreate your exception? As for how to upload an application, please refer to wiki.thinkgeo.com/wiki/map_s…to_support.
Thanks,
Troy
Troy,
I’ve noticed that the Object Reference Not Set is preceded by the Drawing/Drawn Exceptions on the InMemoryFeatureLayer.
What I believe also happens after the Drawing/Drawn Exceptions is that the InMemoryFeatureLayer is no longer being updated. Is that layer no longer present but drawing it is still being attempted resulting in the Object Reference Not Set?
Attached is a set of my exception logs.
Thanks,
Dennis
DrawingDrawnFollowedByObjectReferenceNotSet.txt (7.02 KB)
Hi Dennis,
I am sorry I am not very sure about memory management for XP and win7, but it looks under multiply threads maybe there is some difference between them.
From your last log, the message shows “The FeatureSource is not open”, that’s our error message, I think maybe you want to keep your layer open before it disposed, and see whether this exception will disappear.
Regards,
Don
Don,
Just wanted to update this thread for completeness that the ‘source not open’ condition has been resolved per thread
thinkgeo.com/forums/MapSuite/tabid/143/aft/12983/Default.aspx.
However, I continue to receive other Object Reference Not Set… exceptions. Attached is another of my logs that contains multiple DrawingException conditions on several SQLite Layers. The error is “Parameter is not valid” which is followed by the Object Reference Not Set… condition.
These exceptions seem to occur when scale changes (Zoom In and/or Out). When scale changes my application will determine what layers are to be visible at the target scale. If a layer is supposed to change visibility the IsVisible Property is set accordingly. This is done in the CurrentScaleChanging Event. Is this event invoked prior to the scale changing or while the change is in process? Is doing this somehow interfering with the MapSuite processes?
As I’ve said before these exceptions are not consistent, they are intermittent.
Your assistance on these exceptions is greatly appreciated.
I also updated my application to use the latest Full Production Build V9.0.0.142.
Regards,
Dennis
Hi Dennis,
The other two exception is general exception, I am sorry maybe I cannot get more information from the log, it looks still related with the multiply thread.
About CurrentScaleChanging I don’t think it have problem there, you can modify the visible status when it fired. But I am not sure whether the render logic can works well for muliply thread mode, if you have hide one layer but in other thread it was drawing by tile, maybe you will get this exception. Do you think it’s possible to show or hide layer when you set style to it instead of modify this runtime in event? I means if you know which layer won’t shows on which level, you can disable the style for it. If that’s the reason for your exception, I think this maybe solved that.
Regards,
Don
Don,
Thanks for your insight on this issue.
Layers intended to be visible/invisible is known ahead of time via predefined configuration. This would allow me to let MapSuite do the visible/invisible through styles as you suggest.
Another unusual case I have is that when I have MrSid’s visible I style the polygon layers such that they are outlined. When MrSid’s are invisible the polygons have a solid fill. To accomplish this during run-time I actually change out the style set that is used for these polygons in the CurrentScaleChanged event. (This probably should have been done in the CurrentScaleChanging event) I suspect that this is also causing exceptions in the MapSuite multi-threads. Do you agree? Is there anything in MapSuite Styles that I can set to accommodate this behavior?
Thanks for your assistance,
Dennis
Hi Dennis,
I think maybe I hadn’t understood about how you style the MrSid here. Do you meant for the MrSidRasterLayer, when it’s invisible, you put another layer which shows polygons instead of it, and you modify the style of this layer run time?
If you want to only shows a outline for Mrsid and when it’s invisible shows a solid fill polygon, why not directly put the MrSidRasterLayer above the polygons layer and directly set the style to solid fill, I think that can get the same effect.
If I misunderstand it please let me know.
Regards,
Don
Don,
Apologies for taking so long to reply as I’ve been consumed with other issues.
First of all, I am now using V9.0.0.142 and have changed my code so that styles handle when a layer is Visible or InVisible. I have also moved code that actually updates styles to CurrentScaleChanging Event from the CurrentScaleChanged Event. Doing this has really reduced the number of exceptions from within WpfDesktopEdition.
To answer your last question…my application has a number of polygon layers such as building footprints, parks, hydrography, cemeteries. There is one layer for each of these. When I have MrSid Visible these polygon layers are outlined with a transparent fill. When MrSid is InVisible these polygon layers are outlined with a solid/gradient fill. The MrSid is automatically made Visible/InVisible based on ZoomLevel. For example, when the map goes from ZoomLevel17 to ZoomLevel16 the MrSid Layer is InVisible and the polygon layers have their styles set to outline with solid/gradient fill. When the map goes from ZoomLevel16 to ZoomLevel17 the MrSid Layer is Visible and the polygon layers have their styles set to outline with transparent fill. The styles for the polygons are changed in the CurrentScaleChanging Event.
Does that answer your question?
Ideally I would like to see MapSuite support some additional ‘binding’ that allows WpfDesktopEdition to render according to the binding instead of my application changing the styles, which may or may not be causing my “Object Reference Not set…” exceptions.
I also support a feature that allows my users to change from one color plan to another. In this case different colors are used for features. This would also be a good candidate for binding.
Below you will find one of my most recent exceptions. It looks like WpfDesktopEdition is trapping some type of exception as the name of the api pretty much states that as it is named ThinkGeo.MapSuite.WpfDesktopEdition.Tile.DrawException. Is there any more information you might be able to log under these conditions? It would really be helpful to the users of the ThinkGeo SDK’s if you implemented a means to enable some type of logging so that when you trapped exceptions you could output them to a log file with all the pertinent details. This would certainly save a lot of people, including the ThinkGeo Team, a lot of time in diagnosing problems.
Your thoughts?
Thanks,
Dennis
Source=WpfDesktopEdition
TargetSite=Void DrawException(ThinkGeo.MapSuite.Core.GeoCanvas, System.Exception)
StackTrace= at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.DrawException(GeoCanvas geoCanvas, Exception exception)
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.Draw(GeoCanvas geoCanvas)
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.phc=(Object status)
at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
Message=Object reference not set to an instance of an object.
Don,
Is it possible to override ThinkGeo.MapSuite.WpfDesktopEdition.Tile.Draw so that I can catch any exceptions and log additional information? If so would you provide a code sample?
Regards,
Dennis
Hi Dennis,
Thanks for your suggestions, I think our developers will keep enhancement the WPF version to make it easier to use.
If you want to override Tile.Draw you still cannot insert the custom tile back to the map and make it work.
The DrawException API can catch all exceptions thrown by managed code in Draw function, and you can get them like this:
overlay.DrawingExceptionMode = DrawingExceptionMode.DrawException;
overlay.DrawingException += new System.EventHandler<DrawingExceptionTileOverlayEventArgs>(overlay_DrawingException);
void overlay_DrawingException(object sender, DrawingExceptionTileOverlayEventArgs e)
{
// Catch exception here
}
I think that’s the only way to catch the exception now.
Regards,
Don
Don,
Thanks so much for the tips on catching these exceptions. I’ve added these events to my application and am now catching the exceptions instead of the application crashing. Prior to realizing I could add these events I spent time reorganizing my application and because of that it is much more solid.
It’s only under a lot of Zoom In/Out activity that I receive these exceptions. My users are very active since they operate in a critical real-time environment.
What is the effect on the map itself in terms of what the user might see when a DrawingException/DrawnException is encountered? Is a tile in the process of being created when these exceptions Occur? And will this tile then be damaged?
Attached is a log of these exceptions that are now being caught. First is the exception from the Layer followed by the exception from the LayerOverlay. You’ll notice that both of these Line Feature Layers are in the StreetsCity LayerOverlay, which is cached/tiled. During a Zoom In/Out the styles of these layers are not changed.
What would cause the Collection was modified; enumeration operation may not execute exception that is being encountered?
Thanks very much for your assistance!
Dennis
Hi Dennis,
1. If you hadn’t modify the value of drawingExceptionLayerEventArgs parameter, it will go on working follow the set DrawingExceptionMode.DrawException.
That means we will draw a inner exception image instead of your original tile here.
2. The Collection was modified is a system exception, I think that maybe because when a collection is being use, it is modified by other user. But I cannot make sure where is the problem.
3. Your attached log file cannot be downloaded, that a bug of the forum system, please rename it to a short name so I can download it.
Regards,
Don
Don,
The exception log is attached.
I wonder what collection it is thinking has been modified?
At some point when I get a breather I’ll upload my data and application.exe so that you can run it and recreate the exception while you are in the debugger.
Thanks,
Dennis
CollectionModifiedException.txt (2.45 KB)
Hi Dennis,
I am sorry I cannot guess more detail reason from the information, but I will look into the code of SqliteFeatureLayer to see whether I can find where maybe throw this exception.
Your sample will be welcome and which can make we get close to the issue.
Regards,
Don
MapSuite Team,
I wanted to let you know that the Drawing/Drawn Exceptions with the Collection Modified message have been drastically reduced after setting DrawingMarginInPixel to an appropriate value. On any given workstation these may have been occurring once a day and now they are down to once a week.
Reference the following thread:
When will MapSuite Desktop 3.0 be released?
Thanks,
Dennis
Hi Dennis,
Thanks for your update. It will be helpful for the others who meets the same issue. Our developers will still work on it, hope it will be fixed in the near future.
Thanks,
Peter