By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,175 Members | 1,689 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,175 IT Pros & Developers. It's quick & easy.

Help: Exception using Threads and AxSHDocVw.AxWebBrowser

P: n/a
I have created an application that loads assemblies (plugins). These plugins
are windows forms that have an embedded browser.

private AxSHDocVw.AxWebBrowser browser;

If I comment out
this.browser = new AxSHDocVw.AxWebBrowser();
and associated code to avoid exceptions like
this.browser.Dock = System.Windows.Forms.DockStyle.Fill;
this.browser.Enabled = true;
from my plugin, then I don't get the exception.

I only receive the exception when using Threads. If I don't use threads then I don't
get the exceptions. The exception is generated --=> AFTER <=-- exiting main(). It
is NOT caught by the catch().

Any thoughts?
Dave

Da**********@BellSouth.net
================================================== ===========
EXCEPTION:

An unhandled exception of type 'System.NullReferenceException'
occurred in system.windows.forms.dll

Additional information: Object reference not set to an instance of an object.

================================================== ============================

CODE

main()
{
try {
plugin = (IPlugIn)assembly.CreateInstance("AJB.Plugin");
plugin.PluginID = 74;

thr = new Thread( new ThreadStart(plugin.Execute) );
thr.ApartmentState = ApartmentState.STA;
thr.IsBackground = true;
thr.Start();
thr.Join();
}
catch (Exception e)
{
string s = Application.ExecutablePath.ToString() + "\n" + e.ToString() + e.Message + e.StackTrace;
MessageBox.Show(s, "ExecutePlugin() Error");
}
}
public void Execute()
{
InputForm ajbInputForm = new InputForm();
ajbInputForm.ShowDialog();
ajbInputForm.Close();
}
Nov 15 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.