Using the Edit and Continue Feature

Edit and Continue enables you to change code as you debug without killing your debug session. You can make a modification to a line of code or even fix a bug and keep working in break mode. Visual Basic developers who worked in versions prior to .NET should recall this powerful tool. Its absence in .NET made it one of the most requested features. The good news is that Edit and Continue was added in 2005 to both Visual Basic and C#. In 2008, this feature was also added to Visual C++. Visual Studio 2015 continues to improve on this feature.

There is no trick to invoking Edit and Continue. You simply make your code change during a debug session and then keep running through your code with a Step command or Continue.

The feature is turned on by default. If it is turned off, you can reenable it using the Options dialog box available from the Tools menu.

Not all code changes you make are eligible for Edit and Continue. In fact, it should be used only in minor fixes. As a best practice, any major additions to your code should not be done in debug mode. If your change is within the body of a method, it has a higher likelihood of passing the Edit and Continue test. Most code changes outside the method body require the debugger to restart. Common changes that are not eligible for Edit and Continue include the following:

Image Changing code on the current, active statement

Image Changing code on any calls on the stack that lead to the current, active statement

Image Adding new types, methods, fields, events, or properties

Image Changing a method signature


Note

For a more exhaustive list of features supported (and not supported) by Edit and Continue, search MSDN for “Edit and Continue.” From there, you can link to the Edit and Continue documentation for your chosen language. You can then select the link, titled Supported Code Changes. Here you can review the full list of supported and unsupported changes for your chosen language (C#, VB, C++).


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset