Issue with API (RemoveBasicUser)

The code below worked without issues in API 2020. However, I now have issues in newer versions of the API.

Here is the code:

public bool DeleteBasicUser(string username)

{

  var basicUsers = Server.BasicUserFolder.BasicUsers;

  BasicUser user = basicUsers.First(u => u.DisplayName.ToLower() == username.ToLower());

  BasicUserFolder self = Server.BasicUserFolder;

  var result = self.RemoveBasicUser(user.Path);

  {

    result.UpdateState();

  } while (result.Progress < 100);

  if (result.State != StateEnum.Success)

  {

    return false;

  }

  self.Save(); //ss was self

  return true;

}

UpdateState is throwing the following exception:

HResult=0x80131500

Message=The UpdateState is expecting a Path property in the InvokeResult, but was not found.

Source=VideoOS.Platform

StackTrace:

at VideoOS.Platform.ConfigurationItems.ServerTask.UpdateState()

at Secure365.Services.Subservices.ManagementServerDataRunner.DeleteBasicUser(String username) in [C:\Users\admin\source\repos\Secure365\src\Secure365\Services\Subservices\ManagementServerDataRunner.cs](file:C:/Users/admin/source/repos/Secure365/src/Secure365/Services/Subservices/ManagementServerDataRunner.cs):line 257

at Secure365.Services.MilestoneConfigurationService.DeleteBasicUser(String username) in [C:\Users\admin\source\repos\Secure365\src\Secure365\Services\MilestoneConfigurationService.cs](file:C:/Users/admin/source/repos/Secure365/src/Secure365/Services/MilestoneConfigurationService.cs):line 234

This exception was originally thrown at this call stack:

[External Code]

Secure365.Services.Subservices.ManagementServerDataRunner.DeleteBasicUser(string) in ManagementServerDataRunner.cs

Secure365.Services.MilestoneConfigurationService.DeleteBasicUser(string) in MilestoneConfigurationService.cs

It appears to remove the user though.

API version 23.2.1

Thank you

I tested and reproduced the issue. I have made a bug report with Milestone Development and I will let you know what they find.

Thank you Bo

Milestone Development have made a fix and this fix will be in MIP SDK 2023R3 later this year.

Milestone Development have decided not to make a hot fix for the current MIP SDK (2023R2) and ask that you do a simple change to your code:

// replace
{
    result.UpdateState();
} while (result.Progress < 100);
 
// replace with
while (result.Progress < 100)
{
    result.UpdateState();
}

Thank you .