473,386 Members | 1,720 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,386 software developers and data experts.

Thread hanging/FolderBrowseDialog problem

Hi,

We have a strange problem. We are invoking the FolderBrowseDialog and
have found that if we cancel that dialog within a few seconds of it
appearing it causes one of our (completely unrelated) background
threads to hang on program shut down.

Details:
Background thread is sitting idle waiting for work. This thread has
nothing to with the folder selection activity - it's a completely
separate part of the application.

In unrelated code the user causes the FolderBrowseDialog to appear then
quickly cancels it.

On program exit the background thread is terminated successfully but
the code waiting for it to terminate:

while(workerThread.IsAlive)
Thread.Sleep(100);

Never terminates.

We have put breakpoints in the worker thread that show that it detects
our stop flag and exits correctly.

It looks to us like the FolderBrowseDialog is causing the .NET thread
manager to block and it never gets around to setting IsAlive to false.

FWIW:This problem is most prevalent on machines with one or more slow
drive mappings. If users select [OK] it isn't an issue. If users wait
half a minute before selecting [Cancel] it isn't normally a problem
either. It seems to relate to the dialog box populate itself in a
background thread.

--

Nov 28 '06 #1
1 1730
Sounds like an interesting problem.
I have a suggestion to use as a work-around.

Can you launch the folder browse dialog on another thread that is separate
from the main UI thread. I would recommend using the BackgroundWorker
component.

--
Good luck!

Shailen Sukul
Architect
(BSc MCTS, MCSD.Net MCSD MCAD)
Ashlen Consulting Service P/L
(http://www.ashlen.net.au)
"Andrue Cope" wrote:
Hi,

We have a strange problem. We are invoking the FolderBrowseDialog and
have found that if we cancel that dialog within a few seconds of it
appearing it causes one of our (completely unrelated) background
threads to hang on program shut down.

Details:
Background thread is sitting idle waiting for work. This thread has
nothing to with the folder selection activity - it's a completely
separate part of the application.

In unrelated code the user causes the FolderBrowseDialog to appear then
quickly cancels it.

On program exit the background thread is terminated successfully but
the code waiting for it to terminate:

while(workerThread.IsAlive)
Thread.Sleep(100);

Never terminates.

We have put breakpoints in the worker thread that show that it detects
our stop flag and exits correctly.

It looks to us like the FolderBrowseDialog is causing the .NET thread
manager to block and it never gets around to setting IsAlive to false.

FWIW:This problem is most prevalent on machines with one or more slow
drive mappings. If users select [OK] it isn't an issue. If users wait
half a minute before selecting [Cancel] it isn't normally a problem
either. It seems to relate to the dialog box populate itself in a
background thread.

--

Nov 28 '06 #2

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

Similar topics

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...
0
by: sonali_reddy123 | last post by:
Hi, I a facing a problem regarding use of a FolderBrowseDialog in VB.NET. If i select a long path name using the browse dialog then I am getting exception when I say ok to use the selected path...
3
by: Yura Tigiev | last post by:
Hello! Is it possible to write (classical windows with My computers, My Desctop, My networks Places end etc ) FolderBrowseDialog without use WinApi? If yes, can you send source code ? Yuri
1
by: Toon Verstraelen | last post by:
Hi, I recently had a thread problem and I could reduce it to a very short example that shows the problem. I hope it has its origin in my misunderstanding of how python threads work. Here it is:...
7
by: e2wugui | last post by:
thread1: while 1: buf = s.read() process(buf) thread2: while 1: buf = getdata() s.write(buf)
3
by: David Cartwright | last post by:
Hi all, I'm having a weird time with a call to the Refresh() method of a DataGridView. I have a VB.NET 2005 Windows application with a main form and a "worker" thread. The main form delegates a...
1
by: =?utf-8?B?5qKm5Zyo5aSp5rav?= | last post by:
in the .net freamwork2.0, the openfiledialog support FTP, but the FolderBrowseDialog still do not support the FTP . now i want to make the FolderBrowseDialog to support FTP . can you give me some...
0
by: Newbie19 | last post by:
I'm trying to use folderbrowsedialog on an ASP.net web site to search a network folder and subfolders within for xml or .txt docs that contain data on those subfolders. I was wondering the best way...
1
by: Chrace | last post by:
Hi all, I have a problem with with Thread.Join( Timeout ) where the timeout never occurs. I basically need to make a connection to an AS400 box which works fine. Once in a blue moon the AS400...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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,...

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.