NullReferenceException crash when switching between projects

Product(s): SewerGEMS, SewerCAD, StormCAD, CivilStorm
Area: Other


In version (CONNECT Edition Update 1), with multiple models open, when switching between them, the below error occurs.

System.NullReferenceException: Object reference not set to an instance of an object.

at Haestad.Drawing.Control.Adapting.BackgroundLayerTreeEditorModel.NewBingMapTreeNodeModel()
at Haestad.Drawing.Control.Adapting.BackgroundLayerTreeEditorModel.ProjectEventChannel_ProjectChanged(Object aobject, ProjectEventArgs apea)
at Haestad.Framework.Application.ProjectEventHandler.Invoke(Object aobject, ProjectEventArgs apea)
at Haestad.Framework.Application.ProjectManagerBase.OnProjectChanged(IProject aprojectCurrent, IProject aprojectOld)
at Haestad.Framework.Application.ProjectManagerBase.set_CurrentProject(IProject value)
at Haestad.Drawing.Control.Forms.GraphicalDrawingParentForm.DocumentContainer_ActiveDocumentChanged(Object sender, EventArgs e)
at TD.SandDock.SandDockManager.OnActiveTabbedDocumentChanged(EventArgs e)
at TD.SandDock.SandDockManager.SetActiveTabbedDocument(DockControl value)
at TD.SandDock.SandDockManager.OnDockControlActivated(DockControlEventArgs e)
at TD.SandDock.DockControl.x63491667e252563e()
at TD.SandDock.DockControl.Activate()
at TD.SandDock.ControlLayoutSystem.OnMouseDown(MouseEventArgs e)
at TD.SandDock.DockContainer.OnMouseDown(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


This is a known issue that can occur when the model's .DWH file is missing. Reference defect # 775694. This file is normally created when saving a model. However if it was not included when sent or transferred to another location, the file will be missing. Normally it will be regenerated (it includes a cached version of the drawing pane appearance) but in version there is an issue that can cause this crash in this case, when switching between multiple open models.

The immediate workaround is to simply save both models (which regenerates the .DWH file), then close and reopen them.

This issue will also be fixed in the latest patch set for version, and in future versions. Please contact technical support for help if the patch is needed.

Note: in order to avoid missing the dwh file when exchanging model files, use the new “Save to Package” feature found on the File menu.  This will compress the project files, including the dwh, along with other files selected in the save to package dialog.  You can then send the zip file.

See Also

Cumulative patch set frequently asked questions 

Downloading OpenFlows | Hydraulics and Hydrology Software