Skip to content

NotImplementedException from IVsPathContextProvider.TryCreateContext when called for a vdproj #5089

@debonte

Description

@debonte

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:

  1. Start VS d15rel 26417.0 or later.
  2. Select "Extensions and Updates" from the Tools menu
  3. In the Online tab, search for "Microsoft Visual Studio 2017 Installer Projects"
  4. Download it
  5. Close VS to kick off the installation of the extension.
  6. Press Modify on the installer window.
  7. Press Close when installation completes.

Then to actually repro the issue:

  1. Unzip ReproProject.zip
  2. Open Setup1\Setup1.sln in VS (again d15rel 26417.0 or later)
  3. Open MainWindow.xaml in WpfApp1 project.
  4. Expand Toolbox pane
  5. 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)


Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions