Hi
I've been using CRR for a while now and generally the clean up button goes well, however I've just ran it on a file - and been sat waiting for about 15 minutes now. :(
I have a MS VS Delay Notification icon on the bottom right, VS 2017 seems to have "hung" as I can't click anything but looking at task manager the CPU % of VS 2017 is fluctuating around 15-18%, the memory is about the same value, though slowly increasing.
It's very unusual for the clean up to take this long - normally very quick (though I still have to press it THREE times to clean up fully). I'm not sure what it's doing maybe the clean up has changed some properties and has to edit other files, but looking at the SVN "Commit" screen, no other files have been modified.
There is no visual log / process I can see so not sure if I should end the process of VS2017, but will have to!
Not sure what I can send you to look at (any logs?) There is nothing in my "appdata" folder that looks like it will help:
C:\Users\[username]\AppData\Local\Microsoft\VisualStudio\15.0_93465623
Thanks for any help / ideas you might have on this.
Alan
I've just rebooted, and done nothing else except open VS2017 and the solution, then clicked on the "Run Code Clean up" button again on the same file… Exactly the same response, it just hung.
I've attached the CS file, in case that might help on what the issue might be., though it might not help much without the base classes etc. Forgive the state of the file, it's not my code :-)
hi, sorry, another update.
I've removed all the #regions /endregion from the file and moved the designer part of the code into a codebehind file (xxx.designer.cs) and removed some of the using statements that VS grayed out.
Pressing the button now WORKS - so I've attached the file at the point just before pressing the button, it took a second or two, but it worked. Not sure if you can see what the issue is or not.
Thanks
Here is the file AFTER pressing the button for the first time - the 2nd/3rd times I press the button is basically for the spacing as it doesn't always do the spacing correctly first time
Hi Alan,
Thank you for pointing out this issue and providing the problematic code file. We are concerned to hear that you faced this issue with our product. Code Cleanup tries to apply every rule until it makes any change. It seems that the logic of a Code Cleanup rule works incorrectly on your file and the Code Cleanup engine tries to apply it again. Please give us some time so that we can examine the files. It would be also helpful if you provide us with CodeRush log files that are located in the following folder:
*%localappdata%\CodeRush\Logs*
Hi
Thanks for getting back to me. I've not got the logs from earlier as I think I deleted them by mistake, so I've reverted the file from SVN and replicated the issue to create new logs. I've zipped them up as well as my CRR settings as well for you.
The log files - the ones at 13:42 and 13:45 are the ones where I've replicated the issue . Looking at them they don't seem to tell us much about what the problem might be, but hopefully you can work it out.
I have a feeling it might have something to do with the Infragistics libraries and the using statements - I've had an issue with these in the past, but that's only me guessing.
https://www.devexpress.com/Support/Center/Question/Details/T463225/code-cleanup-nullreferenceexception-during-cleanup-if-remove-redundant-type-qualifier-is
hopefully this helps. if I manage to replicate it, I'll let you know.
GREAT UPDATE!!!
Hi. I've reverted the file back to the SVN version before all my changes… turned off all the clean up options I had on - and then went through them ONE at a time, running only one option, then undo the changes, run the next option, undo etc… All worked fine EXCEPT the one option where I had an issue before - see link in prev comment
When I turned on the option "REMOVE REDUNDANT TYPE QUALIFIERS" - all others are OFF - when I clicked the clean up button, it hung. So the issue is something to do with this part. Maybe because the designer code is not in a code behind?
Hopefully this helps.
Turning all the options back on EXCEPT the one mentioned above, the code clean up works ok - so 100% the above option mentioned causing the issue (sorry for the comments, can't seem to edit)
Hi
More good news for you, I've narrowed it down even more to what the exact problem is.
In the "InitializeComponent()" section the lines that have:
Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance();
are the ones causing the problem - I'm guessing it's removing the namespace to leave "Appearance" and as with the other ticket the Appearance is part of Windows.Forms as well as Infragistics.Win, so the name space HAS to remain in this case.
If I change it to "XYZ.Appearance appearance1 = new XYZ.Appearance();" and put using XYZ = Infragistics.Win at the top, then the clean up works.
Not sure how you would solve this at your end… (if at all) but by me moving the designer code to the code behind pages (designer.cs) it's not a problem.
The only solution I can think of for you to do is to IGNORE making changes to code within the "InitializeComponent()" method on winform applications, but still remove redundant types qualifiers from the rest of the code.
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:
Infragistics.Win.Appearance a = new Infragistics.Win.Appearance();
in the code and clean up works changing it to
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.
Thank you for your cooperation while searching for the cause of this issue. We greatly appreciate this. We have reproduced the problem and are now working on its fix.
To process your last comment in the most efficient manner, I've created a separate ticket on your behalf: Code Cleanup - 'Remove redundant type qualifier' rule doesn't work in some cases. It has been placed in our processing queue and will be answered shortly.
Excellent news - thanks for looking into this - glad to help where I can. Love the product and it gets better with each release.
Thank you for compliments to our product.