Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New tmp file is created when "Compare" is used and "Automatically insert licence headers in new files" is enabled in Visual Studio 2022 options #176

Open
CIO-COSINE opened this issue Nov 25, 2022 · 2 comments

Comments

@CIO-COSINE
Copy link

CIO-COSINE commented Nov 25, 2022

Related to Issue #165
Visual Studio 2022 v17.4.1
LicenceHeaderManager v5.0.1

Other extensions:
Visual Studio 2022 Defaults
Live Share 2022
Productivity Power Tools 2022
Xamarin Templates , Android & Apple SDK
Progress Telerik UI for Xamarin, WPF, ASP.NET MVC, ASP.NET Core

Steps to reproduce:

  1. Install LicenceHeaderManager v5.0.1 for Visual Studio 2022
  2. Enable "Automatically insert licence headers in new files"

image

  1. Open Solution under source control (TFS 2010 in my case)
  2. Pick a file (in my case, any .cs or .cshtml file)
  3. Right-click and select "Compare"
  4. The Diff window is opened, but also a tmp file
    image

This seems to occur to file extensions that are under the "Languages" window in the Licence Header options:

image

For example, this does not occur when comparing .resx or .scss files.

The issue goes away if "Automatically insert licence headers in new files" is disabled.

@MichaelKetting
Copy link
Member

@ciozmi Thank you for reporting this. I can reproduce this behavior with Git by first adding a change to the file and then selecting "Compare with unmodified"

@CIO-COSINE
Copy link
Author

CIO-COSINE commented Nov 30, 2022

I also tested the above steps in Visual Studio 2017. Same setup more or less.

No new file is created as above, however the following message appears:

image

It is not 100% reproducible in all cases in Visual Studio 2017 as with Visual Studio 2022.

The following appears in the Output Pane:
2022-11-30 20:07:23,813 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed System.NotImplementedException: Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL)) at EnvDTE.ProjectItem.Open(String ViewKind) at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\CoreHelpers.cs:line 301 at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 172 at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\LicenseHeadersPackage.cs:line 406 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 272

I hope these help. This seems to be related to Issue #162

Update: There are actually two types of errors that occur by doing the above in Visual Studio 2017. Below is the Output for the other error:
2022-11-30 20:01:07,397 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed System.Runtime.InteropServices.COMException (0x80004005): Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL)) at EnvDTE.ProjectItem.get_FileNames(Int16 index) at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 216 at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 170 at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\LicenseHeadersPackage.cs:line 406 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 272 2022-11-30 20:07:20,150 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed System.NotImplementedException: Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL)) at EnvDTE.ProjectItem.Open(String ViewKind) at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\CoreHelpers.cs:line 301 at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 172 at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\LicenseHeadersPackage.cs:line 406 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 272

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants