'Refactoring failed - Files still read-only' error message when applying Quick Fix
If you get the 'Refactoring failed - Files still read-only' as follows:
for VS2012:
Please update 'Visual Studio Tools for Git' extension to the latest version (this issue was fixed since version 0.9.5.0 of this addin). You may do that via VS Extension Manager ("Tools | Extensions and Updates").
If the issue is still present after the update, please disable/remove the 'Visual Studio Tools for Git' extension from the Visual Studio.
for VS2013/VS2015:
Please disable embedded GIT provider in Options: Tools | Options | Source Control | Plug-in selection | Select "None";
Please sign in to leave a comment.
This issue suddenly started happening to me as well yesterday. It is debilitating as I cannot perform a majority of code refactoring activities. If it is not fixed I will uninstall ReSharper and revoke my license.
Visual Studio Enterprise 2019 v16.11.15
ReSharper 2022.1.2 build 221.0.20220601.154737
*** UPDATE ***
As of the recently announced fix, I reinstalled ReSharper and the problem has been resolved. Thanks for persisting to troubleshoot and fix the issue!
I get this in Microsoft Visual Studio Enterprise 2019 Version 16.8.3
ReSharper 2020.3.20201223.82801
Source control is an Azure Devops Git repository.
Changing the Source Control Plug-in Selection to None is a workaround which works but would prefer this got fixed!
I am also experiencing this problem on VS 2019.
It worked for months but suddenly I get this problem.
Restarting VS allowes me to perform ONE refactoring operation (move class to different file) and then it continues showing me this message.
I have GIT in place and there is no way in uninstalling GIT from VS, this is a necessay tool, especially while company enforces this.
Unfortunately this is a big anoyence, since I am used to use this feature a lot. Creating every file manually and copying the code by hand isn't a pleasure.
The strange thing is that it worked like a charm for... since last year. I did no updates or whatsoever in the last days.
And as mentioned, restarting VS allowes a few operations and then locks up again.
I tried the suggestion to add the resharper cache file to gitignore but without success
In addition adding a new class also stopped working.
I get the popup to enter the name and after that nothing happens...
I tried it different times but no success....
This is even more annoying than the read-only problem :(
Hello everyone,
We have received a message from the Microsoft team that they have fixed the issue. So now everything should work fine without our workaround. Please let us know if it's not.
Angelina Elycheva
I tested on Community edition, issue is solved now!
(And I confirmed "Git.Operation.EphemeralEditsUseDirtyAttributeOnly" flag in registry is set to 0.)
Thank you and your team members for working on these issues.
----
[Information]
Steps for uninstalling extension
https://learn.microsoft.com/en-us/visualstudio/ide/finding-and-using-visual-studio-extensions?view=vs-2019
In my case, issue caused by following condition.
Workaround:
https://github.com/turqTanza/GitFeatureFlagAdjusterForRsharp/
(There may be side effects so at your own risk.)
Related links:
gruthor wrote:
This issue in VS2019 is caused by Visual Studio's bug.
https://developercommunity.visualstudio.com/t/Visual-Studio-2019-Git-plug-in-breaks-IV/10111861
Currently, I think this issue is only on Community edition.
I think you have following options:
I was consistently running into this issue and I think I figured out why (at least for me). I had the ReSharper cache set to use the directory my project was in, this was locking a file and making git very unhappy:
To fix this I added the _ReShaper.Caches file to the .gitignore, and this seems to have cleared up the issue with the read only file errors.
Hope this helps!
Thank you for your quick answer, Tanza!
I tried to add the line in bold in .gitignore:
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
_ReShaper.Caches
but it still does not work. I will look to the other propositions made in the discussions your message dotted at and will come back if any of them work.
Hello everyone,
We've discovered that the problem seems to be related to some VS A/B testing mechanism which could remotely enable and disable features for users
Please try the suggestion from this comment and let me know how it goes for you.
Thank you.
Hi Angelina,
this seems to fix the problem. Also the one where adding classes wasn't possible anymore.
It only works when I execute the cmd as mentioned, which includes the registry fix. Only merging the reg file and then starting VS as usual didn't help.
Thanks for your help and best regards
This issue started for me last week. Here's my configuration:
JetBrains ReSharper 2022.1.2 Build 221.0.20220601.154737 built on 2022-06-01
ReSharper 2022.1.20220601.161736
Microsoft Visual Studio Enterprise 2019
Version 16.11.17
VisualStudio.16.Release/16.11.17+32630.194
Microsoft .NET Framework
Version 4.8.04084
Installed Version: Enterprise
Visual C++ 2019 00435-60000-00000-AA439
Microsoft Visual C++ 2019
.NET Core Debugging with WSL 1.0
.NET Core Debugging with WSL
ADL Tools Service Provider 1.0
This package contains services used by Data Lake tools
ASA Service Provider 1.0
ASP.NET and Web Tools 2019 16.11.110.1451
ASP.NET and Web Tools 2019
ASP.NET Web Frameworks and Tools 2012 16.11.110.1451
For additional information, visit https://www.asp.net/
ASP.NET Web Frameworks and Tools 2019 16.11.110.1451
For additional information, visit https://www.asp.net/
Azure App Service Tools v3.0.0 16.11.110.1451
Azure App Service Tools v3.0.0
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.6.1000.0
Microsoft Azure Data Lake Tools for Visual Studio
Azure Functions and Web Jobs Tools 16.11.110.1451
Azure Functions and Web Jobs Tools
Azure Stream Analytics Tools for Visual Studio 2.6.1000.0
Microsoft Azure Stream Analytics Tools for Visual Studio
C# Tools 3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Common Azure Tools 1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Fabric.DiagnosticEvents 1.0
Fabric Diagnostic Events
File Differ 2.0.28
The easiest way to diff two files directly in Solution Explorer
IntelliCode Extension 1.0
IntelliCode Visual Studio Extension Detailed Info
JetBrains ReSharper 2022.1.2 Build 221.0.20220601.154737
JetBrains ReSharper package for Microsoft Visual Studio. For more information about ReSharper, visit http://www.jetbrains.com/resharper. Copyright © 2022 JetBrains, Inc.
Markdown Editor 1.12.253
A full featured Markdown editor with live preview and syntax highlighting. Supports GitHub flavored Markdown.
Microsoft Azure HDInsight Azure Node 2.6.1000.0
HDInsight Node under Azure Node
Microsoft Azure Hive Query Language Service 2.6.1000.0
Language service for Hive query
Microsoft Azure Service Fabric Tools for Visual Studio 16.10
Microsoft Azure Service Fabric Tools for Visual Studio
Microsoft Azure Stream Analytics Language Service 2.6.1000.0
Language service for Azure Stream Analytics
Microsoft Azure Stream Analytics Node 1.0
Azure Stream Analytics Node under Azure Node
Microsoft Azure Tools for Visual Studio 2.9
Support for Azure Cloud Services projects
Microsoft Continuous Delivery Tools for Visual Studio 0.4
Simplifying the configuration of Azure DevOps pipelines from within the Visual Studio IDE.
Microsoft JVM Debugger 1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
Microsoft Library Manager 2.1.126+g11d4cf0d0c.RR
Install client-side libraries easily to any web project
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual C++ Wizards 1.0
Microsoft Visual C++ Wizards
Microsoft Visual Studio Tools for Containers 1.2
Develop, run, validate your ASP.NET Core applications in the target environment. F5 your application directly into a container with debugging, or CTRL + F5 to edit & refresh your app without having to rebuild the container.
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 5.11.2
NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
ProjectServicesPackage Extension 1.0
ProjectServicesPackage Visual Studio Extension Detailed Info
Razor (ASP.NET Core) 16.1.0.2122504+13c05c96ea6bdbe550bd88b0bf6cdddf8cde1725
Provides languages services for ASP.NET Core Razor.
Snapshot Debugging Extension 1.0
Snapshot Debugging Visual Studio Extension Detailed Info
SQL Server Data Tools 16.0.62205.05200
Microsoft SQL Server Data Tools
ToolWindowHostedEditor 1.0
Hosting json editor into a tool window
TypeScript Tools 16.0.30526.2002
TypeScript Tools for Microsoft Visual Studio
Visual Basic Tools 3.11.0-4.22108.8+d9bef045c4362fbcab27ef35daec4e95c8ff47e1
Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
Visual F# Tools 16.11.0-beta.21514.6+b6c2c4f53ea3a08fa603ea93d6d2f808a62a21d1
Microsoft Visual F# Tools
Visual Studio Code Debug Adapter Host Package 1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio
Visual Studio Container Tools Extensions 1.0
View, manage, and diagnose containers within Visual Studio.
Visual Studio Tools for Containers 1.0
Visual Studio Tools for Containers
Visual Studio Tools for Kubernetes 1.0
Visual Studio Tools for Kubernetes
Hello John Hildebrant
Please try the suggestion from this comment and let me know how it goes for you.
Thank you.
For me it seem to work.
The "MoveToFile" issue and the problem with adding new classes work now.
Thanks for your efforts and best regards
Yesterday I updated my VS 2022 to the latest and Resharper started working at 2019. Thanks guys 👍
This morning (Aug 26, 2022), I updated to VS 2019 Community 16.11.18 (Visual C++) and ReSharper 2022.1.2 and had the bug: 'Refactoring failed - Files still read-only' which lead me on this page...
This issue is caused by a Visual Studio's bug.
(Maybe fixed in next build)
VS2019 Professional/Enterprise is avoided by deploying new remote configurations.
But VS2019 Community is still bugging.
(I think Microsoft is not deploying to Community edition users)
If you think use workaround, please check the comment.
Maria Pleskunina
I reinstalled latest Resharper for VS 2019 Version 16.11.17, still no good.
I also uninstalled GIT Extension and GitHub Extension for VS, no good.
I was able to do Tools => Options => Source Control => Plug-in Selection => Current source control plug-in => None and make it work, but trust me nobody would prefer this option.
Please keep us updated on the fix progress, thanks!
EDIT: I switched the Current source control plug-in back to "Git", no good again.
Disabled Resharper, and then Visual Studio's own renaming tool works fine. Re-enabled Resharper, refactory tool WORKED FOR ONE TIME and then goes back to error.
Dear Frederic, please read previous comment.
This support page is not for VS2019.
Recent issues in VS2019 are discussed in the comments section and on YouTrack.
ex: https://youtrack.jetbrains.com/issue/RSRP-338404/Refactoring-failed-File-still-readonly#focus=Comments-27-6352455.0-0
* If not focused to comment, please find "temporary workaround".
dear Tanza,
thank you, I was confused indeed. The registry corrective provided by Denis Korneev (28 Jul 2022) in the zip file "vs2019_gitplugin_fix.zip" fixes the problem.
Hi all after seeing this problem for the second time in years, I used the age old trick to fix everything with a new update of resharper (as I usually do)
Resharper -> Options -> CleanCache -> Restart VS 2019 -> Let it rebuild the intellisense -> Try Refactor moving a file or class -> it works again as usual.
It seems like between upgrades the Resharper Cache is locking something.
Just wanted to share how I was luckily able to get around this insane bug.
Angelina Elycheva thanks for the suggestion:
This still does not work for me. I'm in VS 2019.
JetBrains, please prioritize this fix. It is a blocking issue for me. In fact, even after restarting Visual Studio, I still cannot refactor a method name. This is really, extremely frustrating and an incredible waste of time for us to deal with.
Tanza
Just installed your extension on VS 2019 (stuck with it due to Unity 3D) and it seems to be working. Thank you very much for this.
Hello Dev Sa, gruthor
Could you please let us know the following info:
Thank you in advance.
Angelina Elycheva
Yes to all
Angelina Elycheva
Yes to all, as well.
The fix Tanza posted appears to have solved the issue.
Thanks.
Hello Dev Sa, gruthor
thank you for the replies.
Could you please check if the issue is reproduced when the workaround is not applied? It seems that the issue should be fixed now for Community users as well.
Angelina Elycheva Sure. Can you explain the best way to uninstall the workaround to test this?
gruthor
If you had used the extension fix please find the extension (GitFeatureFlagAdjusterForRsharp) in VS Extensions | Manage Extensions and select to uninstall it.
Angelina Elycheva yes, the new version of VS Community solved the issue. Thanks!