I'm writing a cancelable async function which does a lot of work with many early returns interspersed if the task has been canceled. I need to perform some post processing tear-down work when the task successfully runs to completion or is canceled. To accomplish that, I tried to put this logic in a defer
block but this reveals an odd error message:
Main actor-isolated property 'isPerformingAsyncWork' can not be mutated from the main actor
Is this not a direct contradiction, saying this property can only be modified on the main actor and you cannot mutate it from the main actor?