473,395 Members | 2,467 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Thread lock on HtmlDocument.InvokeScript

Hello,

I have a C# UI Control that allows Google maps to be displayed in a
Windows Form. I am using the WebBrowser control in a secondary thread
to accomplish this. I make several calls to InvokeScript to move,
size, etc. the maps and 99% of the time it works great. However,
occasionally the InvokeScript calls will lock the secondary thread.
This appears to be because of a deadlock in the Google Maps
Javascript. I have added code to my application to abort and restart
the secondary thread, but the thread never actually gets aborted. I
can still see the threads while debugging in the Threads window. I
have a try...catch for the ThreadAbortException in the secondary
thread, but the exception is never thrown. If I call Join() on the
Thread after calling Abort(), the Join() never returns.

I need a way to either call InvokeScript with a timeout or
asynchronously, or kill the thread completely. Any help would be
greatly appreciated.

Thanks,
Josh
Jan 25 '08 #1
1 3855
On Jan 25, 4:40 pm, jrox6...@gmail.com wrote:
I have a C# UI Control that allows Google maps to be displayed in a
Windows Form. I am using the WebBrowser control in a secondary thread
to accomplish this.
That sounds like a bad idea to start with. Just to check what you
mean, this WebBrowser has been created in one thread but you're
calling methods on it from a different thread? That's generally a no-
no with UI controls - do you have anything to suggest that should
wait?
I make several calls to InvokeScript to move,
size, etc. the maps and 99% of the time it works great. However,
occasionally the InvokeScript calls will lock the secondary thread.
This appears to be because of a deadlock in the Google Maps
Javascript. I have added code to my application to abort and restart
the secondary thread, but the thread never actually gets aborted.
You shouldn't use Thread.Abort - it's unsafe.

Jon
Jan 25 '08 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

44
by: Charles Law | last post by:
Hi guys. I'm back on the threading gig again. It's the age-old question about waiting for something to happen without wasting time doing it. Take two threads: the main thread and a worker...
31
by: AlexeiOst | last post by:
Everywhere in documentation there are recommendations to use threads from thread pooling for relatively short tasks. As I understand, fetching a page or multiple pages (sometimes up to 50 but not...
27
by: Ritesh Raj Sarraf | last post by:
Hi, I have some basic doubts about thread. I have a list which has items in it which need to be downloaded from the internet. Let's say list is: list_items which has 100 items in it.
5
by: admin | last post by:
ok This is my main. Pretty much it goes through each category and starts up 4 worker threads that then ask for groups to gether from. My problem is that when the thread gets done it keeps the...
0
by: Jaret Brower | last post by:
I'm trying to parse html that resides locally by using the HtmlDocument class and unfortunately you can only get an instance of an HtmlDocument through the WebBrowser control. Some of the html...
23
by: Boltar | last post by:
Hi I'm writing a threading class using posix threads on unix with each thread being run by an object instance. One thing I'm not sure about is , if I do the following: myclass::~myclass() {...
6
by: Zytan | last post by:
I have code running in the debugger as I type. I press pause, and it pauses on: Application.Run(new myForm()); *I believe* a worker thread is in deadlock (it's in a lock, but calls another...
0
by: Deepesh | last post by:
Hi all, I'm using the InvokeScript functionality in one of my projects. But it seems like it will invoke the script mentioned only once. For eg.. I'm doing this in my VB.Net code ...
12
by: Ronny | last post by:
Thanks Chris, Looks nice but I miss the dual way communication. In the main thread to deliver paramters and data to the worker thread- how can I do that? Regards Ronny Take a look at the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.