troubleshooting Question

Start second Form with WebBrowser control in a new thread

Avatar of laitt
laitt asked on
1 Comment1 Solution280 ViewsLast Modified:
I have 2 forms, Form1 is the main form, the second is IEForm with a WebBrowser control.

Pls check the code below, when I run the project I got this error message: "Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang."

I tried to turn off LoaderLock check in Debug / Exceptions, the LoaderLock error then disappeared but IEForm now doesnt display.

I'm so confused, pls help me to resolve this issue.

Thank you very much.
namespace Test_Thread
    public partial class Form1 : Form
        public Thread ieThread;
        public IEForm xForm;
        public void ThreadTask()
            xForm = new IEForm();
        private void Form1_Load(object sender, EventArgs e)
            ieThread = new Thread(new ThreadStart(this.ThreadTask));
            ieThread.IsBackground = false;

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 1 Comment.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 1 Comment.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros