rubicon-oss / LicenseHeaderManager

Manage license headers for your source code files in Visual Studio

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

License Header Manager Execution of Asynchronous Task Failed

MrMontana1889 opened this issue · comments

See a screen cap attached.

Here is the output from the output window:

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.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.<g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 272

I cannot reproduce it on purpose. It just happens randomly. It only started relatively recently (I "think" around the release of 4.0). This was one of the most stable extensions at one point but now it is not.
ErrorMsg

It would seem that license headers should not be inserted when debugging code. That doesn't make a lot of sense.

HTH.

@MrMontana1889 Thanks for reporting this. Yes, we had to adapt to the async-requirements of recent Visual Studio updates.

Could you please elaborate on

It would seem that license headers should not be inserted when debugging code. That doesn't make a lot of sense.

Are you saying that the error happens while you're debugging your code and somehow triggering the insertion of a license header?

From what I can ascertain, the message only occurs when I am debugging. It happens seemingly randomly (not "every time" I debug but more than 75% of the time). It seems like it wants to insert the header into the source file that I am stepping into, whether it is part of the currently solution or another component. It's really hard to say, one way or the other though.

@MrMontana1889 Do you have the checkbox "automatically insert license header into new files" checked or unchecked?

@MichaelKetting Hey I get this message too and i have the "automatically insert license header into new files" checked , is there any new insight?

For me it happens when I unload/reload a project in visual studio 2015

@orSolocate Thank you for confirming this. I haven't set this flag and am using ReSharper + Silent-Code-Cleanup instead. I can't verify/falsify this scenario right now.

This is the licenseHeaderManager output window, maybe will help you understand the issue:

2022-02-28 16:21:36,436 [INFO] LicenseHeaderManager.LicenseHeadersPackage: Logger has been initialized
2022-02-28 16:21:37,166 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:21:43,342 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at EnvDTE.ProjectItem.get_IsOpen(String ViewKind)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 212
2022-02-28 16:21:43,372 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:21:49,716 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__0(Language x)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.GetLanguageFromExtension(String extension)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\CoreHelpers.cs:line 297
   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
2022-02-28 16:21:49,797 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at EnvDTE.ProjectItem.get_IsOpen(String ViewKind)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\Extensions.cs:line 212
2022-02-28 16:21:50,946 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__0(Language x)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.GetLanguageFromExtension(String extension)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager\Utils\CoreHelpers.cs:line 297
   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
2022-02-28 16:22:11,288 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:22:11,288 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:22:15,382 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Save options to config file
2022-02-28 16:22:15,397 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:22:15,413 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2022-02-28 16:22:15,946 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file

@orSolocate Thank you for the trace!

@MichaelKetting any update about it mate? I know VS15 is an oldie but this is what my team use.. we really want to use your add-on.

@orSolocate sorry, no updates on this. Either way, VS2015 isn't getting any new builds anymore for License Header Manager because of constraints in the compatibility matrix of VS Extensions => it would mean doing a lot of extra stuff to produce dedicated builds for older versions of Visual Studio.

:( I see, thank you mate!

@MichaelKetting the same problem happens for me on VS 2022. "Automatically insert license header in new files" is enabled. It happens on unloading/releoading of projects and when I added a new file and try to undo the folder containing it in the "Git Changes" window.
This bug is so annoying that our team is looking for alternatives to this extension :/

Here is the content of the output window:

2023-03-01 08:06:03,981 [INFO] LicenseHeaderManager.LicenseHeadersPackage: Logger has been initialized
2023-03-01 08:06:04,495 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2023-03-01 10:41:58,727 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:41:58,732 [INFO] LicenseHeaderManager.Options.Model.BaseOptionModel`1: Load options from config file
2023-03-01 10:42:00,158 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272
2023-03-01 10:42:03,650 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:42:04,746 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272
2023-03-01 10:44:51,023 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:44:52,893 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272
2023-03-01 10:44:52,894 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Falscher Parameter. (Exception from HRESULT: 0x80070057 (E_INVALIDARG))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:44:54,046 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272
2023-03-01 10:45:59,461 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:47:05,493 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272
2023-03-01 10:47:05,493 [ERROR] LicenseHeaderManager.Utils.Extensions: Could not determine if project item  is open. Assuming it is closed.
System.ArgumentException: Value does not fall within the expected range.
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Dte.IdeAutomationObject`1.<>c__21`1.<RunOnMainThreadHr>b__21_0(OutHrFunc`1 innerFunc)
   at LicenseHeaderManager.Utils.Extensions.IsOpen(ProjectItem item) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 212
2023-03-01 10:47:06,746 [ERROR] LicenseHeaderManager.Utils.Extensions: Asynchronous Task failed
System.NullReferenceException: Object reference not set to an instance of an object.
   at LicenseHeaderManager.Core.LicenseHeaderReplacer.<>c__DisplayClass9_0.<GetLanguageFromExtension>b__1(String y)
   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
   at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
   at LicenseHeaderManager.Utils.CoreHelpers.TryOpenDocument(ProjectItem item, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\CoreHelpers.cs:line 297
   at LicenseHeaderManager.Utils.Extensions.GetContent(ProjectItem item, Boolean& wasAlreadyOpen, ILicenseHeaderExtension extension) in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 172
   at LicenseHeaderManager.LicenseHeadersPackage.<FinishedAddingItemAsync>d__63.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\LicenseHeadersPackage.cs:line 406
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at LicenseHeaderManager.Utils.Extensions.<<FireAndForget>g__ForgetAwaited|9_0>d.MoveNext() in C:\Build\1776828f99d31c99\LicenseHeaderManager.Shared\Utils\Extensions.cs:line 272

scenario: Add / Existing Project ...