public void AddDelegate(ActivityDelegate activityDelegate, object origin) { ThrowIfDisposed(); ActivityUtilities.ValidateOrigin(origin, _activity); if (activityDelegate != null) { _activity.AddDelegate(activityDelegate); if (activityDelegate.Handler != null && activityDelegate.Handler.CacheId != _activity.CacheId) { activityDelegate.Handler.Origin = origin; } // We don't currently have ActivityDelegate.Origin. If we ever add it, or if we ever // expose Origin publicly, we need to also set it here. } }