Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix some threading issues when using a non-default sync context #3640

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public IAsyncResult BeginRequest(Message message, AsyncCallback callback, object

public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
return RequestAsync(message, timeout).ToApm(callback, state);
return RequestAsyncInternal(message, timeout).ToApm(callback, state);
}

protected abstract IAsyncRequest CreateAsyncRequest(Message message);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ public IAsyncResult BeginRequest(Message message, AsyncCallback callback, object

public IAsyncResult BeginRequest(Message message, TimeSpan timeout, AsyncCallback callback, object state)
{
return RequestAsync(message, timeout).ToApm(callback, state);
return RequestAsyncInternal(message, timeout).ToApm(callback, state);
}

public Message EndRequest(IAsyncResult result)
Expand Down Expand Up @@ -481,9 +481,15 @@ public async Task<Message> RequestAsync(Message message, TimeSpan timeout)
return ProcessReply(reply, correlationState, timeoutHelper.RemainingTime());
}

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

public Message Request(Message message, TimeSpan timeout)
{
return RequestAsync(message, timeout).GetAwaiter().GetResult();
return RequestAsyncInternal(message, timeout).GetAwaiter().GetResult();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
public class BasicHttpTransportWithMessageCredentialSecurityTests : ConditionalWcfTest
{
[WcfFact]
[Issue(3610)]
[Condition(nameof(Root_Certificate_Installed),
nameof(Client_Certificate_Installed),
nameof(SSL_Available))]
Expand Down Expand Up @@ -59,7 +58,6 @@ public static void Https_SecModeTransWithMessCred_CertClientCredential_Succeeds(
}

[WcfFact]
[Issue(3610)]
[Condition(nameof(Root_Certificate_Installed),
nameof(SSL_Available))]
[OuterLoop]
Expand Down