From f65a97ea93b827f7bd9fd3aa25cb550c6f57e94a Mon Sep 17 00:00:00 2001 From: Justin Nelson Date: Wed, 25 Mar 2026 15:23:19 -0400 Subject: [PATCH] prevent_opening_temp_files Compared new file names against a regex pattern to identify temporary files created by Visual Studio when opening a diff. There will be no attempt to insert a header into these temporary files. --- LicenseHeaderManager.Shared/LicenseHeadersPackage.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LicenseHeaderManager.Shared/LicenseHeadersPackage.cs b/LicenseHeaderManager.Shared/LicenseHeadersPackage.cs index 6d6e80c..d26cfbe 100644 --- a/LicenseHeaderManager.Shared/LicenseHeadersPackage.cs +++ b/LicenseHeaderManager.Shared/LicenseHeadersPackage.cs @@ -17,6 +17,7 @@ using System.IO; using System.Reflection; using System.Runtime.InteropServices; +using System.Text.RegularExpressions; using System.Threading; using EnvDTE; using EnvDTE80; @@ -380,7 +381,7 @@ private void ItemAdded (ProjectItem item) { //An item was added. Check if we should insert a header automatically. var page = GeneralOptionsPageModel; - if (page == null || !page.InsertInNewFiles || item == null) + if (page == null || !page.InsertInNewFiles || item == null || Regex.Match(item.Name, "^vctmp\d+_\d+\.").Success) return; ThreadHelper.ThrowIfNotOnUIThread();