Class ServiceRpcDescriptor.RpcOrderPreservingSynchronizationContext
- Namespace
- Microsoft.ServiceHub.Framework
- Assembly
- Microsoft.ServiceHub.Framework.dll
A SynchronizationContext that preserves message order.
[Obsolete("Use Microsoft.VisualStudio.Threading.NonConcurrentSynchronizationContext instead.")]
protected class ServiceRpcDescriptor.RpcOrderPreservingSynchronizationContext : SynchronizationContext, IDisposable
- Inheritance
-
ServiceRpcDescriptor.RpcOrderPreservingSynchronizationContext
- Implements
- Inherited Members
Remarks
Delegates will be invoked on the threadpool in the order they were posted with Post(SendOrPostCallback, object). No two delegates will ever be executed concurrently. Note that if the delegate invokes an async method, the delegate formally ends when the async method yields for the first time or returns, whichever comes first. Once that delegate returns the next delegate can be executed.
This SynchronizationContext is not a fully functional one, and is intended only for use with JsonRpc to preserve RPC order. It should not be set as the Current SynchronizationContext.
Constructors
RpcOrderPreservingSynchronizationContext()
Initializes a new instance of the ServiceRpcDescriptor.RpcOrderPreservingSynchronizationContext class.
public RpcOrderPreservingSynchronizationContext()
Methods
CreateCopy()
Throws NotSupportedException.
public override SynchronizationContext CreateCopy()
Returns
- SynchronizationContext
Nothing.
Dispose()
Causes this SynchronizationContext to reject all future posted work and releases the queue processor when it is empty.
public void Dispose()
Post(SendOrPostCallback, object?)
public override void Post(SendOrPostCallback d, object? state)
Parameters
dSendOrPostCallbackstateobject
Send(SendOrPostCallback, object?)
Throws NotSupportedException.
public override void Send(SendOrPostCallback d, object? state)
Parameters
dSendOrPostCallbackThe delegate to invoke.
stateobjectState to pass to the delegate.
Events
UnhandledException
Occurs when posted work throws an unhandled exception.
public event EventHandler<Exception>? UnhandledException