Skip to content

Commit

Permalink
Remove UI affinitized operations from VisualBasicPackage constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Feb 10, 2023
1 parent 5b3953b commit 768c20c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,12 @@ Namespace Microsoft.VisualStudio.LanguageServices.VisualBasic
Private _libraryManager As ObjectBrowserLibraryManager
Private _libraryManagerCookie As UInteger

Public Sub New()
MyBase.New()

' This is a UI-affinitized operation. Currently this opeartion prevents setting AllowsBackgroundLoad for
' VisualBasicPackage. The call should be removed from the constructor, and the package set back to allowing
' background loads.
_comAggregate = Implementation.Interop.ComAggregate.CreateAggregatedObject(Me)
End Sub

Protected Overrides Async Function InitializeAsync(cancellationToken As CancellationToken, progress As IProgress(Of ServiceProgressData)) As Task
Try
Await MyBase.InitializeAsync(cancellationToken, progress).ConfigureAwait(True)
Await JoinableTaskFactory.SwitchToMainThreadAsync(cancellationToken)

_comAggregate = Implementation.Interop.ComAggregate.CreateAggregatedObject(Me)
RegisterLanguageService(GetType(IVbCompilerService), Function() Task.FromResult(_comAggregate))

RegisterService(Of IVbTempPECompilerFactory)(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
</PropertyGroup>
<ItemGroup Label="PkgDef">
<PkgDefInstalledProduct Include="{574fc912-f74f-4b4e-92c3-f695c208a2bb}" Name="Microsoft Visual Basic" DisplayName="#113" ProductDetails="#114" />
<!-- Cannot load in background until the VisualBasicPackage constructor has no more UI dependencies -->
<PkgDefPackageRegistration Include="{574fc912-f74f-4b4e-92c3-f695c208a2bb}" Name="VisualBasicPackage" Class="Microsoft.VisualStudio.LanguageServices.VisualBasic.VisualBasicPackage" AllowsBackgroundLoad="false" />
<PkgDefPackageRegistration Include="{574fc912-f74f-4b4e-92c3-f695c208a2bb}" Name="VisualBasicPackage" Class="Microsoft.VisualStudio.LanguageServices.VisualBasic.VisualBasicPackage" AllowsBackgroundLoad="true" />
<None Include="PackageRegistration.pkgdef" PkgDefEntry="FileContent" />
</ItemGroup>
<ItemGroup Label="Project References">
Expand Down

0 comments on commit 768c20c

Please sign in to comment.