Skip to content

Fix csproj duplicates and warnings #3056

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Dec 13, 2024
8 changes: 3 additions & 5 deletions src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,20 @@
return (new Random()).Next();
}

class TestClass
private class TestClass
{
public TestClass() {}

public string SlowMethod2()

Check warning on line 15 in src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Member 'SlowMethod2' does not access instance data and can be marked as static (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1822)
{
Thread.Sleep(1000);
return (new Random()).Next().ToString();
return new Random().Next().ToString();
}

public string SlowMethod3()
{
Thread.Sleep(1000);
return (new Random()).Next().ToString();
return new Random().Next().ToString();
}
}

Expand All @@ -37,15 +37,15 @@
// The same static method should be cached, and therefore the return value should be the same
var task1 = TaskRecycler<int>.RunOrAttachAsync(MySlowMethod1);
var task2 = TaskRecycler<int>.RunOrAttachAsync(MySlowMethod1);
int result1 = task1.GetAwaiter().GetResult();

Check warning on line 40 in src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Test methods should not use blocking task operations, as they can cause deadlocks. Use an async test method and await instead. (https://xunit.net/xunit.analyzers/rules/xUnit1031)
int result2 = task2.GetAwaiter().GetResult();

Check warning on line 41 in src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Test methods should not use blocking task operations, as they can cause deadlocks. Use an async test method and await instead. (https://xunit.net/xunit.analyzers/rules/xUnit1031)
Assert.Equal(result1, result2);

// The same static method should be cached, and therefore the return value should be the same, but different from previous runs
var task3 = TaskRecycler<int>.RunOrAttachAsync(MySlowMethod1);
var task4 = TaskRecycler<int>.RunOrAttachAsync(MySlowMethod1);
int result4 = task4.GetAwaiter().GetResult();

Check warning on line 47 in src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Test methods should not use blocking task operations, as they can cause deadlocks. Use an async test method and await instead. (https://xunit.net/xunit.analyzers/rules/xUnit1031)
int result3 = task3.GetAwaiter().GetResult();

Check warning on line 48 in src/UniGetUI.Core.Classes.Tests/TaskRecyclerTests.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Test methods should not use blocking task operations, as they can cause deadlocks. Use an async test method and await instead. (https://xunit.net/xunit.analyzers/rules/xUnit1031)
Assert.Equal(result3, result4);

// Ensure the last call was not permanently cached
Expand Down Expand Up @@ -131,7 +131,6 @@
string result2 = task2.GetAwaiter().GetResult();
Assert.Equal(result1, result2);


var class1_copy = class1;

// The SAME method from the SAME instance, even when called
Expand All @@ -153,7 +152,6 @@
// Ensure the last call was not permanently cached
Assert.NotEqual(result1, result3);


// The SAME method from two DIFFERENT instances should NOT be
// cached, so the results should differ
var task7 = TaskRecycler<string>.RunOrAttachAsync(class1.SlowMethod3);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
15 changes: 3 additions & 12 deletions src/UniGetUI.Core.Classes/TaskRecycler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,10 @@ namespace UniGetUI.Core.Classes;
*/
public static class TaskRecycler<ReturnT>
{
private static ConcurrentDictionary<int, Task<ReturnT>> _tasks = new();

private static readonly ConcurrentDictionary<int, Task<ReturnT>> _tasks = new();

// ---------------------------------------------------------------------------------------------------------------


/// Asynchronous entry point for 0 parameters
public static Task<ReturnT> RunOrAttachAsync(Func<ReturnT> method, int cacheTimeSecs = 0)
{
Expand Down Expand Up @@ -57,10 +55,8 @@ public static Task<ReturnT> RunOrAttachAsync<Param1T, Param2T, Param3T>(Func<Par
return _runTaskAndWait(new Task<ReturnT>(() => method(arg1, arg2, arg3)), hash, cacheTimeSecs);
}


// ---------------------------------------------------------------------------------------------------------------


/// Synchronous entry point for 0 parameters
public static ReturnT RunOrAttach(Func<ReturnT> method, int cacheTimeSecs = 0)
=> RunOrAttachAsync(method, cacheTimeSecs).GetAwaiter().GetResult();
Expand All @@ -79,10 +75,8 @@ public static ReturnT RunOrAttach<Param1T, Param2T, Param3T>(Func<Param1T, Param
Param2T arg2, Param3T arg3, int cacheTimeSecs = 0)
=> RunOrAttachAsync(method, arg1, arg2, arg3, cacheTimeSecs).GetAwaiter().GetResult();


// ---------------------------------------------------------------------------------------------------------------


/// <summary>
/// Instantly removes a function call from the cache, even if the associated task has not
/// finished yet. Any previous call will finish as expected. New calls won't attach to any
Expand All @@ -93,10 +87,8 @@ public static ReturnT RunOrAttach<Param1T, Param2T, Param3T>(Func<Param1T, Param
public static void RemoveFromCache(Func<ReturnT> method)
=> _removeFromCache(method.GetHashCode(), 0);


// ---------------------------------------------------------------------------------------------------------------


/// <summary>
/// Handles running the task if no such task was found on cache, and returning the cached task if it was found.
/// </summary>
Expand Down Expand Up @@ -134,15 +126,14 @@ private static async Task<ReturnT> _runTaskAndWait(Task<ReturnT> task, int hash,
/// </summary>
private static async void _removeFromCache(int hash, int cacheTimeSecsSecs)
{
if(cacheTimeSecsSecs > 0)
if (cacheTimeSecsSecs > 0)
await Task.Delay(cacheTimeSecsSecs * 1000);

_tasks.Remove(hash, out _);
}
}


public static class TaskRecyclerTelemetry
{
public static int DeduplicatedCalls = 0;
public static int DeduplicatedCalls;
}
8 changes: 2 additions & 6 deletions src/UniGetUI.Core.Classes/UniGetUI.Core.Classes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
Expand All @@ -18,10 +18,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
</ItemGroup>
Expand Down
5 changes: 2 additions & 3 deletions src/UniGetUI.Core.Data.Tests/UniGetUI.Core.Data.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/UniGetUI.Core.Data/CoreData.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System.Diagnostics;
using System.Diagnostics;
using System.Net;
using System.Text.Json;
using System.Text.Json.Serialization.Metadata;
Expand Down Expand Up @@ -160,7 +160,6 @@ public static string UniGetUI_DefaultBackupDirectory
/// </summary>
public const int NewShortcutsNotificationTag = 1236;


/// <summary>
/// A path pointing to the location where the app is installed
/// </summary>
Expand Down
8 changes: 2 additions & 6 deletions src/UniGetUI.Core.Data/UniGetUI.Core.Data.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
Expand All @@ -18,10 +18,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\UniGetUI.Core.Logger\UniGetUI.Core.Logging.csproj" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
3 changes: 0 additions & 3 deletions src/UniGetUI.Core.IconStore/IconCacheEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ cachedIconFile is not null &&
return null;
}


/// <summary>
/// The given image will be downsized to the expected size of an icon, if required
/// </summary>
Expand Down Expand Up @@ -278,10 +277,8 @@ private static void DownsizeImage(string cachedIconFile, string extension)
Logger.Error($"An error occurred while downsizing the image file {cachedIconFile}");
Logger.Error(ex);
}

}


/// <summary>
/// Checks whether a cached image is valid or not depending on the size (in bytes) of the image
/// </summary>
Expand Down
8 changes: 2 additions & 6 deletions src/UniGetUI.Core.IconStore/UniGetUI.Core.IconEngine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
Expand All @@ -18,10 +18,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\UniGetUI.Core.Data\UniGetUI.Core.Data.csproj" />
<ProjectReference Include="..\UniGetUI.Core.Logger\UniGetUI.Core.Logging.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/UniGetUI.Core.LanguageEngine/LanguageEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ public Dictionary<string, string> LoadLanguageFile(string LangKey)

Dictionary<string, string> LangDict = BundledContents.ToDictionary(x => x.Key, x => x.Value?.ToString() ?? "");


string CachedLangFileToLoad = Path.Join(CoreData.UniGetUICacheDirectory_Lang, "lang_" + LangKey + ".json");

if (Settings.Get("DisableLangAutoUpdater"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
Expand All @@ -18,10 +18,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="MessageFormat" Version="7.1.2" />
</ItemGroup>
Expand Down
8 changes: 2 additions & 6 deletions src/UniGetUI.Core.Logger/UniGetUI.Core.Logging.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
Expand All @@ -18,10 +18,6 @@
<Configurations>Debug;Release</Configurations>
</PropertyGroup>

<PropertyGroup>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<Compile Include="..\SharedAssemblyInfo.cs" Link="SharedAssemblyInfo.cs" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
1 change: 0 additions & 1 deletion src/UniGetUI.Core.Settings.Tests/SettingsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
Assert.Equal("this is now a test case", Settings.GetListItem<string>(SettingName, 3));
Assert.Null(Settings.GetListItem<string>(SettingName, 4));

Assert.Equal(Settings.GetListItem<string>(SettingName, 0), JsonSerializer.Deserialize<List<string>>(File.ReadAllText(Path.Join(CoreData.UniGetUIDataDirectory, $"{SettingName}.json")))[0]);

Check warning on line 117 in src/UniGetUI.Core.Settings.Tests/SettingsTest.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Dereference of a possibly null reference.

Settings.ClearList(SettingName);
Assert.Empty(Settings.GetList<object>(SettingName) ?? ["this shouldn't be null; something's wrong"]);
Expand Down Expand Up @@ -149,7 +149,6 @@
public void TestDictionarySettings(string SettingName, string[] keyArray, int[] intArray, string[] strArray)
{
Dictionary<string, SerializableTest?> test = [];
Dictionary<string, string> emptyDictionary = [];
Dictionary<string, SerializableTest?> nonEmptyDictionary = [];
nonEmptyDictionary["this should not be null; something's wrong"] = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
<RuntimeIdentifiers>win-x64;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifier>win-$(Platform)</RuntimeIdentifier>
<Platforms>x64</Platforms>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<TargetPlatformMinVersion>10.0.19041.0</TargetPlatformMinVersion>
<WindowsSdkPackageVersion>10.0.26100.53</WindowsSdkPackageVersion>
<SdkVersion>8.0.401</SdkVersion>
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
<PublishSelfContained>true</PublishSelfContained>
<Authors>Martí Climent and the contributors</Authors>
<PublisherName>Martí Climent</PublisherName>
<Nullable>enable</Nullable>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Configurations>Debug;Release</Configurations>
</PropertyGroup>
Expand Down
4 changes: 2 additions & 2 deletions src/UniGetUI.Core.Settings/SettingsEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace UniGetUI.Core.SettingsEngine
{
public static partial class Settings
{
private static ConcurrentDictionary<string, bool> booleanSettings = new();
private static ConcurrentDictionary<string, string> valueSettings = new();
private static readonly ConcurrentDictionary<string, bool> booleanSettings = new();
private static readonly ConcurrentDictionary<string, string> valueSettings = new();

public static bool Get(string setting, bool invert = false)
{
Expand Down
2 changes: 1 addition & 1 deletion src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{
public static partial class Settings
{
private static ConcurrentDictionary<string, Dictionary<object, object?>> dictionarySettings = new();
private static readonly ConcurrentDictionary<string, Dictionary<object, object?>> dictionarySettings = new();

// Returns an empty dictionary if the setting doesn't exist and null if the types are invalid
private static Dictionary<K, V>? _getDictionary<K, V>(string setting)
Expand All @@ -15,7 +15,7 @@
{
try
{
if (dictionarySettings.TryGetValue(setting, out Dictionary<object, object>? result))

Check warning on line 18 in src/UniGetUI.Core.Settings/SettingsEngine_Dictionaries.cs

View workflow job for this annotation

GitHub Actions / test-codebase

Argument of type 'Dictionary<object, object>' cannot be used as an output of type 'Dictionary<object, object?>' for parameter 'value' in 'bool ConcurrentDictionary<string, Dictionary<object, object?>>.TryGetValue(string key, out Dictionary<object, object?> value)' due to differences in the nullability of reference types.
{
// If the setting was cached
return result.ToDictionary(
Expand Down
2 changes: 1 addition & 1 deletion src/UniGetUI.Core.Settings/SettingsEngine_Lists.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace UniGetUI.Core.SettingsEngine
{
public static partial class Settings
{
private static ConcurrentDictionary<string, List<object>> listSettings = new();
private static readonly ConcurrentDictionary<string, List<object>> listSettings = new();

// Returns an empty list if the setting doesn't exist and null if the type is invalid
private static List<T>? _getList<T>(string setting)
Expand Down
Loading
Loading