Skip to content

Exception when cleaning up all code: InsertFileHeaderDocumentStart must be called on the UI thread #859

@FStapenhorst

Description

@FStapenhorst

Environment

  • Visual Studio version: 2022 Professional 17.0.0
  • CodeMaid version: 12.0
  • Code language: C#

Description

I run "Clean all code" and I get this exception for almost every file:

[CodeMaid Warning 08:10:56 ] Activation was not completed before cleaning began for 'Archive.cs'
[CodeMaid Handled Exception 08:10:59 ] CodeMaid Cleanup for 'Archive.cs' was stopped: System.Runtime.InteropServices.COMException (0x8001010E): InsertFileHeaderDocumentStart must be called on the UI thread.
   at Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread(String callerMemberName)
   at SteveCadwallader.CodeMaid.Logic.Cleaning.FileHeaderLogic.InsertFileHeaderDocumentStart(TextDocument textDocument, String settingsFileHeader) in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\FileHeaderLogic.cs:line 166
   at SteveCadwallader.CodeMaid.Logic.Cleaning.CodeCleanupManager.RunCodeCleanupCSharp(Document document) in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\CodeCleanupManager.cs:line 264
   at SteveCadwallader.CodeMaid.Logic.Cleaning.CodeCleanupManager.<>c__DisplayClass19_0.<Cleanup>b__0() in C:\projects\codemaid\CodeMaidShared\Logic\Cleaning\CodeCleanupManager.cs:line 170
   at SteveCadwallader.CodeMaid.Helpers.UndoTransactionHelper.Run(Action tryAction, Action`1 catchAction) in C:\projects\codemaid\CodeMaidShared\Helpers\UndoTransactionHelper.cs:line 55

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions