{“尝试读取或写入受保护的内存。这通常表示其他内存已损坏。”}

时间:2009-05-19 16:06:45

标签: .net winforms unity-container

我围绕Unity构建了一个简单的应用程序框架。即表单和用户控件被描述为xml并动态构建。我有一个包含ComboBox的表单,当关闭时会导致下面详述的错误。如果用ComboBox替换ListBox控件,则不会出现此问题。

一些谷歌搜索提出了一些我无法安装补丁的报告.. KB923028

  

{“尝试读取或写入受保护的   记忆。这通常是一个迹象   其他记忆已经腐败。“}

堆栈跟踪:

   at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
   at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
   at System.Windows.Forms.Control.DefWndProc(Message& m)
   at System.Windows.Forms.Control.WmCommand(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ComboBox.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.Run(Form mainForm)
   at DPOSSQL.Program.Main() in C:\VSSData\DPOS SQL\DPOS SQL\Program.cs:line 46
   at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
   at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
   at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
   at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
   at System.Threading.ThreadHelper.ThreadStart()

3 个答案:

答案 0 :(得分:0)

当控件使用XP / Vista样式然后在旧版本的Windows上运行时,我看到过这种情况。

答案 1 :(得分:0)

我在系统上安装新字体时遇到此错误。您是否安装了新字体或最近安装了新字体的程序?

其他.net程序是否正常运行?如果没有,您最好的赌注可能是重新安装.NET框架。

答案 2 :(得分:0)

在.NET应用程序运行时尝试将系统显示切换为“超大字体”时,只需在Windows XP上点击此内容。

似乎这可能与格式错误的字体或类似字体有关。

Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Source: System.Windows.Forms
   at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
   at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
   at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)