Handoff from conhost to Terminal can take over 5 seconds
Windows Terminal version
1.23.12811.0
Windows build number
10.0.26100.0
Other Software
No response
Steps to reproduce
The easiest repro is to create a Windows "Hello World" app that calls system("dir"). The actual command does not matter, it is just the act of creating shell.
Expected Behavior
No response
Actual Behavior
If running as admin or after changing the default terminal application to console host, it is almost instant. Running as a regular user with Terminal as default freezes the app for 5+ seconds. It does not seem to affect C# apps. Handoff from conhost.exe to Windows Terminal can take over 5 seconds (each time). A longer write-up with some more findings can be found here: http://msinilo.pl/blog2/post/chasing-a-hitch/
Hey, this is a great write-up. The team will need a bit to digest it, but you're hitting on something that we're not the biggest fans of. We chose COM because it gave us a good combination of (1) an escape hatch in case we needed to pull the ripcord and back all of this out and (2) a potential third-party extensibility point (where other terminals could take over with a simple registration).
While conhost is fairly opaque, Windows Terminal is open sourced
Good news! conhost is in this repository as well[^1] :)
attemptHandoff is here:
https://github.com/microsoft/terminal/blob/f8506f4779c862bac9f8c04773a22c69b382a8d5/src/server/IoDispatchers.cpp#L259
Hope that makes the dig a little more rewarding at least.
[^1]: OpenConsole and conhost differ only by a couple #defines.