-
Notifications
You must be signed in to change notification settings - Fork 269
Description
NuGet product used: VS UI
NuGet version: 4.2.0.2451
VS version: d15rel 26419.1
OS version: rs2_release 15063.0.170323-1837
IVsPathContextProvider.TryCreateContext throws NotImplementedException when it’s called on a vdproj (Visual Studio Installer project). The exception originates from NuGet's call to EnvDTE.Project.get_ParentProjectItem.
Since the project system is extensible and 3rd party project systems might not act like the more common managed/C++ project systems, I'm thinking that perhaps NuGet should be catching all exceptions thrown from all EnvDTE Project API calls on random projects (not just this call) rather than letting them propagate to the caller.
I'm sure you could come up with a simpler repro, but here's how I'm hitting it...
First you need to install the Installer projects extension:
- Start VS d15rel 26417.0 or later.
- Select "Extensions and Updates" from the Tools menu
- In the Online tab, search for "Microsoft Visual Studio 2017 Installer Projects"
- Download it
- Close VS to kick off the installation of the extension.
- Press Modify on the installer window.
- Press Close when installation completes.
Then to actually repro the issue:
- Unzip ReproProject.zip
- Open Setup1\Setup1.sln in VS (again d15rel 26417.0 or later)
- Open MainWindow.xaml in WpfApp1 project.
- Expand Toolbox pane
- This will cause a call to Microsoft.VisualStudio.DesignTools.DesignerHost.Utility.NuGetHostHelper.GetNuGetReferences which will call IVsPatchContextProvider.TryCreateContext.
Result: NotImplementedException thrown from:
EnvDTE.Project.get_ParentProjectItem()
NuGet.PackageManagement.VisualStudio.EnvDTEProjectUtility.<>c__DisplayClass33_0.<<GetCustomUniqueNameAsync>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.VisualStudio.Threading.JoinableTask.<JoinAsync>d__76.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.VisualStudio.Threading.JoinableTask`1.<JoinAsync>d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
NuGet.PackageManagement.VisualStudio.EnvDTEProjectUtility.<GetCustomUniqueNameAsync>d__33.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
NuGet.PackageManagement.VisualStudio.VSSolutionManager.<GetOrCreateProjectAsync>d__107.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
NuGet.VisualStudio.VsPathContextProvider.<>c__DisplayClass8_0.<<TryCreateContext>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
Microsoft.VisualStudio.Threading.JoinableTask.CompleteOnCurrentThread()
Microsoft.VisualStudio.Threading.JoinableTask`1.CompleteOnCurrentThread()
Microsoft.VisualStudio.Threading.JoinableTaskFactory.Run[T](Func`1 asyncMethod, JoinableTaskCreationOptions creationOptions)
NuGet.VisualStudio.VsPathContextProvider.TryCreateContext(String projectUniqueName, IVsPathContext& outputPathContext)
Microsoft.VisualStudio.DesignTools.DesignerHost.Utility.NuGetHostHelper.GetNuGetReferences(IHostProject hostProject, IEnumerable`1 references, IComponentModel componentModel)