/// <summary> /// Constructor /// </summary> public TaskFactoryLoggingHost(bool isRunningWithMultipleNodes, ElementLocation elementLocation, BuildLoggingContext loggingContext) { ErrorUtilities.VerifyThrowArgumentNull(loggingContext, "loggingContext"); ErrorUtilities.VerifyThrowInternalNull(elementLocation, "elementLocation"); _activeProxy = true; _isRunningWithMultipleNodes = isRunningWithMultipleNodes; _loggingContext = loggingContext; _elementLocation = elementLocation; }
/// <summary> /// Indicates to the TaskHost that it is no longer needed. /// Called by TaskBuilder when the task using the EngineProxy is done. /// </summary> internal void MarkAsInactive() { VerifyActiveProxy(); _activeProxy = false; _loggingContext = null; _elementLocation = null; // Clear out the sponsor (who is responsible for keeping the EngineProxy remoting lease alive until the task is done) // this will be null if the engineproxy was never sent across an appdomain boundry. if (_sponsor != null) { ILease lease = (ILease)RemotingServices.GetLifetimeService(this); lease?.Unregister(_sponsor); _sponsor.Close(); _sponsor = null; } }