codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.88k stars 352 forks source link

Running "Cleanup Open Code" does not update File Header #1028

Open FerdinandStapenhorst opened 7 months ago

FerdinandStapenhorst commented 7 months ago

Environment

Description

I have a File Header defined in the "Update" section. It looks like this // (C) COPYRIGHT LEVI, RAY & SHOUP, INC. // ALL RIGHTS RESERVED. // CONFIDENTIAL INFORMATION.

It is being inserted when I press Ctr+M, Space but not if I select "Cleanup Open Code" or "Cleanup All Code"

Steps to recreate

  1. Add the File Header as describes
  2. Run "Cleanup Open Code"

Current behavior

It does not add the file header text.

Expected behavior

It should add the file header

codecadwallader commented 7 months ago

Thanks for reporting the issue. I have been able to reproduce it. It looks like a threading issue, where the cleanup open/all commands are running as background tasks compared to running cleanup active document which is invoked on the UI thread.

System.Runtime.InteropServices.COMException (0x8001010E): InsertFileHeaderDocumentStart must be called on the UI thread.