Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Console]::Beep() does not activate "Bell Notifications" #17263

Closed
GarThor opened this issue May 13, 2024 · 5 comments
Closed

[Console]::Beep() does not activate "Bell Notifications" #17263

GarThor opened this issue May 13, 2024 · 5 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase

Comments

@GarThor
Copy link

GarThor commented May 13, 2024

Windows Terminal version

1.19.11213.0

Windows build number

10.0.19045.0

Other Software

Powershell v5 and v7

I do have oh-my-posh installed, but I don't think that affects this behavior

Steps to reproduce

o Enable "Bell notificaiton styles" in "Advanced" for your powershell profile.
o Enter the command [Console]::Beep() into the console. Observe, while the terminal does emit an audible beep, it does not alert the user in any other way (via flashing the window or the taskbar as configured).

Flashing/notifications do appear to be configurable when using the Write-Host -NoNewLine "a"` command however.

Expected Behavior

[Console]::Beep() should respect the user's configuration for bell notifications.

Actual Behavior

[Console]::Beep() does not respect the user's configuration for bell notifications.

@GarThor GarThor added Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels May 13, 2024
@DHowett
Copy link
Member

DHowett commented May 13, 2024

Thanks for filing! Unfortunately (and I really do mean unfortunately - this bug makes me sad), the .NET runtime or the PowerShell console adapter actually implemented Beep as a direct call to PlaySound() (as of the last time I checked). There’s no way for us to intercept that. ☹

@GarThor
Copy link
Author

GarThor commented May 14, 2024

Thanks for filing! Unfortunately (and I really do mean unfortunately - this bug makes me sad), the .NET runtime or the PowerShell console adapter actually implemented Beep as a direct call to PlaySound() (as of the last time I checked). There’s no way for us to intercept that. ☹

Bummer, I kinda figured it was something like that, but I figured it wouldn't hurt to ask.

@lhecker
Copy link
Member

lhecker commented May 14, 2024

I just checked the latest .NET code and it's still true today:
https://github.com/dotnet/runtime/blob/039d2ecb46687e89337d6d629c295687cfe226be/src/libraries/System.Console/src/System/ConsolePal.Windows.cs#L656-L673

Because of this this bug unfortunately needs to be reported over at https://github.com/dotnet/runtime, if anything 😕.

@lhecker lhecker closed this as not planned Won't fix, can't repro, duplicate, stale May 14, 2024
@lhecker lhecker added the Resolution-External For issues that are outside this codebase label May 14, 2024
@GarThor
Copy link
Author

GarThor commented May 14, 2024

I just checked the latest .NET code and it's still true today: https://github.com/dotnet/runtime/blob/039d2ecb46687e89337d6d629c295687cfe226be/src/libraries/System.Console/src/System/ConsolePal.Windows.cs#L656-L673

Because of this this bug unfortunately needs to be reported over at https://github.com/dotnet/runtime, if anything 😕.

rad, thanks... I'll try over there.

@lhecker
Copy link
Member

lhecker commented May 14, 2024

Thanks for filing it! I'm not familiar with .NET development, but as a terminal maintainer I do hope you have success. Other platforms use "`a" already (if you check out the other ConsolePal.*.cs files), so it IMO makes sense if Windows does too, even if it's only in the next big .NET version.
Maybe the best approach is to just make Beep() print "`a" while Beep(int, int) continues to use the kernel32 implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Resolution-External For issues that are outside this codebase
Projects
None yet
Development

No branches or pull requests

3 participants