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

[Bug]: Visual Studio Nuget Package Manager UI does not open if other extension is enabled #11636

Closed
tonyhallett opened this issue Mar 2, 2022 · 26 comments

Comments

@tonyhallett
Copy link

NuGet Product Used

Visual Studio Package Management UI

Product Version

Visual Studio: 2022 Enterprise / Possibly Professional/Communiy - multiple versions

Worked before?

No response

Impact

I'm unable to use this version

Repro Steps & Context

I am a contributor to a Visual Studio extension Fine Code Coverage that is built for Visual Studio 2019 and Visual Studio 2022.

Users of the 2022 extension are reporting the following behaviour.

FCC ( Fine Code Coverage ) and (NPMUI) Nuget Package Management UI working together no problem.
For no known reason this changes
With FCC enabled NPMUI no longer works.
Disable FCC and NPMUI works.

The logs provided by the 3 users of FCC that have reported the issue are consistent in the error.

Here are the log entries from ActivityLog that are written when I try to open the NuGet Package Manager:

  <entry>
    <record>790</record>
    <time>2021/11/22 08:40:51.160</time>
    <type>Error</type>
    <source>NuGetPackage.ShowManageLibraryPackageForSolutionDialog</source>
    <description>XamlParseException - Provide value on &apos;System.Windows.Markup.StaticExtension&apos; threw an exception.</description>
  </entry>
  <entry>
    <record>791</record>
    <time>2021/11/22 08:41:20.206</time>
    <type>Error</type>
    <source>NuGetPackage.ShowManageLibraryPackageForSolutionDialog</source>
    <description>Exception - The component &apos;NuGet.PackageManagement.UI.PackageManagerControl&apos; does not have a resource identified by the URI &apos;/NuGet.PackageManagement.UI;component/xamls/packagemanagercontrol.xaml&apos;.</description>
  </entry>

I see this error when running VS in log mode, not sure if that means anything.

2149 2022/03/01 21:39:52.229 Error NuGetPackage.ShowManageLibraryPackageDialog Exception - The component 'NuGet.PackageManagement.UI.PackageManagerControl' does not have a resource identified by the URI '/NuGet.PackageManagement.UI;component/xamls/packagemanagercontrol.xaml'.

Comparing the two VS activity logs generated in each case, I can see the following in the log with FCC enabled that doesn't appear in with it disabled:

<entry> <record>2052</record> <time>2022/03/01 22:38:01.536</time> <type>Error</type> <source>NuGetPackage.ShowManageLibraryPackageDialog</source> <description>XamlParseException - Provide value on &apos;System.Windows.Markup.StaticExtension&apos; threw an exception.</description> </entry>

Verbose Logs

No response

@erdembayar
Copy link
Contributor

@tonyhallett
Thank you for filing this issue. But I was not able to repro this issue with latest VS 2022 Pro, not only I can open PMUI also I was able to install new package without issue.

image

Could you give us repro steps?

@tonyhallett
Copy link
Author

tonyhallett commented Mar 2, 2022

Could you give us repro steps?

No. Nobody has noticed anything in particular that could have been the cause.

It has happended to me in the last 20 minutes believe it or not !

The first time I noticed it was in a UWP project ( that I ran no tests in ) - a project type that I rarely use.

Note that the Package Manager Console can be opened and that there is nothing reported in the Package Manager Output Window Pane.

Unfortunately game bar recording do not show the context menu otherwise I would post it.

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Mar 2, 2022
@tonyhallett
Copy link
Author

tonyhallett commented Mar 2, 2022

@erdembayar

If I fork the repo and build the vsix can I debug locally ?

Do you want to see my screen some time tomorrow ? I am in the UK.

@erdembayar
Copy link
Contributor

@erdembayar

If I fork the repo and build the vsix can I debug locally ?

Which repo are you referring here?

Do you want to see my screen some time tomorrow ? I am in the UK.

Sorry, I'm afraid I can't attend it, I have other responsibilities too.

@ghost ghost added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Mar 2, 2022
@tonyhallett
Copy link
Author

If I fork the repo and build the vsix can I debug locally ?

Nuget

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Mar 2, 2022
@erdembayar
Copy link
Contributor

If I fork the repo and build the vsix can I debug locally ?

Nuget

Sure, you can. We have independent contributors.
https://github.com/NuGet/NuGet.Client/blob/dev/CONTRIBUTING.md
https://github.com/NuGet/NuGet.Client/blob/dev/docs/debugging.md

@ghost ghost added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Mar 2, 2022
@tonyhallett
Copy link
Author

Thanks for the links - the debugging link had the information for installing that I required.
I will debug the commands and hopefully find a way to get back this odd behaviour.

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Mar 2, 2022
@erdembayar erdembayar added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Mar 3, 2022
@donnie-msft
Copy link
Contributor

