在有html文本编辑控件退出时报错

html文本编辑控件的窗体上,退出时,报错,在开发环境中,项目直接中断退出

发现是这句话造成的

     IntPtr ptr = Marshal.GetIDispatchForObject(this.theSite);
                        int i = Marshal.Release(ptr);
                        while (i > 0)
                        {
                            i = Marshal.Release(ptr);
                        }

没有找到原因

直接try 了

   try
                    {
                        IntPtr ptr = Marshal.GetIDispatchForObject(this.theSite);
                        int i = Marshal.Release(ptr);
                        while (i > 0)
                        {
                            i = Marshal.Release(ptr);
                        }
                    }
                    catch { }

原文地址:https://www.cnblogs.com/cwfsoft/p/1673676.html