我们有一个VSTO 4.0插件,用于Excel 2007,似乎存在内存泄漏问题,但只有某些文档且仅在Windows 7上。行为类似到在VSTO 4中应该补救的LCID代理问题。内存峰值大约在1.2到1.5 GB之间,然后引发OutOfMemory异常。当我在Windows 7上运行时尝试打开某些文档时,似乎只发生这种情况。如果我在XP中打开相同的文档,内存肯定会变高,但我没有发现异常。基本上,我得到的各种异常,从来没有在同一个地方两次:VSTO 4.0 Excel 2007插件在Windows 7上导致内存泄漏
-----来源:System.Windows.Forms的-----
的System.OutOfMemoryException:类型的异常“System.OutOfMemoryException的'被抛出。
在System.Windows.Forms.Screen.FromRectangle(矩形RECT)
在System.Windows.Forms.Screen.GetWorkingArea(矩形RECT)
在System.Windows.Forms.WindowsFormsUtils.ConstrainToScreenWorkingAreaBounds (矩形范围)
在System.Windows.Forms.ToolStripDropDown.GetDropDownBounds(矩形suggestedBounds)
在System.Windows.Forms.ToolStripDropDown.SetBoundsCore(的Int32的x,的Int32 Y,的Int32宽度,的Int32高度,BoundsSpecified指定)
在System.Windows.Forms.Control.SetBounds(的Int32的x,的Int32 Y,的Int32宽度,高度的Int32,BoundsSpecified指定)
在System.Windows.Forms.Control的。 set_Size(Size值)
在System.Windows.Forms.ToolStripDropDown.AdjustSize()
在System.Windows.Forms.ToolStripDropDown.OnLayout(LayoutEventArgs E)
在System.Windows.Forms的。 ToolStripDropDownMenu.OnLayout( LayoutEventArgs E)
在System.Windows.Forms.Control.PerformLayout(LayoutEventArgs参数)
在System.Windows.Forms.Control.System.Windows.Forms.Layout.IArrangedElement.PerformLayout(IArrangedElement affectedElement,字符串affectedProperty)
在System.Windows.Forms.Layout.LayoutTransaction.DoLayout(IArrangedElement elementToLayout,IArrangedElement elementCausingLayout,String属性)
在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串affectedProperty,布尔invalidatePainting)
在System.Windows.Forms.ToolStripItem.InvalidateItemLayout(字符串affectedProperty)
在System.Windows.Forms.ToolStripItem.OnRightToLeftChanged(EventArgs的)
在System.Windows.Forms.ToolStripDropDownItem.OnRightToLeftChanged (EventArgs的)
在System.Windows.Forms.ToolStripItem.OnOwnerChanged(EventArgs的)
在System.Windows.Forms的。ToolStripMenuItem.OnOwnerChanged(EventArgs五)
在System.Windows.Forms.ToolStripItem.SetOwner(ToolStrip的newOwner)
在System.Windows.Forms.ToolStripItemCollection.SetOwner(ToolStripItem的项目)
的系统。 Windows.Forms.ToolStripItemCollection.Add(ToolStripItem的值)
在Hcg.Stinger.Report.ShadowRangeTree.ShadowRangeNodeEventBehavior.AddDynamicLabelMenu()在C:\ Serenity6.x \来源\ HCG \毒刺\报告\ ShadowRangeTree \ ShadowRangeNodeEventBehavior.cs :135行
这里的另一个问题:
-----来源:System.Windows.Forms的-----
的System.OutOfMemoryException:类型的System.OutOfMemoryException“引发的异常。
在System.Windows.Forms.ToolStripManager.ProcessShortcut(消息&米,键的快捷方式)
在System.Windows.Forms.ToolStripManager.ProcessCmdKey(消息&米,钥匙KEYDATA)
在系统.Windows.Forms.ContainerControl.ProcessCmdKey(消息& MSG,钥匙KEYDATA)
在System.Windows.Forms.Form.ProcessCmdKey(消息& MSG,钥匙KEYDATA)
在System.Windows.Forms.Control.ProcessCmdKey(消息& MSG,钥匙KEYDATA)
在System.Windows.Forms.Control.ProcessCmdKey(消息& MSG,钥匙KEYDATA)
在System.Windows .Forms.TextBoxBase.ProcessCmdKey(消息& MSG,钥匙KEYDATA)
在System.Windows.Forms.Control.PreProcessMessage(消息& MSG)
在System.Windows.Forms.Control.PrePr ocessControlMessageInternal(控制目标,消息& MSG)
在System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG & MSG)
当我保存为独立的文件,不打开文件他们使用VSTO插件,它能够以最小的内存打开它们。当我使用添加来打开它们时,就是当事情发生并崩溃时。
任何帮助或指示为什么Windows 7有这些问题将不胜感激。
感谢,
埃里克
你是什么意思“一旦我让这些共享...”?我也有内存问题和ContextMenuStrip控件包含各种ToolStripMenuItems。但我不知道如何让他们“共享”。你能帮我吗? – jreichert 2015-01-16 17:14:44
@jreichert我分享的意思是简单地将它们添加到树menucontext中。我一直为每个节点创建单个的。我只是使用规则来决定哪些节点显示哪个节点。 – Erick 2015-01-16 21:59:07