terminal icon indicating copy to clipboard operation
terminal copied to clipboard

Show a more descriptive error message when the ConptyConnection fails to start for some reason

Open RufusJWB opened this issue 5 years ago • 11 comments

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)

RufusJWB avatar Aug 05 '20 07:08 RufusJWB

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?

KalleOlaviNiemitalo avatar Aug 05 '20 09:08 KalleOlaviNiemitalo

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.

RufusJWB avatar Aug 05 '20 09:08 RufusJWB

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.

KalleOlaviNiemitalo avatar Aug 05 '20 09:08 KalleOlaviNiemitalo

This isn't a bad idea, and I bet @DHowett thought about something like this when he first added the error codes

zadjii-msft avatar Aug 05 '20 12:08 zadjii-msft

Yeah, we can definitely do better with these error messages!

DHowett avatar Aug 06 '20 01:08 DHowett

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

zadjii-msft avatar Apr 07 '22 10:04 zadjii-msft

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 avatar Oct 07 '24 12:10 Harshit-Agarwal-2022

@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).

KalleOlaviNiemitalo avatar Oct 08 '24 07:10 KalleOlaviNiemitalo

@Harshit-Agarwal-2022 You still working on this issue?

ATOMworkplace avatar Oct 15 '24 12:10 ATOMworkplace

@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 avatar Oct 16 '24 13:10 Harshit-Agarwal-2022

@Harshit-Agarwal-2022 Sure, thanks for letting me know, I'll give it a try and see what I can do.

ATOMworkplace avatar Oct 16 '24 13:10 ATOMworkplace