views:

114

answers:

3

When using VB.Net (2008) and paused in debugging, Edit-And-Continue is a great time-saver. However if you change any module/class-level information (variable, sub/function signature, etc), you get the error message like this:

"unable to apply this change while debugging"

While I can understand the technical challenge to making this work (and why it would be hard), it leaves me in a tight spot with just a few options:

1) Restart and recompile and get the program back to the same state
2) Continue debugging without making the change, and risk forgetting
3) Type up a reminder note to make the change

All of which are annoying.

Now I know that option '4) Just actually make the change' may not be possible. but does anybody know how to enable the following 'technically easy' possibility?

4) Let me change the code, get it flagged with the purple squiggly underline, so I can save it, but just ignore the change until recompile

I have checked the Tools|options|debug|edit and continue, nothing appears to let me do this.

thanks!

+2  A: 

You can't do exactly what you want but you could have the solution/project open in another vs instace and change the code in that. You would have to make sure you didn't save it though.

Ben Robinson
Ben, this is really the only thing I was looking for and I do not know why I didn't think of such an easy solution. Of course I still have to explore for the files but it beats my other alternatives - trying (and often failing) to remember, or, making a note. I guess I was hoping for a built-in option to allow this.
FastAl
A: 

Unfortunately, this is not possible.

It's not as simple as you might think.
At the very least, you will invalidate all of the line numbering (although that happens in normal E&C too). However, the IDE would need an extra layer of validation to prevent you from doing things like changing method signatures or class interfaces that would make source-level debugging impossible.

In addition, it would be extremely confusing for people who don't understand exactly what's going on.

SLaks
A: 

I don't think that's possible, and when you say that it's easy, I think you forget that Visual Studio then would have to keep track of any changes you've done compared with what it was like at compile time so that it could show you the correct line you're on in the debugger etc, which if you add some lines, delete some other lines and amend some lines could get quite messy to cover all eventualities, and it might be quite confusing too.

ho1