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

VisualBasicPackage must be constructed on the main thread #66797

Merged
merged 1 commit into from
Feb 15, 2023

Conversation

sharwell
Copy link
Member

@sharwell sharwell commented Feb 10, 2023

This package was incorrectly set as AllowsBackgroundLoad=true when the constructor contained a UI-affinitized operation. We attempted to moved the operation to InitializeAsync instead, but it did not work (exception in a comment below). Instead, we have marked this package as requiring the UI thread for construction.

Fixes AB#1745017

This package was incorrectly set as AllowsBackgroundLoad=true when the
constructor contained a UI-affinitized operation.
@sharwell sharwell marked this pull request as ready for review February 10, 2023 02:33
@sharwell sharwell requested a review from a team as a code owner February 10, 2023 02:33
@sharwell sharwell changed the title VisualBasicPackage must be constructed on the main thread Remove UI dependencies from VisualBasicPackage constructor Feb 10, 2023
@sharwell
Copy link
Member Author

Integration tests are failing to create VB projects:

System.ArgumentException: Value does not fall within the expected range.
   at Microsoft.VisualStudio.CommonIDE.Solutions.Interop.IVsNativeEnvironmentInternal.WizLoadAndRunFile(String pwszWizard, String pwszDestination, Boolean bCloseSolution, Boolean bRunSilent, Array psaCustomParams, String pwszFrameworkVersion)
   at Microsoft.VisualStudio.CommonIDE.Solutions.Solution.<>c__DisplayClass417_0.<Microsoft.VisualStudio.Shell.Interop.IVsSolution6.AddNewProjectFromTemplate>b__0()
   at Microsoft.VisualStudio.CommonIDE.Solutions.HResultExtensions.ExToHr(Action action)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(Int32 hr)
   at Microsoft.VisualStudio.Extensibility.Testing.SolutionExplorerInProcess.<AddProjectAsync>d__14.MoveNext() in /_/src/VisualStudio/IntegrationTest/New.IntegrationTests/InProcess/SolutionExplorerInProcess.cs:line 221
--- 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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Roslyn.VisualStudio.NewIntegrationTests.Workspaces.WorkspaceBase.<OpenCSharpThenVBSolution>d__4.MoveNext() in /_/src/VisualStudio/IntegrationTest/New.IntegrationTests/Workspace/WorkspaceBase.cs:line 56
--- 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 System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at Xunit.Threading.InProcessIdeTestInvoker.<>c__DisplayClass6_1.<<InvokeTestMethodAsync>b__1>d.MoveNext()

@sharwell sharwell changed the title Remove UI dependencies from VisualBasicPackage constructor VisualBasicPackage must be constructed on the main thread Feb 10, 2023
@sharwell sharwell merged commit ff2ac53 into dotnet:main Feb 15, 2023
@ghost ghost added this to the Next milestone Feb 15, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.6 P2 Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants