Bug Report T1137878
Visible to All Users

Code Cleanup - CodeCleanupHangedException is raised when executing the Add Copyright Header rule

created 2 years ago

Goal: add my custom copyright template to a code file when doing code cleanup.
Environment: Coderush version 22.2.3, Visual Studio Pro 2022 x64, windows 10 x64, c# plain/empty class to test it on.

Issue: During code cleanup by action via: ctrl + ` I'd like to think about 50% of the time, i get this error with the stack trace (see below). Sometimes i make a change to an irrelevant setting and it works again, and then the next day, with no config change, it breaks again, not really sure why it throws that exception sometimes. I attached the settings i have for the copyright template and all.

Error: The 'Add copyright header' rule encountered an error and applying Code Cleanup was aborted.
Error: Message: The 'Add copyright header' rule encountered an error and applying Code Cleanup was aborted.
Error: Type: DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanupHangedException
Error: HResult: 80131500
Error: Source: DevExpress.CodeAnalysis
Error: StackTrace:
Error: at DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpEngine.<Apply>d__31.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpEngine.<Apply>d__39.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at DevExpress.CodeAnalysis.CodeCleanUp.CodeCleanUpEngine.<Apply>d__40.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at DevExpress.CodeAnalysis.Refactorings.RefactoringAction.<Apply>d__5.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at DevExpress.CodeAnalysis.Refactorings.RefactoringAction.<Apply>d__5.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at DevExpress.CodeAnalysis.Workspaces.RefactoringCodeAction.<GetChangedSolutionAsync>d__33.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at DevExpress.CodeAnalysis.Workspaces.BaseCodeAction.<ComputeOperationsAsync>d__20.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at Microsoft.CodeAnalysis.CodeActions.CodeAction.<ComputeOperationsAsync>d__26.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at Microsoft.CodeAnalysis.CodeActions.CodeAction.<GetOperationsCoreAsync>d__23.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at Microsoft.CodeAnalysis.Editor.Implementation.Suggestions.SuggestedAction.<InvokeWorkerAsync>d__20.MoveNext()
Error: — End of stack trace from previous location where exception was thrown —
Error: at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
Error: at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Error: at Microsoft.CodeAnalysis.Extensions.IExtensionManagerExtensions.<PerformActionAsync>d__2.MoveNext()

Comments (2)
PW PW
Przemyslaw Wlodarczak (DevExpress) 2 years ago

    Hi,

    I reproduced this issue. We will fix it shortly. As a workaround, you can disable the "Auto line terminator" check box for the "h" template:

    1. Open the CodeRush->Code Templates… menu item;
    2. Expand the 1-key node in the tree list and find the h template;
    3. Disable the "Auto line terminator" check box:

    DisableAutoLineTerminator.png

    If you use the settings I corrected for you in the T1137907 ticket, it contains this workaround already applied. Let me know if this helps.

      You a doctor? because my headache is now gone lol. I can confirm it is working in the settings you provided in the other ticket. Glad i could also help report a bug from my usage. Thanks again!

      Answers approved by DevExpress Support

      created 2 years ago

      We have addressed the issue described in this ticket and will include a fix in our next maintenance update. Should you need to apply our fix prior to official release, you can request a hotfix here.

      Important Notes:

      • Hotfixes may be unavailable for Early Access/Beta builds or updates set for release within a week.
      • .NET only: in the NuGet Package Manager, use your personal NuGet feed and check the "Include prerelease" option to view the hotfix package in the "Updates" tab.
        Comments (2)

          Glad i could help find a bug! ;) appreciate the response!

          PW PW
          Przemyslaw Wlodarczak (DevExpress) 2 years ago

            You are welcome! Thank you for your cooperation. We totally appreciate it.

            Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

            Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.