Unsupported Edits in Visual Basic Edit and Continue

Edit and Continue les you stop program execution in Break mode, make changes to the executing code, and resume program execution with the newly incorporated changes. Declarative code edits that affect the public structure of a class are generally prohibited, but many edits that you might make to a method, property body, or private declarations within a class are allowed. Whenever possible, Edit and Continue marks code that cannot be edited as light gray.

If you need to make a change that is not supported, you must stop debugging, make the changes, and start a new debugging session.

In this Topic

The following sections describe the unsupported edits for Edit and Continue.

Method and Property Body Edits

Attribute Edits

Class Declaration Edits

Class Member Declaration Edits

Compiler Option Edits

Conditional Compilation Edits

Constants Edits

Delegate and Event Declaration Edits

Enumeration Edits

External Declarations Edits

Imports Edits

Interface Definition Edits

Module Declaration Edits

Module Member Declaration Edits

Nested Type Declaration Edits

Structure Declaration Edits

Method and Property Body Edits

Unsupported Changes to Static Local Variables

  • Removing a static local variable.

Unsupported Changes to Iteration Constructs

  • Modifying the condition of a While loop, when the instruction pointer is in the condition.

  • Modifying the lower or upper bound of a For statement, when the instruction pointer is in the expression.

  • Adding or removing a Next loop, when the instruction pointer is used in the enumerator expression.

  • Adding a For Each loop, when the instruction pointer is in the body of the loop.

  • Changing the iterator of a For Each loop, when the instruction pointer is in the enumerator expression or the body of the loop.

  • Changing the enumerator expression of a For Each loop, when the instruction pointer is in the enumerator expression.

Unsupported Changes to Generics

  • Changes to the generic method itself or generic method body are not supported. Instantiation of a generic type or calls to existing generic methods can be added, deleted, or changed.

Other Unsupported Changes

  • Changing the invocation statement of a method that is on the call stack.

  • Adding a Try...Catch block, when the instruction pointer ends up in the Catch block or the Finally block.

  • Removing a Try...Catch block, when the instruction pointer is in a Catchblock or the Finally block.

  • Adding six or more nested Try statements around the current instruction pointer.

  • Adding a Using block around the current instruction pointer.

  • Adding a SynchLock block around the current instruction pointer.

  • Adding, removing, or modifying a user-defined #region.

Attribute Edits

Edit and Continue does not support modifying attributes. Specifically, Edit and Continue does not support the following changes:

  • Defining, editing, or deleting an attribute class.

  • Adding an attribute.

  • Editing or removing an existing attribute.

Class Declaration Edits

Most changes to class declarations are not allowed by Edit and Continue while in Break mode. Specifically, Edit and Continue does not support the following changes:

  • Creating a new class.

  • Renaming, deleting, or changing the inheritance of an existing class.

  • Implementing a new interface or removing the implementation of an interface.

  • Changing any of the following modifiers on a class: MustInherit, NotInheritable, or Shared.

  • Adding, changing, or removing ComClass status.

  • Changing the access modifier for a class.

  • Editing any generic class declaration.

Class Member Declaration Edits

Changes to member declarations are prohibited in most Edit and Continue cases. For example, you cannot change the signature or access level of a member, you cannot declare a new non-private method or property, and you cannot completely remove members during Break mode. Specifically, Edit and Continue does not support the following changes:

  • Shadowing an existing member variable by declaring a global or member variable of the same name in the containing block.

  • Shadowing a static local variable by declaring a new instance inside a block.

  • Adding a new, non-private property or method. Adding a Private property or method is allowed.

  • Adding a new field, unless the field is Private and there are no occurrences of the field name in any active statement.

  • Adding a new Private field in any class marked with SequentialLayout or ExplicitLayout.

  • Adding or deleting a constructor.

  • Removing handlers for an event. Adding an event handler is allowed.

  • Adding a new overloading property or method, unless the property or method is Private and there are no occurrences of the name in any active statement.

  • Adding or removing the WithEvents clause on a member variable.

  • Deleting a member.

  • Changing a property or method declaration to stop implementing an interface.

  • Editing any method that uses generics.

  • Changing the signature or return type of a non-private property or method.

  • Overriding or shadowing a member in a base class.

  • Changing the MustInherit or NotOverridable status of a method.

  • Changing the access modifiers for a property or method.

  • Changing the type or read-only status of a field.

  • Changing a public field.

