Skip to content

Commit 9ca092a

Browse files
author
ladeak
committed
dotnet-dump and dotnet-symbol returns 407 behind a proxy when downloading symbols. Setting the default network credentials before HttpClient is set. Optionally HttpSymbolStore could create a custom HttpClientHandler, but based on the remarks https://learn.microsoft.com/en-us/dotnet/api/system.net.http.httpclienthandler.usedefaultcredentials?view=net-9.0 this is only desired for client applications, while not sure how this project is used otherwise.
1 parent aebf15d commit 9ca092a

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/Tools/dotnet-dump/Analyzer.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
using System;
55
using System.IO;
6+
using System.Net;
7+
using System.Net.Http;
68
using System.Reflection;
79
using System.Runtime.InteropServices;
810
using System.Security;
@@ -102,6 +104,7 @@ or NotSupportedException
102104
contextService.SetCurrentTarget(target);
103105

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

src/Tools/dotnet-symbol/Program.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
using System.Collections.Generic;
66
using System.IO;
77
using System.Linq;
8+
using System.Net;
9+
using System.Net.Http;
810
using System.Net.Http.Headers;
911
using System.Runtime.InteropServices;
1012
using System.Threading;
@@ -68,7 +70,7 @@ public static void Main(string[] args)
6870
program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null });
6971
break;
7072

71-
case "--internal-server":
73+
case "--internal-server":
7274
Uri.TryCreate("https://symweb.azurefd.net/", UriKind.Absolute, out uri);
7375
program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null, InternalSymwebServer = true });
7476
break;
@@ -263,7 +265,7 @@ internal async Task DownloadFiles()
263265
private Microsoft.SymbolStore.SymbolStores.SymbolStore BuildSymbolStore()
264266
{
265267
Microsoft.SymbolStore.SymbolStores.SymbolStore store = null;
266-
268+
HttpClient.DefaultProxy.Credentials = CredentialCache.DefaultCredentials;
267269
foreach (ServerInfo server in ((IEnumerable<ServerInfo>)SymbolServers).Reverse())
268270
{
269271
if (server.InternalSymwebServer)
@@ -597,8 +599,7 @@ internal void VerifyCoreDump()
597599

598600
private IEnumerable<string> GetInputFiles()
599601
{
600-
IEnumerable<string> inputFiles = InputFilePaths.SelectMany((string file) =>
601-
{
602+
IEnumerable<string> inputFiles = InputFilePaths.SelectMany((string file) => {
602603
string directory = Path.GetDirectoryName(file);
603604
string pattern = Path.GetFileName(file);
604605
return Directory.EnumerateFiles(string.IsNullOrWhiteSpace(directory) ? "." : directory, pattern,

0 commit comments

Comments
 (0)