Skip to content

Commit

Permalink
Merge pull request #3655 from mconnew/FixWSHttpSyncContextProblem
Browse files Browse the repository at this point in the history
Fix WS HTTP Sync Context problem
  • Loading branch information
StephenBonikowsky authored May 30, 2019
2 parents 2410294 + d4a36f6 commit 8bb5c47
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1492,13 +1492,13 @@ public Task<Message> RequestAsync(Message message)
return RequestAsync(message, DefaultSendTimeout);
}

Message IRequestChannel.Request(Message message) => RequestAsync(message, DefaultSendTimeout).GetAwaiter().GetResult();
Message IRequestChannel.Request(Message message) => ((IRequestChannel)this).Request(message, DefaultSendTimeout);

Message IRequestChannel.Request(Message message, TimeSpan timeout) => RequestAsync(message, timeout).GetAwaiter().GetResult();
Message IRequestChannel.Request(Message message, TimeSpan timeout) => RequestAsyncInternal(message, timeout).WaitForCompletionNoSpin();

IAsyncResult IRequestChannel.BeginRequest(Message message, AsyncCallback callback, object state) => RequestAsync(message, DefaultSendTimeout).ToApm(callback, state);
IAsyncResult IRequestChannel.BeginRequest(Message message, AsyncCallback callback, object state) => ((IRequestChannel)this).BeginRequest(message, DefaultSendTimeout, callback, state);

IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state) => RequestAsync(message, timeout).ToApm(callback, state);
IAsyncResult IRequestChannel.BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state) => RequestAsyncInternal(message, timeout).ToApm(callback, state);

Message IRequestChannel.EndRequest(IAsyncResult result) => result.ToApmEnd<Message>();

Expand Down Expand Up @@ -1543,6 +1543,11 @@ private Message ProcessReply(Message reply, TimeSpan timeout, SecurityProtocolCo
return processedReply;
}

private async Task<Message> RequestAsyncInternal(Message message, TimeSpan timeout)
{
await TaskHelpers.EnsureDefaultTaskScheduler();
return await RequestAsync(message, timeout);
}

public async Task<Message> RequestAsync(Message message, TimeSpan timeout)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ internal WcfTestCase(IXunitTestCase testCase, string skippedReason = null, bool

public int Timeout { get { return 0; } }

public void Deserialize(IXunitSerializationInfo info) { _testCase.Deserialize(info); }
public void Deserialize(IXunitSerializationInfo info) { _testCase?.Deserialize(info); }

public async Task<RunSummary> RunAsync(
IMessageSink diagnosticMessageSink, IMessageBus messageBus, object[] constructorArguments,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
public class BasicHttpTransportWithMessageCredentialSecurityTests : ConditionalWcfTest
{
[WcfFact]
[Issue(2870)]
[Issue(2870, OS = OSID.AnyOSX)]
[Condition(nameof(Root_Certificate_Installed),
nameof(Client_Certificate_Installed),
nameof(SSL_Available))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
public class WSHttpTransportWithMessageCredentialSecurityTests : ConditionalWcfTest
{
[WcfFact]
[Issue(2870)]
[Issue(2870, OS = OSID.AnyOSX)]
[Condition(nameof(Root_Certificate_Installed),
nameof(Client_Certificate_Installed),
nameof(SSL_Available))]
Expand Down

0 comments on commit 8bb5c47

Please sign in to comment.