Adopted further C# 14 and .NET 10 features (#1158)

This commit is contained in:
Thorsten Sommer authored and GitHub committed 2026-11-04 14:04:10 +01:00
1 parent f649febf88
commit f0fa1411c8
40 files changed
+545 -56

No files matched your search

@@ -13,6 +13,19 @@ namespace AIStudio.Provider;
/// </remarks>
public static class AdditionalApiParametersParser
{
/// <summary>
/// Every name only once per object.
/// </summary>
/// <remarks>
/// The dialog for providers refuses a name written twice, but a configuration plugin brings its
/// providers past the dialog. With both values read, it would be open which of them reaches the
/// provider, and the dictionary below would refuse the second one with an exception.
/// </remarks>
private static readonly JsonDocumentOptions DOCUMENT_OPTIONS = new()
{
AllowDuplicateProperties = false,
};
/// <summary>
/// Try to parse an additional-API-parameters JSON fragment into a dictionary.
/// </summary>
@@ -30,7 +43,7 @@ public static class AdditionalApiParametersParser
try
{
// The UI stores only the object body, so wrap it before parsing.
using var jsonDoc = JsonDocument.Parse($"{{{additionalJsonApiParameters}}}");
using var jsonDoc = JsonDocument.Parse($"{{{additionalJsonApiParameters}}}", DOCUMENT_OPTIONS);
parameters = ConvertToDictionary(jsonDoc.RootElement);
return true;
}