Remove the symweb symbol server support (#4694)
authorMike McLaughlin <mikem@microsoft.com>
Fri, 31 May 2024 17:21:16 +0000 (10:21 -0700)
committerGitHub <noreply@github.com>
Fri, 31 May 2024 17:21:16 +0000 (10:21 -0700)
Removes the dotnet-symbol --internal-server option. Use the
--authenticated-server-path option instead.

Removes the internal server/symweb options from the setsymbolserver
command and ISymbolService interface.

14 files changed:
src/Microsoft.Diagnostics.DebugServices.Implementation/SymbolService.cs
src/Microsoft.Diagnostics.DebugServices/ISymbolService.cs
src/Microsoft.Diagnostics.ExtensionCommands/Host/SetSymbolServerCommand.cs
src/Microsoft.Diagnostics.TestHelpers/TestHost/TestDump.cs
src/Microsoft.SymbolStore/SymbolStores/SymwebSymbolStore.cs
src/SOS/SOS.Hosting/SymbolServiceWrapper.cs
src/Tools/dotnet-dump/Analyzer.cs
src/Tools/dotnet-symbol/Program.cs
src/Tools/dotnet-symbol/Properties/Resources.Designer.cs
src/Tools/dotnet-symbol/Properties/Resources.resx
src/Tools/dotnet-symbol/README.md
src/tests/DbgShim.UnitTests/LibraryProviderWrapper.cs
src/tests/Microsoft.Diagnostics.DebugServices.UnitTests/SymbolServiceTests.cs
src/tests/Microsoft.SymbolStore.UnitTests/SymbolStoreTests.cs

index 4b5ad2b9ba7fdd5aeed469a1a1020d49f0ea6e27..4ed23f80620f82d04ee76c3f9acb44b46b6590ae 100644 (file)
@@ -32,7 +32,6 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// Symbol server URLs
         /// </summary>
         public const string MsdlSymbolServer = "https://msdl.microsoft.com/download/symbols/";
-        public const string SymwebSymbolServer = "https://symweb/";
 
         private readonly IHost _host;
         private string _defaultSymbolCache;
@@ -58,9 +57,13 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// </summary>
         public bool IsSymbolStoreEnabled => _symbolStore != null;
 
+        /// <summary>
+        /// The default symbol server URL (normally msdl) when not overridden in AddSymbolServer.
+        /// </summary>
+        public string DefaultSymbolPath { get; set; } = MsdlSymbolServer;
+
         /// <summary>
         /// The default symbol cache path:
-        ///
         /// * dbgeng on Windows uses the dbgeng symbol cache path: %PROGRAMDATA%\dbg\sym
         /// * dotnet-dump on Windows uses the VS symbol cache path: %TEMPDIR%\SymbolCache
         /// * dotnet-dump/lldb on Linux/MacOS uses: $HOME/.dotnet/symbolcache
@@ -204,7 +207,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                     }
                     if (symbolServerPath != null)
                     {
-                        if (!AddSymbolServer(msdl: false, symweb: false, symbolServerPath.Trim()))
+                        if (!AddSymbolServer(symbolServerPath: symbolServerPath.Trim()))
                         {
                             return false;
                         }
@@ -226,47 +229,19 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
         /// <summary>
         /// Add symbol server to search path.
         /// </summary>
-        /// <param name="msdl">if true, use the public Microsoft server</param>
-        /// <param name="symweb">if true, use symweb internal server and protocol (file.ptr)</param>
-        /// <param name="symbolServerPath">symbol server url (optional)</param>
+        /// <param name="symbolServerPath">symbol server url (optional, uses <see cref="DefaultSymbolPath"/> if null)</param>
         /// <param name="authToken">PAT for secure symbol server (optional)</param>
         /// <param name="timeoutInMinutes">symbol server timeout in minutes (optional uses <see cref="DefaultTimeout"/> if null)</param>
         /// <param name="retryCount">number of retries (optional uses <see cref="DefaultRetryCount"/> if null)</param>
         /// <returns>if false, failure</returns>
         public bool AddSymbolServer(
-            bool msdl,
-            bool symweb,
             string symbolServerPath = null,
             string authToken = null,
             int? timeoutInMinutes = null,
             int? retryCount = null)
         {
-            bool internalServer = false;
-
             // Add symbol server URL if exists
-            if (symbolServerPath == null)
-            {
-                if (msdl)
-                {
-                    symbolServerPath = MsdlSymbolServer;
-                }
-                else if (symweb)
-                {
-                    symbolServerPath = SymwebSymbolServer;
-                    internalServer = true;
-                }
-            }
-            else
-            {
-                // Use the internal symbol store for symweb
-                internalServer = symbolServerPath.Contains("symweb");
-            }
-
-            // Return error if symbol server path is null and msdl and symweb are false.
-            if (symbolServerPath == null)
-            {
-                return false;
-            }
+            symbolServerPath ??= DefaultSymbolPath;
 
             // Validate symbol server path
             if (!Uri.TryCreate(symbolServerPath.TrimEnd('/') + '/', UriKind.Absolute, out Uri uri))
@@ -285,15 +260,7 @@ namespace Microsoft.Diagnostics.DebugServices.Implementation
                 if (!IsDuplicateSymbolStore<HttpSymbolStore>(store, (httpSymbolStore) => uri.Equals(httpSymbolStore.Uri)))
                 {
                     // Create http symbol server store
-                    HttpSymbolStore httpSymbolStore;
-                    if (internalServer)
-                    {
-                        httpSymbolStore = new SymwebHttpSymbolStore(Tracer.Instance, store, uri);
-                    }
-                    else
-                    {
-                        httpSymbolStore = new HttpSymbolStore(Tracer.Instance, store, uri, personalAccessToken: authToken);
-                    }
+                    HttpSymbolStore httpSymbolStore = new(Tracer.Instance, store, uri, personalAccessToken: authToken);
                     httpSymbolStore.Timeout = TimeSpan.FromMinutes(timeoutInMinutes.GetValueOrDefault(DefaultTimeout));
                     httpSymbolStore.RetryCount = retryCount.GetValueOrDefault(DefaultRetryCount);
                     SetSymbolStore(httpSymbolStore);
index 13e66f4a632430c3dff7fc95eb9a10f6cd5bca53..b32b19cde0ee8215a86200d01f7d7e5e36c28459 100644 (file)
@@ -18,24 +18,28 @@ namespace Microsoft.Diagnostics.DebugServices
         /// </summary>
         bool IsSymbolStoreEnabled { get; }
 
+        /// <summary>
+        /// The default symbol server URL (normally msdl) when not overridden in AddSymbolServer.
+        /// </summary>
+        string DefaultSymbolPath { get; }
+
         /// <summary>
         /// The default symbol cache path:
-        ///
         /// * dbgeng on Windows uses the dbgeng symbol cache path: %PROGRAMDATA%\dbg\sym
         /// * dotnet-dump on Windows uses the VS symbol cache path: %TEMPDIR%\SymbolCache
         /// * dotnet-dump/lldb on Linux/MacOS uses: $HOME/.dotnet/symbolcache
         /// </summary>
-        string DefaultSymbolCache { get; set; }
+        string DefaultSymbolCache { get; }
 
         /// <summary>
         /// The time out in minutes passed to the HTTP symbol store when not overridden in AddSymbolServer.
         /// </summary>
-        int DefaultTimeout { get; set; }
+        int DefaultTimeout { get; }
 
         /// <summary>
         /// The retry count passed to the HTTP symbol store when not overridden in AddSymbolServer.
         /// </summary>
-        int DefaultRetryCount { get; set; }
+        int DefaultRetryCount { get; }
 
         /// <summary>
         /// Reset any HTTP symbol stores marked with a client failure
@@ -52,14 +56,12 @@ namespace Microsoft.Diagnostics.DebugServices
         /// <summary>
         /// Add symbol server to search path.
         /// </summary>
-        /// <param name="msdl">if true, use the public Microsoft server</param>
-        /// <param name="symweb">if true, use symweb internal server and protocol (file.ptr)</param>
-        /// <param name="symbolServerPath">symbol server url (optional)</param>
+        /// <param name="symbolServerPath">symbol server url (optional, uses <see cref="DefaultSymbolPath"/> if null)</param>
         /// <param name="authToken">PAT for secure symbol server (optional)</param>
-        /// <param name="timeoutInMinutes">symbol server timeout in minutes (optional uses <see cref="DefaultTimeout"/> if null)</param>
-        /// <param name="retryCount">number of retries (optional uses <see cref="DefaultRetryCount"/> if null)</param>
+        /// <param name="timeoutInMinutes">symbol server timeout in minutes (optional, uses <see cref="DefaultTimeout"/> if null)</param>
+        /// <param name="retryCount">number of retries (optional, uses <see cref="DefaultRetryCount"/> if null)</param>
         /// <returns>if false, failure</returns>
-        bool AddSymbolServer(bool msdl, bool symweb, string symbolServerPath = null, string authToken = null, int? timeoutInMinutes = null, int? retryCount = null);
+        bool AddSymbolServer(string symbolServerPath = null, string authToken = null, int? timeoutInMinutes = null, int? retryCount = null);
 
         /// <summary>
         /// Add cache path to symbol search path
index fe9ebc59e756fedd968e6713ba62908b72f1babb..3d165d44eb895a1b1c16a7029245c14961f8f7e6 100644 (file)
@@ -18,9 +18,6 @@ namespace Microsoft.Diagnostics.ExtensionCommands
         [Option(Name = "--ms", Aliases = new string[] { "-ms" }, Help = "Use the public Microsoft symbol server.")]
         public bool MicrosoftSymbolServer { get; set; }
 
-        [Option(Name = "--mi", Aliases = new string[] { "-mi" }, Help = "Use the internal symweb symbol server.")]
-        public bool InternalSymbolServer { get; set; }
-
         [Option(Name = "--disable", Aliases = new string[] { "-disable" }, Help = "Clear or disable symbol download support.")]
         public bool Disable { get; set; }
 
@@ -50,13 +47,9 @@ namespace Microsoft.Diagnostics.ExtensionCommands
 
         public override void Invoke()
         {
-            if (MicrosoftSymbolServer && InternalSymbolServer)
-            {
-                throw new DiagnosticsException("Cannot have both -ms and -mi options");
-            }
-            if ((MicrosoftSymbolServer || InternalSymbolServer) && !string.IsNullOrEmpty(SymbolServerUrl))
+            if (MicrosoftSymbolServer && !string.IsNullOrEmpty(SymbolServerUrl))
             {
-                throw new DiagnosticsException("Cannot have -ms or -mi option and a symbol server path");
+                throw new DiagnosticsException("Cannot have -ms option and a symbol server path");
             }
             if (Disable)
             {
@@ -66,13 +59,13 @@ namespace Microsoft.Diagnostics.ExtensionCommands
             {
                 SymbolService.Reset();
             }
-            if (MicrosoftSymbolServer || InternalSymbolServer || !string.IsNullOrEmpty(SymbolServerUrl))
+            if (MicrosoftSymbolServer || !string.IsNullOrEmpty(SymbolServerUrl))
             {
                 if (string.IsNullOrEmpty(Cache))
                 {
                     Cache = SymbolService.DefaultSymbolCache;
                 }
-                SymbolService.AddSymbolServer(MicrosoftSymbolServer, InternalSymbolServer, SymbolServerUrl, AccessToken, Timeout, RetryCount);
+                SymbolService.AddSymbolServer(SymbolServerUrl, AccessToken, Timeout, RetryCount);
             }
             if (!string.IsNullOrEmpty(Cache))
             {
index 0f24d19275ce831a9f155fd554e2bed7a37cd7ae..738320ee87976722cb1b9433274017e6ab94bf7f 100644 (file)
@@ -41,7 +41,7 @@ namespace Microsoft.Diagnostics.TestHelpers
             _serviceContainer.AddService<ISymbolService>(_symbolService);
 
             // Automatically enable symbol server support
-            _symbolService.AddSymbolServer(msdl: true, symweb: false, timeoutInMinutes: 6, retryCount: 5);
+            _symbolService.AddSymbolServer(timeoutInMinutes: 6, retryCount: 5);
             _symbolService.AddCachePath(_symbolService.DefaultSymbolCache);
         }
 
index 858ea96fd59670918bf6d24a1ad7c0bd690cfc27..10a7820decb777ee3dd3539613bd0bd53089bf19 100644 (file)
@@ -11,6 +11,7 @@ namespace Microsoft.SymbolStore.SymbolStores
     /// <summary>
     /// The symbol store for the internal symweb symbol server that handles the "file.ptr" support.
     /// </summary>
+    [Obsolete]
     public sealed class SymwebHttpSymbolStore : HttpSymbolStore
     {
         /// <summary>
index 94ac022fd5df9604dd3f0ed3f4afe53b277e7614..1c9e37baebde3a6257f4643822883322bb309c15 100644 (file)
@@ -335,56 +335,11 @@ namespace SOS.Hosting
 
         #region Symbol service delegates
 
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate bool IsSymbolStoreEnabledDelegate(
-            [In] IntPtr self);
-
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate bool InitializeSymbolStoreDelegate(
-            [In] IntPtr self,
-            [In] bool msdl,
-            [In] bool symweb,
-            [In] string symbolServerPath,
-            [In] string authToken,
-            [In] int timeoutInMinutes,
-            [In] string symbolCachePath,
-            [In] string symbolDirectoryPath);
-
         [UnmanagedFunctionPointer(CallingConvention.Winapi)]
         private delegate bool ParseSymbolPathDelegate(
             [In] IntPtr self,
             [In] string windowsSymbolPath);
 
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate void DisplaySymbolStoreDelegate(
-            [In] IntPtr self,
-            [In] WriteLine writeLine);
-
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate void DisableSymbolStoreDelegate(
-            [In] IntPtr self);
-
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate void LoadNativeSymbolsDelegate(
-            [In] IntPtr self,
-            [In] SymbolFileCallback callback,
-            [In] IntPtr parameter,
-            [In] RuntimeConfiguration config,
-            [In] string moduleFilePath,
-            [In] ulong address,
-            [In] uint size);
-
-        [UnmanagedFunctionPointer(CallingConvention.Winapi)]
-        private delegate void LoadNativeSymbolsFromIndexDelegate(
-            [In] IntPtr self,
-            [In] SymbolFileCallback callback,
-            [In] IntPtr parameter,
-            [In] RuntimeConfiguration config,
-            [In] string moduleFilePath,
-            [In] bool specialKeys,
-            [In] int moduleIndexSize,
-            [In] IntPtr moduleIndex);
-
         [UnmanagedFunctionPointer(CallingConvention.Winapi)]
         private delegate IntPtr LoadSymbolsForModuleDelegate(
             [In] IntPtr self,
index 55b0abc93860e129989585141b56ac2828fc3eaa..0fa51a64bf0fdee035dc67e2eaf1e2fcd91cd79d 100644 (file)
@@ -127,7 +127,7 @@ namespace Microsoft.Diagnostics.Tools.Dump
                 contextService.SetCurrentTarget(target);
 
                 // Automatically enable symbol server support, default cache and search for symbols in the dump directory
-                symbolService.AddSymbolServer(msdl: true, symweb: false, retryCount: 3);
+                symbolService.AddSymbolServer(retryCount: 3);
                 symbolService.AddCachePath(symbolService.DefaultSymbolCache);
                 symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName));
 
index 19a9bbebee7718999886ecc8365d6ce560542d1a..d7f7e0a21b38c81740257d793659acfdd5d3fd8c 100644 (file)
@@ -25,7 +25,6 @@ namespace Microsoft.Diagnostics.Tools.Symbol
         {
             public Uri Uri;
             public string PersonalAccessToken;
-            public bool InternalSymwebServer;
         }
 
         private readonly List<string> InputFilePaths = new();
@@ -64,11 +63,6 @@ namespace Microsoft.Diagnostics.Tools.Symbol
                         program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null });
                         break;
 
-                    case "--internal-server":
-                        Uri.TryCreate("https://symweb/", UriKind.Absolute, out uri);
-                        program.SymbolServers.Add(new ServerInfo { Uri = uri, PersonalAccessToken = null, InternalSymwebServer = true });
-                        break;
-
                     case "--authenticated-server-path":
                         if (++i < args.Length)
                         {
@@ -262,14 +256,7 @@ namespace Microsoft.Diagnostics.Tools.Symbol
 
             foreach (ServerInfo server in ((IEnumerable<ServerInfo>)SymbolServers).Reverse())
             {
-                if (server.InternalSymwebServer)
-                {
-                    store = new SymwebHttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken);
-                }
-                else
-                {
-                    store = new HttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken);
-                }
+                store = new HttpSymbolStore(Tracer, store, server.Uri, server.PersonalAccessToken);
                 if (Timeout.HasValue && store is HttpSymbolStore http)
                 {
                     http.Timeout = Timeout.Value;
index ef6e9daad0f27aa0f6f5457962b8f95c8263e388..ebb37423faf594778f464c0a1a1f764b92bbfe57 100644 (file)
@@ -113,9 +113,10 @@ namespace Microsoft.Diagnostic.Tools.Symbol.Properties {
         ///
         ///Options:
         ///  --microsoft-symbol-server                         Add &apos;https://msdl.microsoft.com/download/symbols&apos; symbol server path (default).
-        ///  --internal-server                                 Add &apos;https://symweb&apos; internal symbol server path.
         ///  --server-path &lt;symbol server path&gt;                Add a http server path.
-        ///  --authenticated-server-path &lt;pat&gt; &lt;server path&gt;   Add a http PAT authenticated s [rest of string was truncated]&quot;;.
+        ///  --authenticated-server-path &lt;pat&gt; &lt;server path&gt;   Add a http PAT authenticated server path.
+        ///  --cache-directory &lt;file cache directory&gt;          Add a cache directory.
+        ///  --timeout &lt;m [rest of string was truncated]&quot;;.
         /// </summary>
         internal static string UsageOptions {
             get {
index cba5360316786424c8820d942153a6add22cd357..3ffa0a5f78c6eea924e4ad3d640eaf6ed554c002 100644 (file)
@@ -140,7 +140,6 @@ Arguments:
 
 Options:
   --microsoft-symbol-server                         Add 'https://msdl.microsoft.com/download/symbols' symbol server path (default).
-  --internal-server                                 Add 'https://symweb' internal symbol server path.
   --server-path &lt;symbol server path&gt;                Add a http server path.
   --authenticated-server-path &lt;pat&gt; &lt;server path&gt;   Add a http PAT authenticated server path.
   --cache-directory &lt;file cache directory&gt;          Add a cache directory.
@@ -163,4 +162,4 @@ Options:
   <data name="WritingFilesToOutput" xml:space="preserve">
     <value>Writing files to {0}</value>
   </data>
-</root>
\ No newline at end of file
+</root>
index 110c0c3ba8f31e551b1241f5721d4242c29087f4..45d9ddbd8b261b9f47fb6d2b41fb110a2109dbef 100644 (file)
@@ -9,7 +9,6 @@ This tool can download all the files needed for debugging (symbols, modules, SOS
 
     Options:
       --microsoft-symbol-server                         Add 'https://msdl.microsoft.com/download/symbols' symbol server path (default).
-      --internal-server                                 Add 'https://symweb' internal symbol server path.
       --server-path <symbol server path>                Add a http server path.
       --authenticated-server-path <pat> <server path>   Add a http PAT authenticated server path.
       --cache-directory <file cache directory>          Add a cache directory.
@@ -45,7 +44,7 @@ This downloads just the host program needed to load a core dump on Linux or macO
 
 To download the symbol files for a specific assembly:
 
-    dotnet-symbol --symbols --cache-directory c:\temp\symcache --server-path https://symweb --output c:\temp\symout System.Threading.dll
+    dotnet-symbol --symbols --cache-directory c:\temp\symcache --server-path https://msdl.microsoft.com/download/symbols --output c:\temp\symout System.Threading.dll
 
 Downloads all the symbol files for the shared runtime:
 
index a1c54f93d4e381c79e81b5427124b9880330c17e..d4c0ea3cded51afe69c8c2dd9779cd69887e47eb 100644 (file)
@@ -482,7 +482,7 @@ namespace SOS.Hosting
                 if (_symbolService is null)
                 {
                     _symbolService = new SymbolService(this);
-                    _symbolService.AddSymbolServer(msdl: true, symweb: false, timeoutInMinutes: 6, retryCount: 5);
+                    _symbolService.AddSymbolServer(timeoutInMinutes: 6, retryCount: 5);
                     _symbolService.AddCachePath(SymbolService.DefaultSymbolCache);
                 }
                 return _symbolService;
index e4fad3d54a3b8dd37a7b1c97ecc7edafc3fbbad8..fd63cea359bdc0c21591a4d429d6fcc2da44d673 100644 (file)
@@ -55,8 +55,8 @@ namespace Microsoft.Diagnostics.DebugServices.UnitTests
             Assert.Equal(defaultPath, symbolService.FormatSymbolStores());
             symbolService.DisableSymbolStore();
 
-            Assert.True(symbolService.ParseSymbolPath($"srv*{localSymbolCache}*{SymbolService.SymwebSymbolServer}"));
-            string testpath1 = $"Cache: {localSymbolCache} Server: {SymbolService.SymwebSymbolServer}";
+            Assert.True(symbolService.ParseSymbolPath($"srv*{localSymbolCache}*https://symweb/"));
+            string testpath1 = $"Cache: {localSymbolCache} Server: https://symweb/";
             Assert.Equal(testpath1, symbolService.FormatSymbolStores());
             symbolService.DisableSymbolStore();
 
index e93ab2933576755c73aab16492c1c07f34d2c482..ee87de31da4feb6eba4d34c43dd3bf632e824096 100644 (file)
@@ -97,34 +97,18 @@ namespace Microsoft.SymbolStore.Tests
             {
                 using (Stream compareStream = File.OpenRead("TestBinaries/dir1/System.Threading.Thread.pdb"))
                 {
-                    await DownloadFile(downloadStream, compareStream, ms: true, mi: false, KeyTypeFlags.SymbolKey);
+                    await DownloadFile(downloadStream, compareStream, flags: KeyTypeFlags.SymbolKey);
                 }
             }
         }
 
-        [Fact]
-        public async Task SymwebHttpSymbolStore()
-        {
-            using (FileStream downloadStream = File.OpenRead("TestBinaries/dir2/System.Threading.Thread.dll"))
-            {
-                await DownloadFile(downloadStream, downloadStream, ms: false, mi: true, KeyTypeFlags.IdentityKey);
-            }
-        }
-
-        private async Task DownloadFile(FileStream downloadStream, Stream compareStream, bool ms, bool mi, KeyTypeFlags flags)
+        private async Task DownloadFile(FileStream downloadStream, Stream compareStream, KeyTypeFlags flags)
         {
             SymbolStoreFile file = new SymbolStoreFile(downloadStream, downloadStream.Name);
-            SymbolStores.SymbolStore store = null;
-            if (ms)
-            {
-                Uri.TryCreate("https://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri);
-                store = new HttpSymbolStore(_tracer, store, uri);
-            }
-            if (mi)
-            {
-                Uri.TryCreate("https://symweb/", UriKind.Absolute, out Uri uri);
-                store = new SymwebHttpSymbolStore(_tracer, store, uri);
-            }
+
+            Uri.TryCreate("https://msdl.microsoft.com/download/symbols/", UriKind.Absolute, out Uri uri);
+            SymbolStores.SymbolStore store = new HttpSymbolStore(_tracer, backingStore: null, uri);
+
             var generator = new FileKeyGenerator(_tracer, file);
 
             IEnumerable<SymbolStoreKey> keys = generator.GetKeys(flags);