public static void StampCurrentDataContext(Exception exception) { ExecutionContext.DataContextHolder contextHolder = ExecutionContext.GetContextHolder(exception, true); if (contextHolder != null && ExecutionContext.currentContexts != null) { foreach (DataContext dataContext in ExecutionContext.currentContexts) { contextHolder.Contexts.Add(dataContext.ToString()); if (contextHolder.Side == null) { OperationSideDataContext operationSideDataContext = dataContext as OperationSideDataContext; if (operationSideDataContext != null) { contextHolder.Side = new ExceptionSide?(operationSideDataContext.Side); } } if (contextHolder.OperationType == OperationType.None) { OperationDataContext operationDataContext = dataContext as OperationDataContext; if (operationDataContext != null && operationDataContext.OperationType != OperationType.None) { contextHolder.OperationType = operationDataContext.OperationType; } } } } }
public void ReconstructAndThrow(string serverName, VersionInformation serverVersion) { ExecutionContext.Create(new DataContext[] { this.DataContext.IsEmpty ? null : new WrappedDataContext(this.DataContext), OperationSideDataContext.GetContext(new ExceptionSide?(this.Side)), string.IsNullOrEmpty(serverName) ? null : new WrappedDataContext(MrsStrings.RemoteServerName(serverName)) }).Execute(delegate { throw this.Reconstruct(serverVersion); }); }