System.AccessViolationException:尝试读取或写入受保护的内存。这通常表明这一点 [英] System.AccessViolationException: Attempted to read or write protected memory.This is often an indication that
问题描述
我遇到了与此处发布完全相同的问题:
http://www.windows-tech.info/1/f10a0726381d08ff.php
I have had the same issue exactly as posted at here : http://www.windows-tech.info/1/f10a0726381d08ff.php
以下是异常:
System.Reflection.TargetInvocationException:异常有一个调用目标抛出的
。 ---> System.AccessViolationException
:尝试读取或写入受保护的内存。这通常表明其他内存损坏了。
在System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk,IntPtr
itfMT,IntPtr classMT,Int32标志)
在System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
在System.Windows.Forms.WebBrowser.get_Document()
在System.Windows.Forms.WebBrowser.get_ReadyState()
在Ohlala.Motor.Common.ExtendedWebBrowser.webBrowser_DocumentCompleted(对象
发件人,WebBrowserDocumentCompletedEventArgs e)
在System.Windows.Forms.WebBrowser.OnDocumentCompleted(WebBrowserDocumentComp
letedEventArgs e)
在System.Windows.Forms.WebBrowser.WebBrowserEvent.DocumentComplete(Object pD
isp,Object& urlObject)
---内部异常堆栈跟踪结束---
在System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo方法,Ob
ject target,Object []参数,SignatureStruct& sig,MethodAttributes methodAt
tributes,RuntimeType typeOwner)
在System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo方法,Obj
ect target,Object []参数,Signature sig,MethodAttributes methodAttributes
,RuntimeType typeOwner)
在System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags调用
Attr,Binder binder,Object []参数,CultureInfo文化,Boolean skipVisib
ilityChecks)
在System.Reflection.RuntimeMethodInfo.Invoke(Object obj,BindingFlags调用
Attr,Binder binder,Object []参数,CultureInfo文化)
在System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
在System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.Uns
afeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID,Int
32 reason,Int32 pvLoopData)
在System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 r
eason,ApplicationContext context)
System.Reflection.TargetInvocationException: Exception has
been thrown by the target of an invocation. ---> System.AccessViolationException
: Attempted to read or write protected memory. This is often an indication that
other memory is corrupt.
at System.StubHelpers.InterfaceMarshaler.ConvertToManaged(IntPtr pUnk, IntPtr
itfMT, IntPtr classMT, Int32 flags)
at System.Windows.Forms.UnsafeNativeMethods.IHTMLDocument2.GetLocation()
at System.Windows.Forms.WebBrowser.get_Document()
at System.Windows.Forms.WebBrowser.get_ReadyState()
at Ohlala.Motor.Common.ExtendedWebBrowser.webBrowser_DocumentCompleted(Object
sender, WebBrowserDocumentCompletedEventArgs e)
at System.Windows.Forms.WebBrowser.OnDocumentCompleted(WebBrowserDocumentComp
letedEventArgs e)
at System.Windows.Forms.WebBrowser.WebBrowserEvent.DocumentComplete(Object pD
isp, Object& urlObject)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Ob
ject target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAt
tributes, RuntimeType typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Obj
ect target, Object[] arguments, Signature sig, MethodAttributes methodAttributes
, RuntimeType typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisib
ilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
Attr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.Uns
afeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int
32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 r
eason, ApplicationContext context)
我的应用程序是在VS2010,.NET中构建的Framework 4.0
My application was built in VS2010, .NET Framework 4.0
任何人都可以帮助我?
谢谢
Scott
推荐答案
嗨donvn,
Hi donvn,
我读了你的帖子和你提供的链接,基于异常,我认为它不是WPF问题,更相对的WindowsForms,我建议您可以在WinForm论坛上发布您的问题以获得解决方案,链接是:
I read your post and the link you provide, based on the exception, I think it is not a WPF issue, more relative WindowsForms, I suggest that you could post your issue on WinForm forum to get the solution, the link is:
http://social.msdn.microsoft.com/Forums/en-US/winforms/threads
祝你好运,
这篇关于System.AccessViolationException:尝试读取或写入受保护的内存。这通常表明这一点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!