-
-
Notifications
You must be signed in to change notification settings - Fork 221
Open
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't working
Description
Package
Sentry
.NET Flavor
.NET
.NET Version
9.0.302
OS
Any (not platform specific)
OS Version
No response
Development Environment
Visual Studio v17.x
SDK Version
5.12.0
Self-Hosted Sentry Version
25.7.0
Workload Versions
...
UseSentry or SentrySdk.Init call
...
Steps to Reproduce
When using API to set the intervar it does not work with hour ranges. But in web-UI it seems to work.
There are two issues in the API:
- It does not allow to enter weekdays e.g. MON, TUE, ... (but as workaround I can replace them before submitting (see unit-test))
- Ranges are not allowed e.g. 8-18/4 (trigger every 4 hours from 8-18)
Here a unit tests that reproduces the issue:
public class SentryMonitorOptionsTests
{
private static readonly Dictionary<string, string> DayMappings = new(StringComparer.OrdinalIgnoreCase)
{
{ "MON", "1" },
{ "TUE", "2" },
{ "WED", "3" },
{ "THU", "4" },
{ "FRI", "5" },
{ "SAT", "6" },
{ "SUN", "7" }
};
[Theory]
[InlineData("0 0 * * MON-FRI")]
[InlineData("0 9 * * MON-FRI")]
[InlineData("0 18 * * MON-FRI")]
[InlineData("0 8-18/4 * * MON-FRI")] //this test is failing
[InlineData("30 8-18/4 * * MON-FRI")] //this test is failing
[InlineData("0 0 * * *")]
[InlineData("0 0 * * MON-FRI")]
[InlineData("0 20 * * MON-FRI")]
public void Test(string trigger)
{
string cron = trigger;
foreach (var mapping in DayMappings)
{
cron = cron.Replace(mapping.Key, mapping.Value, StringComparison.OrdinalIgnoreCase);
}
var ctor = typeof(SentryMonitorOptions).GetConstructors(BindingFlags.Instance | BindingFlags.NonPublic).First();
var options = (SentryMonitorOptions)ctor.Invoke(null);
options.Interval(cron);
}
}

Expected Result
To be allowed to use ranges and weekdays
Actual Result
System.ArgumentException
The provided crontab does not match the expected format of '* * * * *' translating to 'minute', 'hour', 'day of the month', 'month', and 'day of the week'.
Metadata
Metadata
Assignees
Labels
.NETPull requests that update .net codePull requests that update .net codeBugSomething isn't workingSomething isn't working
Type
Projects
Status
No status
Status
No status