Ghasem
Ghasem

Reputation: 15643

Error while trying to edit code in debugging mode in VS2013

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?

Upvotes: 10

Views: 5742

Answers (8)

BGD
BGD

Reputation: 219

Edit while debug

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

Please refer below image for more info.

Upvotes: 0

Crazy Cat
Crazy Cat

Reputation: 1462

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.)

Upvotes: 0

Nils
Nils

Reputation: 1

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

Upvotes: 0

S.Roshanth
S.Roshanth

Reputation: 1507

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.

Upvotes: 3

serdar
serdar

Reputation: 1628

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:'.

Upvotes: 0

Cees Timmerman
Cees Timmerman

Reputation: 19712

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

Upvotes: 10

user444293
user444293

Reputation:

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.

Upvotes: 0

Stuart
Stuart

Reputation: 699

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.

Upvotes: 0

Related Questions