diff --git a/src/Directory.Build.props b/src/Directory.Build.props
index 2db96b741b..2cea04fc32 100644
--- a/src/Directory.Build.props
+++ b/src/Directory.Build.props
@@ -52,5 +52,6 @@
latest
true
+ $(NoWarn);EnableGenerateDocumentationFile
diff --git a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs
index d412fb8d72..85575d8ff1 100644
--- a/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs
+++ b/src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs
@@ -1,3 +1,5 @@
+using System.Diagnostics.CodeAnalysis;
+
namespace UniGetUI.Core.Classes.Tests;
public class TaskRecyclerTests
@@ -8,16 +10,18 @@ private int MySlowMethod1()
return new Random().Next();
}
- private class TestClass
+ private sealed class TestClass
{
public TestClass() {}
+ [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Instance methods are required to validate TaskRecycler instance-bound delegate behavior.")]
public string SlowMethod2()
{
Thread.Sleep(1000);
return new Random().Next().ToString();
}
+ [SuppressMessage("Performance", "CA1822:Mark members as static", Justification = "Instance methods are required to validate TaskRecycler instance-bound delegate behavior.")]
public string SlowMethod3()
{
Thread.Sleep(1000);
diff --git a/src/UniGetUI.Core.Classes/TaskRecycler.cs b/src/UniGetUI.Core.Classes/TaskRecycler.cs
index d6ec607ada..94aa9b6d0e 100644
--- a/src/UniGetUI.Core.Classes/TaskRecycler.cs
+++ b/src/UniGetUI.Core.Classes/TaskRecycler.cs
@@ -93,7 +93,6 @@ public static void RemoveFromCache(Func method)
// ---------------------------------------------------------------------------------------------------------------
-
///
/// Handles running the task if no such task was found on cache, and returning the cached task if it was found.
///
diff --git a/src/UniGetUI.Core.Data/CoreCredentialStore.cs b/src/UniGetUI.Core.Data/CoreCredentialStore.cs
index e0e281d3f3..ca5ce6eecf 100644
--- a/src/UniGetUI.Core.Data/CoreCredentialStore.cs
+++ b/src/UniGetUI.Core.Data/CoreCredentialStore.cs
@@ -93,6 +93,7 @@ public static void DeleteSecret(string resourceName, string userName)
}
}
+#if !WINDOWS
private static string GetStorageDirectory()
=> Path.Join(CoreData.UniGetUIDataDirectory, "SecureStorage");
@@ -104,4 +105,5 @@ private static string GetStableFileName(string resourceName, string userName)
byte[] hash = SHA256.HashData(Encoding.UTF8.GetBytes($"{resourceName}\n{userName}"));
return Convert.ToHexString(hash) + ".secret";
}
+#endif
}
\ No newline at end of file
diff --git a/src/UniGetUI.Core.Data/CoreData.cs b/src/UniGetUI.Core.Data/CoreData.cs
index 53838dd914..54ec0e31f0 100644
--- a/src/UniGetUI.Core.Data/CoreData.cs
+++ b/src/UniGetUI.Core.Data/CoreData.cs
@@ -59,7 +59,7 @@ public static string UniGetUIDataDirectory
}
} else if (IS_PORTABLE is true)
{
- return PORTABLE_PATH ?? throw new Exception("This shouldn't be possible");
+ return PORTABLE_PATH ?? throw new InvalidOperationException("This shouldn't be possible");
}
string old_path = Path.Join(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), ".wingetui");
diff --git a/src/UniGetUI.Core.IconStore/IconDatabase.cs b/src/UniGetUI.Core.IconStore/IconDatabase.cs
index 70f9b83483..e18fb4b6c0 100644
--- a/src/UniGetUI.Core.IconStore/IconDatabase.cs
+++ b/src/UniGetUI.Core.IconStore/IconDatabase.cs
@@ -19,7 +19,6 @@ public struct IconCount
public IconCount() { }
}
-
private static IconDatabase? __instance;
public static IconDatabase Instance
{
@@ -57,7 +56,6 @@ public async Task LoadIconAndScreenshotsDatabaseAsync()
Logger.ImportantInfo("Downloaded new icons and screenshots successfully!");
-
if (!File.Exists(IconsAndScreenshotsFile))
{
Logger.Error("Icon Database file not found");
@@ -74,7 +72,6 @@ public async Task LoadIconAndScreenshotsDatabaseAsync()
await LoadFromCacheAsync();
}
-
public async Task LoadFromCacheAsync()
{
try
diff --git a/src/UniGetUI.Core.SecureSettings/SecureSettings.cs b/src/UniGetUI.Core.SecureSettings/SecureSettings.cs
index b4f132c0ca..240211119f 100644
--- a/src/UniGetUI.Core.SecureSettings/SecureSettings.cs
+++ b/src/UniGetUI.Core.SecureSettings/SecureSettings.cs
@@ -34,7 +34,6 @@ public static string ResolveKey(K key)
};
}
-
private static readonly Dictionary _cache = new();
public static class Args
diff --git a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs
index ede74dc344..f568c5da00 100644
--- a/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs
+++ b/src/UniGetUI.Core.Settings.Tests/SettingsTest.cs
@@ -18,7 +18,7 @@ public sealed class SerializableTest
public SerializableTestSub sub { get; set; }
}
- public class SettingsTest
+ public class SettingsTest : IDisposable
{
private readonly string _testRoot;
@@ -50,7 +50,6 @@ public void Dispose()
private string GetNewSettingPath(string fileName) => Path.Combine(_newConfigurationDirectory, fileName);
private string GetOldSettingsPath(string fileName) => Path.Combine(_oldConfigurationDirectory, fileName);
-
[Fact]
public void TestSettingsSaveToNewDirectory()
{
@@ -175,7 +174,9 @@ public void TestListSettings(string SettingName, string[] ls1Array, int[] ls2Arr
Assert.Equal("this is now a test case", Settings.GetListItem(SettingName, 3));
Assert.Null(Settings.GetListItem(SettingName, 4));
- Assert.Equal(Settings.GetListItem(SettingName, 0), JsonSerializer.Deserialize>(File.ReadAllText(Path.Join(CoreData.UniGetUIUserConfigurationDirectory, $"{SettingName}.json")), Settings.SerializationOptions)[0]);
+ List? persistedList = JsonSerializer.Deserialize>(File.ReadAllText(Path.Join(CoreData.UniGetUIUserConfigurationDirectory, $"{SettingName}.json")), Settings.SerializationOptions);
+ Assert.NotNull(persistedList);
+ Assert.Equal(Settings.GetListItem(SettingName, 0), persistedList[0]);
Settings.ClearList(SettingName);
Assert.Empty(Settings.GetList