Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.WorkflowServices / System / ServiceModel / Dispatcher / DurableErrorHandler.cs / 1305376 / DurableErrorHandler.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.ServiceModel.Dispatcher { using System.ServiceModel.Channels; using System.Diagnostics.CodeAnalysis; abstract class DurableErrorHandler : IErrorHandler { bool debug; public DurableErrorHandler(bool debug) { this.debug = debug; } public static void CleanUpInstanceContextAtOperationCompletion() { if (OperationContext.Current == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR2.NoOperationContext)); } DurableMessageDispatchInspector.SuppressContextOnReply(OperationContext.Current); OperationContext.Current.InstanceContext.IncomingChannels.Clear(); } public bool HandleError(Exception error) { return IsUserCodeException(error); } [SuppressMessage("Microsoft.Globalization", "CA1304")] public void ProvideFault(Exception error, MessageVersion version, ref Message fault) { if (fault == null && IsUserCodeException(error)) { FaultCode code = new FaultCode(FaultCodeConstants.Codes.InternalServiceFault, FaultCodeConstants.Namespaces.NetDispatch); code = FaultCode.CreateReceiverFaultCode(code); string action = FaultCodeConstants.Actions.NetDispatcher; MessageFault messageFault; if (this.debug) { Exception toTrace = GetExceptionToTrace(error); messageFault = MessageFault.CreateFault(code, new FaultReason(toTrace.Message), new ExceptionDetail(toTrace)); } else { string reason = SR.GetString(SR.SFxInternalServerError); messageFault = MessageFault.CreateFault(code, new FaultReason(reason)); } fault = Message.CreateMessage(version, messageFault, action); } } protected virtual Exception GetExceptionToTrace(Exception error) { return error; } protected abstract bool IsUserCodeException(Exception error); } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- FaultHandlingFilter.cs
- ImageCodecInfoPrivate.cs
- StopRoutingHandler.cs
- EventBuilder.cs
- ValidationErrorCollection.cs
- MatrixStack.cs
- PerformanceCounter.cs
- ContextQuery.cs
- TcpWorkerProcess.cs
- CheckBoxList.cs
- ValueUtilsSmi.cs
- RoutedEventValueSerializer.cs
- NumericExpr.cs
- FixedBufferAttribute.cs
- OneOf.cs
- UIElementPropertyUndoUnit.cs
- Pen.cs
- QualifiedId.cs
- CheckPair.cs
- XmlQueryType.cs
- XsltSettings.cs
- Rule.cs
- TypeBuilder.cs
- ObfuscateAssemblyAttribute.cs
- TypeDelegator.cs
- AndAlso.cs
- DropTarget.cs
- XmlException.cs
- AnnotationResourceCollection.cs
- SoundPlayerAction.cs
- autovalidator.cs
- UnsafeNativeMethods.cs
- UpdateRecord.cs
- InternalMappingException.cs
- HostingEnvironmentException.cs
- WebPartMinimizeVerb.cs
- WebConfigManager.cs
- OdbcReferenceCollection.cs
- WindowsToolbar.cs
- RangeContentEnumerator.cs
- SpanIndex.cs
- MaterialGroup.cs
- BehaviorEditorPart.cs
- XmlStreamStore.cs
- SubclassTypeValidatorAttribute.cs
- CompositeControl.cs
- TemplateBaseAction.cs
- ObjectItemAttributeAssemblyLoader.cs
- ManipulationStartingEventArgs.cs
- SplineQuaternionKeyFrame.cs
- MessageSecurityOverTcp.cs
- ListBindingConverter.cs
- Directory.cs
- StretchValidation.cs
- DocumentReferenceCollection.cs
- Int32CAMarshaler.cs
- Buffer.cs
- Graphics.cs
- DeploymentExceptionMapper.cs
- List.cs
- SqlAggregateChecker.cs
- LinkedResource.cs
- SHA384.cs
- BitmapMetadata.cs
- SoapSchemaImporter.cs
- UrlMappingsModule.cs
- DeclaredTypeValidatorAttribute.cs
- WeakReference.cs
- ExtendedPropertyDescriptor.cs
- PenLineCapValidation.cs
- StrongNameMembershipCondition.cs
- CompModSwitches.cs
- ModifierKeysConverter.cs
- RSAOAEPKeyExchangeFormatter.cs
- SpeakInfo.cs
- RootAction.cs
- Calendar.cs
- ParameterExpression.cs
- EndEvent.cs
- InvalidAsynchronousStateException.cs
- EntityDataSourceWrapperPropertyDescriptor.cs
- ErrorStyle.cs
- CompiledRegexRunnerFactory.cs
- MenuTracker.cs
- ComponentDispatcherThread.cs
- MessageQueueAccessControlEntry.cs
- TextElement.cs
- VirtualPathProvider.cs
- xmlfixedPageInfo.cs
- OdbcError.cs
- DynamicField.cs
- versioninfo.cs
- MobileListItem.cs
- AppDomainUnloadedException.cs
- Encoder.cs
- ToolboxCategoryItems.cs
- URI.cs
- OptimisticConcurrencyException.cs
- RefType.cs
- ProfileGroupSettings.cs