It is already enabled.
Main Topics
Browse All TopicsMy Visual Studio 2005 suddenly started ending program execution as if it hit an End statement when it encounters a run-time error of any kind. It used to start the debug. Any advice?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
And have you implemented Try ... Catch block to get the error ?
Also try one thing:
Project menu > Properties > Application tab > View Application Events
Then:
Private Sub MyApplication_UnhandledExc
ByVal e As Microsoft.VisualBasic.Appl
Handles Me.UnhandledException
MsgBox(e.Exception.Message
End Sub
This is ANY litlle bug, not critical or where a user may have entered something wrong.
Right now I am chasing a bug that makes the program quit when you click on a certain tab in a form. Some textboxes have been renamed and changed. I am looking thru hundreds of lines to find exactly where the bug is. With the exception, it would have been fixed in under 30 sec.
Wierd. If I build it and run it outside VS, the UnhandledException sub works. It still does not tell me where it happened like VS did a week ago when making software was still profitabe for me....
I miss the happy VB6 days so much. Back when working after midnight menat to solving the customers problem rather than Microsofts.
>> Second try it also just threw me out of the program. No box at all.
The second you used in the exception ?
Catch ex As Exception
msgbox(Err.Number)
End Try
Just one more crazy thing! Can you create a new project and copy the files from that application to the right place (just forms, classes, modules, datasets). Then in the Menu project select "Show all files" and include then in your application.
I'm getting out of ideas! Is the application to big or can you upload it (database also) ? you can remove the unnecessary stuff.
Is this behaviour specific to this solution/project? Or if you create a completely new project, containing something very simple but including an error, do you get the same behaviour in that, too?
Try a new project, one form, one button, this code
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As Integer = 0
Dim b As Integer = 6
Dim c As Integer = b / a
End Sub
End Class
If that just ends, save the solution, go to the project folder, open the .vbproj file with NotePad and paste the contents back here. Then, rather than us guessing at settings etc, we will have a known output from your system to compare with what our systems produce for the same thing.
If that behaves properly (i.e. breaks at the offending line) then you can either post the contents of the .vbproj file for the "bad" project here, or yourself compare the settings as between the "good", new project file and the "bad", old one.
I am not sure about this, but my thinking is that - even if the problem arises from a general setting rather than a specific Application setting - it should be reflected somewhere in the file which controls the specific build/s.
Roger
There's a thread here which seems consider a whole range of possibilities which MIGHT be relevant here. Warning: it's long and (I found) a bit confusing. But it goes over so much ground that I imagine the answer for this case is probably in there somewhere.
http://forums.msdn.microso
Roger
I think it might be a good idea to post the .vbproj file contents. You could either do it from notepad with a copy and paste, or rename it to .txt, or zip it up. It's just that, so far as I know, the "Attach File" facility won't accept a .vbproj extension, and it shouldn't be large enough, on its own, to warrant uploading to http://www.ee-stuff.com
Roger
Thanks. Unfortunately, I can't see anything odd about that at all. It is, so far as I can see, identical in all "build-significant" respects (that is, leaving aside references to project-specific items, etc) to what works OK for me.
I think it unlikely, because even if this were the case I would not expect the application just to End, but have you checked that the Debug build configuration hasn't got set to Release by accident? You can check that either in the Configuration Manager or by opening the .sln file and looking under GlobalSection(ProjectConfi
Apart from that, I am out of ideas, I'm afraid. It does seem - from the link I posted earlier - that all sorts of unexpected factors can affect debugging behaviour. But as I have no personal practical experience of the problem, and I've exhausted my limited theoretical knoweldge on the topic, I'll have to leave it at that.
Good luck with it.
Roger
I read your question and recalled I had the same issue and I just learned to deal with it.
I got to investigating the first suggestion and knew I could really benefit from this "Exception assistant", and realized this feature only works for uncaught exceptions.
I was catching all exceptions and emailing an error, which is why I never saw it. Once I commented out the "Catch" part of my application, the exception assistant worked fine!
Perhaps this may be of use to you?
>> Wierd. If I build it and run it outside VS, the UnhandledException sub works.
FYI: This is a known issue. I *think* the decision was made to do this in order to make debugging uncaught exceptions easier while running from the IDE.
I see Roger has already made my suggestion -- it sounds like you're not running in debug mode. This would explain why you're not getting a decent stack trace for debugging -- you need the debug symbols to see line numbers rather than just method names of where the code failed.
I use the exception assistant to find out where I may have obvious errors before I even place try catch, so that is not the case. The last thing I want is to have the program ignore if I made a wrong object reference. Right now the program execution just stops as if you hit an end statement. That does not help me at all and now I can guessing where the error is. Before, VS came up and said "here"
you can try disabling the "just my code" in tools/options/debugging
if that does not work, you can try just-in-time debugging - also from tools/options/debugging/ju
hth,
A.
There must be a way to restore the regular an very useful exception handler in VS. I started moving all the files, classes etc. into a new project. What a disaster. I am still trying to even make the first form appear without useless error codes from VS.
I appreciate all the workarounds that you guys suggest. It almost appear normal that these things happen in VS and people are getting used to unexplainable Microsoft errors that people have to get creative to resolve.
Have you tried a new project, with no code and a simple like this (below) to see if the exception assistant pops up?
Throw New ApplicationException("blah
If it does, then you know it's a problem with your current project, code or setup. If it doesn't, then it's probably something to do with visual studio.
I have a June 20th deadline that is creeping up on me. I have almost messed with this for a week now and nothing. Is there anybody who know VS inside and out that would be willing to take a look at this thru phone and remote assist? Cash will be offered if the point are not enough. Yes, I am desperate.
This is the only project where this is happening. Starting a new project and throwing exceptions works fine.
As I already post it before:
"I'm getting out of ideas! Is the application to big or can you upload it (database also) ? you can remove the unnecessary stuff."
I'm shure that I or other expert will try to help you. As you know it's not easy to find a decente solution for this problems without the code.
I would venture to say at this point this question is going in circles because you are not responding to all experts that are trying to help you. I for one have proposed (in my opinion) two good concepts when dealing with the exception assistant, and you have not once responded specifically to my suggestion, leading me to believe you either didn't read it or you never tried it out?
raterus: If you look further back you will see that a new project does not create the same problem. Read >> This is the only project where this is happening. Starting a new project and throwing exceptions works fine. << from earlier reply.
I use the exception as a part of my work to develop and debug. I guess that is one handicap when you come from VB6. Besides that, the Unhandledexceptions sub for the application does not work either.
What if on the first line of Form_Load in your main form, you put a statement like
Throw New ApplicationException("blah
Do you see the exception assistant? If not, you should be able to set a breakpoint on this statement, step into the procedure and at least debug to figure out what code is catching your exceptions?
'CDTsoftware.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_M
'CDTsoftware.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_3
'CDTsoftware.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_3
'CDTsoftware.vshost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_3
Is 'Just My Code' supposed to be enabled?
Try Catch works fine!
It is when I don't use it and rely on the one that VS should send back. As mentioned some posting ago, I normally write the code and then use the exception handler to find where the try catch go because tthe program is unable to handle the unexpected conditions.
Yes, that was where the breakpoint was.
did you try the 'exceptions' dialog - enabling all on thrown column? i realy beleive that it's not stopping into the debugger because you have some try-catch and the exception is handled somewhere. if you enable the exceptions from the exception dialog, it should stop even if the exception it's handled.
if the code does not crash in your code, the you have to disable just my code.
hth,
A.
Here is a status on the situation for those who are interested. Microsoft is really scratching their heads on this one. The program has two database connections, one OleDB and a SQLclient for a remote server. Both of them work fine, but once you have had the SQL connection open, it kills the debugger in VS. Even if you close and dispose. Remove the .open statement and everything works fine in the entire application. MS is now analyzing a memory dump to see why.
Any comments?
Problem solved. A process called bmnet.dll (Byte mobile dll that comes with AT&T Blackberry communication mgr) started taking over the exception handling as soon as the program tried to use the sockets. That happened when the program opened the remote SQL Server connection. After that, it would handle all exceptions from there on regardless of the type. It actually just ignored the exception and caused VS to just stop. I removed the AT&T Com. mgr. and everything works fine. Who would have guessed that?
Business Accounts
Answer for Membership
by: jpaulinoPosted on 2008-05-30 at 05:11:58ID: 21676959
Go to Tools - Options - Show All Settings - Debugging - General and then check the Enable The Exception Assistant