ConfigurationService.GetChildren(EnvironmentManager.Instance.CurrentSite.ServerId, "/RuleFolder") --> throws exception

We have a MIP pugin which was working fine with 2023 r1. After an upgrate to 2023 r3 the plugin throws the following exception:

Exception source:      VideoOS.Platform
Exception type:        VideoOS.Platform.Proxy.RestApi.ConfigApiRelated.ResourceNotFoundException
Exception message:     Unknown resource: Unknown
Exception target site: ResourcePluralToItemType
   at VideoOS.Platform.Proxy.RestApi.ConfigApiRelated.NameConvert.ResourcePluralToItemType(String resourceName, Boolean throwForInvalid)
   at VideoOS.Platform.Proxy.RestApi.RestApiConvert.SetValuefrom(String callerItemType, Property property, String field, JsonObject resource, JsonObject definitions, Boolean isPath)
   at VideoOS.Platform.Proxy.RestApi.RestApiConvert.ConstructProperties(String itemType, String id, JsonObject resource, JsonObject definitions)
   at VideoOS.Platform.Proxy.RestApi.RestApiConvert.ConvertToConfigurationItem(JsonObject resource, String callerItemType, JsonObject tasks, JsonObject definitions, Boolean fromInvoke)
   at VideoOS.Platform.Proxy.RestApi.RestApiClientDecorator.GetChildItems(String path)
   at VideoOS.Platform.ConfigurationItems.ConfigurationService.GetChildren(ServerId serverId, String path)
   at UFilter.UFilterLicenceHandler.CollectAffectedCameras(CancellationToken cancellationToken)
   at UFilter.UFilterLicenceHandler.UpdateLicence(CancellationToken cancellationToken)
   at UFilter.UFilterLicenceHandler.<StartUpdateLicenceAsync>b__29_0()
   at System.Threading.Tasks.Task.Execute()

This is a coorporate version.

We are calling you API with the following:

private void CollectAffectedCameras(CancellationToken cancellationToken)
{
        _rulesWithCameras.Clear();
        var rules = ConfigurationService.GetChildren(EnvironmentManager.Instance.CurrentSite.ServerId, "/RuleFolder"); // this throws the exception
        .....
}

This is a prod server where the problem happens.

In dev environment with the same versions we could not reproduce the issue.

We suspect that some resource/rule is wrong after the upgrade.

Please help us in the investigation.

We did some further investigations, and we figured it out, that this call

ConfigurationService.GetChildren(EnvironmentManager.Instance.CurrentSite.ServerId, "/RuleFolder")

fails with the exception mentioned above when the event type defined as the start or stop condition of the rule is missing (e.g., deleted). The SDK should handle this situation in a more sophisticated manner, particularly given that a user can delete an event type attached to a rule without any restrictions or warnings in the Management Client.

We met this issue first in version 2023 R3.

Thank you.

Did you test whether a deleted device would cause the same exception in 2023R1?

I have reported this as a potential bug to Milestone Development. I will update this thread when I have news on what Milestone Development found.

The upgrade was from XProtect Corporate 2022 R3.

It was not tested with 2023R1.

The thread started by saying it worked in 2023R1, but what is important, when you tried, 2022R3, did you ever try with a deleted device? What I am trying to ascertain is whether we know it worked in an older version if testing the right way; having rules with a deleted device. There could be a deleted device because other maintenance work was done together with the upgrade..

@Bo Ellegård Andersen (Milestone Systems)​

Unfortunatly we had the wrong information initially, so the 2023 R1 was a wrong information from the initial thread.

Now I retested with:

  • 2022 R3 - it is working as expected
  • 2023 R1 - breaks
  • 2023 R3 - breaks

Step to reproduce:

  • create a custom generic event e.g. MY_TEST
  • create a rule for which the "Perform an action on " is the previously generated MY_TEST event
  • create a plugin which calls ConfigurationService.GetChildren(EnvironmentManager.Instance.CurrentSite.ServerId, “/RuleFolder”) → works as expected
  • delete the MY_TEST
  • Call the “ConfigurationService.GetChildren(…)” function and it will throw the exception starting from 2023 R1.

Your support is kindly appreciated.

Thank you for the clarification. I have reported this as a potential bug with Milestone Development, and the last clarification is valuable.

I will post here when there is news from Development.

Thank you very much.

@Bo Ellegård Andersen (Milestone Systems)​

Do you have any update on this?

Do you have any workaround or other suggestion/solutions to get the list of channels which belong to some given rules?

When checking up on this with development I was made aware that we miss a basic piece of information:

What version of the MIP SDK are you using?

If you are not using the newest version of the MIP SDK please try with the newest version. There’s a chance that the issue is solved! https://www.nuget.org/profiles/milestonesys

@Bo Ellegård Andersen (Milestone Systems)​

We are using the latest versions.

Forgive me another question, you mention that this is a MIP plugin, where does the plugin load? (Smart Client, Management Client, Event Server)?

It is loaded into the Management Client.

We also have a setup documentation of our solution.

https://docs.ultinous.com/ufilter/docs/u-filter/ufilter_milestone_xprotect_integration

I am finally confident that I was able to reproduce the exact same as you have. Milestone Development will have to investigate still but the issue is clearer now.

Thank you for the information.

Do you have any information when will the Development give any update on this?

Milestone Development have developed a fix that will be released in 2024R1

Hi @Bo Ellegård Andersen (Milestone Systems)​

Thank you for the update.

Will the fix come in the VideoOS.Platform.SDK so we will be able to use with Milestone XProtect 2023 R1 R2 and R3 products?

Or it was fixed only in the products and in Milestone XProtect 2023 R* will still crash the GetChildren API?

The fix will be in the VideoOS.Platfom.dll.

When you have a 2024R1 VideoOS.Platfom.dll you can replace the VideoOS.Platfom.dll in a Management Client (or Smart Client or Event Server) version 2023 R1 R2 and R3.

See comment below..

I am curious as I don’t have that information, are you able to capture the exception from your plugin code (Try .. Catch ..)? (I can test of course but I suspect you might have done the test and have the information.)

Thanks for the update regarding the VideoOS.Platfom.dll.

We did not test it but I don’t see any obstacle catching it, however it does not really help us, because without the API call we are not able to get the information.

I hope that customers will be willing to replace the dll.

You could offer a hint for the user that the rules cannot be fetched which could be caused by rules that contain removed devices.