Are you using any COM objects? I'm no expert, but AFAIK a COM object that
uses a single threaded apartment would load itself into your applications
STA thread, which might block the UI?

If so, it may help if you change the [STAThread] attribute on your main
method to [MTAThread].

(also some .net framework classes use COM underneath, maybe the message
queuing classes do?)

HTH,

James.

> -----Original Message-----
> From: Unmoderated discussion of advanced .NET topics. [mailto:ADVANCED-
> [EMAIL PROTECTED] On Behalf Of Ross Diesel
> Sent: 12 April 2005 08:32
> To: [email protected]
> Subject: [ADVANCED-DOTNET] UI thread problems
>
> Hi
>
> I'm struggling with what appears to be deadlock/UI thread marshall
> failure.
>
> The main application thread creates a UI synchronization object (UiSync)
> on
> startup and thereafter spawns a background thread (listener - not a pooled
> thread) which is given access to UiSync.
>
> UiSync supports ISynchronizeInvoke by inheriting from
> System.Windows.Forms.Form.
>
> The background thread uses the UiSync object to create and launch a
> modeless
> form. In the case of our product though, both the main form and the newly
> launched form cease to respond to user input. In various other test
> harnesses both the test harness application form and the UiSync launched
> form remain responsive to user input. In the case of product the listener
> thread remains responsive to message queue receives.
>
> Further, in the case of our product, we are spawning session threads from
> our background thread on receipt of certain messages. These session
> threads
> are responsable for invoking UI functionality (web browser control
> creation
> and parenting) using the UiSync object. When the backgrond thread receives
> and processes the first start session request, the UiSync.Invoke is
> executed
> and the application deadlocks and all ui is frozen.
>
> I have developed a number of test harness varying in complexity (wrt the
> background processing) but these test harnesses all fail to reproduce the
> deadlock/marshalling problem in our product when UiSync.Invoke is
> executed.
> UiSync.InvokeRequired is checked (and returns true) prior to execution of
> the Invoke in the test harnesses and the product.
>
> Pausing the VS debugger and examining the process threads provides no
> thread
> status clues.
>
> Any suggestions as to the probable cause or to more sophisticated
> tools/techniques for debugging this kind of problem would be most
> appreciated.
>
> regards
>
> ===================================
> This list is hosted by DevelopMentorR  http://www.develop.com
>
> View archives and manage your subscription(s) at
> http://discuss.develop.com

===================================
This list is hosted by DevelopMentor�  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to