/// <summary> /// Record the point when activity identified with descriptor has finished. /// It will have no effect when wrong activity identifier was given. /// </summary> /// <param name="descriptor">Activity identifier created by <see cref="RecordActivityStarted" /></param> public void RecordActivityFinished(string descriptor) { if (String.IsNullOrEmpty(descriptor)) { return; } Guid actionGuid; try { actionGuid = Guid.Parse(descriptor); } catch (FormatException) { return; } _mutex.WaitOne(); IActivity examinedActivity = _currentActivity; while (examinedActivity != null && examinedActivity.Guid != actionGuid) { examinedActivity.FinalizeActivity(); examinedActivity = examinedActivity.Parent; } if (examinedActivity != null) { examinedActivity.FinalizeActivity(); _currentActivity = examinedActivity.Parent; } _mutex.ReleaseMutex(); }