Show a more descriptive error message when the ConptyConnection fails to start for some reason
Description of the new feature/enhancement
Show a speaking error message, when it is necessary to run Terminal with admin privileges. See https://github.com/microsoft/terminal/issues/4272 for the problem
Proposed technical implementation details (optional)
How about just displaying the error message that matches the error code, like so:
[error 0x800702e4 when launching `C:\Program Files\PowerShell\6\pwsh.exe']
The requested operation requires elevation.
Or does Windows Terminal have to recognize the 0x800702e4 code specifically and display something more verbose?
I think displaying the error message would be perfectly fine. I had to google it. With the error message, this wouldn't have been necessary.
Could even extend that to process exit codes that look like NTSTATUS error codes:
[process exited with code 3221225786]
The application terminated as a result of a CTRL+C.
That would have a greater risk of false matches, though.
This isn't a bad idea, and I bet @DHowett thought about something like this when he first added the error codes
Yeah, we can definitely do better with these error messages!
For those who'd like to try this themselves, I added a similar kind of error message in #10045.
Collected relevant error messages:
| Symbolic Name | Error Description | Header |
|---|---|---|
| ERROR_ELEVATION_REQUIRED | The requested operation requires elevation. | winerror.h |
| STATUS_CONTROL_C_EXIT | {Application Exit by CTRL+C} The application terminated as a result of a CTRL+C. | ntstatus.h |
| MSG_DIR_BAD_COMMAND_OR_FILE | '%1' is not recognized as an internal or external command, operable program or batch file. | cmdmsg.h |
Hello , I have read through the issue and I want to try to help in adding the new error message , Can someone guide me as to how to recreate the same runtime conditions as in #4272 ?
@Harshit-Agarwal-2022, create a Windows Terminal profile that runs %windir%\system32\msconfig.exe, and try to start that profile. The application requires elevation, and this causes error 2147943140 (0x800702e4) as in https://github.com/microsoft/terminal/issues/4272 (unless Windows Terminal itself is elevated).
@Harshit-Agarwal-2022 You still working on this issue?
@ATOMworkplace I was facing some issues with vs 2022 while building the terminal repo on my local system so i havent started with the issue yet , you can work on it if you want , I was able to recreate the error log using @KalleOlaviNiemitalo 's instructions
@Harshit-Agarwal-2022 Sure, thanks for letting me know, I'll give it a try and see what I can do.