I am starting out a pretty simple project - essentially a web browser with a hard-coded URL for public terminal use. That is to say, it WOULD HAVE been simple if the C# web browser control didn't make me want to commit suicide.
I decided to go with the Skybound Gecko browser, as it seems to be the only feasible alternative.. I went through some of the learning curve with this project, and got around several "Starter" errors (ie. cannot navigate before setting window handle, and the error when xpcom.dll can't be found), and have corrected them
Now, when I go to run the application and open the URL in a Skybound Gecko Control, I get an error in Program.cs.
Also, on a side note, I installed Stylizer 5 and it utilizes the Skybound project properly, so I assume it's in my code or config.
Any assistance would be greatly appreciated.
Program.cs (where the error is shown)
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.
}
}
}
Relevant Code
//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.alphacommunications.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
The full error and Stack Trace
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: