Condividi tramite


How to: Use Edit and Continue (C#)

Note

This article applies to Visual Studio 2015. If you're looking for the latest Visual Studio documentation, see Visual Studio documentation. We recommend upgrading to the latest version of Visual Studio. Download it here

With Edit and Continue for C#, you can make changes to your code in break mode while debugging. The changes can be applied without having to stop and restart the debugging session.

Edit and Continue is invoked automatically when you make changes in break mode, then choose a debugger execution command, such as Continue, Step, or Set Next Statement, or evaluate a function in a debugger window.

Note

Edit and Continue is not supported when debugging the Compact Framework, optimized code, mixed native/managed code, or SQL Server common language runtime (CLR) integration code. If you try to apply code changes in one of these scenarios, the debugger puts up a dialog box explaining that Edit and Continue is not supported.

To invoke Edit and Continue automatically

  1. In break mode, make a change to your source code.

  2. From the Debug menu, click Continue, Step, or Set Next Statement or evaluate a function in a debugger window.

    The new code is compiled and the debugging continues with the new code. Some changes are not supported by Edit and Continue. For more information, see Supported Code Changes (C#).

To enable/disable Edit and Continue

  1. On the Tools menu, click Options.

  2. In the Options dialog box, expand the Debugging node, and select Edit and Continue.

  3. In the Options dialog box Edit and Continue page, select or clear the Enable Edit and Continue check box.

    The setting takes effect when you restart the debugging session.

See Also

Edit and Continue (Visual C#)
Supported Code Changes (C#)
Edit and Continue Errors and Warnings (C#)