diff --git a/CsWin32Lib/CsWin32Lib.csproj b/CsWin32Lib/CsWin32Lib.csproj index 6970b27..8e297d1 100644 --- a/CsWin32Lib/CsWin32Lib.csproj +++ b/CsWin32Lib/CsWin32Lib.csproj @@ -1,7 +1,7 @@ - net8.0-windows + net9.0-windows enable true diff --git a/WinAppSdkCleaner/Models/Model.cs b/WinAppSdkCleaner/Models/Model.cs index 6126e55..2819e1e 100644 --- a/WinAppSdkCleaner/Models/Model.cs +++ b/WinAppSdkCleaner/Models/Model.cs @@ -35,36 +35,26 @@ public static VersionRecord CategorizePackageVersion(SdkId sdkId, PackageVersion return new VersionRecord(string.Empty, string.Empty, sdkId, packageVersion); } - private static void AddDependents(Dictionary lookUpTable, IEnumerable allPackages) + private static void AddDependents(Dictionary sdkFrameworksLookUpTable, IEnumerable allPackages) { - object lockObject = new object(); - Dictionary subLookUp = new Dictionary(); + Lock lockObject = new(); Parallel.ForEach(allPackages, package => { foreach (Package dependency in package.Dependencies) { // TryGetValue() is thread safe as long as the dictionary isn't modified by another thread - if (lookUpTable.TryGetValue(dependency.Id.FullName, out PackageData? parentPackageRecord)) + if (sdkFrameworksLookUpTable.TryGetValue(dependency.Id.FullName, out PackageData? parentPackageRecord)) { lock (lockObject) { PackageData dependentPackage = new PackageData(package, new List()); parentPackageRecord!.PackagesDependentOnThis.Add(dependentPackage); - - if (package.IsFramework) - { - subLookUp[package.Id.FullName] = dependentPackage; - } + Debug.Assert(!package.IsFramework); // framework packages cannot be dependent on other framework packages } } } }); - - if (subLookUp.Count > 0) - { - AddDependents(subLookUp, allPackages); - } } public static async Task> GetSDKsAsync() diff --git a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.Arm.Release.Singlefile.pubxml b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.Arm.Release.Singlefile.pubxml index f7f966c..3bcbba5 100644 --- a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.Arm.Release.Singlefile.pubxml +++ b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.Arm.Release.Singlefile.pubxml @@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - bin\Release\net8.0-windows10.0.17763.0\publish\win-arm64\ + bin\Release\net9.0-windows10.0.17763.0\publish\win-arm64\ FileSystem <_TargetId>Folder - net8.0-windows10.0.17763.0 + net9.0-windows10.0.17763.0 win-arm64 true true diff --git a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x64.Release.SingleFile.pubxml b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x64.Release.SingleFile.pubxml index b259441..4559e8d 100644 --- a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x64.Release.SingleFile.pubxml +++ b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x64.Release.SingleFile.pubxml @@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - bin\Release\net8.0-windows10.0.17763.0\publish\win-x64\ + bin\Release\net9.0-windows10.0.17763.0\publish\win-x64\ FileSystem <_TargetId>Folder - net8.0-windows10.0.17763.0 + net9.0-windows10.0.17763.0 win-x64 true true diff --git a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x86.Release.SingleFile.pubxml b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x86.Release.SingleFile.pubxml index 49d169b..767f0b8 100644 --- a/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x86.Release.SingleFile.pubxml +++ b/WinAppSdkCleaner/Properties/PublishProfiles/FolderProfile.x86.Release.SingleFile.pubxml @@ -6,10 +6,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. Release Any CPU - bin\Release\net8.0-windows10.0.17763.0\publish\win-x86\ + bin\Release\net9.0-windows10.0.17763.0\publish\win-x86\ FileSystem <_TargetId>Folder - net8.0-windows10.0.17763.0 + net9.0-windows10.0.17763.0 win-x86 true true diff --git a/WinAppSdkCleaner/Views/ViewTraceListener.cs b/WinAppSdkCleaner/Views/ViewTraceListener.cs index b1983fb..0aea3fe 100644 --- a/WinAppSdkCleaner/Views/ViewTraceListener.cs +++ b/WinAppSdkCleaner/Views/ViewTraceListener.cs @@ -2,9 +2,9 @@ internal sealed partial class ViewTraceListener : TraceListener { - private readonly object lockObject = new object(); - private StringBuilder? store = null; - private TextBox? Consumer { get; set; } + private readonly Lock lockObject = new(); + private StringBuilder? store; + private TextBox? consumer; public ViewTraceListener() : base(nameof(ViewTraceListener)) { @@ -14,9 +14,9 @@ public void RegisterConsumer(TextBox textBox) { lock (lockObject) { - Debug.Assert(Consumer is null && textBox.IsInitialized); + Debug.Assert(consumer is null && textBox.IsInitialized); - Consumer = textBox; + consumer = textBox; if (store is not null) { @@ -38,7 +38,7 @@ private void WriteInternal(string message) try { - if (Consumer is null) + if (consumer is null) { if (store is null) { @@ -54,20 +54,20 @@ private void WriteInternal(string message) } else { - Consumer.Dispatcher.BeginInvoke(() => + consumer.Dispatcher.BeginInvoke(() => { - int selectionStart = Consumer.SelectionStart; - int selectionLength = Consumer.SelectionLength; + int selectionStart = consumer.SelectionStart; + int selectionLength = consumer.SelectionLength; - Consumer.Text += message; + consumer.Text += message; if (selectionLength > 0) { - Consumer.Select(selectionStart, selectionLength); + consumer.Select(selectionStart, selectionLength); } else { - Consumer.CaretIndex = Consumer.Text.Length; + consumer.CaretIndex = consumer.Text.Length; } }, DispatcherPriority.Background); diff --git a/WinAppSdkCleaner/WinAppSdkCleaner.csproj b/WinAppSdkCleaner/WinAppSdkCleaner.csproj index 33c55cd..da159b6 100644 --- a/WinAppSdkCleaner/WinAppSdkCleaner.csproj +++ b/WinAppSdkCleaner/WinAppSdkCleaner.csproj @@ -2,7 +2,7 @@ WinExe - net8.0-windows10.0.17763.0 + net9.0-windows10.0.17763.0 enable true 10.0.17763.0