I need a workaround for Resharper when it says 'Failed to modify Documents'. Does anybody know why it does this and how to get around it?

StackOverflow https://stackoverflow.com/questions/23569152

Вопрос

I have noticed a few times over the past months that sometimes I will use the little yellow lightbulb icon and right click it and select an option for it to fix something for me and then it just highlights what it was going to fix and pops up a message that says "Failed to modify Documents".

Has anybody had this problem?
Do you know how to overcome it?
It is almost as if resharper thinks that the document is read-only or something, even though I can manually edit the document.

Это было полезно?

Решение 2

I hade the same issue with Visual Studio 2013.
The solution was to add the project to version control (git in my case).

Now, you don't need make commits if you don't want to but simply add the solution to version control and the issue should go away.

Другие советы

Disable the Visual Studio source control plug-in.

  1. Tools -> Options -> Source Control
  2. Change "Current source control plug-in" from "Microsoft Git Provider" to "None"

What did the trick for me was unloading and reloading the project in which the file that fails to be edited resides under. (Just right click on the project, and select "Unload Project" from the context menu.

July 2022 Update:

Ran into this with VS 2019 after upgrading Resharper to 2022.1. Before the upgrade, the issue would not occur.

Uninstalled the Resharper, rebooted the computer, reinstalled Resharper (version 2022.1, the same that I was upgrading to) and it resolved.

I started VS 2013 as administrator and opened project and it works now fine.

Allow me to chime in a bit late :

I solved this error by adding a .gitignore file and trying to commit my changes.

I cannot explain how this solved it, however, this happened to me on a completely new git repository. I've been using Git and VS for a few moth on another repository which has had a .gitignore file from the beguining and neither me nor anyone in my team had this problem before.

Changing "Microsoft Git Provider" worked but I wanted a permanent solution.

I was already using GIT and had all the ReSharper stuff in my .gitignore. I was using VS 2015. When I updated to the latest version of ReSharper 2017.1.3 this issue started happening.

I made a backup of my solution folder (called it "repo_backup"), then cloned my repo fresh from git. Everything worked as normal again. I copied my changes into the new re-cloned repo, deleted the repo_backup, then continued on my way.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top