Program hangs when not out of Visual C# 2010 Express IDE
-
Sunday, April 22, 2012 9:13 PM
New C# programmer here. I used the "Start Here!" book to build an example project which simply opened a form with no added code required (the No_Code_Windows_Forms project which opens a Web Browser). After working a few more samples I went back and used this example to work up my own application. As I flushed it out it ran fine from the IDE but when I tried running either the Debug or Release code directly it would hang up. At first this was due to a Norton scan false report but when I isolated the code directories from Norton scans I noted that it would still hang up sometimes, usually when running it immediately after a compile. As I added forms and classes to the project it would always create them in the No_Code_Windows_Forms namespace. I would then edit them to be in the namespace I wanted to use. A couple of days ago I became more confident in the refactoring process and did a global replacement of the No_Code_Windows_Forms namespace with my own. It did changes to the project properties which I hadn’t thought to do. At this moment the hang problem seems to have disappeared!
Any ideas on why this would be?
All Replies
-
Monday, April 23, 2012 12:05 AMModerator
What problem are you asking for help with - the hang or namespace changes? Changing namespaces is generally not a good thing to do unless you are aware of the consequences. If you want to change the default namespace that new files will use then use the project's properties dialog to specify the new default namespace. All files will use this namespace (further isolated by their folder).
The hange can be caused by any number of issues. The only way to debug the issue is to break into the program when it hangs via VS. Then you can determine where the hang is occurring. The most common causes are blocking calls or UI updates on non-UI threads.
Michael Taylor - 4/22/2012
http://msmvps.com/blogs/p3net
-
Monday, April 23, 2012 4:43 PM
I am trying to understand what is happening. The program hung with no display at all (very little code precedes the display of the first form and most of that is IDE generated). Eventually the notification the the program was not responding was displayed. Since this only happened when running the progrtam outside the IDE I'm not sure how VS would be used to analze it.
After running the refactor, which changed the default namespace, any code I added would have made the program more complex. I'm not sure how it could have eliminated or hidden the causes for the hang. Anyway, as I stated, the hang problem seems to have gone away. For what its worth I removed the code directory from Norton's exclude-from-scan list and it no long triggers what I thought was a false report. Norton was showing "Suspicious Actions - Event: Accessibility API usage"
-
Monday, April 23, 2012 5:31 PMModerator
Not sure why the problem would have gone away with a refactor. If the hang occurs again in the future then you can debug it by waiting until it hangs and then use VS to attach to the hung process. Alternatively if you are using Process Explorer it will allow you to debug the process as well.
Michael Taylor - 4/23/2012
http://msmvps.com/blogs/p3net
-
Tuesday, April 24, 2012 1:04 AM
When I used the refactor in Microsoft Visual C# 2010 Express to change the namespace I'd inherited from the original example application it made a number of changes throughout my project and in the project settings. It seemed to be the only substantial action that I took before the hang problem went away. Prior to that I was editing the namespace name in new forms and classes I as I created them.

