RicoSuter / NuGetReferenceSwitcher

Visual Studio extension to switch between NuGet and project references.
http://nugetreferenceswitcher.org
Microsoft Public License
208 stars 69 forks source link

Error HRESULT E_FAIL has been returned from a call to a COM component. #5

Closed ChristopherElliott closed 9 years ago

ChristopherElliott commented 9 years ago

Upon switching from Project references to Nuget references.

image

Error occurred looking for one of our internal custom packages: "C:\src\vso\Ganon\master\packages\Iro.Cache.1.0.2744.372\lib\net451\Iro.Cache.dll"

Error code was: -2147467259

So my first guess is it is trying to add back references that don't exist anymore.

Note that this happened in the experimental hive so in theory no other plug ins should be affecting yours.

Stack Tace: System.Runtime.InteropServices.COMException (0x80004005): Error HRESULT E_FAIL has been returned from a call to a COM component. at VSLangProj.References.Add(String bstrPath) at NuGetReferenceSwitcher.Presentation.Models.ProjectModel.AddReference(String assemblyPath) in c:\src\Open\NuGetReferenceSwitcher-master\src\NuGetReferenceSwitcher.Presentation\Models\ProjectModel.cs:line 101 at NuGetReferenceSwitcher.Presentation.ViewModels.MainDialogModel.b1a() in c:\src\Open\NuGetReferenceSwitcher-master\src\NuGetReferenceSwitcher.Presentation\ViewModels\MainDialogModel.cs:line 175 at System.Threading.Tasks.Task.InnerInvoke() at System.Threading.Tasks.Task.Execute() --- 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 System.Runtime.CompilerServices.TaskAwaiter.GetResult() at MyToolkit.Mvvm.ViewModelBase.<>cDisplayClass6.<b5>d8.MoveNext() --- 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 System.Runtime.CompilerServices.TaskAwaiter1.GetResult() at MyToolkit.Mvvm.ViewModelBase.<RunTaskAsync>d__01.MoveNext()

ChristopherElliott commented 9 years ago

I understand this one better now. It seems that the stored paths in the *.previous.nugetreferenceswitcher file was old. I imagine this happens when there are errors in switching from Nuget references to Project references to start with and then we are in this state where the references from the last conversion are used. Probably better to focus on bugs related to switching to project references and this one should take care of itself.

RicoSuter commented 9 years ago

Nonetheless, we should catch the exception so that vs does not break...

RicoSuter commented 9 years ago

Just added a project path check...