0

I'm stepping through my C# program in Visual Studio, trying to test how a generated HTML string will look given a few modifications. After I pause the debugger, modify my code, then continue, the changes do not take effect. I step through the entire method and when I look at the generated HTML string, it's the same as it was before I modified it. The changes only take effect if I stop running the program and run it again, which is extremely tedious.

Is it caching in some way?

James Z
  • 12,209
  • 10
  • 24
  • 44
  • disable navigator cache or use Ctrl-F5 to force the cache to refresh on the browser – Mohammed Sajid Apr 08 '20 at 16:43
  • i'm not sure that would help me here, it's not that i want to refresh without it caching, what i'm doing is, i drag the arrow back up after i generate the html to before i generate it, change the way it's generated, but when i step over again, it's the old one – Alex Leslie Apr 08 '20 at 18:54
  • Did you try one of the solutions listed in this Stack Overflow post? https://stackoverflow.com/questions/18266972/visual-studio-edit-and-continue-does-not-work – Anouar Apr 08 '20 at 21:28
  • Was your project created from an old VS version? – Mr Qian Apr 09 '20 at 09:53
  • Well it still doesn't work on occasion, I've tried the responses in this thread. – Alex Leslie Apr 12 '20 at 21:25

1 Answers1

0

Code Changes While Debugging Not Taking Effect (Visual Studio 2017)

In fact, to use that function, every time put the cursor back to the changed part and then step over the cursor, it will take effect.

So please try these suggestions:

Suggestion

1) make sure that these settings are checked under Tools-->Options-->Debugging-->General

enter image description here

uncheck Require source files to exactly match the original version under Tools-->Options-->Debugging-->General.

check Managed and uncheck Native under Tools-->Options-->Debugging-->Just In Time

2) close VS Instance, delete .vs hidden folder, bin,obj folder and then restart your project again.

3) If you port an existing project, you should specify EmbedInteropTypes as false.

Add it in xxxx.csproj file.

  <PropertyGroup>
 <EmbedInteropTypes>false</EmbedInteropTypes>
  </PropertyGroup>

4) disable any third party extensions under Extensions-->Manage Extension

5) make sure that you use the Debug mode

If your project is created by an old VS version, try to create a new project in VS2017 and then migrate the content of the old project into the new project to test this. (Not sure if the project is created by an old VS version)

Note that in different versions of vs, they can be some different, and if it is an old project, it may have some problems with this function in VS2017.

Hope it could help you.

Mr Qian
  • 21,064
  • 1
  • 31
  • 41