I'm getting the following error when trying to open any .cs file in my solution.
I've tried 1) restarting Visual Studio, 2) restarting computer, 3) delete all obj folders, 4) delete all .vs files and folders and still I can't open any files.
Same error message if I double click on the file in solution explorer or use F7.
The files do exist.
I've also tried disabling resharper in case it was that causing the issues, but it doesn't help.
I've also tried navigating to classes using Ctrl+T, entering class name and selecting the class. No error messages, but nothing loads.
: 'Cannot access a disposed object. A common cause of this error is disposing a context that was resolved from dependency injection and then later trying to use the same context instance elsewhere in your application.
In the context of C#, dispose is an object method invoked to execute code required for memory cleanup and release and reset unmanaged resources, such as file handles and database connections.
This is the error I got when I tried to open an old solution: Cannot access a disposed object. Object name: 'WorkspaceContext'
. I found the solution from Refat Eid's blog.
You just need to open the following directory and delete the content there:
%LocalAppData%\Microsoft\Team Foundation\7.0\Cache
Depending on your Visual Studio, you may have a different version number in your %LocalAppData%\Microsoft\Team Foundation
. If you are not sure, copy the content to a temp folder first.
Other answers, either upgrading or reinstalling, basically serve the same purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With