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.
Steps to Reproduce
Steps to reproduce the behavior:
-
Add the Microsoft.Toolkit.Uwp.Notifications NuGet 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.
Describe the bug
The
ToastContentBuilderinMicrosoft.Toolkit.Uwp.Notificationsis unable to create a toast notification that uses one of the built-inms-winsoundeventsounds.Steps to Reproduce
Steps to reproduce the behavior:
Add the
Microsoft.Toolkit.Uwp.NotificationsNuGet package to your UWP app.Then put this code in your UWP app:
Expected behavior
The
ToastContentBuildershould create aToastContentobject equivalent to the following XML content:Actual behavior
The following exception is thrown:
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
Additional context
Add any other context about the problem here.