10

I'm a C# programmer and recently I've installed Visual Studio 2013. The problem is when i set a break point or get an error and trying to edit the codes while debugging I get this error and I couldn't find the same error searching on Google.

Changes are not allowed for this module as it was not built for changes while debugging or the target .NET runtime version does not support it

I also tried to check the options on Tools -> Options -> Debugging -> Edit and Continue, But didn't help.

Any idea what the problem is?

Ghasem
  • 14,455
  • 21
  • 138
  • 171
  • Did you restart the debugging process and encountered same error after you configure Edit and Continue? – Stuart May 08 '14 at 04:01
  • @Juan I did. and I'm having this error on 3 computers for 2 weeks. – Ghasem May 08 '14 at 04:12
  • Were you allowed to do that on earlier versions of VS? I know you can have edit and continue in C++ but I've never known the option to be available in C#. – cup May 08 '14 at 05:28
  • @cup Yeah i were allowed to do so on all the earlier versions. But I can't edit the same codes in VS2013. – Ghasem May 08 '14 at 05:32
  • Just tested on VS2008 - it is available on that version. Just going to see if I can find a 2010 compiler. If anything, that is probably when it got removed. – cup May 08 '14 at 05:38
  • It is probably context dependent - works on simple stuff in 2013. Could you post some code on what you are trying to change? – cup May 08 '14 at 05:43
  • @cup It's not about the code. cause it's happening in all of my old and new projects. I'm p sure Something's wrong with VS2013 – Ghasem May 08 '14 at 05:50
  • 1
    We encountered the same issue...found out that when adding fake assemblies edit and continue stopped working. Do you use fakes too? – martinoss Jul 25 '14 at 12:57
  • @martinoss No i don't use them. even in simplest codes I write, i get that error. Codes like this >> a= b+c – Ghasem Jul 27 '14 at 06:37
  • @martinoss Was there a work around? – Daryl Jan 06 '15 at 17:23
  • @Daryl Unfortunately I don't know a workaround yet :( – martinoss Jan 06 '15 at 17:48
  • @martinoss I removed the fakes from the project, and I still can't edit and continue. – Daryl Jan 06 '15 at 17:52
  • @martinoss, scratch that. I only removed the xml settings, not the dlls themselves. Removing the generated dll fakes enabled edit and continue. – Daryl Jan 06 '15 at 17:57
  • It happens to me when I select the Debug configurations to "Release" Once I change back to "Debug" it allows to edit as usual. – S.Roshanth Jun 14 '17 at 05:57

8 Answers8

10

To edit a C# program while you're running it in Visual Studio 2013:

  1. Go to Project, Properties, Build.
  2. Set Platform target: x86
  3. Disable "Optimize code"
  4. Set Advanced, Debug Info: Full
Cees Timmerman
  • 17,623
  • 11
  • 91
  • 124
  • 1
    Did this already, still receive the same error message that OP is seeing – Jon Mar 04 '15 at 15:58
  • @Mangist Did you also check the settings mentioned in the question and other answers, including the exceptions mentioned [here](https://msdn.microsoft.com/en-us/library/ms164927.aspx?f=255&MSPPError=-2147217396)? – Cees Timmerman Mar 04 '15 at 16:25
  • @JohnPeters [Same question](http://stackoverflow.com/questions/23532460/error-while-trying-to-edit-code-in-debugging-mode-in-vs2013/28301828?noredirect=1#comment45984858_28301828) - Is my answer missing something from there? – Cees Timmerman Apr 17 '15 at 06:44
3

I came across the same issue and found that "solution configuration" on the top bar was changed to Release from Debug,because I build the last version into Release folder.Changing back to Debug mode will solve the issue.

S.Roshanth
  • 1,499
  • 3
  • 25
  • 36
0

The code your probably modifying is included in the exception. Since, your code is not posted here, I can't say. So please refer to this link and check whether it is really not allowed.

Stuart
  • 711
  • 1
  • 11
  • 35
  • I get the same error even if there's no exception. It happens when I also try a break point. – Ghasem May 08 '14 at 04:14
0

We just had the same issue in Visual Studio 2013 and in our case it was because we had disabled the Visual Studio Hosting Process on the Debug tab in Project Settings.

0

You can try

  1. Right click 'Solution' in the Solution Explorer.
  2. Select Properties.
  3. Choose Configuration Properties from the left menu.
  4. Select 'Debug' from the dropdown list in the upper-left corner labeled 'Configuration:'.
serdar
  • 1,564
  • 1
  • 20
  • 30
0

I just had the same problem and found a solution that worked for me right here after trying 100 other things:

https://stackoverflow.com/a/12543388/5367013

1.) execute VsPerfCLREnv /globaloff 2.) reboot your computer

Community
  • 1
  • 1
Nils
  • 1
0

In a Web Forms application, I initially received the "Changes are not allowed for this module as it was not built for changes while debugging or the target .NET runtime version does not support it" error message. Based on suggestions above I completed the following:

  1. Right click the project name, just under the Solution name in Solution Explorer and select Properties, the "Build" tab
  2. Set Platform target: x86 (Note, for me this was already set)
  3. Disable "Optimize code"
  4. Click the “Advanced” button (near bottom) and set, Debug Info: Full

I tried to modify code, but then I received the "Edit and Continue" window stating "Changes are not allowed while code is running."

Here was the important part: I can only make changes while stopped at a breakpoint. If the page is loaded, I get that same "Changes are not allowed..." message. So set a breakpoint to a line above where you need to make the change, complete the update and you should be set.

Or (as I subsequently discovered) another way to modify code without using a breakpoint is to click in Visual Studio "Debug/Break All" (Ctrl+Alt+Break), make your change and then press F5 or click the "Continue" button. (Using this method you will might need a page refresh to see the mods.)

Crazy Cat
  • 1,332
  • 15
  • 19
0

Edit while debug

It worked for me by unchecking "Enable optimizations" option.

Please refer below image for more info.

Community
  • 1
  • 1
BGD
  • 219
  • 1
  • 8