This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CallContext.SetData("key", new Number { N = 1 }); | |
var task1 = Task.Factory.StartNew(() => | |
{ | |
var n = CallContext.GetData("key") as Number; | |
n.N++; | |
Thread.Sleep(1000); | |
}); | |
var task2 = Task.Factory.StartNew(() => | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static OperationDescription[] AddHelpOperations(ContractDescription contractDescription, DispatchRuntime dispatchRuntime) | |
{ | |
Fx.Assert(contractDescription != null, "The 'contractDescription' parameter should not be null."); | |
Fx.Assert(dispatchRuntime != null, "The 'dispatchRuntime' parameter should not be null."); | |
Uri baseAddress = dispatchRuntime.EndpointDispatcher.EndpointAddress.Uri; | |
HelpPage helpPage = new HelpPage(baseAddress, null, contractDescription); | |
HttpOperationDescription helpPageOperation = new HttpOperationDescription(HelpPage.HelpMethodName, contractDescription); | |
helpPageOperation.Behaviors.Add(new WebGetAttribute() { UriTemplate = HelpPage.OperationListHelpPageUriTemplate }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected internal sealed override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, | |
CancellationToken cancellationToken) | |
{ | |
if (request == null) | |
{ | |
throw new ArgumentNullException("request", SR.net_http_handler_norequest); | |
} | |
// ProcessRequest() and ProcessResponse() are supposed to be fast, so we call ProcessRequest() on the same | |
// thread SendAsync() was invoked to avoid context switches. However, if ProcessRequest() throws, we have |
NewerOlder