mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Do not allow plugins to modify default ASF json serializer settings upon creation
This can only accidentally break things we expect to be operative
This commit is contained in:
@@ -116,8 +116,8 @@ public static class JsonUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
|
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2026:RequiresUnreferencedCode", Justification = "We don't care about trimmed assemblies, as we need it to work only with the known (used) ones")]
|
||||||
private static JsonSerializerOptions CreateDefaultJsonSerializerOptions(bool writeIndented = false) =>
|
private static JsonSerializerOptions CreateDefaultJsonSerializerOptions(bool writeIndented = false) {
|
||||||
new(JsonSerializerDefaults.Strict) {
|
JsonSerializerOptions result = new(JsonSerializerDefaults.Strict) {
|
||||||
AllowTrailingCommas = true,
|
AllowTrailingCommas = true,
|
||||||
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
Encoder = JavaScriptEncoder.UnsafeRelaxedJsonEscaping,
|
||||||
IndentCharacter = '\t',
|
IndentCharacter = '\t',
|
||||||
@@ -129,6 +129,11 @@ public static class JsonUtilities {
|
|||||||
WriteIndented = writeIndented
|
WriteIndented = writeIndented
|
||||||
};
|
};
|
||||||
|
|
||||||
|
result.MakeReadOnly();
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2070", Justification = "We don't care about trimmed methods, it's not like we can make it work differently anyway")]
|
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2070", Justification = "We don't care about trimmed methods, it's not like we can make it work differently anyway")]
|
||||||
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2075", Justification = "We don't care about trimmed properties, it's not like we can make it work differently anyway")]
|
[UnconditionalSuppressMessage("AssemblyLoadTrimming", "IL2075", Justification = "We don't care about trimmed properties, it's not like we can make it work differently anyway")]
|
||||||
private static MethodInfo? GetShouldSerializeMethod([SuppressMessage("ReSharper", "SuggestBaseTypeForParameter")] Type parent, JsonPropertyInfo property) {
|
private static MethodInfo? GetShouldSerializeMethod([SuppressMessage("ReSharper", "SuggestBaseTypeForParameter")] Type parent, JsonPropertyInfo property) {
|
||||||
|
|||||||
Reference in New Issue
Block a user