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
- HttpSysSettings.cs
- EntityDataSourceView.cs
- SqlMultiplexer.cs
- WebPartDescription.cs
- BaseTemplateCodeDomTreeGenerator.cs
- PaintEvent.cs
- XmlDataImplementation.cs
- RsaSecurityTokenAuthenticator.cs
- CLSCompliantAttribute.cs
- ObjectHelper.cs
- ReversePositionQuery.cs
- HtmlImage.cs
- TargetFrameworkAttribute.cs
- XmlSchemaExternal.cs
- HttpModulesSection.cs
- NetworkInformationException.cs
- ColumnReorderedEventArgs.cs
- x509utils.cs
- HostingEnvironment.cs
- ErrorProvider.cs
- ConfigsHelper.cs
- BatchServiceHost.cs
- RoleManagerSection.cs
- unsafeIndexingFilterStream.cs
- SoapSchemaExporter.cs
- GridEntryCollection.cs
- XmlBoundElement.cs
- HebrewNumber.cs
- PersistChildrenAttribute.cs
- LineServicesRun.cs
- TreeViewAutomationPeer.cs
- NameSpaceExtractor.cs
- SessionParameter.cs
- WriteFileContext.cs
- SoapAttributeOverrides.cs
- DataRelationCollection.cs
- CreateRefExpr.cs
- EdmToObjectNamespaceMap.cs
- ActivationServices.cs
- DateTimeConverter2.cs
- SmtpNegotiateAuthenticationModule.cs
- ObjectConverter.cs
- PrintingPermission.cs
- VerificationAttribute.cs
- WinEventQueueItem.cs
- MultiView.cs
- HttpDictionary.cs
- UIPropertyMetadata.cs
- MinimizableAttributeTypeConverter.cs
- CharacterHit.cs
- UndirectedGraph.cs
- SHA384.cs
- FSWPathEditor.cs
- EnlistmentState.cs
- ToolStripDesignerAvailabilityAttribute.cs
- DataSetMappper.cs
- RemotingConfiguration.cs
- MdiWindowListItemConverter.cs
- AssemblyCache.cs
- DecoderFallbackWithFailureFlag.cs
- ComponentManagerBroker.cs
- CodeTypeReference.cs
- DesignerVerb.cs
- ProgressBar.cs
- Types.cs
- CatalogPartCollection.cs
- SimpleHandlerBuildProvider.cs
- NativeMethods.cs
- VirtualPath.cs
- TextRunProperties.cs
- OleDbSchemaGuid.cs
- GridViewCellAutomationPeer.cs
- DefaultProxySection.cs
- X509ChainPolicy.cs
- FilterableAttribute.cs
- HelpProvider.cs
- _ScatterGatherBuffers.cs
- DataContract.cs
- ClosableStream.cs
- ArrayExtension.cs
- LinqDataSourceValidationException.cs
- RectAnimationClockResource.cs
- SynchronizationContext.cs
- ListViewItemSelectionChangedEvent.cs
- Polygon.cs
- LayoutTableCell.cs
- CatalogPart.cs
- InstalledVoice.cs
- TraceContext.cs
- DeleteMemberBinder.cs
- CmsInterop.cs
- MatrixAnimationUsingKeyFrames.cs
- GridViewColumnHeader.cs
- PagesSection.cs
- SystemParameters.cs
- TypeToken.cs
- WebDisplayNameAttribute.cs
- CancelRequestedQuery.cs
- DiscoveryInnerClientManaged11.cs
- TraceSection.cs