VB.net 2005 Forms application intermintently freezing

S

Steve

Hi All

I have a VB.net 2005 Windows forms application which connects to a SQL
Server express 2005 database

Intermittently the Program freezes up for a few seconds and I am at a loss
how to find out what is causing it

Several behind the scenes routines run occassionally to send data to my
website or download updates from my website etc, but they all run in a
different thread.

I have set break points within these routines but when the freezing occurs
the break points are not hit.

The freezing happens when different forms are open etc, so it is not limited
to a certain section of my code

Is there any program which monitors when a section of code is taking an
abnormal amount of time to complete?

I am an MSDN subscriber to Visual Studio Professional

Regards
Steve
 
K

kimiraikkonen

Hi All

I have a VB.net 2005 Windows forms application which connects to a SQL
Server express 2005 database

Intermittently the Program freezes up for a few seconds and I am at a loss
how to find out what is causing it

Several behind the scenes routines run occassionally to send data to my
website or download updates from my website etc, but they all run in a
different thread.

I have set break points within these routines but when the freezing occurs
the break points are not hit.

The freezing happens when different forms are open etc, so it is not limited
to a certain section of my code

Is there any program which monitors when a section of code is taking an
abnormal amount of time to complete?

I am an MSDN subscriber to Visual Studio Professional

Regards
Steve

Steve,
Temporary freezes can happen which i experienced using such as
system.net related operations or kind that. Have you tried using
background worker control? You indicated they run on a different
thread, but still some multi-threading points may be missing.
 
J

Jeffrey Tan[MSFT]

Hi Steve,

I assume you mean that your GUI thread may intermintently not
responding(hang) during the operation. Normally, a thread hangs(freezes)
means that either it is busy performing work(such loop or calculating) now
or it is waiting something. The easy way to distinguish these two types of
hang is looking at the CPU usage.(You can see it in Task Manager or Process
Explorer) Waiting hang will cosume low CPU while working(calculating) hang
will cost much CPU usage.

Yes, I see that you have placed all your database I/O code in the worker
threads. So is it possible that you fill the DataTable/DataSet in the
worker threads? If you are using databinding in .Net Winform, filling
DataTable/DataSet will trigger the databinding code which finally updates
the UI controls. However, since .Net Winform controls are all STA, only the
thread creating the control can modify/update this control. So if your
worker threads fill/modify the datatable/dataset, it will offend the STA
threading rule of Winform. This may introduce a lot of strange phenomenon.

Finally, if you do not have above Winform threading issue, an informative
approach is using a debugger to attach your application during the
freezing. With debugger you can examine the GUI thread stack trace to find
out if it is waiting or working on something. Please refer to my article
below to know how to get a stack trace for a hang application:
"How to debug application crash/hang in production environment?"
http://blogs.msdn.com/msdnts/archive/2006/11/24/how-to-debug-application-cra
sh-hang-in-production-environment.aspx

Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top