This repository was archived by the owner on Feb 25, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Copy link
Copy link
Closed
Labels
Completed 🔥bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviorin progress 🚧notifications 🔔
Milestone
Description
Describe the bug
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.NotificationsNuGet package to your UWP app. -
Then put this code in your UWP app:
ToastContent toast = new ToastContentBuilder()
.AddText("Hello World")
.AddAudio(new Uri("ms-winsoundevent:Notification.Mail"))
GetToastContent();- Run the app.
Expected behavior
The ToastContentBuilder should create a ToastContent object equivalent to the following XML content:
<toast>
<visual>
<binding template='ToastGeneric'>
<text>Hello World</text>
</binding>
</visual>
<audio src='ms-winsoundevent:Notification.Mail'/>
</toast>Actual behavior
The following exception is thrown:
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: )
Additional context
Add any other context about the problem here.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Completed 🔥bug 🐛An unexpected issue that highlights incorrect behaviorAn unexpected issue that highlights incorrect behaviorin progress 🚧notifications 🔔