microsoft/dotnet-apiport

2.5.0.20 - SetSite failed for package on load in VS2017 15.9.3

Closed this issue · 1 comments

When starting Visual Studio 2017 Enterprise (15.9.3) with .Net Portability Analyzer 2.5.0.20, I get the following error logged on startup:

  <entry>
    <record>1106</record>
    <time>2018/12/10 15:24:41.051</time>
    <type>Error</type>
    <source>VisualStudio</source>
    <description>SetSite failed for package [ApiPortVSPackage]Source: &apos;Autofac&apos; Description: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = AnalyzeMenu (ReflectionActivator), Services = [ApiPortVS.AnalyzeMenu], Lifetime = Autofac.Core.Lifetime.RootScopeLifetime, Sharing = Shared, Ownership = OwnedByLifetimeScope ---&gt; An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = Object (DelegateActivator), Services = [EnvDTE.DTE], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = OwnedByLifetimeScope ---&gt; Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService. (See inner exception for details.) (See inner exception for details.)&#x000D;&#x000A;</description>
    <guid>{05B3D9F1-6699-4F10-A9E4-DA2ED1248523}</guid>
    <hr>80131500</hr>
    <errorinfo></errorinfo>
  </entry>

Not sure it that's the error that prevents the option from appearing in the right click menu on the solution / projet menu.
A way to bypass the issue is to go in the extensions options (Tools / Options / .Net Portability Analyzer), then the option will appear in the right click menu. (similar to the nuget / migrate packages.config issue)

The same kind of exception occurs at the end of the analysis (it doesn t seem to prevent the completion of the analysis):

Microsoft (R) .NET Portability Analyzer 2.5.0.20
Copyright (C) Microsoft Corporation. All rights reserved.
About Tool https://go.microsoft.com/fwlink/?LinkId=506955
View Privacy Statement https://privacy.microsoft.com/en-us/privacystatement

Detecting assembly references                      [Done]
Analyzing compatibility                            [Done]
Writing Excel report                               [Done]
Computing report.                                  [Done]

Finding source line information
	Observer.exe                                   [Done]
	Guardian.exe                                   [Done]
	Common.dll                                    [Done]
	CommunicatorDaemon.exe                         [Done]
	SQLAdapter.dll                                 [Done]
	ReportingTool.exe                             [Done]
	GuardianDaemon.exe                            [Done]
	AlarmEditor.exe                                [Done]
	Configurator.exe                               [Done]
	Octopus.Schedule.WinForms.dll                  [Done]
	Octopus.Tests.dll                              [Done]
	Controls.dll                                   [Done]
An unknown error occured.
System.InvalidOperationException: Due to high risk of deadlock you cannot call GetService from a background thread in an AsyncPackage derived class. You should instead call GetServiceAsync (without calling Result or Wait on the resultant Task object) or switch to the UI thread with the JoinableTaskFactory.SwitchToMainThreadAsync method before calling GetService.
   at Microsoft.VisualStudio.Shell.AsyncPackage.GetService(Type serviceType)
   at Microsoft.VisualStudio.Shell.Package.System.IServiceProvider.GetService(Type serviceType)
   at Microsoft.VisualStudio.Shell.ErrorListProvider.get_VsTaskList()
   at Microsoft.VisualStudio.Shell.TaskProvider.Refresh()
   at ApiPortVS.ErrorListProvider.<DisplaySourceItemsAsync>d__4.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.TaskAwaiter.ValidateEnd(Task task)
   at ApiPortVS.Analyze.ProjectAnalyzer.<AnalyzeProjectAsync>d__10.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 ApiPortVS.AnalyzeMenu.<AnalyzeProjectsAsync>d__7.MoveNext()