Edit & Continue – Rude Edits

VBTeam

 

by Bill Horst

 

Edit and Continue is a new VB debugging feature which allows the user to make edits to code while the debugger is in “Break Mode” and then to continue debugging with the new edits applied, without having to start execution over again.

A Rude Edit is an edit made during “Break Mode” from which the debugger cannot continue.  In other words, the user must restart the debugging process if they wish to apply a rude edit.  When an edit is rude, it will generate a purple squiggle and an error message to indicate that it is rude.

 

If the user attempts to step or run while there is a rude edit, an error dialog will appear which lets you either edit the code (to get rid of the rude edit) or restart the debugger execution.  Almost all rude edits can be undone.

  • Any edit that produces a compile error is not allowed, because the code no longer makes sense

Types

  • Type (e.g. Class, Interface, Module) definitions cannot be Added, Edited or Removed

Methods/Members

  • Method (e.g. Function) and member (e.g. Dim) definitions cannot be Edited or Removed from a Type Definition

  • Method/Member definitions can be added, but only if they are “Private”

Edits within methods

This is where things are the most interesting with Edit and Continue

  • Editing the an active line (i.e. a line on the call stack) is never allowed. 

  • This also applied to any area that is gray.  For example, edits to a catch block are allowed, unless the active statement is inside the try block

Otherwise, most edits within a method are allowed, with the following exceptions (there may be more I can’t think of right now, so don’t hold me to this…there’s a lot of possible edits!)

  • On Error statements can be edited only if they are in a method not on the call stack
  • Redim statements cannot be removed
  • Editing an Erase statement is not allowed, though you can add and remove them
  • Catch blocks cannot be removed from a method if it is on the call stack

Misc.

  • Edits are not allowed at all within generic type or method definitions

  • Compiler statements (lines starting with #) cannot be Added, Edited or Deleted

  • Imports and Option statements cannot be Added, Edited or Removed
  • Attributes cannot be Added, Edited or Removed

  • Comments can be added, edited or removed, except in regions not allowed as indicated above

0 comments

Leave a comment

Feedback usabilla icon