You've already forked linux-packaging-mono
acceptance-tests
data
debian
docs
external
ikvm-native
llvm
m4
man
mcs
build
class
Accessibility
Commons.Xml.Relaxng
Cscompmgd
CustomMarshalers
Facades
I18N
IBM.Data.DB2
ICSharpCode.SharpZipLib
Microsoft.Build
Microsoft.Build.Engine
Microsoft.Build.Framework
Microsoft.Build.Tasks
Microsoft.Build.Utilities
Microsoft.CSharp
Microsoft.NuGet.Build.Tasks
Microsoft.VisualC
Microsoft.Web.Infrastructure
MicrosoftAjaxLibrary
Mono.Btls.Interface
Mono.C5
Mono.CSharp
Mono.Cairo
Mono.Cecil
Mono.Cecil.Mdb
Mono.CodeContracts
Mono.CompilerServices.SymbolWriter
Mono.Data.Sqlite
Mono.Data.Tds
Mono.Debugger.Soft
Mono.Http
Mono.Management
Mono.Messaging
Mono.Messaging.RabbitMQ
Mono.Options
Mono.Parallel
Mono.Posix
Mono.Profiler.Log
Mono.Runtime.Tests
Mono.Security
Mono.Security.Win32
Mono.Simd
Mono.Tasklets
Mono.WebBrowser
Mono.XBuild.Tasks
Novell.Directory.Ldap
PEAPI
RabbitMQ.Client
SMDiagnostics
System
System.ComponentModel.Composition.4.5
System.ComponentModel.DataAnnotations
System.Configuration
System.Configuration.Install
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Linq
System.Data.OracleClient
System.Data.Services
System.Data.Services.Client
System.Deployment
System.Design
System.DirectoryServices
System.DirectoryServices.Protocols
System.Drawing
System.Drawing.Design
System.Dynamic
System.EnterpriseServices
System.IO.Compression
System.IO.Compression.FileSystem
System.IdentityModel
System.IdentityModel.Selectors
System.Json
System.Json.Microsoft
System.Management
System.Messaging
System.Net
System.Net.Http
System.Net.Http.Formatting
System.Net.Http.WebRequest
System.Net.Http.WinHttpHandler
System.Numerics
System.Numerics.Vectors
System.Reactive.Core
System.Reactive.Debugger
System.Reactive.Experimental
System.Reactive.Interfaces
System.Reactive.Linq
System.Reactive.Observable.Aliases
System.Reactive.PlatformServices
System.Reactive.Providers
System.Reactive.Runtime.Remoting
System.Reactive.Windows.Forms
System.Reactive.Windows.Threading
System.Reflection.Context
System.Runtime.Caching
System.Runtime.CompilerServices.Unsafe
System.Runtime.DurableInstancing
System.Runtime.Remoting
System.Runtime.Serialization
System.Runtime.Serialization.Formatters.Soap
System.Security
System.ServiceModel
System.ServiceModel.Activation
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.Web
System.ServiceProcess
System.Threading.Tasks.Dataflow
System.Transactions
System.Web
System.Web.Abstractions
System.Web.ApplicationServices
System.Web.DynamicData
System.Web.Extensions
System.Web.Extensions.Design
System.Web.Http
System.Web.Http.SelfHost
System.Web.Http.WebHost
System.Web.Mobile
System.Web.Mvc3
System.Web.Razor
System.Web.RegularExpressions
System.Web.Routing
System.Web.Services
System.Web.WebPages
System.Web.WebPages.Deployment
System.Web.WebPages.Razor
System.Windows
System.Windows.Forms
System.Windows.Forms.DataVisualization
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.XML
System.Xaml
System.Xml.Linq
System.Xml.Serialization
SystemWebTestShim
WebMatrix.Data
WindowsBase
aot-compiler
corlib
dlr
doc
legacy
lib
monodoc
notes
reference-assemblies
referencesource
SMDiagnostics
System
System.Activities
System.Activities.Core.Presentation
System.Activities.DurableInstancing
System.Activities.Presentation
System.ComponentModel.DataAnnotations
System.Configuration
System.Core
System.Data
System.Data.DataSetExtensions
System.Data.Entity
System.Data.Entity.Design
System.Data.Linq
System.Data.SqlXml
System.IdentityModel
System.IdentityModel.Selectors
System.Net
System.Numerics
System.Runtime.Caching
System.Runtime.DurableInstancing
System.Runtime.Serialization
System.ServiceModel
InternalApis
Serialization
System
Collections
ServiceModel
Activation
Administration
Channels
AddressHeader.cs
AddressHeaderCollection.cs
Addressing.cs
AddressingVersion.cs
AppContainerInfo.cs
ApplicationContainerSettings.cs
AsymmetricSecurityBindingElement.cs
AuthenticationSchemesBindingParameter.cs
AuthenticationSchemesHelper.cs
BaseUriWithWildcard.cs
BinaryMessageEncoder.cs
BinaryMessageEncodingBindingElement.cs
BinaryVersion.cs
Binding.cs
BindingContext.cs
BindingElement.cs
BindingElementCollection.cs
BindingParameterCollection.cs
BodyWriter.cs
BufferManager.cs
BufferManagerOutputStream.cs
BufferedConnection.cs
BufferedMessageData.cs
BufferedMessageWriter.cs
BufferedOutputAsyncStream.cs
BufferedReceiveMessageProperty.cs
BufferedRequestContext.cs
CallbackContextMessageHeader.cs
CallbackContextMessageProperty.cs
ChainedAsyncResult.cs
ChannelAcceptor.cs
ChannelBase.cs
ChannelBindingMessageProperty.cs
ChannelBindingProviderHelper.cs
ChannelBindingUtility.cs
ChannelBuilder.cs
ChannelDemuxer.cs.REMOVED.git-id
ChannelFactoryBase.cs
ChannelListenerBase.cs
ChannelManagerBase.cs
ChannelParameterCollection.cs
ChannelPool.cs
ChannelPoolSettings.cs
ChannelReliableSession.cs
ChannelRequirements.cs
ChannelTracker.cs
ClientContextProtocol.cs
ClientReliableChannelBinder.cs
ClientWebSocketFactory.cs
ClientWebSocketTransportDuplexSessionChannel.cs
CloseCollectionAsyncResult.cs
CloseSequence.cs
CloseSequenceResponse.cs
CommunicationObject.cs
CommunicationObjectManager.cs
CompositeDuplexBindingElement.cs
CompositeDuplexBindingElementImporter.cs
CompressionFormat.cs
CompressionFormatHelper.cs
ConnectAlgorithms.cs
Connection.cs
ConnectionAcceptor.cs
ConnectionBufferPool.cs
ConnectionDemuxer.cs
ConnectionDumpInitiator.cs
ConnectionModeReader.cs
ConnectionOrientedTransportBindingElement.cs
ConnectionOrientedTransportChannelFactory.cs
ConnectionOrientedTransportChannelListener.cs
ConnectionOrientedTransportManager.cs
ConnectionPool.cs
ConnectionPoolRegistry.cs
ContentOnlyMessage.cs
ContextAddressHeader.cs
ContextBindingElement.cs
ContextBindingElementImporter.cs
ContextBindingElementPolicy.cs
ContextChannelFactory.cs
ContextChannelListener.cs
ContextChannelRequestContext.cs
ContextDictionary.cs
ContextDuplexSessionChannel.cs
ContextExchangeCorrelationHelper.cs
ContextExchangeMechanism.cs
ContextExchangeMechanismHelper.cs
ContextInputChannel.cs
ContextInputChannelBase.cs
ContextInputSessionChannel.cs
ContextMessageHeader.cs
ContextMessageProperty.cs
ContextOutputChannel.cs
ContextOutputChannelBase.cs
ContextOutputSessionChannel.cs
ContextProtocol.cs
ContextReplyChannel.cs
ContextReplySessionChannel.cs
ContextRequestChannel.cs
ContextRequestChannelBase.cs
ContextRequestSessionChannel.cs
CorrelationCallbackMessageProperty.cs
CorrelationDataDescription.cs
CorrelationDataMessageProperty.cs
CorrelationDataSourceHelper.cs
CorrelationKey.cs
CorrelationMessageProperty.cs
CreateSequence.cs
CreateSequenceResponse.cs
CustomBinding.cs
DatagramAdapter.cs
DefaultWebSocketConnectionHandler.cs
DelegatingChannelListener.cs
DelegatingMessage.cs
DelegatingStream.cs
DeliveryFailure.cs
DeliveryStatus.cs
DeliveryStrategy.cs
DetectEofStream.cs
DirectionalAction.cs
DnsCache.cs
DoneReceivingAsyncResult.cs
DuplexChannel.cs
EncoderHelpers.cs
EndpointSettings.cs
ExclusiveNamedPipeTransportManager.cs
ExclusiveTcpTransportManager.cs
FaultConverter.cs
FramingChannels.cs
FramingDecoders.cs
FramingEncoders.cs
FramingFormat.cs
HttpAnonymousUriPrefixMatcher.cs
HttpChannelFactory.cs
HttpChannelHelpers.cs.REMOVED.git-id
HttpChannelListener.cs
HttpCookieContainerBindingElement.cs
HttpCookieContainerManager.cs
HttpHeaderInfo.cs
HttpHeadersWebHeaderCollection.cs
HttpMessageHandlerFactory.cs
HttpMessageSettings.cs
HttpPipeline.cs
HttpPipelineCancellationTokenSource.cs
HttpRequestContext.cs
HttpRequestMessageExtensionMethods.cs
HttpRequestMessageProperty.cs
HttpResponseMessageExtensionMethods.cs
HttpResponseMessageProperty.cs
HttpTransportBindingElement.cs
HttpTransportManager.cs
HttpsChannelFactory.cs
HttpsChannelListener.cs
HttpsTransportBindingElement.cs
IAnonymousUriPrefixMatcher.cs
IBindingDeliveryCapabilities.cs
IBindingMulticastCapabilities.cs
IBindingRuntimePreferences.cs
IChannel.cs
IChannelAcceptor.cs
IChannelBindingProvider.cs
IChannelFactory.cs
IChannelListener.cs
ICompressedMessageEncoder.cs
IContextBindingElement.cs
IContextManager.cs
ICorrelationDataSource.cs
ICorrelatorKey.cs
IDuplexChannel.cs
IDuplexSession.cs
IDuplexSessionChannel.cs
IHttpCookieContainerManager.cs
IInputChannel.cs
IInputSession.cs
IInputSessionChannel.cs
ILockingQueue.cs
IMergeEnabledMessageProperty.cs
IMessageProperty.cs
IMessageSource.cs
IOutputChannel.cs
IOutputSession.cs
IOutputSessionChannel.cs
IPeerNeighbor.cs
IPoisonHandlingStrategy.cs
IReceiveContextSettings.cs
IReliableChannelBinder.cs
IReliableFactorySettings.cs
IReplyChannel.cs
IReplySessionChannel.cs
IRequestChannel.cs
IRequestReplyCorrelator.cs
IRequestSessionChannel.cs
ISecurityCapabilities.cs
ISession.cs
ISessionChannel.cs
IStreamUpgradeChannelBindingProvider.cs
IStreamedMessageEncoder.cs
ITransactedBindingElement.cs
ITransactionChannelManager.cs
ITransportCompressionSupport.cs
ITransportFactorySettings.cs
ITransportTokenAssertionProvider.cs
IWebMessageEncoderHelper.cs
IWebsocketCloseDetails.cs
IdlingCommunicationPool.cs
InitialServerConnectionReader.cs
InputChannel.cs
InputChannelAcceptor.cs
InputQueueChannel.cs
InputQueueChannelAcceptor.cs
InternalDuplexBindingElement.cs
InternalDuplexChannelFactory.cs
InternalDuplexChannelListener.cs
InvalidChannelBindingException.cs
LateBoundChannelParameterCollection.cs
LayeredChannel.cs
LayeredChannelFactory.cs
LayeredChannelListener.cs
LifetimeManager.cs
LocalClientSecuritySettings.cs
LocalServiceSecuritySettings.cs
LockHelper.cs
MaxMessageSizeStream.cs
Message.cs
MessageBuffer.cs
MessageEncoder.cs
MessageEncoderCompressionHandler.cs
MessageEncoderFactory.cs
MessageEncodingBindingElement.cs
MessageEncodingBindingElementImporter.cs
MessageFault.cs
MessageHeader.cs
MessageHeaderInfo.cs
MessageHeaders.cs
MessageProperties.cs
MessageState.cs
MessageVersion.cs
Msmq.cs
Msmq3PoisonHandler.cs
Msmq4PoisonHandler.cs
Msmq4SubqueuePoisonHandler.cs
MsmqBindingElementBase.cs
MsmqBindingFilter.cs
MsmqBindingMonitor.cs
MsmqChannelFactory.cs
MsmqChannelFactoryBase.cs
MsmqChannelListenerBase.cs
MsmqDecodeHelper.cs
MsmqDefaultLockingQueue.cs
MsmqDiagnostics.cs
MsmqInputChannel.cs
MsmqInputChannelBase.cs
MsmqInputChannelListener.cs
MsmqInputChannelListenerBase.cs
MsmqInputMessage.cs
MsmqInputMessagePool.cs
MsmqInputSessionChannel.cs
MsmqInputSessionChannelListener.cs
MsmqMessageProperty.cs
MsmqNonTransactedPoisonHandler.cs
MsmqOutputChannel.cs
MsmqOutputMessage.cs
MsmqOutputSessionChannel.cs
MsmqQueue.cs
MsmqReceiveContext.cs
MsmqReceiveContextLockManager.cs
MsmqReceiveHelper.cs
MsmqReceiveParameters.cs
MsmqSubqueueLockingQueue.cs
MsmqTransportBindingElement.cs
MsmqTransportReceiveParameters.cs
MsmqUri.cs
MsmqVerifier.cs
MtomMessageEncoder.cs
MtomMessageEncodingBindingElement.cs
NamedPipeChannelFactory.cs
NamedPipeChannelListener.cs
NamedPipeConnectionPool.cs
NamedPipeConnectionPoolSettings.cs
NamedPipeSettings.cs
NamedPipeTransportBindingElement.cs
NamedPipeTransportManager.cs
NativeMsmqMessage.cs
OneWayBindingElement.cs
OneWayBindingElementImporter.cs
OneWayChannelFactory.cs
OneWayChannelListener.cs
OpaqueContent.cs
OpenCollectionAsyncResult.cs
OutputChannel.cs
OverlappedContext.cs
PeerChannelFactory.cs
PeerChannelListener.cs
PeerConnector.cs
PeerCustomResolverBindingElement.cs
PeerDuplexChannel.cs
PeerDuplexChannelListener.cs
PeerFlooder.cs
PeerHelpers.cs
PeerIPHelper.cs
PeerInputChannel.cs
PeerInputChannelListener.cs
PeerMaintainer.cs
PeerMessageDispatcher.cs
PeerNeighborManager.cs
PeerNodeImplementation.cs
PeerNodeStateManager.cs
PeerOutputChannel.cs
PeerResolverBindingElement.cs
PeerSecurityHelpers.cs
PeerSecurityManager.cs
PeerService.cs
PeerServiceMessageContracts.cs
PeerTransportBindingElement.cs
PeerUnsafeNativeCryptMethods.cs
PeerUnsafeNativeMethods.cs
PipeConnection.cs.REMOVED.git-id
PipeException.cs
PnrpPeerResolver.cs.REMOVED.git-id
PnrpPeerResolverBindingElement.cs
PrivacyNoticeBindingElement.cs
PrivacyNoticeBindingElementImporter.cs
QueuedObjectPool.cs
ReceiveContext.cs
ReceiveContextState.cs
RedirectionConstants.cs
RedirectionDuration.cs
RedirectionException.cs
RedirectionLocation.cs
RedirectionScope.cs
RedirectionType.cs
RedirectionUtility.cs
ReliableChannelBinder.cs.REMOVED.git-id
ReliableChannelFactory.cs
ReliableChannelListener.cs
ReliableDuplexSessionChannel.cs
ReliableInputConnection.cs
ReliableInputSessionChannel.cs
ReliableMessagingHelpers.cs.REMOVED.git-id
ReliableOutputConnection.cs
ReliableOutputSessionChannel.cs
ReliableReplySessionChannel.cs
ReliableRequestSessionChannel.cs
ReliableSessionBindingElement.cs
ReliableSessionBindingElementImporter.cs
RemoteEndpointMessageProperty.cs
ReplyAdapterChannelListener.cs
ReplyChannel.cs
ReplyChannelAcceptor.cs
RequestChannel.cs
RequestContext.cs
RequestContextBase.cs
RequestReplyCorrelator.cs
RetryException.cs
SafeNativeMethods.cs
SecurityAttributeGenerationHelper.cs
SecurityBindingElement.cs.REMOVED.git-id
SecurityBindingElementImporter.cs
SecurityCapabilities.cs
SecurityChannelFactory.cs
SecurityChannelFaultConverter.cs
SecurityChannelListener.cs
SecurityHeaderLayout.cs
SelfSignedCertificate.cs
SequenceRange.cs
SequenceRangeCollection.cs
ServerReliableChannelBinder.cs
ServerWebSocketTransportDuplexSessionChannel.cs
ServiceChannel.cs
ServiceChannelFactory.cs
ServiceChannelProxy.cs
ServiceContextProtocol.cs
ServiceWebSocketContext.cs
SessionConnectionReader.cs
SessionOpenNotification.cs
SharedConnectionListener.cs
SharedHttpTransportManager.cs
SharedHttpsTransportManager.cs
SharedTcpTransportManager.cs
SingletonChannelAcceptor.cs
SingletonConnectionReader.cs
SocketAsyncEventArgsPool.cs
SocketConnection.cs
SslStreamSecurityBindingElement.cs
SslStreamSecurityUpgradeProvider.cs
StandardBindingImporter.cs
StreamSecurityUpgradeAcceptor.cs
StreamSecurityUpgradeAcceptorAsyncResult.cs
StreamSecurityUpgradeAcceptorBase.cs
StreamSecurityUpgradeInitiator.cs
StreamSecurityUpgradeInitiatorAsyncResult.cs
StreamSecurityUpgradeInitiatorBase.cs
StreamSecurityUpgradeProvider.cs
StreamUpgradeAcceptor.cs
StreamUpgradeBindingElement.cs
StreamUpgradeInitiator.cs
StreamUpgradeProvider.cs
StreamedFramingRequestChannel.cs
SupportedAddressingMode.cs
SymmetricSecurityBindingElement.cs
SynchronizedMessageSource.cs
TcpChannelFactory.cs
TcpChannelListener.cs
TcpConnectionPool.cs
TcpConnectionPoolSettings.cs
TcpTransportBindingElement.cs
TcpTransportManager.cs
TerminateSequence.cs
TerminateSequenceResponse.cs
TextMessageEncoder.cs
TextMessageEncodingBindingElement.cs
TimeoutStream.cs
TracingConnection.cs
TracingConnectionInitiator.cs
TracingConnectionListener.cs
TransactionChannel.cs
TransactionChannelFactory.cs
TransactionChannelFaultConverter.cs
TransactionChannelListener.cs
TransactionFlowBindingElement.cs
TransactionFlowBindingElementImporter.cs
TransactionFlowProperty.cs
TransferSession.cs
TransmissionStrategy.cs
TransportBindingElement.cs
TransportBindingElementImporter.cs
TransportChannelFactory.cs
TransportChannelListener.cs
TransportDefaults.cs
TransportDuplexSessionChannel.cs
TransportManager.cs
TransportOutputChannel.cs
TransportReplyChannelAcceptor.cs
TransportSecurityBindingElement.cs
TransportSecurityHelpers.cs
UnderstoodHeaders.cs
UniqueTransportManagerRegistration.cs
UnrecognizedAssertionsBindingElement.cs
UnsafeNativeMethods.cs
UriGenerator.cs
UriHelper.cs
UriPrefixTable.cs
UseManagedPresentationBindingElement.cs
UseManagedPresentationBindingElementImporter.cs
UtilityExtension.cs
WebSocketConnectionHandler.cs
WebSocketHelper.cs
WebSocketMessageProperty.cs
WebSocketTransportDuplexSessionChannel.cs
WebSocketTransportSettings.cs
WebSocketTransportUsage.cs
WebSocketTransportUsageHelper.cs
WindowsStreamSecurityBindingElement.cs
WindowsStreamSecurityUpgradeProvider.cs
WrappedOptions.cs
WsrmFault.cs
WsrmMessageInfo.cs
XmlSerializerImportOptions.cs
ComIntegration
Configuration
Description
Diagnostics
Dispatcher
MsmqIntegration
PeerResolvers
Security
Syndication
Transactions
XamlIntegration
ActionMismatchAddressingException.cs
ActionNotSupportedException.cs
AddressAccessDeniedException.cs
AddressAlreadyInUseException.cs
AddressFilterMode.cs
AppContextDefaultValues.Default.cs
AuditLevel.cs
AuditLogLocation.cs
BasicHttpBinding.cs
BasicHttpContextBinding.cs
BasicHttpMessageCredentialType.cs
BasicHttpMessageSecurity.cs
BasicHttpSecurity.cs
BasicHttpSecurityMode.cs
BasicHttpsBinding.cs
BasicHttpsSecurity.cs
BasicHttpsSecurityMode.cs
CacheSetting.cs
CallbackBehaviorAttribute.cs
ChannelFactory.cs
ChannelFactoryRefCache.cs
ChannelTerminatedException.cs
ClientBase.cs
CommunicationException.cs
CommunicationObjectAbortedException.cs
CommunicationObjectFaultedException.cs
CommunicationState.cs
ConcurrencyMode.cs
ConfigurationEndpointTrait.cs
DXD.cs
DataContractFormatAttribute.cs
DeadLetterQueue.cs
DeliveryRequirementsAttribute.cs
DnsEndpointIdentity.cs
DuplexChannelFactory.cs
DuplexClientBase.cs
EmptyArray.cs
EndpointAddress.cs
EndpointAddress10.cs
EndpointAddressAugust2004.cs
EndpointIdentity.cs
EndpointNotFoundException.cs
EndpointTrait.cs
EnvelopeVersion.cs
ExceptionDetail.cs
ExceptionMapper.cs
ExtensionCollection.cs
FaultCode.cs
FaultCodeConstants.cs
FaultContractAttribute.cs
FaultException.cs
FaultImportOptions.cs
FaultReason.cs
FaultReasonText.cs
FederatedMessageSecurityOverHttp.cs
GeneralEndpointIdentity.cs
HostnameComparisonMode.cs
HttpBindingBase.cs
HttpClientCredentialType.cs
HttpProxyCredentialType.cs
HttpTransportSecurity.cs
IChannelBaseProxy.cs
IClientChannel.cs
ICommunicationObject.cs
IContextChannel.cs
IContextSessionProvider.cs
IDefaultCommunicationTimeouts.cs
IDuplexContextChannel.cs
IExtensibleObject.cs
IExtension.cs
IExtensionCollection.cs
IOnlineStatus.cs
IOperationContractAttributeProvider.cs
IServiceChannel.cs
ImpersonationOption.cs
InstanceContext.cs
InstanceContextMode.cs
InvalidMessageContractException.cs
KeyedByTypeCollection.cs
LocalAppContextSwitches.cs
MessageBodyMemberAttribute.cs
MessageContractAttribute.cs
MessageContractMemberAttribute.cs
MessageCredentialType.cs
MessageHeaderArrayAttribute.cs
MessageHeaderAttribute.cs
MessageHeaderException.cs
MessageHeaderT.cs
MessageParameterAttribute.cs
MessagePropertyAttribute.cs
MessageSecurityOverHttp.cs
MessageSecurityOverMsmq.cs
MessageSecurityOverTcp.cs
MessageSecurityVersion.cs
MostlySingletonList.cs
MsmqAuthenticationMode.cs
MsmqBindingBase.cs
MsmqEncryptionAlgorithm.cs
MsmqException.cs
MsmqPoisonMessageException.cs
MsmqSecureHashAlgorithm.cs
MsmqTransportSecurity.cs
MustUnderstandSoapException.cs
NamedPipeTransportSecurity.cs
NetHttpBinding.cs
NetHttpMessageEncoding.cs
NetHttpMessageEncodingHelper.cs
NetHttpsBinding.cs
NetMsmqBinding.cs
NetMsmqSecurity.cs
NetMsmqSecurityMode.cs
NetNamedPipeBinding.cs
NetNamedPipeSecurity.cs
NetNamedPipeSecurityMode.cs
NetPeerTcpBinding.cs
NetTcpBinding.cs
NetTcpContextBinding.cs
NetTcpSecurity.cs
NonDualMessageSecurityOverHttp.cs
OSEnvironmentHelper.cs
OSVersion.cs
OperationBehaviorAttribute.cs
OperationContext.cs
OperationContextScope.cs
OperationContractAttribute.cs
OperationFormatStyle.cs
OperationFormatUse.cs
PeerHopCountAttribute.cs
PeerMessageOrigination.cs
PeerMessagePropagation.cs
PeerMessagePropagationFilter.cs
PeerNode.cs
PeerNodeAddress.cs
PeerResolver.cs
PeerSecuritySettings.cs
PeerTransportCredentialType.cs
PeerTransportSecuritySettings.cs
PoisonMessageException.cs
Pool.cs
ProgrammaticEndpointTrait.cs
ProtocolException.cs
QueueTransferProtocol.cs
QueuedDeliveryRequirementsMode.cs
QuotaExceededException.cs
ReceiveContextEnabledAttribute.cs
ReceiveErrorHandling.cs
ReleaseInstanceMode.cs
ReliableMessagingVersion.cs
ReliableSession.cs
RsaEndpointIdentity.cs
SecurityMode.cs
ServerTooBusyException.cs
ServiceActivationException.cs
ServiceAuthenticationManager.cs
ServiceAuthorizationManager.cs
ServiceBehaviorAttribute.cs
ServiceChannelManager.cs
ServiceConfiguration.cs
ServiceContractAttribute.cs
ServiceDefaults.cs
ServiceEndpointTrait.cs
ServiceHost.cs
ServiceKnownTypeAttribute.cs
ServiceModelAppSettings.cs
ServiceModelAttributeTargets.cs
ServiceModelDictionary.cs
ServiceModelStrings.cs
ServiceModelStringsVersion1.cs
ServiceSecurityContext.cs
SessionMode.cs
SpnEndpointIdentity.cs
StringUtil.cs
SynchronizedCollection.cs
SynchronizedDisposablePool.cs
SynchronizedKeyedCollection.cs
SynchronizedReadOnlyCollection.cs
TcpClientCredentialType.cs
TcpTransportSecurity.cs
ThreadTrace.cs
TimeSpanHelper.cs
TransactionFlowAttribute.cs
TransactionFlowOption.cs
TransactionProtocol.cs
TransferMode.cs
UnifiedSecurityMode.cs
UnknownMessageReceivedEventArgs.cs
UpnEndpointIdentity.cs
UriSchemeKeyedCollection.cs
WS2007FederationHttpBinding.cs
WS2007HttpBinding.cs
WSAddressing10ProblemHeaderQNameFault.cs
WSDualHttpBinding.cs
WSDualHttpSecurity.cs
WSDualHttpSecurityMode.cs
WSFederationHttpBinding.cs
WSFederationHttpSecurity.cs
WSFederationHttpSecurityMode.cs
WSHttpBinding.cs
WSHttpBindingBase.cs
WSHttpContextBinding.cs
WSHttpSecurity.cs
WSMessageEncoding.cs
WrappedDispatcherException.cs
X509CertificateEndpointIdentity.cs
XD.cs.REMOVED.git-id
XPathMessageQuery.cs
XmlBuffer.cs
XmlSerializerFormatAttribute.cs
XmlUtil.cs
UriTemplate.cs
UriTemplateCompoundPathSegment.cs
UriTemplateEquivalenceComparer.cs
UriTemplateHelpers.cs
UriTemplateLiteralPathSegment.cs
UriTemplateLiteralQueryValue.cs
UriTemplateMatch.cs
UriTemplateMatchException.cs
UriTemplatePartType.cs
UriTemplatePathPartiallyEquivalentSet.cs
UriTemplatePathSegment.cs
UriTemplateQueryValue.cs
UriTemplateTable.cs
UriTemplateTableMatchCandidate.cs
UriTemplateTrieIntraNodeLocation.cs
UriTemplateTrieLocation.cs
UriTemplateTrieNode.cs
UriTemplateVariablePathSegment.cs
UriTemplateVariableQueryValue.cs
AssemblyInfo.cs
System.ServiceModel.txt.REMOVED.git-id
TD.Designer.cs.REMOVED.git-id
System.ServiceModel.Activation
System.ServiceModel.Activities
System.ServiceModel.Channels
System.ServiceModel.Discovery
System.ServiceModel.Internals
System.ServiceModel.Routing
System.ServiceModel.WasHosting
System.ServiceModel.Web
System.Web
System.Web.ApplicationServices
System.Web.DataVisualization
System.Web.DynamicData
System.Web.Entity
System.Web.Entity.Design
System.Web.Extensions
System.Web.Mobile
System.Web.Routing
System.Web.Services
System.Workflow.Activities
System.Workflow.ComponentModel
System.Workflow.Runtime
System.WorkflowServices
System.Xaml.Hosting
System.Xml
System.Xml.Linq
XamlBuildTask
mscorlib
LICENSE.txt
PATENTS.TXT
README.Mono.md
README.md
test-helpers
LICENSE
Makefile
Open.snk
README
ecma.pub
mono.pub
mono.snk
msfinal.pub
reactive.pub
silverlight.pub
winfx.pub
winfx3.pub
docs
errors
ilasm
jay
mcs
packages
tests
tools
AUTHORS
COPYING
INSTALL.txt
Makefile
MonoIcon.png
README
ScalableMonoIcon.svg
mkinstalldirs
mk
mono
msvc
netcore
po
runtime
samples
scripts
support
tools
COPYING.LIB
LICENSE
Makefile.am
Makefile.in
NEWS
README.md
acinclude.m4
aclocal.m4
autogen.sh
code_of_conduct.md
compile
config.guess
config.h.in
config.rpath
config.sub
configure.REMOVED.git-id
configure.ac.REMOVED.git-id
depcomp
install-sh
ltmain.sh.REMOVED.git-id
missing
mkinstalldirs
mono-uninstalled.pc.in
test-driver
winconfig.h
733 lines
25 KiB
C#
733 lines
25 KiB
C#
![]() |
//------------------------------------------------------------
|
||
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
//------------------------------------------------------------
|
||
|
namespace System.ServiceModel.Channels
|
||
|
{
|
||
|
using System;
|
||
|
using System.Diagnostics;
|
||
|
using System.Runtime;
|
||
|
using System.ServiceModel;
|
||
|
using System.ServiceModel.Diagnostics;
|
||
|
using System.ServiceModel.Diagnostics.Application;
|
||
|
using System.Transactions;
|
||
|
using System.Runtime.Diagnostics;
|
||
|
|
||
|
public abstract class ReceiveContext
|
||
|
{
|
||
|
public readonly static string Name = "ReceiveContext";
|
||
|
ThreadNeutralSemaphore stateLock; // protects state that may be reverted
|
||
|
bool contextFaulted;
|
||
|
object thisLock;
|
||
|
EventTraceActivity eventTraceActivity;
|
||
|
|
||
|
protected ReceiveContext()
|
||
|
{
|
||
|
this.thisLock = new object();
|
||
|
this.State = ReceiveContextState.Received;
|
||
|
this.stateLock = new ThreadNeutralSemaphore(1);
|
||
|
}
|
||
|
|
||
|
public ReceiveContextState State
|
||
|
{
|
||
|
get;
|
||
|
protected set;
|
||
|
}
|
||
|
|
||
|
protected object ThisLock
|
||
|
{
|
||
|
get { return thisLock; }
|
||
|
}
|
||
|
|
||
|
public event EventHandler Faulted;
|
||
|
|
||
|
public static bool TryGet(Message message, out ReceiveContext property)
|
||
|
{
|
||
|
if (message == null)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("message");
|
||
|
}
|
||
|
|
||
|
bool result = TryGet(message.Properties, out property);
|
||
|
if (result && FxTrace.Trace.IsEnd2EndActivityTracingEnabled && property.eventTraceActivity == null)
|
||
|
{
|
||
|
property.eventTraceActivity = EventTraceActivityHelper.TryExtractActivity(message);
|
||
|
}
|
||
|
|
||
|
return result;
|
||
|
}
|
||
|
|
||
|
public static bool TryGet(MessageProperties properties, out ReceiveContext property)
|
||
|
{
|
||
|
if (properties == null)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("properties");
|
||
|
}
|
||
|
|
||
|
property = null;
|
||
|
object foundProperty;
|
||
|
if (properties.TryGetValue(Name, out foundProperty))
|
||
|
{
|
||
|
property = (ReceiveContext)foundProperty;
|
||
|
return true;
|
||
|
}
|
||
|
return false;
|
||
|
}
|
||
|
|
||
|
public virtual void Abandon(TimeSpan timeout)
|
||
|
{
|
||
|
Abandon(null, timeout);
|
||
|
}
|
||
|
|
||
|
public virtual void Abandon(Exception exception, TimeSpan timeout)
|
||
|
{
|
||
|
EnsureValidTimeout(timeout);
|
||
|
TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
|
||
|
this.WaitForStateLock(timeoutHelper.RemainingTime());
|
||
|
|
||
|
try
|
||
|
{
|
||
|
if (PreAbandon())
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
// Abandon can never be reverted, release the state lock.
|
||
|
this.ReleaseStateLock();
|
||
|
}
|
||
|
|
||
|
bool success = false;
|
||
|
try
|
||
|
{
|
||
|
if (exception == null)
|
||
|
{
|
||
|
OnAbandon(timeoutHelper.RemainingTime());
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (TD.ReceiveContextAbandonWithExceptionIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextAbandonWithException(this.eventTraceActivity, this.GetType().ToString(), exception.GetType().ToString());
|
||
|
}
|
||
|
OnAbandon(exception, timeoutHelper.RemainingTime());
|
||
|
}
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
ThrowIfFaulted();
|
||
|
ThrowIfNotAbandoning();
|
||
|
this.State = ReceiveContextState.Abandoned;
|
||
|
}
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextAbandonFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextAbandonFailed(this.eventTraceActivity, this.GetType().ToString());
|
||
|
}
|
||
|
Fault();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
public virtual IAsyncResult BeginAbandon(TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
{
|
||
|
return BeginAbandon(null, timeout, callback, state);
|
||
|
}
|
||
|
|
||
|
public virtual IAsyncResult BeginAbandon(Exception exception, TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
{
|
||
|
EnsureValidTimeout(timeout);
|
||
|
return new AbandonAsyncResult(this, exception, timeout, callback, state);
|
||
|
}
|
||
|
|
||
|
public virtual IAsyncResult BeginComplete(TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
{
|
||
|
EnsureValidTimeout(timeout);
|
||
|
return new CompleteAsyncResult(this, timeout, callback, state);
|
||
|
}
|
||
|
|
||
|
public virtual void Complete(TimeSpan timeout)
|
||
|
{
|
||
|
EnsureValidTimeout(timeout);
|
||
|
TimeoutHelper timeoutHelper = new TimeoutHelper(timeout);
|
||
|
this.WaitForStateLock(timeoutHelper.RemainingTime());
|
||
|
bool success = false;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
PreComplete();
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
// Case 1: State validation fails, release the lock.
|
||
|
// Case 2: No trasaction, the state can never be reverted, release the lock.
|
||
|
// Case 3: Transaction, keep the lock until we know the transaction outcome (OnTransactionStatusNotification).
|
||
|
if (!success || Transaction.Current == null)
|
||
|
{
|
||
|
this.ReleaseStateLock();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
success = false;
|
||
|
try
|
||
|
{
|
||
|
OnComplete(timeoutHelper.RemainingTime());
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
ThrowIfFaulted();
|
||
|
ThrowIfNotCompleting();
|
||
|
this.State = ReceiveContextState.Completed;
|
||
|
}
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextCompleteFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextCompleteFailed(this.eventTraceActivity, this.GetType().ToString());
|
||
|
}
|
||
|
Fault();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
public virtual void EndAbandon(IAsyncResult result)
|
||
|
{
|
||
|
AbandonAsyncResult.End(result);
|
||
|
}
|
||
|
|
||
|
public virtual void EndComplete(IAsyncResult result)
|
||
|
{
|
||
|
CompleteAsyncResult.End(result);
|
||
|
}
|
||
|
|
||
|
void EnsureValidTimeout(TimeSpan timeout)
|
||
|
{
|
||
|
if (timeout < TimeSpan.Zero)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new ArgumentOutOfRangeException("timeout", SR.GetString(SR.SFxTimeoutOutOfRange0)));
|
||
|
}
|
||
|
|
||
|
if (TimeoutHelper.IsTooLarge(timeout))
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new ArgumentOutOfRangeException("timeout", timeout, SR.GetString(SR.SFxTimeoutOutOfRangeTooBig)));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected internal virtual void Fault()
|
||
|
{
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
if (this.State == ReceiveContextState.Completed || this.State == ReceiveContextState.Abandoned || this.State == ReceiveContextState.Faulted)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
this.State = ReceiveContextState.Faulted;
|
||
|
}
|
||
|
OnFaulted();
|
||
|
}
|
||
|
|
||
|
protected abstract void OnAbandon(TimeSpan timeout);
|
||
|
protected virtual void OnAbandon(Exception exception, TimeSpan timeout)
|
||
|
{
|
||
|
// default implementation: delegate to non-exception overload, ignoring reason
|
||
|
OnAbandon(timeout);
|
||
|
}
|
||
|
|
||
|
protected abstract IAsyncResult OnBeginAbandon(TimeSpan timeout, AsyncCallback callback, object state);
|
||
|
protected virtual IAsyncResult OnBeginAbandon(Exception exception, TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
{
|
||
|
// default implementation: delegate to non-exception overload, ignoring reason
|
||
|
return OnBeginAbandon(timeout, callback, state);
|
||
|
}
|
||
|
|
||
|
protected abstract IAsyncResult OnBeginComplete(TimeSpan timeout, AsyncCallback callback, object state);
|
||
|
|
||
|
protected abstract void OnComplete(TimeSpan timeout);
|
||
|
protected abstract void OnEndAbandon(IAsyncResult result);
|
||
|
protected abstract void OnEndComplete(IAsyncResult result);
|
||
|
|
||
|
protected virtual void OnFaulted()
|
||
|
{
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
if (this.contextFaulted)
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
this.contextFaulted = true;
|
||
|
}
|
||
|
|
||
|
if (TD.ReceiveContextFaultedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextFaulted(this.eventTraceActivity, this);
|
||
|
}
|
||
|
|
||
|
EventHandler handler = this.Faulted;
|
||
|
|
||
|
if (handler != null)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
handler(this, EventArgs.Empty);
|
||
|
}
|
||
|
catch (Exception exception)
|
||
|
{
|
||
|
if (Fx.IsFatal(exception))
|
||
|
{
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperCallback(exception);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void OnTransactionStatusNotification(TransactionStatus status)
|
||
|
{
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
if (status == TransactionStatus.Aborted)
|
||
|
{
|
||
|
if (this.State == ReceiveContextState.Completing || this.State == ReceiveContextState.Completed)
|
||
|
{
|
||
|
this.State = ReceiveContextState.Received;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (status != TransactionStatus.Active)
|
||
|
{
|
||
|
this.ReleaseStateLock();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool PreAbandon()
|
||
|
{
|
||
|
bool alreadyAbandoned = false;
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
if (this.State == ReceiveContextState.Abandoning || this.State == ReceiveContextState.Abandoned)
|
||
|
{
|
||
|
alreadyAbandoned = true;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
ThrowIfFaulted();
|
||
|
ThrowIfNotReceived();
|
||
|
this.State = ReceiveContextState.Abandoning;
|
||
|
}
|
||
|
}
|
||
|
return alreadyAbandoned;
|
||
|
}
|
||
|
|
||
|
void PreComplete()
|
||
|
{
|
||
|
lock (ThisLock)
|
||
|
{
|
||
|
ThrowIfFaulted();
|
||
|
ThrowIfNotReceived();
|
||
|
if (Transaction.Current != null)
|
||
|
{
|
||
|
Transaction.Current.EnlistVolatile(new EnlistmentNotifications(this), EnlistmentOptions.None);
|
||
|
}
|
||
|
this.State = ReceiveContextState.Completing;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ReleaseStateLock()
|
||
|
{
|
||
|
this.stateLock.Exit();
|
||
|
}
|
||
|
|
||
|
void ThrowIfFaulted()
|
||
|
{
|
||
|
|
||
|
if (State == ReceiveContextState.Faulted)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new CommunicationException(SR.GetString(SR.ReceiveContextFaulted, this.GetType().ToString())));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ThrowIfNotAbandoning()
|
||
|
{
|
||
|
if (State != ReceiveContextState.Abandoning)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new InvalidOperationException(SR.GetString(SR.ReceiveContextInInvalidState, this.GetType().ToString(), this.State.ToString())));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ThrowIfNotCompleting()
|
||
|
{
|
||
|
if (State != ReceiveContextState.Completing)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new InvalidOperationException(SR.GetString(SR.ReceiveContextInInvalidState, this.GetType().ToString(), this.State.ToString())));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void ThrowIfNotReceived()
|
||
|
{
|
||
|
if (State != ReceiveContextState.Received)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
|
||
|
new InvalidOperationException(SR.GetString(SR.ReceiveContextCannotBeUsed, this.GetType().ToString(), this.State.ToString())));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void WaitForStateLock(TimeSpan timeout)
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
this.stateLock.Enter(timeout);
|
||
|
}
|
||
|
catch (TimeoutException exception)
|
||
|
{
|
||
|
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WrapStateException(exception));
|
||
|
}
|
||
|
}
|
||
|
|
||
|
bool WaitForStateLockAsync(TimeSpan timeout, FastAsyncCallback callback, object state)
|
||
|
{
|
||
|
return this.stateLock.EnterAsync(timeout, callback, state);
|
||
|
}
|
||
|
|
||
|
Exception WrapStateException(Exception exception)
|
||
|
{
|
||
|
return new InvalidOperationException(SR.GetString(SR.ReceiveContextInInvalidState, this.GetType().ToString(), this.State.ToString()), exception);
|
||
|
}
|
||
|
|
||
|
sealed class AbandonAsyncResult : WaitAndContinueOperationAsyncResult
|
||
|
{
|
||
|
Exception exception;
|
||
|
static AsyncCompletion handleOperationComplete = new AsyncCompletion(HandleOperationComplete);
|
||
|
|
||
|
public AbandonAsyncResult(ReceiveContext receiveContext, Exception exception, TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
: base(receiveContext, timeout, callback, state)
|
||
|
{
|
||
|
this.exception = exception;
|
||
|
base.Begin();
|
||
|
}
|
||
|
|
||
|
// The main Abandon logic.
|
||
|
protected override bool ContinueOperation()
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
if (this.ReceiveContext.PreAbandon())
|
||
|
{
|
||
|
return true;
|
||
|
}
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
// Abandon can never be reverted, release the state lock.
|
||
|
this.ReceiveContext.ReleaseStateLock();
|
||
|
}
|
||
|
|
||
|
bool success = false;
|
||
|
IAsyncResult result;
|
||
|
try
|
||
|
{
|
||
|
if (exception == null)
|
||
|
{
|
||
|
result = this.ReceiveContext.OnBeginAbandon(this.TimeoutHelper.RemainingTime(), PrepareAsyncCompletion(handleOperationComplete), this);
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
if (TD.ReceiveContextAbandonWithExceptionIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextAbandonWithException(this.ReceiveContext.eventTraceActivity, this.GetType().ToString(), exception.GetType().ToString());
|
||
|
}
|
||
|
|
||
|
result = this.ReceiveContext.OnBeginAbandon(exception, this.TimeoutHelper.RemainingTime(), PrepareAsyncCompletion(handleOperationComplete), this);
|
||
|
}
|
||
|
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextAbandonFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextAbandonFailed((this.ReceiveContext != null) ? this.ReceiveContext.eventTraceActivity : null,
|
||
|
this.GetType().ToString());
|
||
|
}
|
||
|
|
||
|
this.ReceiveContext.Fault();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return SyncContinue(result);
|
||
|
}
|
||
|
|
||
|
public static void End(IAsyncResult result)
|
||
|
{
|
||
|
AsyncResult.End<AbandonAsyncResult>(result);
|
||
|
}
|
||
|
|
||
|
void EndAbandon(IAsyncResult result)
|
||
|
{
|
||
|
this.ReceiveContext.OnEndAbandon(result);
|
||
|
lock (this.ReceiveContext.ThisLock)
|
||
|
{
|
||
|
this.ReceiveContext.ThrowIfFaulted();
|
||
|
this.ReceiveContext.ThrowIfNotAbandoning();
|
||
|
this.ReceiveContext.State = ReceiveContextState.Abandoned;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static bool HandleOperationComplete(IAsyncResult result)
|
||
|
{
|
||
|
bool success = false;
|
||
|
AbandonAsyncResult thisPtr = (AbandonAsyncResult)result.AsyncState;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
thisPtr.EndAbandon(result);
|
||
|
success = true;
|
||
|
return true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextAbandonFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextAbandonFailed(thisPtr.ReceiveContext.eventTraceActivity, thisPtr.GetType().ToString());
|
||
|
}
|
||
|
|
||
|
thisPtr.ReceiveContext.Fault();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
sealed class CompleteAsyncResult : WaitAndContinueOperationAsyncResult
|
||
|
{
|
||
|
Transaction transaction;
|
||
|
static AsyncCompletion handleOperationComplete = new AsyncCompletion(HandleOperationComplete);
|
||
|
|
||
|
public CompleteAsyncResult(ReceiveContext receiveContext, TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
: base(receiveContext, timeout, callback, state)
|
||
|
{
|
||
|
this.transaction = Transaction.Current;
|
||
|
this.Begin();
|
||
|
}
|
||
|
|
||
|
protected override bool ContinueOperation()
|
||
|
{
|
||
|
IAsyncResult result;
|
||
|
|
||
|
using (PrepareTransactionalCall(this.transaction))
|
||
|
{
|
||
|
bool success = false;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
this.ReceiveContext.PreComplete();
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
// Case 1: State validation fails, release the lock.
|
||
|
// Case 2: No trasaction, the state can never be reverted, release the lock.
|
||
|
// Case 3: Transaction, keep the lock until we know the transaction outcome (OnTransactionStatusNotification).
|
||
|
if (!success || this.transaction == null)
|
||
|
{
|
||
|
this.ReceiveContext.ReleaseStateLock();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
success = false;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
result = this.ReceiveContext.OnBeginComplete(this.TimeoutHelper.RemainingTime(), PrepareAsyncCompletion(handleOperationComplete), this);
|
||
|
success = true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextCompleteFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextCompleteFailed(this.ReceiveContext.eventTraceActivity, this.GetType().ToString());
|
||
|
}
|
||
|
|
||
|
this.ReceiveContext.Fault();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return SyncContinue(result);
|
||
|
}
|
||
|
|
||
|
public static void End(IAsyncResult result)
|
||
|
{
|
||
|
AsyncResult.End<CompleteAsyncResult>(result);
|
||
|
}
|
||
|
|
||
|
void EndComplete(IAsyncResult result)
|
||
|
{
|
||
|
this.ReceiveContext.OnEndComplete(result);
|
||
|
lock (this.ReceiveContext.ThisLock)
|
||
|
{
|
||
|
this.ReceiveContext.ThrowIfFaulted();
|
||
|
this.ReceiveContext.ThrowIfNotCompleting();
|
||
|
this.ReceiveContext.State = ReceiveContextState.Completed;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
static bool HandleOperationComplete(IAsyncResult result)
|
||
|
{
|
||
|
CompleteAsyncResult thisPtr = (CompleteAsyncResult)result.AsyncState;
|
||
|
bool success = false;
|
||
|
|
||
|
try
|
||
|
{
|
||
|
thisPtr.EndComplete(result);
|
||
|
success = true;
|
||
|
return true;
|
||
|
}
|
||
|
finally
|
||
|
{
|
||
|
if (!success)
|
||
|
{
|
||
|
if (TD.ReceiveContextCompleteFailedIsEnabled())
|
||
|
{
|
||
|
TD.ReceiveContextCompleteFailed(thisPtr.ReceiveContext.eventTraceActivity, thisPtr.GetType().ToString());
|
||
|
}
|
||
|
|
||
|
thisPtr.ReceiveContext.Fault();
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
class EnlistmentNotifications : IEnlistmentNotification
|
||
|
{
|
||
|
ReceiveContext context;
|
||
|
|
||
|
public EnlistmentNotifications(ReceiveContext context)
|
||
|
{
|
||
|
this.context = context;
|
||
|
}
|
||
|
|
||
|
public void Commit(Enlistment enlistment)
|
||
|
{
|
||
|
this.context.OnTransactionStatusNotification(TransactionStatus.Committed);
|
||
|
enlistment.Done();
|
||
|
}
|
||
|
|
||
|
public void InDoubt(Enlistment enlistment)
|
||
|
{
|
||
|
this.context.OnTransactionStatusNotification(TransactionStatus.InDoubt);
|
||
|
enlistment.Done();
|
||
|
}
|
||
|
|
||
|
public void Prepare(PreparingEnlistment preparingEnlistment)
|
||
|
{
|
||
|
this.context.OnTransactionStatusNotification(TransactionStatus.Active);
|
||
|
preparingEnlistment.Prepared();
|
||
|
}
|
||
|
|
||
|
public void Rollback(Enlistment enlistment)
|
||
|
{
|
||
|
this.context.OnTransactionStatusNotification(TransactionStatus.Aborted);
|
||
|
enlistment.Done();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
abstract class WaitAndContinueOperationAsyncResult : TransactedAsyncResult
|
||
|
{
|
||
|
static FastAsyncCallback onWaitForStateLockComplete = new FastAsyncCallback(OnWaitForStateLockComplete);
|
||
|
|
||
|
public WaitAndContinueOperationAsyncResult(ReceiveContext receiveContext, TimeSpan timeout, AsyncCallback callback, object state)
|
||
|
: base(callback, state)
|
||
|
{
|
||
|
this.ReceiveContext = receiveContext;
|
||
|
this.TimeoutHelper = new TimeoutHelper(timeout);
|
||
|
}
|
||
|
|
||
|
protected ReceiveContext ReceiveContext
|
||
|
{
|
||
|
get;
|
||
|
private set;
|
||
|
}
|
||
|
|
||
|
protected TimeoutHelper TimeoutHelper
|
||
|
{
|
||
|
get;
|
||
|
private set;
|
||
|
}
|
||
|
|
||
|
protected void Begin()
|
||
|
{
|
||
|
if (!this.ReceiveContext.WaitForStateLockAsync(this.TimeoutHelper.RemainingTime(), onWaitForStateLockComplete, this))
|
||
|
{
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (this.ContinueOperation())
|
||
|
{
|
||
|
this.Complete(true);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
protected abstract bool ContinueOperation();
|
||
|
|
||
|
static void OnWaitForStateLockComplete(object state, Exception asyncException)
|
||
|
{
|
||
|
WaitAndContinueOperationAsyncResult thisPtr = (WaitAndContinueOperationAsyncResult)state;
|
||
|
bool completeAsyncResult = true;
|
||
|
Exception completeException = null;
|
||
|
|
||
|
if (asyncException != null)
|
||
|
{
|
||
|
if (asyncException is TimeoutException)
|
||
|
{
|
||
|
asyncException = thisPtr.ReceiveContext.WrapStateException(asyncException);
|
||
|
}
|
||
|
|
||
|
completeException = asyncException;
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
try
|
||
|
{
|
||
|
completeAsyncResult = thisPtr.ContinueOperation();
|
||
|
}
|
||
|
catch (Exception e)
|
||
|
{
|
||
|
if (Fx.IsFatal(e))
|
||
|
{
|
||
|
throw;
|
||
|
}
|
||
|
|
||
|
completeException = e;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if (completeAsyncResult)
|
||
|
{
|
||
|
thisPtr.Complete(false, completeException);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|