Skip to content

Commit c9cb4c9

Browse files
author
ladeak
committed
Custom new HttpClientHandler() when HttpSymbolServer is built on .netstandard
1 parent 9ca092a commit c9cb4c9

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/Microsoft.SymbolStore/SymbolStores/HttpSymbolStore.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,15 @@ public HttpSymbolStore(ITracer tracer, SymbolStore backingStore, Uri symbolServe
6767
_authenticationFunc = authenticationFunc;
6868

6969
// Create client
70-
_client = new HttpClient
70+
#if NETSTANDARD2_0
71+
_client = new HttpClient(new HttpClientHandler()
72+
{
73+
UseProxy = true,
74+
DefaultProxyCredentials = CredentialCache.DefaultNetworkCredentials,
75+
})
76+
#else
77+
_client = new HttpClient()
78+
#endif
7179
{
7280
Timeout = TimeSpan.FromMinutes(4)
7381
};

src/Tools/dotnet-dump/Analyzer.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,10 @@
33

44
using System;
55
using System.IO;
6-
using System.Net;
7-
using System.Net.Http;
86
using System.Reflection;
97
using System.Runtime.InteropServices;
108
using System.Security;
119
using System.Threading;
12-
using System.Threading.Tasks;
1310
using Microsoft.Diagnostics.DebugServices;
1411
using Microsoft.Diagnostics.DebugServices.Implementation;
1512
using Microsoft.Diagnostics.ExtensionCommands;
@@ -104,7 +101,6 @@ or NotSupportedException
104101
contextService.SetCurrentTarget(target);
105102

106103
// Automatically enable symbol server support, default cache and search for symbols in the dump directory
107-
HttpClient.DefaultProxy.Credentials = CredentialCache.DefaultCredentials;
108104
symbolService.AddSymbolServer(retryCount: 3);
109105
symbolService.AddCachePath(symbolService.DefaultSymbolCache);
110106
symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName));

src/Tools/dotnet-symbol/Program.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8-
using System.Net;
9-
using System.Net.Http;
108
using System.Net.Http.Headers;
119
using System.Runtime.InteropServices;
1210
using System.Threading;
@@ -265,7 +263,7 @@ internal async Task DownloadFiles()
265263
private Microsoft.SymbolStore.SymbolStores.SymbolStore BuildSymbolStore()
266264
{
267265
Microsoft.SymbolStore.SymbolStores.SymbolStore store = null;
268-
HttpClient.DefaultProxy.Credentials = CredentialCache.DefaultCredentials;
266+
269267
foreach (ServerInfo server in ((IEnumerable<ServerInfo>)SymbolServers).Reverse())
270268
{
271269
if (server.InternalSymwebServer)

0 commit comments

Comments
 (0)