[DevExpress Support Team: CLONED FROM T523216: Coderush cleanup taking ages - or hung?]
It's very strange that it's the same "Appearance" problem as before which was fixed back in 16.2.4. After splitting the code into two files I can easily put:
C#Infragistics.Win.Appearance a = new Infragistics.Win.Appearance();
in the code and clean up works changing it to
C#var a = new Infragistics.Win.Appearance();
and keeping the namespace in place (even with using at the top). Clean up works on the designer code as well.
Hi Alan,
Thank you for providing code samples. The 'Remove redundant type qualifiers' Code Cleanup rule works based on of the 'Remove Type Qualifier' refactoring's engine. This refactoring removes type qualifiers only in cases when it doesn't change the declaration of a current reference and doesn't require adding a new alias. So, please specify what using references are declared in your file or provide us with entire code of a problematic file and if the 'System.Windows.Forms' namespace reference is declared then, the Code Cleanup works correctly.
As concerns designer files, we don't skip designer files, because Code Cleanup can apply only on an active file. The user himself decides to apply Code Cleanup or not for a current file. We are working on possibility to run Code Cleanup on a folder, on a project and on a solution and there we will implement the option for skipping designer files.
Hi
Thanks for the reply. Note that the code I'm cleaning is very old code written by someone else where the designer code is in the same file as the class code - (personally I have it in a separate file as a partial class) - Because design code generally puts the namespace on the objects (e.g. system.windows.forms.appearance) and not have using, it's this that is causing the issue.
I'm more than happy to split the code into two files as it "should" be and then run the clean up process on the main file . However, sometimes I forget and click the button to clean up - it's cases like this where it seems to hang.
Is it possibly for it to not hang, but instead bring up a warning and exit the clean up routine???
Code cleanup through out the project/folders could be quite dangerous, I tend to do it file by file as I'm altering existing code.
Thank you for your clarifications. We will consider the possibility of automatically skipping some auto-generated parts of the code file (e.g. the InitializeComponent methods in windows forms applications) in the Code Cleanup feature. Also, we will improve the Code Cleanup engine to prevent possible hangs in the future.
As for applying Code Cleanup to folders/projects, we understand that it is a dangerous operation. So, we are working on making it stable and on providing the capability to undo changes and return to the previous state in a simple and convenient way.
Hi Alan,
Having examined the possibility of implementing this functionality, we found that our current Code Cleanup engine does not allow us to do this. At the moment, all Code Cleanup rules are designed to be applied to a whole syntax node (a code file). To add the capability to exclude some parts from processing, it is necessary to make significant changes to the current architecture of the Code Cleanup engine to make it possible to apply cleanup rules to arbitrary code blocks. Taking this into account, it is unlikely that we will be able to implement this functionality in the near future.
Hi Alexander
Many thanks for the quick reply, much appreciated.
What are the chances of adding in checks so it doesn't hang but instead just report the issue?
Hi Alan,
We are working on it in the context of your initial ticket. To prevent possible Code Cleanup hanging, we will add a check to detect that applying a current rule hangs. In this case, the engine will break processing of this rule and report about it in the CodeRush log. So, all Code Cleanup rules except for problematic ones will be applied. Currently, we don't plan to add any additional notification of these cases except logging.
Hi,
Thanks for that, much appreciated - Will they be some sort of visual indicator that it failed so I know to check the log, or try and fix the code to clean up again?
Hi,
We have added a check on possible Code Cleanup hanging. The final implementation works as follows: if applying a current rule hangs then CodeRush aborts the Code Cleanup process and keeps a file as before applying it. Wherein Visual Studio shows the standard notification in the top of the editor. I have recorded and attached to this comment a screencast that illustrates this behavior.
Also, we have prepared a build that contains these changes: DevExpress.CodeRush.Roslyn-17.1.4.17166.vsix. I suggest you install it and see how this check works on your side.
Hi
Many thanks for this, I'll download the build and try it out and see how it goes. Judging by the video it looks much better than hanging. I'll report back when I've tested.
Hi again,
I've installed the fix and tested it, seems to work much better and I get the error in the log file. However I don't get the yellow bar at the top like you did in your video - instead I get a message box prompt titled "Microsoft Visual Studio" with the error text of "One or more errors occurred", See Attached . but still way better than before. Thanks again!
Thank you for testing this build and your feedback. Please give us some time to determine the reason that the notification is not shown on your side.
Hi,
Thank you for your patience. We tried to reproduce this behavior but our attempts were unsuccessful. To help us determine what causes this behavior, please call Code Cleanup on the problematic file again and provide us with the Visual Studio activity log (see this article: Troubleshooting Extensions with the Activity Log) and CodeRush log files that are located in the following folder by default:
%localappdata%\CodeRush\Logs\
Hi
I cleared down the activitylog and the CR logs, and restarted VS, so have fresh logs - Please find these attached for you.
I don't recall any sort of option to turn off the yellow bar, but come to think of it, I've not seen it for ages - Note also that VS is on the latest update - v15.2 (26430.13) Release
Here is the info from the Help/About screen:
Microsoft Visual Studio Enterprise 2017
Version 15.2 (26430.13) Release
VisualStudio.15.Release/15.2.0+26430.13
Microsoft .NET Framework
Version 4.6.01590
Installed Version: Enterprise
Visual Basic 2017 00369-60000-00001-AA007
Microsoft Visual Basic 2017
Visual C# 2017 00369-60000-00001-AA007
Microsoft Visual C# 2017
Visual C++ 2017 00369-60000-00001-AA007
Microsoft Visual C++ 2017
Advanced Installer Extension 14.0.2
Advanced Installer Extension. For more information visit the Advanced Installer website at www.advancedinstaller.com. Copyright © Caphyon LTD. All rights reserved.
AnkhSVN - Subversion Support for Visual Studio 2.7.12815.35086
AnkhSVN - Subversion Support for Visual Studio 2.7.12815.35086
* Ankh.Package 2.7.12815.35086
* Subversion 1.9.5 via SharpSvn 1.9005.3940.224
* Git/LibGit2 0.24.0 via SharpGit 0.2401.1116.230
SharpSvn is linked to: Apr 1.5.2, Apr-util 1.5.4, Cyrus Sasl 2.1.26, eXpat 2.2.0, LibSSH2 1.8.0, OpenSSL 1.0.2k 26 Jan 2017, Serf 1.3.9, SQLite 3.17.0, Subversion 1.9.5-SharpSvn, Utf8proc 1.1.5, ZLib 1.2.8
SharpSvn is optionally linked to: Berkeley DB 4.4.20, SharpPlink 0.67.0(SharpSvn)
SharpGit is linked to: Apr 1.5.1, Apr-Util 1.5.4, eXpat 2.1.0, Libgit2 0.24.0, LibSSH2 1.7.0, OpenSSL 1.0.2h 3 May 2016, Subversion 1.9.3, Utf8proc 1.1.5, ZLib 1.2.8
ASP.NET and Web Tools 2017 15.0.30503.0
ASP.NET and Web Tools 2017
ASP.NET Web Frameworks and Tools 2017 5.2.50303.0
For additional information, visit https://www.asp.net/
Clear MEF Component Cache 1.4
Clears the Visual Studio MEF component cache to fix issues with cache corruption.
CodeRush for Roslyn 17.1.4.0
DevExpress CodeRush for Roslyn package.
Common Azure Tools 1.9
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
Devart SQL Complete 5.6.163
Devart dbForge SQL Complete for Management Studio and Visual Studio
Copyright © 2017 Devart. All rights reserved.
Web: http://www.devart.com/dbforge/sql/sqlcomplete
Support: http://www.devart.com/dbforge/sql/sqlcomplete/support.html
Ordering: http://www.devart.com/dbforge/sql/sqlcomplete/ordering.html
Favorite Documents 2.3.1
Favorites menu for Visual Studio IDE.
File Icons 2.7
Adds icons for files that are not recognized by Solution Explorer
File Nesting 2.6.67
Automatically nest files based on file name and enables developers to nest and unnest any file manually
GhostDoc 5.5.17070.0
Generate XML Comments from your code, maintain clean and up-to-date documentation, produce help documentation in multiple formats, use intelligent source code Spell Checker in Visual Studio.
GitHub.VisualStudio 2.2.0.11
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
Image Optimizer 3.6.103
Uses industry standard tools to optimize any JPEG, PNG and Gifs - including animated Gifs. Can do both lossy and lossless optimization.
JavaScript Language Service 2.0
JavaScript Language Service
JavaScript Project System 2.0
JavaScript Project System
JavaScript UWP Project System 2.0
JavaScript UWP Project System
JustDecompilePackage2017 Extension 1.0
JustDecompilePackage2017 Visual Studio Extension Detailed Info
KofePackagePackage Extension 1.0
KofePackagePackage Visual Studio Extension Detailed Info
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50131.1
Microsoft MI-Based Debugger 1.0
Provides support for connecting Visual Studio to MI compatible debuggers
Microsoft Visual Studio VC Package 1.0
Microsoft Visual Studio VC Package
NuGet Package Manager 4.2.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
Office Developer Tools for Visual Studio 2017 ENU 15.0.26309
Microsoft Office Developer Tools for Visual Studio 2017 ENU
Open Command Line 2.1.179
Opens a command line at the root of the project. Support for all consoles such as CMD, PowerShell, Bash etc. Provides syntax highlighting, Intellisense and execution of .cmd and .bat files.
Redgate ReadyRoll 1.14.4.4009
Extend DevOps processes to your SQL Server databases and safely automate database deployments.
Visit https://www.red-gate.com/readyroll for more information.
Copyright © 2011 Red Gate Software Ltd. All rights reserved.
This software contains components from Component Owl.
SQL Server is a registered trademark of Microsoft Corporation.
Visual Studio is a registered trademark of Microsoft Corporation.
ReadyRoll contains code from the following open source software:
NuGet https://www.nuget.org/
SQL LocalDB Wrapper https://github.com/martincostello/sqllocaldb
Autofac https://autofac.org/
Json.NET https://json.net/
MahApps.Metro http://mahapps.com/
SemVer https://github.com/maxhauser/semver
Log4Net http://logging.apache.org/log4net/
Extended WPF Toolkit https://wpftoolkit.codeplex.com/
Code InfoBox VSX http://www.codeproject.com/Articles/55196/Code-InfoBox-Visual-Studio-Extension-VSX
OctoPack https://github.com/OctopusDeploy/OctoPack
SQLite https://sqlite.org/
This product contains icons from http://www.visualpharm.com distributed under a free backlink license.
For license details or other notices relating to the above software, please see NOTICE.TXT and EULA.rtf in the ReadyRoll application folder.
Redgate SQL Prompt 8.0.2.1513
Write, format, and refactor SQL effortlessly
SlowCheetah - XML config transforms 1.0
This package enables you to transform your app.config or any other XML file based on the build configuration. It also adds additional tooling to help you create XML transforms.
SQL Server Data Tools 15.1.61702.140
Microsoft SQL Server Data Tools
Supercharger 1.1.0.838
Extend Visual Studio with CodeMAP, Intelligent Code Flow Lines, Code Highlighters, SuperFind, Rich Code, Magic Comments etc. More info: http://supercharger.tools
Trailing Whitespace Visualizer 2.5.83
Keeps your code files clean by making it easier than ever to identify and remove any trailing whitespace
Visual Studio Tools for Universal Windows Apps 15.0.26430.06
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
Hi
Just a quick update, Iv'e done a repair on VS 2017 and reinstalled the extensions to see if this might have helped… but no, exactly the same error - but I'm happy that it didn't hang, so it's a step in the right direction :)
Thank you for providing the additional information. I have installed the extensions from your provided Visual Studio about information (except JustDecompile, the last version of this extension doesn't support integration in Visual Studio 2017) and tried to reproduce this behavior, but the notification hint is shown correctly on my side. Please give us some time to examine what can causes this issue on your side.
Hi
The JustCompile version I have is 2017_2_0503_4 - this one is compatible with VS2017. However I've recently found out that Coderush has it built in anyway, so won't be using the JC extension - however it's useful for external DLLs (not in vs).
Sorry to hear you can't reproduce the issue. Take all the time you need - at least I know what the issue is when it errors after clicking the clean up button (or I can look in the log when I don't remember).
Hi,
Thank you for your clarification. To help us narrow down possible causes of this issue, please check whether the functionality of Visual Studio's notify bar works on you side. For this, perform the following steps:
Let us know whether a CodeRush notification hint will be shown.

