Hook to see when VS web app finishes starting

I am writing a Visual Studio extension (as a VS package ) and I am trying to measure the time from the moment the user clicks to launch a web application until a new tab is opened in the web browser and is ready to use.

Ideally, I want to measure the start time when the web app is launched with both:

  • Debug -> Start Debugging (F5)
  • Debug -> Start Without Debugging (Ctrl + F5)

Using IVsUpdateSolutionEvents4 I can see when the user starts and ends:

  • Build solution ( SBF_OPERATION_BUILD


  • Clean solution ( SBF_OPERATION_CLEAN


And using IVsDebuggerEvents.OnModeChange I can see when:

  • User clicks Debug -> Start Debugging ( DBGMODE_Run

  • User clicks the "Disable Debugging" button ( DBGMODE_Design


However, I haven't found a good hook to see when the app finishes. Any ideas?


source to share

1 answer

I do not expect a "magic hook" to be available. In the case of web applications, here's what I think VS:

  • User clicks "Debug"
  • VS deploys the package to a temporary location
  • VS creates WebBrowserInterface
  • VS sends url to browser and starts navigation

VS has pretty much done its job at this point, but there's a lot to be done there.

  • The browser sends a request to the web server
  • The web server downloads the application
  • The web server sends a response to the browser.

So, the browser is the guy who knows that the user can start using the app and should be responsible for firing that event you are looking for.

This is difficult to obtain as the programmer can choose the default browser Chrome, Safari, Firefox, etc.

My opinion is that you need to monitor IIS activity and detect a pattern for what happens when a new web application starts.



All Articles