C# WebBrowser Control System.AccessViolationException

后端 未结 8 2088
谎友^
谎友^ 2020-12-05 13:41

I have a program that uses the built in webbrowser control. At some point during the usage of this, I\'m not sure at what point, but it appears to be random, I get the foll

8条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-05 14:02

    We have recently had similar problem on machines of several customers. The problem turned out to be a bug in the MSHTML control in certain environments. A common symptom for the problem seems to be broken registration of the jscript.dll library.

    Symptoms that may help to diagnose if it's the same problem - the jscript.dll is not listed in Modules in the debugger and is not loaded by the process; Native stack trace for the crash is the following:

    mshtml!CRootTracker::CollectGarbageInternal+0xd
    mshtml!CDoc::ReduceMemoryPressureTask+0x29
    mshtml!CStackPtrAry::GetStackSize+0xb6
    mshtml!GlobalWndProc+0x183
    USER32!InternalCallWinProc+0x23
    USER32!UserCallWinProcCheckWow+0x109
    USER32!DispatchMessageWorker+0x3bc
    USER32!DispatchMessageW+0xf
    

    The solution is to re-register the jscript.dll library and the crash should go away.

    Re-registering the library is done as follows (example given for 64-bit Windows, otherwise only the first line is necessary):

    C:\Windows\System32\regsvr32.exe C:\Windows\System32\jscript.dll
    C:\Windows\SysWOW64\regsvr32.exe C:\Windows\SysWOW64\jscript.dll
    

    Both commands have to be "Run as Administrator".

提交回复
热议问题