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

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

Open
debonte opened this issue Apr 20, 2017 · 3 comments
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:VS.Client Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug
Milestone

Comments

@debonte
Copy link

debonte commented Apr 20, 2017

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)


@debonte
Copy link
Author

debonte commented Apr 20, 2017

FYI @alpaix

@mishra14
Copy link
Contributor

@debonte is this still an important scenario?

@mishra14 mishra14 added the Priority:1 High priority issues that must be resolved in the current sprint. label Oct 17, 2017
@mishra14 mishra14 added this to the Backlog milestone Oct 17, 2017
@debonte
Copy link
Author

debonte commented Oct 17, 2017

We worked around this by catching all exceptions thrown from TryCreateContext, so I'm not concerned about it. I mainly filed this because it could surprise other possible consumers of the API and I thought it would be a quick fix

@mishra14 mishra14 added Priority:2 Issues for the current backlog. and removed Priority:1 High priority issues that must be resolved in the current sprint. labels Oct 27, 2017
@nkolev92 nkolev92 added Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Type:Bug and removed Priority:2 Issues for the current backlog. labels Apr 17, 2020
@ghost ghost added the Status:Inactive Icebox issues not updated for a specific long time label Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority:3 Issues under consideration. With enough upvotes, will be reconsidered to be added to the backlog. Product:VS.Client Status:Excluded from icebox cleanup Status:Inactive Icebox issues not updated for a specific long time Type:Bug
Projects
None yet
Development

No branches or pull requests

6 participants