Is This Content Helpful?
We're glad to know this article was helpful.
A System.NullReferenceException is thrown when using the the sceneTools.dll generated by the C# sample. The crash can be reproduced using the steps below:
1. The following sample is built to create the sceneTools.dll: <DeveloperKit install Location>\SamplesNET\Engine\ControlsCommandsSceneCommands.
2. Create an application that contains a ToolbarControl.
3. Add the ZoomIn and ZoomOut tools from the sample to the application’s ToolbarControl in Visual Studio designer, programmatically or by customizing the control at runtime.
The crash may occur when adding the tools, while building the application, or when exiting the application.
The Custom Scene Navigation Command sample has two commands that do not check for 'null' in the destructors. The Destructor methods are ~ZoomIn() and ~ZoomOut() These methods do not check for null m_pen and m_brush objects before calling the Dispose method. The Destructor method of ZoomIn and ZoomOut is as follows:
m_pSceneHookHelper = null;
m_pCursor = null;
Use one of the solutions below to fix the ArcGIS Sample: