M-Files / VAF.Extensions.Community

Community-built .NET extension methods for use with the M-Files Vault Application Framework.
MIT License
25 stars 20 forks source link

Configuration issue introduced in v24.10.73 #141

Closed petrijr closed 1 month ago

petrijr commented 1 month ago

Hello,

I think I found a bug in the latest release of MFiles.VAF.Extensions-component.

The bug appeared as I tried to update the dependency version of MFiles.VAF.Extensions to version 24.10.73, but this introduced a configuration-related issue where I can't anymore modify the configuration and save it without getting an exception.

Exception looks like this: [Void OnConfigurationUpdated(TSecureConfiguration, Boolean, Boolean)], IL:27, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Void PopulateFromConfiguration(Boolean)], IL:33, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Void PopulateFromConfiguration(TSecureConfiguration, Boolean)], IL:1070, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [System.Nullable1[System.DateTimeOffset] GetNextExecution(System.Nullable1[System.DateTimeOffset])], IL:144, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [System.Nullable1[System.DateTimeOffset] GetNextExecution(System.Nullable1[System.DateTimeOffset])], IL:260, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Boolean Any[TSource](System.Collections.Generic.IEnumerable1[TSource])], IL:21, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Boolean MoveNext()], IL:43, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Void .ctor(System.Collections.Generic.IEnumerable1[TElement])], IL:114, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Boolean MoveNext()], IL:78, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [Boolean MoveNext()], IL:95, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [System.Nullable1[System.DateTimeOffset] b__0(MFiles.VAF.Extensions.ScheduledExecution.Trigger)], IL:0, Tyhjäarvon sallivalla objektilla on oltava arvo. 0x80131509) [System.Nullable1[System.DateTimeOffset] GetNextExecution(System.Nullable1[System.DateTimeOffset], System.TimeZoneInfo)], IL:47, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [System.Nullable1[System.DateTimeOffset] GetNextExecution(System.Nullable1[System.DateTimeOffset], System.TimeZoneInfo)], IL:0, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) [System.Nullable1[System.DateTimeOffset] GetNextExecutionIncludingNextDay(System.Nullable1[System.DateTimeOffset], System.TimeZoneInfo, Boolean)], IL:79, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) Void ThrowInvalidOperationException(System.ExceptionResource)], IL:16, Tyhjäarvon sallivalla objektilla on oltava arvo. (0x80131509) (M-Files 24.9.14055.3 2024-10-24T18:55:45.771Z)`

Version 24.10.72 works fine, there I can modify configuration and save the modifications without any issues.

Let me know if you need me to test something to help investigating this, I can easily repro it with my VAF by updating the version. Sorry I can't produce a simple repro for this as my VAF is quite complicated and has lots of configurations, especially lots of recurring task configurations so probably some of those is behind the error, but I can't say which one; or maybe they all are.

Best regards,

CraigHawker commented 1 month ago

I have not been able to reproduce this myself yet. It would be useful to have details of the configuration structure used (just the bit that defines the recurrence), the current value (before the configuration is updated), and the new value.

petrijr commented 1 month ago

I tested the potential fix, but it didn't help. Just has the same bug as in 24.10.73. Downgraded version back to 24.10.72 and the bug went away.

I copy-pasted the (cleaned up) JSON from the advanced configuration so you see what the config looks like. It doesn't matter what I change there, for example on line 43 I can change the 10 minutes to 11 minutes and then try to save and the bug occurs. So the changed value is not the issue itself. Error-on-24.10.73.json

Here are some example recurrence configurations that are in the code: `[DataMember] [RecurringOperationConfiguration(VaultApplication.QueueId, "task")] [Security(ChangeBy = SecurityAttribute.UserLevel.VaultAdmin)] public Frequency SomeFrequence { get; set; } = TimeSpan.FromHours(1);

[DataMember] [RecurringOperationConfiguration(VaultApplication.QueueId, "task", DefaultValue = "21.00",)] [Security(ChangeBy = SecurityAttribute.UserLevel.VaultAdmin)] public Frequency SomeFrequence { get; set; } = new Schedule() { Enabled = true, RunOnVaultStartup = false, Triggers = new List() { new DailyTrigger() { TriggerTimes = new List { new TimeSpan(21,0,0) } } } };

[DataMember] [RecurringOperationConfiguration(VaultApplication.QueueId, "task", DefaultValue = "21.04")] [Security(ChangeBy = SecurityAttribute.UserLevel.VaultAdmin)] public Frequency DeleteOldLogsFrequence { get; set; } = new Schedule() { Enabled = true, RunOnVaultStartup = false, Triggers = new List() { new DailyTrigger() { TriggerTimes = new List { new TimeSpan(21,4,0) } }, new WeeklyTrigger() { TriggerDays = new List { DayOfWeek.Monday }, TriggerTimes = new List { new TimeSpan(19,0,0) } } } };

[DataMember] [RecurringOperationConfiguration(VaultApplication.QueueId, "task"", DefaultValue = "21.00, 22.00, 23.00")] [Security(ChangeBy = SecurityAttribute.UserLevel.VaultAdmin)] public Frequency SomeFrequence { get; set; } = new Schedule() { Enabled = true, RunOnVaultStartup = false, Triggers = new List() { new DailyTrigger() { TriggerTimes = new List { new TimeSpan(21, 0, 0), new TimeSpan(22, 0, 0), new TimeSpan(23, 0, 0) } } } };

[DataMember] [RecurringOperationConfiguration(VaultApplication.QueueId, "task", DefaultValue = "3 minuutin välein",)] [Security(ChangeBy = SecurityAttribute.UserLevel.VaultAdmin)] public Frequency SomeFrequence { get; set; } = TimeSpan.FromMinutes(3);`

CraigHawker commented 1 month ago

I have replicated the issue and I believe that it's resolved in 24.10.0.7-issue-141. If you're able to confirm that'd be great, but I have a high confidence that this is resolved as I can see where I introduced this bug.

Note: There is not a public release of this yet. I'm hoping to get some positive feedback from you first.

CraigHawker commented 1 month ago

Did you manage to test this @petrijr? I am confident that this solves the issue, but I'd like to get some feedback from yourself first.