Skybound Gecko项目:尝试读取或写入受保护的内存

时间:2010-08-24 20:12:35

标签: c# geckofx

我正在开始一个非常简单的项目 - 本质上是一个带有硬编码URL的Web浏览器,供公共终端使用。也就是说,如果C#网页浏览器控件没让我想要自杀,那就简单了。

我决定使用Skybound Gecko浏览器,因为它似乎是唯一可行的替代方案。我通过这个项目学习了一些学习曲线,并解决了几个“Starter”错误(即无法导航设置窗口句柄,以及无法找到xpcom.dll时的错误),并更正了它们

现在,当我去运行应用程序并在Skybound Gecko Control中打开URL时,我在Program.cs中收到错误。

另外,在旁注中,我安装了Stylizer 5并且它正确使用了Skybound项目,所以我认为它在我的代码或配置中。

非常感谢任何协助。

Program.cs(显示错误的地方)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;

namespace alphaCommKiosk
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Error Line--------------------------------------------
            Application.Run(new Form1()); //  <--- ERROR OCCURS HERE.
        }
    }
}

相关代码

    //webBrowser1 is a control dragged onto the form
    //Intialize
    string path = "C:\\Program Files (x86)\\xulrunner\\";
    Skybound.Gecko.Xpcom.Initialize(path);
    webBrowser1 = new Skybound.Gecko.GeckoWebBrowser();
    webBrowser1.CreateControl();
    string u = "http://www.domaion.com/kiosk/index.php?account=" + mAccount + "&hash=" + mHash;

    //Navigate
    webBrowser1.Navigate("http://www.ibm.com/");
    //execution actually progresses past this line to the end of the sub

完整错误和堆栈跟踪

   System.AccessViolationException was unhandled
  Message=Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
  Source=System.Windows.Forms
  StackTrace:
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr 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 alphaCommKiosk.Program.Main() in c:\code\alphaCommKiosk\alphaCommKiosk\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 

1 个答案:

答案 0 :(得分:0)

我能够通过切换到WebKit组件来解决这个为期一天的问题。坦率地说,如果我先找到它,我宁愿选择对FireFox进行“镀铬”控制。

http://webkitdotnet.sourceforge.net/downloads.php

超级易于安装且没有任何问题 xulrunner 垃圾