Debugging is a good suggestion. Just curious, do you test/debug your VSIX in the VS Experimental Instance? If you open NuGet PMUI in that Experimental VS, does the same error occur?

Another quick thing to check:

The component 'NuGet.PackageManagement.UI.PackageManagerControl' does not have a resource identified by the URI '/NuGet.PackageManagement.UI;component/xamls/packagemanagercontrol.xaml'.

This is the sort of error I've seen with assembly version issues/conflicts. I'd check any configs you may find here:
C:\Users\<user>\AppData\Local\Microsoft\VisualStudio\17.0_<some goo>\devenv.exe.config
...to see if the assemblies listed here for our NuGet extension makes sense (files exist at path, version # is expected, etc):
Sample:

<dependentAssembly>
    <assemblyIdentity name="NuGet.PackageManagement.UI" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
         <codeBase version="6.2.0.75" href="c:\program files\microsoft visual studio\2022\preview\common7\ide\commonextensions\microsoft\nuget\NuGet.PackageManagement.UI.dll"/></dependentAssembly>

Also any assembly errors show up in ILDasm?

@tonyhallett
Copy link
Author

tonyhallett commented Mar 4, 2022

@donnie-msft

Just curious, do you test/debug your VSIX in the VS Experimental Instance?

Indeed.

If you open NuGet PMUI in that Experimental VS, does the same error occur?

Unfortunately I do not have the issue on my machine. If it does reappear I will see if it occurs in the experimental instance.

I have version 6.0.1.1 of NuGet.PackageManagement.UI. I used Reflector to check the nuget dependencies and they all opened. I opened NuGet.PackageManagement.UI in ILDasm and there were no errors.

6.0.1.1 is a release candidate.... I will update visual studio when I get the opportunity.

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Mar 4, 2022
@donnie-msft
Copy link
Contributor

@tonyhallett I reached out to the VS Extensibility team, and their suggestion was to get a full heap dump. They said,

This is almost always the best first step, then one can look at what dlls are loaded / where they are loaded from. Generally, these things happen when extensions ship VS dlls (like say the NuGet one that is failing to load) and the ‘wrong’ one (from VS’ perspective) gets loaded, which can happen for a variety of reasons.

I'd suggest, the next time a contributor has a repro of this problem, in VS use the Help -> Report a Problem to submit a report. Be sure to reference this issue, and the issue in your repo, so we can see the context of we have in this thread. Make sure to include a DMP in that report and that it finishes uploading. For more information on doing that, see https://docs.microsoft.com/en-us/visualstudio/ide/how-to-report-a-problem-with-visual-studio?view=vs-2022

@ghost ghost added WaitingForCustomer Applied when a NuGet triage person needs more info from the OP and removed WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. labels Mar 5, 2022
@tonyhallett
Copy link
Author

@donnie-msft Thank you. I will inform the users of the extension.

@ghost ghost added WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. and removed WaitingForCustomer Applied when a NuGet triage person needs more info from the OP labels Mar 5, 2022
@donnie-msft donnie-msft removed the WaitingForClientTeam Customer replied, needs attention from client team. Do not apply this label manually. label Mar 5, 2022
@cutty225
Copy link

cutty225 commented Mar 6, 2022

I am one of the users of @tonyhallett FCC extension. As per instructions, I have reproduced the issue this morning and submitted a report via Visual Studio with DMP attached: https://developercommunity.visualstudio.com/t/NuGet-Package-Manager-prevented-from-ope/1684617

@donnie-msft
Copy link
Contributor

@cutty225 Just took a look and replied. In short, the DMP is corrupted, and I could not reproduce the NuGet issue. Instead, your extension was not successfully loaded. My first guess is there's a broken MEF export in your extension. NuGet also uses an export for the Output Window in VS and implements an ILogger , so perhaps it's related to why NuGet is broken on your machine.

2022/03/08 20:39:41.525
Error
VisualStudio
SetSite failed for package [OutputToolWindowPackage]Source: 'Microsoft.VisualStudio.Composition' Description: Expected 1 export(s) with contract name "ILogger" but found 0 after applying applicable constraints. Microsoft.VisualStudio.Composition.CompositionFailedException: Expected 1 export(s) with contract name "ILogger" but found 0 after applying applicable constraints. at Microsoft.VisualStudio.Composition.ExportProvider.GetExports(ImportDefinition importDefinition) at Microsoft.VisualStudio.Composition.ExportProvider.GetExports[T,TMetadataView](String contractName, ImportCardinality cardinality) at Microsoft.VisualStudio.Composition.ExportProvider.GetExport[T,TMetadataView](String contractName) at Microsoft.VisualStudio.Composition.ExportProvider.GetExportedValueT at Microsoft.VisualStudio.ComponentModelHost.ComponentModel.GetServiceT at FineCodeCoverage.Output.OutputToolWindowPackage.<InitializeAsync>d__4.MoveNext() --- 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 Microsoft.VisualStudio.Shell.AsyncPackage.<>c__DisplayClass20_0.<<Microsoft-VisualStudio-Shell-Interop-IAsyncLoadablePackageInitialize-Initialize>b__1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at Microsoft.VisualStudio.Services.VsTask.RethrowException(AggregateException e) at Microsoft.VisualStudio.Services.VsTask.InternalGetResult(Boolean ignoreUIThreadCheck)
{4E91BA47-CD42-42BC-B92E-3C4355D2EB5F}


80131500

@tonyhallett
Copy link
Author

tonyhallett commented Mar 8, 2022

@donnie-msft
I had that Mef exception in the last couple of days during extension debugging. It did not matter what component I asked Vs for. Even ILogger with export having no imports. I cleared the Mef cache and the problem went away.

@tonyhallett
Copy link
Author

@donnie-msft

@cutty225 has also cleared the MEF cache FortuneN/FineCodeCoverage#213 (comment) which may be a common resolution.

NuGet also uses an export for the Output Window in VS and implements an ILogger , so perhaps it's related to why NuGet is broken on your machine.

Seems unlikely to me ? I will fork the repo so I can search it efficiently.

Is there a method to get MEF to provide better logging ?

@donnie-msft
Copy link
Contributor

Found this.. maybe a better approach than just deleting the folder.

The following file is created whenever VS MEF constructs its cache of MEF parts:
%localappdata%\microsoft\visualstudio<instanceID>\ComponentModelCache\Microsoft.VisualStudio.Default.err
This cache is replaced with each update of the MEF cache. Because most updates of the MEF cache are incremental, the log file can be incomplete, showing only issues found during the incremental update. To ensure that the log is complete, run these commands:

devenv /clearcache
devenv /updateconfiguration

@donnie-msft
Copy link
Contributor

Also using these MEF Analyzers may be helpful to identify code issues:
https://github.com/microsoft/vs-mef/blob/main/doc/analyzers/index.md

@tonyhallett
Copy link
Author

@donnie-msft Thanks

@nkolev92
Copy link
Member

@donnie-msft Do you think there's still something to investigate on NuGet end?

@donnie-msft
Copy link
Contributor

@nkolev92 We don't know either way until we receive a DMP and someone takes a look at that.

@donnie-msft donnie-msft added the WaitingForCustomer Applied when a NuGet triage person needs more info from the OP label Mar 18, 2022
@nkolev92
Copy link
Member

Thank you reporting this issue. At this point we do not have enough information to continue investigating the issue.
Please feel free to comment or open a new issue if needed.

@ghost ghost removed the WaitingForCustomer Applied when a NuGet triage person needs more info from the OP label Mar 24, 2022
@bstordrup
Copy link

I can reproduce the error on my Visual Studio 2022 17.4.1 installation. With Fine Code Coverage activated, I get this entry in the AcivityLog.xml file, and PMUI does not show.

  <entry>
    <record>518</record>
    <time>2022/11/28 20:55:15.073</time>
    <type>Error</type>
    <source>NuGetPackage.ShowManageLibraryPackageForSolutionDialog</source>
    <description>XamlParseException - Provide value on &apos;System.Windows.Markup.StaticExtension&apos; threw an exception.</description>
  </entry>

Version of Fine Code Coverage is 1.1.188

If I disable Fine Code Coverage extension, then the above entry is not written ti ActivityLog, and the PMUI shows up as expected.

@bstordrup
Copy link

@jeffkl
Copy link
Contributor

jeffkl commented Dec 1, 2022

@bstordrup Are there exact steps I can follow to reproduce the issue? I installed FCC, ran tests with code coverage, loaded the FCC tool window and then loaded Manage Packages for Solution without issues.

image

@bstordrup
Copy link

@jeffkl Not sure. As I demonstrated in the screen record, all I did was to enable the FCC extension, and then the Package Management UI would no longer load. Disabling it made the PMUI work again. That were the steps provided.

Did any of the files provided in by bug report that was closed provide any further information around Visual Studion?

@jeffkl
Copy link
Contributor

jeffkl commented Dec 1, 2022

Did any of the files provided in by bug report that was closed provide any further information around Visual Studion?

The feedback ticket had the recording of you enabling the FCC extension and then Package Manager not loading. I think the Activity Log also shows the error you had included in the main description. What I'd really like to do is repro it on my machine and then look at it under the debugger.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants