Visual studio mistakenly makes correct code wrong after debugging edit

I am using visual studio 2013 with unity 3.5 downloadable with nuget. I have a container class that looks like this

  public class Container
    static IUnityContainer _container; //<- System IDisposable error on _container
    static ILogger _logger = GetLogger();

    //continuation here


My problem is that when I run the application, debug works fine, but if I edit a statement completely unrelated to the class above during the debugging process, when I resume debugging, I get the following strange blue underscore error below _container


enter image description here

The type "System.IDisposable" is defined in an assembly that is not referenced. You have to add assembly reference 'System.Runtime, Version =, Culture = neutral, PublicKeyToken = b03f5f7f11d50a3a'

after that I have to stop debugging and restart again. without touching anything, the error disappears and can be debugged back.

I searched for the System.Runtime assembly in Framework Assemblies, but I couldn't find it. available assemblies:

System.Runtime.Caching System.Runtime.DurableInstancing system.runtime.remoting System.Runtime.Serialization System.Runtime.Serialization.Formatters.Soap

how, at least, to track down this error?


source to share

2 answers

Finally I found a solution.

There %ProgramFiles(x86)%\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.5.1\Facades\

is system.runtime.dll

. I added a link to it and it solved the problem. I don't know if this went away correctly, but at least the IDisposable error went away. I wonder why this assembly is not listed in the list of standard assemblies.



I ran into the same problem (although I didn't have to edit it while debugging to trigger it). For me, it turned out that the (false) error messages were actually generated by Resharper and not by Visual Studio. I was able to confirm this by doing Tools | Options | Resharper | Suspend Now

; all the little red screams disappeared instantly. With this prompt, I was able to open this ticket ; which shows that this is a known issue with Resharper 9.0. The fix will be included in version 9.2, which is apparently scheduled for August. If you are as impatient as I am, you can fix this by installing the latest EAP (Access Preview) from this location .



All Articles