Skip to content
This repository was archived by the owner on Apr 28, 2022. It is now read-only.

Commit 23c6cfd

Browse files
authored
MissingMethodException in THttpClientTransport for .NET (#166)
This is just an addition to the issue #105. Seperated the handler.ClientCertificates.AddRange to a function. Some APIs are not implemented in net461, but they are available in netStandard2.0, see: https://stackoverflow.com/a/46577035/10038915 Signed-off-by: Jonas S <[email protected]>
1 parent b5514bd commit 23c6cfd

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

Diff for: src/Thrift/netcore/Thrift/Transports/Client/THttpClientTransport.cs

+12-1
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,23 @@ public override async Task WriteAsync(byte[] buffer, int offset, int length, Can
147147
await _outputStream.WriteAsync(buffer, offset, length, cancellationToken);
148148
}
149149

150+
/// <summary>
151+
/// Seperate function to avoid a MissingMethodException in .NET Framework 4.6.1
152+
/// https://stackoverflow.com/a/46577035/10038915
153+
/// Related to: https://github.com/jaegertracing/jaeger-client-csharp/issues/105
154+
/// </summary>
155+
/// <param name="handler">HttpClientHandler</param>
156+
private void AddCertificates(HttpClientHandler handler)
157+
{
158+
handler.ClientCertificates.AddRange(_certificates);
159+
}
160+
150161
private HttpClient CreateClient()
151162
{
152163
var handler = new HttpClientHandler();
153164
if (_certificates.Length > 0)
154165
{
155-
handler.ClientCertificates.AddRange(_certificates);
166+
AddCertificates(handler);
156167
}
157168

158169
var httpClient = new HttpClient(handler);

0 commit comments

Comments
 (0)