Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual Studio Extension: Wait for all projects to complete loading with IVsSolutionEvents OnAfterOpenSolution

I am looking for an event/interface to use that notifies me once all projects have loaded in a solution after opening a solution.

I have implemented OnAfterOpenSolution in IVsSolutionEvents2 interface. This gets called immediately after the solution opens... so any code I run against the UI thread, even asycnhronously, locks up the IDE prior to the project(s) loading.

Is there a similar technique to implementing `OnAfterOpenSolution', that is called once all the projects for the solution have opened?

like image 487
Sheldon Warkentin Avatar asked Dec 06 '12 18:12

Sheldon Warkentin


People also ask

How many solution load managers does Visual Studio allow at once?

Visual Studio allows only one solution load manager at a given time, so you must advise Visual Studio when you want to activate your solution load manager. If a second solution load manager is activated later on, your solution load manager will be disconnected.

How to enable wait-for-process in Visual Studio Code?

Launch VS Code Quick Open ( Ctrl+P ), paste the following command, and press enter. This very small extensions exposes a vscode command called wait-for-process.wait which is primarily designed to be used by a Attach to debugger launch configuration when debugging native modules.

How do I ensure that projects and solutions are loaded?

You can also ensure that projects and solutions are loaded by calling one of the following methods: EnsureSolutionIsLoaded: calling this method forces the projects in a solution to load before the method returns. EnsureProjectIsLoaded: calling this method forces the projects in guidProject to load before the method returns.

Why is my UI not working after the solution loads?

After the solution loads, the project system is doing design time builds in the background, leaving the UI responsive and interactive. However, for the time it takes to run the design time build, certain features may not be working as they used to.


1 Answers

The OnAfterBackgroundSolutionLoadComplete event in the IVsSolutionLoadEvents interface is fired after all projects for the solution have completed loading. The implementation for this will still need to implement or extend from an implementation of one of the IVsSolutionEvents interfaces in order to attach the event using IVsSolution.AdviseSolutionEvents(..) method.

Upon Further investigation in this area, the OnAfterBackgroundSolutionLoadComplete only occurs if projects are set to load in the background. If the background loading has been disabled this event will not occur. You will likely also have to implement IVsSolutionLoadManager and ensure that at least 1 project has a background load priority if you intend to rely on the OnAfterBackgroundSolutionLoadComplete event, or switch based on how the user has set their loading priority.

like image 159
Colin Pedlar Avatar answered Sep 27 '22 15:09

Colin Pedlar