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
- SafeRightsManagementEnvironmentHandle.cs
- EventPrivateKey.cs
- EntityCommandExecutionException.cs
- Size.cs
- GridViewPageEventArgs.cs
- CssTextWriter.cs
- ConfigXmlText.cs
- ResXBuildProvider.cs
- _SslSessionsCache.cs
- FastPropertyAccessor.cs
- CellRelation.cs
- StaticResourceExtension.cs
- SqlCachedBuffer.cs
- Model3DCollection.cs
- ServicePointManagerElement.cs
- ServicesExceptionNotHandledEventArgs.cs
- HandlerMappingMemo.cs
- BufferedResponseStream.cs
- hresults.cs
- InkCanvasSelectionAdorner.cs
- Attributes.cs
- PackUriHelper.cs
- SecurityManager.cs
- ValidationEventArgs.cs
- ListViewDataItem.cs
- SmtpMail.cs
- XmlNodeList.cs
- DecimalAnimation.cs
- TextRangeEditTables.cs
- coordinator.cs
- WorkflowInspectionServices.cs
- PixelFormat.cs
- Marshal.cs
- ConfigurationManagerHelperFactory.cs
- InvalidChannelBindingException.cs
- NotifyCollectionChangedEventArgs.cs
- XmlStreamStore.cs
- CodeParameterDeclarationExpressionCollection.cs
- JsonReaderDelegator.cs
- DrawListViewItemEventArgs.cs
- VectorAnimation.cs
- Constraint.cs
- OdbcInfoMessageEvent.cs
- ConfigXmlText.cs
- TripleDES.cs
- ExpressionContext.cs
- MasterPageParser.cs
- DebugView.cs
- InheritanceAttribute.cs
- SectionXmlInfo.cs
- EditingMode.cs
- WindowsAuthenticationModule.cs
- RadioButtonRenderer.cs
- ListViewItemMouseHoverEvent.cs
- Label.cs
- XmlSchemaObjectTable.cs
- RawUIStateInputReport.cs
- VectorKeyFrameCollection.cs
- NullableDoubleSumAggregationOperator.cs
- TranslateTransform3D.cs
- XmlSchemaElement.cs
- DeviceFilterEditorDialog.cs
- FlagsAttribute.cs
- IndividualDeviceConfig.cs
- BulletedListDesigner.cs
- ColumnClickEvent.cs
- DBNull.cs
- ZipFileInfoCollection.cs
- StrokeNode.cs
- ProfilePropertyMetadata.cs
- RankException.cs
- XmlRawWriterWrapper.cs
- DiscoveryExceptionDictionary.cs
- DecimalAnimation.cs
- IDQuery.cs
- DefaultHttpHandler.cs
- HasActivatableWorkflowEvent.cs
- LinkArea.cs
- CustomAttributeSerializer.cs
- ToolStripComboBox.cs
- MediaElement.cs
- NetworkInterface.cs
- CodePrimitiveExpression.cs
- InternalsVisibleToAttribute.cs
- ConfigurationCollectionAttribute.cs
- NumberSubstitution.cs
- columnmapkeybuilder.cs
- XmlSchemaObjectTable.cs
- ObjectDataSourceEventArgs.cs
- Util.cs
- SqlDesignerDataSourceView.cs
- IOThreadScheduler.cs
- PassportAuthenticationModule.cs
- TrackingMemoryStreamFactory.cs
- AccessControlList.cs
- PhysicalAddress.cs
- SqlErrorCollection.cs
- returneventsaver.cs
- CorrelationManager.cs
- UidManager.cs