Compiler Option Edits

While using Edit and Continue in Break mode, you cannot change, add, or remove the following compiler options:

  • Option Strict

  • Option Explicit

  • Option Compare

Conditional Compilation Edits

Most changes to conditional compilation directives are not allowed while in Edit and Continue mode. Specifically, Edit and Continue does not support the following changes:

  • Adding or removing conditional compilation directives.

  • Adding, removing, or changing the evaluation expression of a conditional compilation statement.

Constants Edits

Changes to constants while in Edit and Continue mode are very limited. Specifically, Edit and Continue does not support the following changes:

  • Defining a new constant, unless the constant is private and there are no occurrences of the constant name in any active statement.

  • Changing the type or value of a constant.

  • Removing a constant.

Delegate and Event Declaration Edits

Most changes to delegates and events are not allowed by Edit and Continue during Break mode. Specifically, Edit and Continue does not support the following changes:

  • Defining a new delegate.

  • Changing or deleting a delegate definition.

  • Defining a new event.

  • Deleting an event.

Enumeration Edits

Changes to enumerations (Enums) are not allowed by Edit and Continue during Break Mode. Specifically, Edit and Continue does not support the following changes:

  • Defining a new Enum.

  • Modifying the underlying type of an Enum.

  • Adding, changing, or removing an Enum member.

  • Changing the access modifier of an Enum.

External Declarations Edits

In general, you cannot change the declarations of external methods during Edit and Continue. Specifically, Edit and Continue does not support the following changes:

  • Adding or removing an external declaration.

  • Changing the signature or marshaling attributes of an external declaration.

Imports Edits

Edit and Continue does not allow adding, changing, or removing Imports statements while in Break mode.

Interface Definition Edits

Although you are frequently allowed to make changes to members that implement interfaces, changes to the actual interface definitions are generally not allowed by Edit and Continue. Specifically, Edit and Continue does not support the following changes:

  • Defining a new interface.

  • Adding, changing, or removing interface members.

  • Deleting an existing interface.

  • Changing the access modifier of an interface.

  • Changing the interface inheritance hierarchy.

Module Declaration Edits

Most changes to module declarations are not allowed by Edit and Continue while in Break mode. Specifically, Edit and Continue does not support the following changes:

  • Creating a new module.

  • Renaming or deleting an existing module.

  • Changing the access modifier for a module.

Module Member Declaration Edits

Using Edit and Continue, you can make a variety of changes to module members, such as properties, methods, and fields, while in Break mode. Some changes, however, are not supported. Most notably, Edit and Continue does not support adding, deleting, or changing the type or signature of non-private members.

Specifically, Edit and Continue does not support the following changes:

  • Adding a new member, unless that member is Private and there are no occurrences of the name in any active statement.

  • Removing a property or method.

  • Changing the signature of a non-private property or method.

  • Editing any method that uses generics.

  • Changing the access modifiers for a property or method, for example, changing Public to Private.

  • Deleting or changing the type of an existing field.

Nested Type Declaration Edits

In general, you cannot make changes to nested type declarations in Break mode while you use Edit and Continue. Specifically, Edit and Continue does not support the following changes:

  • Adding a new nested type.

  • Moving a nested type to another namespace or type.

Structure Declaration Edits

Most changes to structure declarations are not allowed by Edit and Continue while in Break mode. Specifically, Edit and Continue does not support the following changes:

  • Creating a new structure.

  • Renaming or deleting an existing structure.

  • Implementing a new interface or removing the implementation of an interface.

  • Changing the access modifier for a structure.

Structure Member Declaration Edits

Using Edit and Continue, you can make a variety of changes to structure members (properties, methods, and fields) while in Break mode. Some changes, however, are not supported, most notably changes that affect the declaration of structure members. Specifically, Edit and Continue does not support the following changes:

  • Adding or removing a property or method, including constructor methods (unless the method is Private and there are no occurrences of the field name in any active statement).

  • Changing the signature of a property or method.

  • Editing any method that uses generics.

  • Changing whether a property or method declaration implements an interface.

  • Changing the access modifiers of a property or method (for example, changing Public to Private).

  • Adding or removing a field.

  • Changing the type of a field.

See Also

Tasks

How to: Apply Edits in Break Mode with Edit and Continue

Other Resources

Edit and Continue (Visual Basic)