Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows Service: Managed Compatibility Mode does not support Edit and Continue

I have been assigned to work on a Windows Service project. I installed it in my machine using installer class (ProjectInstaller.cs). I want to debug the source code and sometimes need to make changes while it is in debug mode. I attached the process via Debug menu to debug the project which works fine but it throw an error while I am trying to edit or continue the source code:

Managed Compatibility Mode does not support Edit and Continue

I googled and tried tons of solutions but none of them worked for me, couple of them are as below:

  • Unchecked the Use Managed Compatibility Mode from Tools -> Options

  • Unchecked Managed Compatibility Mode from Debug -> Attach to Process -> Attached To -> Select...

  • Checked the Managed (v4.6, V4.5, V4.0) from Debug -> Attach to Process -> Attached To -> Select...

  • Played with Platform target in Project Build.

  • Added {351668CC-8477-4fbf-BFE3-5F1006E4DB1F} field in my .csproj file

The error message varies depending on different solutions I implemented.

Below is the link I last time tried:

https://blogs.msdn.microsoft.com/visualstudioalm/2013/10/16/switching-to-managed-compatibility-mode-in-visual-studio-2013/

I am guessing: the last one didn't work because I do not have an exe project for my service instead I have implemented ProjectInstaller.cs Class and manually installed it through command prompt.

Any suggestion/recommendation are welcomed.

like image 912
M. Fawad Surosh Avatar asked Dec 03 '16 02:12

M. Fawad Surosh


People also ask

What is use managed compatibility mode?

Use Managed Compatibility Mode: Replaces the default debugging engine with a legacy version to enable these scenarios: You are using a . NET language other than C#, Visual Basic, or F# that provides its own Expression Evaluator (this includes C++/CLI).


4 Answers

Edit and Continue requires many factors which are not obvious to users. Your case is simply not supported (mostly for attaching cases).

See Supported Code Changes (C#) in MSDN. In particular:

Edit and Continue is not available in the following debugging scenarios: [...]

Debugging an application that has Attach to instead of running the application by choosing Start from the Debug menu.

like image 50
Lex Li Avatar answered Nov 07 '22 15:11

Lex Li


Unckeck Use Managed Compatibility Mode, It working for me! and you must Enable Edit and Continue in Debuging General enter image description here

like image 38
Dang Thinh Avatar answered Nov 07 '22 17:11

Dang Thinh


Attaching my process for each debug was a headache for me.

Just want to share a link that saved a lot of my time by writing a simple method and calling it in Main() method inside Program.cs.

This also gives me flexibility to edit and continue my code as simple as WinForm / Web Form. LOVE IT.

https://coding.abel.nu/2012/05/debugging-a-windows-service-project/

like image 33
M. Fawad Surosh Avatar answered Nov 07 '22 15:11

M. Fawad Surosh


I reset the VISUAL STUDIO settings and the problem is resolved hope it helps to Reset visual studio setting

like image 43
Yitzhak Weinberg Avatar answered Nov 07 '22 16:11

Yitzhak Weinberg