Hi
I've followed the above steps, and yes, the above notice bar does appear - I've taken a snippet and attached it.
Sorry if this is causing a headache for you.
Hi,
We have prepared a test extension that allows reading the option value showing a hint when any code action throws an error. The extension also allows changing it.
I have attached it to this comment. Please install it and perform the following steps:
Hi
I've followed the steps above, the value was already set to "enabled" . repeated the clean up on the file, got the exact same MS error. changed the value to disabled, same error message.
Thank you for informing us of your results. Please reset Visual Studio settings as described in the following article: How to: Reset Your Settings and check if it solves this issue. Your current settings will be saved at the corresponding step and then you can get back to them. If resetting resolves the issue, please provide us with these saved settings.
Hi
Sorry for the delay, I was just leaving work when you commented. Anyway, I've done it this morning and attached the settings files (before & after) - unfortunately this didn't solve the issue, still the same VS message.
Hi,
Thank you for providing the settings. Please give us some time to examine them.
Hi Alan,
We have reproduced this behavior if Code Cleanup is called from the Visual Studio menu:
Please clarify whether you use this way to call Code Cleanup.
Hi Alex
Wow that is good to hear that you've replicated it… however I'm not sure if I have good news or bad news now.
I use the icon on the TOOLBAR - "Coderush Visualize" to run a clean up, I've added the Coderush Issues Icon there next to it as well.
Never used the clean up in the drop down menu as in your above screen shot (Is there a shortcut key for it, if so, never used it, the menu doesn't show one).
I've just loaded the cs code with the file that won't format to test out the cleanup in the menu - however here is the good news.
BOTH cleanups (menu & toolbar) WORKED, the formatting didn't error at all and it formatted the document as expected.
However - I have recently (yesterday) updated the software to the latest version 17. 1.5 - Which I tend to do every time I get the notification is VS2017. So maybe something has changed in the 17.1.5 code that fixed the formatting issue?
Thanks for taking the time to look into this.
As you can see from the snippet below it's changed the appearance line correctly now and has kept the "infragistics.win" name space there.
private void InitializeComponent() { components = new Container(); var ultraStatusPanel1 = new UltraStatusPanel(); var ultraStatusPanel2 = new UltraStatusPanel(); var appearance1 = new Infragistics.Win.Appearance(); var ultraToolbar1 = new UltraToolbar("Main"); }
Thank you for the clarification.
We have corrected the "Remove redundant type qualifiers" rule in the context of your initial ticket. These changes are included in the 17.1.5 version. So, Code Cleanup doesn't hang on this file after update and processes it correctly.
As for the ways to call Code Cleanup, the icon on the toolbar and the item in the Visual Studio menu work identically. Currently, CodeRush doesn't support notifications about issues on applying Code Cleanup if it was called using these ways. We have plans to implement notifications for these cases in the nearest releases. Now, I suggest you call Code Cleanup from the light bulb menu as it is shown in the screencast attached to this comment. This way supports usage of Visual Studio's notification bar.
Hi
I've uninstalled 17.1.5, and reinstalled the previous version I had - 17.1.4.17166
Opened the code and cleaned up the cs file.
Glad we've finally got to the bottom of this, must have been a headache for you trying to find the issue - apologies I wasn't aware of the calling of cleanup might have been the reason. I'll try and remember in future and test all 3 ways.
Great news that 17.1.5 fixes the cleanup though - Now time to update to latest version again :)
Thank you for informing us. We are happy to hear that calling Code Cleanup from the light bulb menu works as expected on your side.