Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/PlanViewer.App/Controls/PlanViewerControl.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
Expand Down
7 changes: 3 additions & 4 deletions src/PlanViewer.App/Dialogs/QueryStoreHistoryWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Interactivity;
using Avalonia.Layout;
using Avalonia.Media;
using Avalonia.VisualTree;
using PlanViewer.Core.Models;
Expand Down Expand Up @@ -111,9 +110,9 @@ public QueryStoreHistoryWindow(string connectionString, string queryHash,

// Select initial metric in the combo box
var metricTag = initialMetricTag;
foreach (ComboBoxItem item in MetricSelector.Items)
foreach (var entry in MetricSelector.Items)
{
if (item.Tag?.ToString() == metricTag)
if (entry is ComboBoxItem item && item.Tag?.ToString() == metricTag)
{
MetricSelector.SelectedItem = item;
break;
Expand Down Expand Up @@ -759,7 +758,7 @@ private void HighlightGridRows()

private void OnHighlightLoadingRow(object? sender, DataGridRowEventArgs e)
{
var idx = e.Row.GetIndex();
var idx = e.Row.Index;
if (_selectedRowIndices.Contains(idx))
{
e.Row.Background = new SolidColorBrush(Avalonia.Media.Color.FromArgb(60, 79, 195, 247));
Expand Down
22 changes: 11 additions & 11 deletions src/PlanViewer.App/PlanViewer.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Avalonia" Version="11.3.12" />
<PackageReference Include="Avalonia" Version="11.3.14" />
<PackageReference Include="Avalonia.AvaloniaEdit" Version="11.4.1" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.12" />
<PackageReference Include="ScottPlot.Avalonia" Version="5.1.57" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.12" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.12" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.12" />
<PackageReference Include="Avalonia.Controls.DataGrid" Version="11.3.13" />
<PackageReference Include="ScottPlot.Avalonia" Version="5.1.58" />
<PackageReference Include="Avalonia.Desktop" Version="11.3.14" />
<PackageReference Include="Avalonia.Themes.Fluent" Version="11.3.14" />
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.3.14" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.12">
<PackageReference Include="Avalonia.Diagnostics" Version="11.3.14">
<IncludeAssets Condition="'$(Configuration)' != 'Debug'">None</IncludeAssets>
<PrivateAssets Condition="'$(Configuration)' != 'Debug'">All</PrivateAssets>
</PackageReference>
<PackageReference Include="AvaloniaEdit.TextMate" Version="11.4.1" />
<PackageReference Include="AvaloniaEdit.TextMate.Grammars" Version="0.10.12" />
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.17" />
<PackageReference Include="ModelContextProtocol" Version="0.7.0-preview.1" />
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="0.7.0-preview.1" />
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.18" />
<PackageReference Include="ModelContextProtocol" Version="1.2.0" />
<PackageReference Include="ModelContextProtocol.AspNetCore" Version="1.2.0" />
<PackageReference Include="TextMateSharp.Grammars" Version="2.0.3" />
<PackageReference Include="Microsoft.SqlServer.TransactSql.ScriptDom" Version="170.191.0" />
<PackageReference Include="Velopack" Version="0.0.1298" />
Expand All @@ -40,7 +40,7 @@
but the managed SkiaSharp 3.x requires native libs in the [119.0, 120.0) range.
Without these pins, the old 2.88.x .so overwrites the correct one at publish time,
causing a TypeInitializationException on Linux (GitHub issue #139). -->
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.0" />
<PackageReference Include="SkiaSharp.NativeAssets.Linux" Version="3.119.2" />
</ItemGroup>

<ItemGroup>
Expand Down
15 changes: 9 additions & 6 deletions src/PlanViewer.Cli/Commands/CredentialCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,15 @@ private static Command CreateListCommand(ICredentialService credentialService)

cmd.SetHandler(() =>
{
IReadOnlyList<(string ServerName, string Username)>? creds = credentialService switch
{
WindowsCredentialService win => win.ListAll(),
KeychainCredentialService mac => mac.ListAll(),
_ => null
};
IReadOnlyList<(string ServerName, string Username)>? creds = null;
// CA1416: WindowsCredentialService is gated on OperatingSystem.IsWindows().
// .NET 8 won't run below Windows 10, so the underlying "windows5.1.2600" requirement is always met.
#pragma warning disable CA1416
if (OperatingSystem.IsWindows() && credentialService is WindowsCredentialService win)
creds = win.ListAll();
#pragma warning restore CA1416
if (OperatingSystem.IsMacOS() && credentialService is KeychainCredentialService mac)
creds = mac.ListAll();

if (creds == null)
{
Expand Down
2 changes: 1 addition & 1 deletion src/PlanViewer.Core/PlanViewer.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Data.SqlClient" Version="6.0.1" />
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.17" />
<PackageReference Include="Meziantou.Framework.Win32.CredentialManager" Version="1.7.18" />
<PackageReference Include="Microsoft.SqlServer.TransactSql.ScriptDom" Version="170.191.0" />
</ItemGroup>

Expand Down
9 changes: 6 additions & 3 deletions src/PlanViewer.Core/Services/CredentialServiceFactory.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
using System.Runtime.InteropServices;
using PlanViewer.Core.Interfaces;

namespace PlanViewer.Core.Services;
Expand All @@ -7,10 +6,14 @@ public static class CredentialServiceFactory
{
public static ICredentialService Create()
{
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
// CA1416: the underlying CredentialManager API declares "windows5.1.2600" (XP+);
// .NET 8 won't run on anything below Windows 10, so OperatingSystem.IsWindows() is sufficient.
#pragma warning disable CA1416
if (OperatingSystem.IsWindows())
return new WindowsCredentialService();
#pragma warning restore CA1416

if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
if (OperatingSystem.IsMacOS())
return new KeychainCredentialService();

// Linux and other platforms: use in-memory storage (credentials not persisted across sessions)
Expand Down
4 changes: 2 additions & 2 deletions src/PlanViewer.Core/Services/PlanAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ private static void AnalyzeStatement(PlanStatement stmt, AnalyzerConfig cfg)

if (unsnifffedParams.Count > 0)
{
var hasRecompile = stmt.StatementText.Contains("RECOMPILE", StringComparison.OrdinalIgnoreCase);
var hasRecompile = stmt.StatementText?.Contains("RECOMPILE", StringComparison.OrdinalIgnoreCase) == true;
if (!hasRecompile)
{
var names = string.Join(", ", unsnifffedParams.Select(p => p.Name));
Expand Down Expand Up @@ -1321,7 +1321,7 @@ _ when nonSargableReason.StartsWith("Function call") =>
// Rule 28: Row Count Spool — NOT IN with nullable column
// Pattern: Row Count Spool with high rewinds, child scan has IS NULL predicate,
// and statement text contains NOT IN
if (!cfg.IsRuleDisabled(28) && node.PhysicalOp.Contains("Row Count Spool"))
if (!cfg.IsRuleDisabled(28) && node.PhysicalOp?.Contains("Row Count Spool") == true)
{
var rewinds = node.HasActualStats ? (double)node.ActualRewinds : node.EstimateRewinds;
if (rewinds > 10000 && HasNotInPattern(node, stmt))
Expand Down
2 changes: 2 additions & 0 deletions src/PlanViewer.Core/Services/WindowsCredentialService.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
using System.Runtime.Versioning;
using Meziantou.Framework.Win32;
using PlanViewer.Core.Interfaces;

namespace PlanViewer.Core.Services;

[SupportedOSPlatform("windows5.1.2600")]
public class WindowsCredentialService : ICredentialService
{
private const string Prefix = "planview:";
Expand Down
8 changes: 4 additions & 4 deletions tests/PlanViewer.Core.Tests/PlanViewer.Core.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.8.0" />
<PackageReference Include="xunit" Version="2.5.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.5.3" />
<PackageReference Include="coverlet.collector" Version="10.0.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.4.0" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5" />
</ItemGroup>

<ItemGroup>
Expand Down
Loading