NRE Exception in SearchLayerModifier
- Dominant language
- C#
- Stars
- 76
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
jirikadlec2[CodePlex]
I was testing the data export and selection functionality and found the following exception:
Steps to duplicate:
In search, select area - countries - USA and Data Sources - Christina River Critical Zone Observatory
select some sites and download data Use the Map tab select tool to select one site with downloaded data in the map
Right - click on the Christina River Basin Critical Zone Observatory and choose Data - Export Data in the context menu
In the dialog choose quotSelecte featuresquot option, click OK Click OK in the Do you want to load the shapefile? message The unhandled exception is shown:
************** Exception Text **************
System.NullReferenceException: Object reference not set to an instance of an object.
at HydroDesktop.DataDownload.SearchLayersProcessing.SearchLayerModifier.UpdateSymbolizing(IFeatureLayer layer) in F:\dev\HydroDesktop\Source\DataDownload\DataDownload\SearchLayersProcessing\SearchLayerModifier.cs:line 262
at HydroDesktop.DataDownload.SearchLayersProcessing.SearchLayerModifier.AddCustomFeaturesToSearchLayer(IFeatureLayer layer) in F:\dev\HydroDesktop\Source\DataDownload\DataDownload\SearchLayersProcessing\SearchLayerModifier.cs:line 81
at HydroDesktop.DataDownload.DataDownloadPlugin.AttachLayerToPlugin(ILayer layer) in F:\dev\HydroDesktop\Source\DataDownload\DataDownload\DataDownloadPlugin.cs:line 201
at HydroDesktop.DataDownload.DataDownloadPlugin.Map_LayerAdded(Object sender, LayerEventArgs e) in F:\dev\HydroDesktop\Source\DataDownload\DataDownload\DataDownloadPlugin.cs:line 190
at DotSpatial.Symbology.Group.OnLayerAdded(Object sender, LayerEventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology\Group.cs:line 602
at DotSpatial.Symbology.Group.Layers_LayerAdded(Object sender, LayerEventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology\Group.cs:line 592
at DotSpatial.Symbology.LayerEventList1.OnLayerAdded(Object sender, LayerEventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology\LayerEventList.cs:line 305
at DotSpatial.Symbology.LayerEventList1.OnIncludeComplete(T item) in F:\dev\DotSpatial\DotSpatial.Symbology\LayerEventList.cs:line 186
at DotSpatial.Serialization.BaseList`1.DoInsert(Int32 index, T item) in F:\dev\DotSpatial\DotSpatial.Serialization\BaseList.cs:line 122
at DotSpatial.Controls.MapLayerCollection.Insert(Int32 index, IMapLayer item) in F:\dev\DotSpatial\DotSpatial.Controls\MapLayerCollection.cs:line 297
at DotSpatial.Controls.MapGroup.Insert(Int32 index, ILayer layer) in F:\dev\DotSpatial\DotSpatial.Controls\MapGroup.cs:line 181
at DotSpatial.Symbology.Forms.FeatureLayerEventReceiver.LoadFeatureSetAsLayer(FeatureLayerEventArgs e, FeatureSet fs, String newLayerName) in F:\dev\DotSpatial\DotSpatial.Symbology.Forms\FeatureLayerEventReceiver.cs:line 113
at DotSpatial.Symbology.Forms.FeatureLayerEventReceiver.ExportDataClicked(Object sender, FeatureLayerEventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology.Forms\FeatureLayerEventReceiver.cs:line 152
at DotSpatial.Symbology.FeatureLayerEventSender.Raise_ExportData(Object sender, FeatureLayerEventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology\FeatureLayerEventSender.cs:line 138
at DotSpatial.Symbology.FeatureLayer.OnExportData() in F:\dev\DotSpatial\DotSpatial.Symbology\FeatureLayer.cs:line 2086
at DotSpatial.Symbology.Layer.ExportDataClick(Object sender, EventArgs e) in F:\dev\DotSpatial\DotSpatial.Symbology\Layer.cs:line 425
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItem.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Command.DispatchID(Int32 id)
at System.Windows.Forms.Control.WmCommand(Messageamp m)
at System.Windows.Forms.Control.WndProc(Messageamp m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Messageamp m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Messageamp m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with SearchLayerModifier.cs at UpdateSymbolizing line 262 and trace the call from AddCustomFeaturesToSearchLayer; DataDownloadPlugin.cs lines 190 and 201 show how the layer is attached. Reproduce the described selected-feature export flow, then verify that adding the exported layer no longer raises a NullReferenceException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100