VS2005 Executes Code After I Hit Stop

O

ohnoonho

Hey All,

In my website projects I can set a breakpoint, run the app, the
breakpoint gets hit, and I can step through or check some variables or
what not, and if I hit stop it appears that the rest of the method (and
any calling method) continues to execute. I know this because there are
sql calls being made (though they are on lines well after whatever line
I was on when I hit stop) and I can check the database and see that
rows were inserted/updated. As you can imagine, this is quite
frustrating as the whole reason I hit stop is that I *didn't* want to
continue to do work against the db.

Anyone else have this problem? What's a coder to do?
 
C

chanmm

Hello,

When you debug a web project I assume your IE launches. Do you close the IE
as well?

chanmm
 
A

Andy

I think this happens because VS attaches to the aspnet_wp.exe process,
but since it didn't create it (IIS did), it won't terminate it. You
wouldn't want it to either, if you are remoted debugging an actual
webserver, for example.

What I would do is use the Set Next Statement to move the statement to
the block of code after the database calls (or possibly just to the
exit of your method).

Andy
 
O

ohnoonho

When you hit stop, the IDE closes IE. If you close IE manually the
debugger detaches and stops.
 
O

ohnoonho

What you say makes sense, however, this problem *never* happened in
VS2003 and to be honest it only started doing this last week (several
months after I started using VS2005) so this is definitely not the
IDE's normal behavior.
 
A

Andy

What you say makes sense, however, this problem *never* happened in
VS2003 and to be honest it only started doing this last week (several
months after I started using VS2005) so this is definitely not the
IDE's normal behavior.

Its been a while, but when I was doing web in VS2003, I'm pretty sure I
remember that behavior..

Anyway, while you're in debug mode, you should be able to bring up the
list of attached proceses (ctrl-alt-p) and specify that it will the
aspnet_wp. I'm not sure, but it may remember that you chose that
action.

Did anything else change? For example, are you using Cassini where
before you had it hosted in a 'real' IIS server?
 
O

ohnoonho

I've been programming enterprise web apps every day for the past 6
years and the behavior I'm describing has never happened to me before
last week. You are right and it is attaching to the aspnet_wp.exe
process but when you hit "Start Debugging" a new IE window is opened
and you can tool around your app and when you either close IE or hit
"Stop Debugging" the code should stop running. At least, like I've
said, it always used to.

Nothing else changed AFAIK. I've always been under IIS, etc.

I appreciate your responses, Andy. Thanks for taking the time to
respond. I'd love to hear from one of the MS guys or MVPs on this
topic.
 

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