EgorBo / EgorBo/Toasts.Forms.Plugin

Unhandled Exception when using GetDeliveredNotifications method

Open
#159 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
275
Forks
81
PR merge metrics
No merged PRs in 30d

Description

Hi,

I'm trying to get all notifications to delete some of them but when I'm using this code, I got a Exception:

`var notifications = await _toastNotificator.GetDeliveredNotifications();
foreach (var notification in notifications)
{
Console.WriteLine(notification.Title);
}`

> Unhandled Exception
> System.ArgumentOutOfRangeException: Value to add was out of range.
> Parameter name: value

I'm using the last version on nuget 3.3.2.

This error was also present with the 3.2.1 version.

In the source code, I think the problem comes from this line in NotificationBuilder.cs :

`Delivered = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(notification.Notification.When)`

I create the notifications with this code:

`var options = new NotificationOptions`
`{`
` Title = call.CallLevel?.Name,`
` Description = call.Subject,`
` IsClickable = true,`
` AndroidOptions = new AndroidOptions`
` {`
` SmallDrawableIcon = 2130903040// Defined Android Icon`
` }`
`};`
``
`_toastNotificator.Notify(options);`

Do you have any idea why i'm getting this error ?
Unfortunately, I can test only on Android, I cant update my Windows 10 with the last update.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.