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

Closed
opened 2026-01-31 07:52:47 +00:00 by claunia · 5 comments
Owner

Originally created by @GarThor on GitHub (May 14, 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.

Originally created by @GarThor on GitHub (May 14, 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.
claunia added the Needs-TriageIssue-BugResolution-External labels 2026-01-31 07:52:47 +00:00
Author
Owner

@DHowett commented on GitHub (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. ☹

@DHowett commented on GitHub (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. ☹
Author
Owner

@GarThor commented on GitHub (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.

@GarThor commented on GitHub (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.
Author
Owner

@lhecker commented on GitHub (May 14, 2024):

I just checked the latest .NET code and it's still true today:
039d2ecb46/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 commented on GitHub (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 😕.
Author
Owner

@GarThor commented on GitHub (May 14, 2024):

I just checked the latest .NET code and it's still true today: 039d2ecb46/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.

@GarThor commented on GitHub (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.
Author
Owner

@lhecker commented on GitHub (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.

@lhecker commented on GitHub (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 in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21710