How can I edit my code while debugging using Visual Studio?

Matan David

How can I change my code while debugging it so when it breaks I'll see the original code?

I have a program that runs for hours or days, and I want to debug it. Meanwhile instead of waiting I want to keep working on it's code. But if I change the code I can't break my running session and see it's original code.

EDIT: I disabled the "Edit and Continue" feature in order to do so, because when it's enabled and the debugger is on, my solution gets "locked" and can't be changed.

JotaBe

You need two copies of your solution:

  • one to keep working on it
  • other with the original code, as it was when you started debugging your application

Now open two instances of Visual Studio:

  • other copy to keep working on it
  • one with the original source code, and attached to the debugged process

You can safely have the "edit and continue" option enabled in your debugging instance, and use this functionality there - i.e. you can try a change in the original source code to see if it works as expected, and then apply the same change in the working copy of your solution.

This is the only way to do it. If you don't have the original source code apart, the debugger has no way to show you the original source code.

Note: you can open a new instance of VS with the original source code, and attach to the running process, and then detach from the process and close VS without interfering with the running application. See the options "Attach to process..." and "Detach all" of the "Debug" menu.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Can't step over code in Visual studio while debugging

From Dev

Execute code only while debugging with Visual Studio

From Dev

Using Visual Studio code, coding vb.net, how can I start my program then enter debug mode?

From Java

How can I prevent Visual Studio 2013 from closing my IIS Express app when I end debugging?

From Dev

How to edit C# code in Visual Studio while running, NOT with edit and continue

From Dev

How to edit C# code in Visual Studio while running, NOT with edit and continue

From Dev

Console Window Appears while debugging Python code using PTVS in Visual Studio

From Dev

Pressing break while debugging in Visual Studio - annoying "Code Not Running"

From Dev

How do I pass args while debugging a node.js project in Visual Studio 2017?

From Dev

How can I debug my unity project using Visual Studio 2012?

From Dev

How can I make my application find a third-party DLL using Visual Studio?

From Dev

How can I debug Python 3 code in Visual Studio Code?

From Dev

Why can't I edit my alerts email address in Visual Studio Team Services

From Dev

How can I log my SQL calls in Visual Studio 2013?

From Java

How can I switch my signed in user in Visual Studio 2013?

From Dev

How can I see the changes on my SQL server in Visual Studio?

From Dev

How I can get my visual studio IDE background as transparent?

From Dev

How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)?

From Dev

How to view ViewBag content while debugging in Visual Studio?

From Dev

How can i improve my python code regarding while loops

From Dev

How can I get my code to stop in Visual Basic?

From Dev

How can I start a new Chrome instance in Visual Studio on website startup without Javascript Debugging?

From Java

How can I clear the terminal in Visual Studio Code?

From Java

How can I view the Git history in Visual Studio Code?

From Java

How can I change keyboard shortcut bindings in Visual Studio Code?

From Java

How can I install Visual Studio Code extensions offline?

From Java

How can I switch word wrap on and off in Visual Studio Code?

From Java

How can I disable live code analysis in Visual Studio 2017?

From Dev

How can I disable GPU rendering in Visual Studio Code

Related Related

  1. 1

    Can't step over code in Visual studio while debugging

  2. 2

    Execute code only while debugging with Visual Studio

  3. 3

    Using Visual Studio code, coding vb.net, how can I start my program then enter debug mode?

  4. 4

    How can I prevent Visual Studio 2013 from closing my IIS Express app when I end debugging?

  5. 5

    How to edit C# code in Visual Studio while running, NOT with edit and continue

  6. 6

    How to edit C# code in Visual Studio while running, NOT with edit and continue

  7. 7

    Console Window Appears while debugging Python code using PTVS in Visual Studio

  8. 8

    Pressing break while debugging in Visual Studio - annoying "Code Not Running"

  9. 9

    How do I pass args while debugging a node.js project in Visual Studio 2017?

  10. 10

    How can I debug my unity project using Visual Studio 2012?

  11. 11

    How can I make my application find a third-party DLL using Visual Studio?

  12. 12

    How can I debug Python 3 code in Visual Studio Code?

  13. 13

    Why can't I edit my alerts email address in Visual Studio Team Services

  14. 14

    How can I log my SQL calls in Visual Studio 2013?

  15. 15

    How can I switch my signed in user in Visual Studio 2013?

  16. 16

    How can I see the changes on my SQL server in Visual Studio?

  17. 17

    How I can get my visual studio IDE background as transparent?

  18. 18

    How do I suppress the console window when debugging python code in Python Tools for Visual Studio (PTVS)?

  19. 19

    How to view ViewBag content while debugging in Visual Studio?

  20. 20

    How can i improve my python code regarding while loops

  21. 21

    How can I get my code to stop in Visual Basic?

  22. 22

    How can I start a new Chrome instance in Visual Studio on website startup without Javascript Debugging?

  23. 23

    How can I clear the terminal in Visual Studio Code?

  24. 24

    How can I view the Git history in Visual Studio Code?

  25. 25

    How can I change keyboard shortcut bindings in Visual Studio Code?

  26. 26

    How can I install Visual Studio Code extensions offline?

  27. 27

    How can I switch word wrap on and off in Visual Studio Code?

  28. 28

    How can I disable live code analysis in Visual Studio 2017?

  29. 29

    How can I disable GPU rendering in Visual Studio Code

HotTag

Archive