7

Hi I have been shifted from VS 2013 to 2015 presently. So I am not too much familiar with in depth specifications.

I like VS 2015 as it allows me to evaluate lambda expressions and also it allow to me to change values runtime.

Scenario:

In some apps (winforms tested only) I am able to edit code while debugging and yes latest code is executed always i.e I don't need to stop and run the program again and againe. Yes it is very excellent feature.

But in case of my first experience at controller in MVC I am unable to edit code and it shows me multiple reasons behind this.

enter image description here

Can someone explain in what scenarios I can add/delete code while debugging?

Thanks in advance!

CodeGenius
  • 514
  • 1
  • 6
  • 21
  • 3
    Related: https://msdn.microsoft.com/en-us/library/7yty6a48.aspx – CinCout Nov 24 '16 at 09:29
  • already done with it. The Edit and Continue option is already enabled. – CodeGenius Nov 24 '16 at 09:38
  • Highly Possible of duplicate question.http://stackoverflow.com/questions/2795795/cant-edit-and-continue-when-using-visual-studio-2010-on-a-64-bit-machine-app-t – Hameed Syed Nov 24 '16 at 11:12
  • yes but the problem is not solved. I already tried all the solutions there. – CodeGenius Nov 24 '16 at 11:23
  • Having the same issue :( –  Nov 24 '16 at 11:53
  • I'm assuming you're building for DEBUG and have checked every other thing that error message mentions? I ask because you should always strive to comment on the specific error message you get, saying something like "I went through the things the error message mentioned and it's building for DEBUG, I have no other debugger attached, it's the normal .NET runtime, it was loaded as a normal reference, not through reflection, etc.". Can you verify that all of the things the error message mention doesn't apply? – Lasse V. Karlsen Nov 24 '16 at 12:31
  • yes @LasseV.Karlsen I have checked all the things except Intellitrace which is missing in my Visual studio. – CodeGenius Nov 24 '16 at 12:42

4 Answers4

1

In your visual studio go to Tools->Options-> expand debugging -> select Edit and continue and then check Enable edit and continue. here is image of that: see screenshot

farrukh aziz
  • 162
  • 1
  • 2
  • 9
1

You normally cannot edit and continue if you attached to an already running process which maybe your case if you are attached to a running MVC web project. If something was load using Reflection you will not be able to edit it as well.

Ignacio Soler Garcia
  • 21,122
  • 31
  • 128
  • 207
  • yes @Igancio I am running MVC project, what could have been attached? I have some reference assemblies and there is nothing else. – CodeGenius Nov 24 '16 at 12:15
0

I have also seen sometimes a similar message appearing during debug. I found the following from MSDN regarding code changes during debugging:

The following changes cannot be applied to C# code during a debugging session:

- Changes to the current statement or any other active statement.

- Active statements include any statements, in functions on the call stack, that were called to get to the current statement.

- The current statement is marked by a yellow background in the source window. Other active statements are  marked by a shaded background and are read-only. These default colors can be changed in the Options dialog box.

- Changing the signature of a type.

- Adding an anonymous method that captures a variable that hasn’t been captured before.

- Adding, removing, or changing attributes.

- Adding, removing, or changing using directives.

- Adding a foreach, using, or lock around the active statement.

More information: https://msdn.microsoft.com/en-us/library/ms164927.aspx

c0mm4
  • 31
  • 2
0

So, after alot of R&D i came to know that Edit and continue is NOT available for Asp.net yet. It would be released in the final version of Visual studio 15.

source: https://blogs.msdn.microsoft.com/visualstudioalm/2015/04/29/net-enc-support-for-lambdas-and-other-improvements-in-visual-studio-2015/

CodeGenius
  • 514
  • 1
  • 6
  • 21