diff --git a/Engine/StackResolver.cs b/Engine/StackResolver.cs index 2fd1d6d..a384991 100644 --- a/Engine/StackResolver.cs +++ b/Engine/StackResolver.cs @@ -440,6 +440,10 @@ public async Task> GetListofCallStacksAsync(string inputCalls inputCallstackText = Regex.Replace(inputCallstackText, @"(?.*?)(?\.+?\<\/HistogramTarget\>)", (Match m) => { return $"{m.Groups["starttag"].Value} annotation=\"{System.Net.WebUtility.HtmlEncode(m.Groups["prefix"].Value.Replace("\r", string.Empty).Replace("\n", string.Empty).Trim())}\" {m.Groups["trailing"].Value}"; } , RegexOptions.Singleline); + + // handle the case seen in SQL Server 2022+ where there is no CDATA section in the HistogramTarget XML + if (!inputCallstackText.Contains("", " />]]>"); + inputCallstackText = $"{inputCallstackText}"; } } diff --git a/GUI/App.config b/GUI/App.config index 3f8a770..6dc78ef 100644 --- a/GUI/App.config +++ b/GUI/App.config @@ -23,8 +23,14 @@ - - True - False - - + + + + True + + + False + + + + \ No newline at end of file diff --git a/Tests/Tests.cs b/Tests/Tests.cs index 2a58b79..1fbfa7d 100644 --- a/Tests/Tests.cs +++ b/Tests/Tests.cs @@ -665,6 +665,24 @@ private string PrepareLargeXEventInput() { Assert.AreEqual(expected.Trim(), ret.Trim()); } + /// End-to-end test with XE histogram target and XML frames with no CDATA section and the elements directly inside. + [TestMethod][TestCategory("Unit")] + public async Task E2ESymSrvXMLFramesHistogramNoCDATA() { + using var csr = new StackResolver(); + using var cts = new CancellationTokenSource(); + var pdbPath = @"srv*https://msdl.microsoft.com/download/symbols"; + var input = "" + +"" + +"" + +"" + +"" + +""; + + var ret = await csr.ResolveCallstacksAsync(await csr.GetListofCallStacksAsync(input, false, cts), pdbPath, false, null, false, true, false, true, false, false, null, cts); + var expected = "Slot_0 [count:5]:\r\n\r\n00 ntdll!NtWaitForSingleObject+20\r\n01 KERNELBASE!WaitForSingleObjectEx+147\r\n02 sqldk!MemoryClerkInternal::AllocatePagesWithFailureMode+644\r\n\r\nSlot_1 [count:3]:\r\n\r\n00 VCRUNTIME140!__C_specific_handler+160 (d:\\agent\\_work\\2\\s\\src\\vctools\\crt\\vcruntime\\src\\eh\\riscchandler.cpp:290)\r\n01 sqldk!Spinlock<244,2,1>::SpinToAcquireWithExponentialBackoff+349"; + Assert.AreEqual(expected.Trim(), ret.Trim()); + } + /// End-to-end test with XE histogram target and module+offset frames. [TestMethod][TestCategory("Unit")] public async Task E2EHistogramAddresses() { using var csr = new StackResolver();