ArcGIS AddIN异常之:object reference not set to an instance of an object

异常出现在

frmDownload frd = new frmDownload();
frd.ShowDialog();

在ArcMap中能正常弹出窗体,点击按钮时显示此异常:object reference not set to an instance of an object

网上检索后,基本给的解释都是对象没有实例化,可对象明明实例化了!

想不明白,清理了一下解决方案,然后重新编译生成,再运行就OK

可能原因:由于电脑上之前有过此AddIN插件,当时功能模块没有写完。后来写完后,在目标电脑上装上了VS,进行编译。

编译之后,由于一些未知的原因,AddIN中的插件相关dll等没有完整替换,导致ArcMap中的工具与代码中写的不一致,出现上述问题。

原文地址:https://www.cnblogs.com/DayDreamEveryWhere/p/4994625.html