Hello,
I have been experiencing issues with CodeRush Cleanup. It doesn't run on certain files. I have tried to uninstall the CodeRush extension and then reinstall it with no success. I uninstalled the extension using the instructions found here: https://supportcenter.devexpress.com/ticket/details/t713743
The following text is from the Package Log. I opened Visual Studio and opened a file that is causing the issue and then saved it. CodeRush should have ran and changed the header along with other minor changes.
Code2020.03.31 10:41:28.4638 Error: Message: One or more errors occurred.
2020.03.31 10:41:28.4638 Error: Type: System.AggregateException
2020.03.31 10:41:28.4638 Error: Source: mscorlib
2020.03.31 10:41:28.4638 Error: StackTrace:
2020.03.31 10:41:28.4638 Error: at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
2020.03.31 10:41:28.4638 Error: at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
2020.03.31 10:41:28.4638 Error: at System.Threading.Tasks.Task`1.get_Result()
2020.03.31 10:41:28.4638 Error: at DevExpress.CodeRush.Foundation.CodeCleanUp.CleanUpOnSaveService.ProcessDocumentSaved(ITextDocument textDocument)
2020.03.31 10:41:28.4638 Error: InnerException:
2020.03.31 10:41:28.4638 Error: Message: Unable to cast object of type 'Microsoft.CodeAnalysis.VisualBasic.Syntax.MemberAccessExpressionSyntax' to type 'Microsoft.CodeAnalysis.VisualBasic.Syntax.IdentifierNameSyntax'.
2020.03.31 10:41:28.4648 Error: Type: System.InvalidCastException
2020.03.31 10:41:28.4648 Error: Source: Microsoft.CodeAnalysis.VisualBasic
2020.03.31 10:41:28.4648 Error: StackTrace:
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitHandlesClauseItem(HandlesClauseItemSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.HandlesClauseItemSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SeparatedSyntaxList`1 list)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitHandlesClause(HandlesClauseSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.HandlesClauseSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitMethodStatement(MethodStatementSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodStatementSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitMethodBlock(MethodBlockSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.MethodBlockSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitClassBlock(ClassBlockSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.ClassBlockSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitListElement[TNode](TNode node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitList[TNode](SyntaxList`1 list)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.VisitCompilationUnit(CompilationUnitSyntax node)
2020.03.31 10:41:28.4648 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.CompilationUnitSyntax.Accept[TResult](VisualBasicSyntaxVisitor`1 visitor)
2020.03.31 10:41:28.4658 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxRewriter.Visit(SyntaxNode node)
2020.03.31 10:41:28.4658 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replacer`1.Visit(SyntaxNode node)
2020.03.31 10:41:28.4658 Error: at Microsoft.CodeAnalysis.VisualBasic.Syntax.SyntaxReplacer.Replace[TNode](SyntaxNode root, IEnumerable`1 nodes, Func`3 computeReplacementNode, IEnumerable`1 tokens, Func`3 computeReplacementToken, IEnumerable`1 trivia, Func`3 computeReplacementTrivia)
2020.03.31 10:41:28.4658 Error: at Microsoft.CodeAnalysis.VisualBasic.VisualBasicSyntaxNode.ReplaceCore[TNode](IEnumerable`1 nodes, Func`3 computeReplacementNode, IEnumerable`1 tokens, Func`3 computeReplacementToken, IEnumerable`1 trivia, Func`3 computeReplacementTrivia)
2020.03.31 10:41:28.4658 Error: at Microsoft.CodeAnalysis.SyntaxNodeExtensions.ReplaceNode[TRoot](TRoot root, SyntaxNode oldNode, SyntaxNode newNode)
2020.03.31 10:41:28.4658 Error: at DevExpress.CodeAnalysis.VisualBasic.CodeStyle.ApplyThisQualifierStyleRuleProvider.<Stylize>d__10.MoveNext()
2020.03.31 10:41:28.4658 Error: --- End of stack trace from previous location where exception was thrown ---
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
2020.03.31 10:41:28.4658 Error: at DevExpress.CodeAnalysis.VisualBasic.CodeCleanUp.Providers.ApplyThisStyleCodeCleanUp.<Apply>d__4.MoveNext()
2020.03.31 10:41:28.4658 Error: --- End of stack trace from previous location where exception was thrown ---
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020.03.31 10:41:28.4658 Error: at DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpEngine.<Apply>d__22.MoveNext()
2020.03.31 10:41:28.4658 Error: --- End of stack trace from previous location where exception was thrown ---
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
2020.03.31 10:41:28.4658 Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
2020.03.31 10:41:28.4658 Error: at DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpEngine.<Apply>d__31.MoveNext()
I am also attaching the log file for you to analyze. Hopefully there is something that I am doing wrong and can be corrected. I have some files that work and some files that don't. I also attached the VB code file that is causing the error and not running Cleanup.
I can manually run Organize Methods and it works. If I try to run Code Cleanup manually, it will fail with this same log.
BTW, the IDE when setting up this ticket does not populate. It just says 'No results found'. I am using Visual Studio Professional 2017 Version 15.9.21
Thank you for your assistance!
Nathan
I am also going to attach a zipped folder for the CodeRush Settings from:
I thought maybe it would be helpful.
Thanks,
Nathan
Nathan,
Thank you for such a detailed report. With your data, I was able to reproduce the issue with ease. We will let you know when we fix it. Please bear with us.
Przemyslaw,
Thank you for the update.
Hello Nathan,
We've created a separate thread for this part of your initial post and will examine it:
The IDE list is not populated when creating a CodeRush-related ticket
Thank you for drawing our attention to this issue.