You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Feb 25, 2026. It is now read-only.
The ToastContentBuilder is unable to set the toast notification sound to a ms-winsoundevent sound #3753
The ToastContentBuilder in Microsoft.Toolkit.Uwp.Notifications is unable to create a toast notification that uses one of the built-in ms-winsoundevent sounds.
Is this bug a regression in the toolkit? If so, what toolkit version did you last see it work: I don't know
Steps to Reproduce
Can this be reproduced in the Sample App? (Either in a sample as-is or with new XAML pasted in the editor.) If so, please provide custom XAML or steps to reproduce. If not, let us know why it can't be reproduced (e.g. more complex setup, environment, dependencies, etc...)
Steps to reproduce the behavior:
Add the Microsoft.Toolkit.Uwp.Notifications NuGet package to your UWP app.
System.ArgumentException
HResult=0x80070057
Message=src
Parameter name: Audio Source has to be a file.
Source=Microsoft.Toolkit.Uwp.Notifications
StackTrace:
at Microsoft.Toolkit.Uwp.Notifications.ToastContentBuilder.AddAudio(Uri src)
at LessonTimer.Services.Notifications.ScheduleToastNotification(String source, DateTime time) in ..\Notifications.cs:line 39
at LessonTimer.MainPage.ScheduleNotification() in ..\MainPage.xaml.cs:line 286
at LessonTimer.MainPage.StartCountdown() in ..\MainPage.xaml.cs:line 259
at LessonTimer.MainPage.StartButton_Click(Object sender, RoutedEventArgs e) in ..\MainPage.xaml.cs:line 177
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
NuGet Package(s):
- Microsoft.NETCore.UniversalWindowsPlatform (v6.2.12),
- Microsoft.Services.Store.Engagement (v10.1901.28001),
- Microsoft.Toolkit.Uwp.Notifications (v6.1.1)
Windows 10 Build Number:
- [ ] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [ ] May 2020 Update (19041)
- [x] Insider Build (build number: 19042.804)
App min and target version:
- [x] Fall Creators Update (16299)
- [ ] April 2018 Update (17134)
- [ ] October 2018 Update (17763)
- [ ] May 2019 Update (18362)
- [x] May 2020 Update (19041)
- [ ] Insider Build (xxxxx)
Device form factor:
- [x] Desktop
- [ ] Xbox
- [ ] Surface Hub
- [ ] IoT
Visual Studio
- [ ] 2017 (version: )
- [x] 2019 (version: 16.8.5)
- [ ] 2019 Preview (version: )
Thanks, @EmilJunker for the detailed description. Tagging this for further investigation. Let's see if any community member can help identify the root cause.
Hey @EmilJunker thanks for reporting this. As a quick workaround, you can update to the 7.0.0-preview4 prerelease version of the NuGet package and use the following method that accepts a ToastAudio object... I tested the below and it works. Looks like in our other method we were checking to make sure it was a file, but this new alternative method doesn't require it to be a file.
newToastContentBuilder().AddText("Check out this sound!").AddAudio(newToastAudio(){Src=newUri("ms-winsoundevent:Notification.Looping.Alarm2")}).Show();
You can also use the new simplified Show() API as seen above with the new preview. Docs here: https://aka.ms/toast7
I'll get the bug itself fixed for the other AddAudio method! Thanks again for reporting this!
Activity
Kyaa-dost commentedon Feb 12, 2021
Thanks, @EmilJunker for the detailed description. Tagging this for further investigation. Let's see if any community member can help identify the root cause.
michael-hawker commentedon Feb 12, 2021
FYI @andrewleader
andrewleader commentedon Feb 12, 2021
Hey @EmilJunker thanks for reporting this. As a quick workaround, you can update to the
7.0.0-preview4prerelease version of the NuGet package and use the following method that accepts aToastAudioobject... I tested the below and it works. Looks like in our other method we were checking to make sure it was a file, but this new alternative method doesn't require it to be a file.You can also use the new simplified
Show()API as seen above with the new preview. Docs here: https://aka.ms/toast7I'll get the bug itself fixed for the other
AddAudiomethod! Thanks again for reporting this!Fix ToastContentBuilder audio ms-winsoundevent and ms-appx (#3755)