Skip to content

ArchiSteamFarm V6.0.0.3

Compare
Choose a tag to compare
@JustArchi-ArchiBot JustArchi-ArchiBot released this 27 Feb 01:03
· 991 commits to main since this release
6.0.0.3
e4c20df

Changelog

Changes since V5.5.3.4:

  • [!] ASF V6 comes with modern System.Text.Json replacement of previously used since the very first ASF version, Newtonsoft.Json library. This is core foundation that ASF is based on - while it should be mostly transparent for end-users, it's breaking change for existing ASF plugins, and it also has far bigger scope than usual in terms of ASF codebase, hence V6 major version bump. If you're plugin creator, you can find notes below for technical details in regards to upgrade (@JustArchi #3145 #3061).
  • Latest ASF-ui with new features, improvements and bugfixes (@MrBurrBurr).
  • Updated localization provided by our community (@JustArchi-ArchiBot).
  • Usual amount of other core improvements, optimizations and bugfixes (@JustArchi).

Changes for plugin creators:

  • V6 upgrade version may require more changes than usual, especially in regards to breaking changes that are not outright visible during compilation, as well as extensive testing.
  • OnASFInit() and OnBotInitModules() found in IASF and IBotModules plugin interfaces have changed the signature of additionalConfigProperties from JToken to JsonElement. If you're not using additional config props, change in signature is sufficient, otherwise, you'll need to correct existing usage a bit to the new API.
  • Apart from above, you should search for every Newtonsoft.Json reference in your code, and correct it as per instructions below.
  • Remove <PackageReference Include="Newtonsoft.Json"> reference in all your csproj files - there is no need for any other additional custom dependency for JSON parsing anymore. ASF uses STJ exclusively now, which means that your Newtonsoft attributes, if any, are ignored anyway - this is why code that compiles, but doesn't use STJ, might not serialize/deserialize properly in V6 (if using ASF integration such as ArchiWebHandler, WebBrowser, SerializableFile or anything else that ASF provides to you).
  • Drop using Newtonsoft.Json from each of your cs files, those files will need a correction.
  • Replace every [JsonProperty] you have with [JsonInclude] from System.Text.Json namespace.
  • If your [JsonProperty] included custom property name, like [JsonProperty("custom")], add additional attribute, [JsonPropertyName("custom")].
  • If your [JsonProperty] was always required, like [JsonProperty(Required = Required.Always)], add additional attribute, [JsonRequired].
  • If your [JsonProperty] used disallowed nulls, like [JsonProperty(Required = Required.DisallowNull)], then either:
    • If it's a struct (e.g. DateTime), nullable class (e.g. object?), or otherwise null-allowed property (including System.Nullable<T>, e.g. DateTime?), don't add additional attribute, leave it as it is.
    • Only if it's non-nullable class (e.g. object) and you expect to always have a value there (extra bulletproofing against "Prop": null), add additional [JsonDisallowNull] attribute.
  • If your property was { get; }-only before, make it { get; private init; } instead.
  • If your field was readonly before, drop readonly and make it { get; private init; } instead.
  • If your property was static before, drop it, STJ doesn't serialize those, even if they're same for every instance.
  • If you're using custom parameterless constructor, including internal/private one i.e. private MyClass() { }, ensure it's annotated with [JsonConstructor] - this wasn't required before in Newtonsoft, but it's mandatory in STJ now.
  • If you've used [JsonExtensionData], use the same attribute from STJ, add additional [JsonInclude] and correct JToken to JsonElement - also remember about { get; private init; }.
  • If you've used JsonConvert before, use ToJsonObject<T>(), ToJsonText() (and in rare occurances, ToJsonElement()) helper methods from ASF namespace. You can also use standard JsonSerializer, but then you should always include custom JsonUtilities.DefaultJsonSerialierOptions from ASF namespace, which add support for otherwise missing STJ features, such as [JsonDisallowNull] attribute, custom Guid formats or ShouldSerializeXYZ() conditional methods - everything we needed ourselves in ASF.

Depending on how big your plugin is and what it does, you most likely won't have as much work as it might seem like from our notes above - we've included comprehensive guide to aid you with upgrade, but it's expected that majority of plugin developers will be fine just changing [JsonProperty] to [JsonInclude], and maybe adding [JsonPropertyName] on top of it.

Like you, we also needed to adapt all of our existing ASF code to STJ - this is why you can find a lot of examples of expected/required changes in our commit 6b0bf0f, feel free to use it as a reference in regards to notes above, and if you need help, remember you can always reach us through usual support channels, especially #dev-plugins on our Discord server.


Support

ASF is available for free, this release was made possible thanks to the people that decided to support the project. If you're grateful for what we're doing, please consider a donation. Developing ASF requires massive amount of time and knowledge, especially when it comes to Steam (and its problems). Even $1 is highly appreciated and shows that you care. Thank you!

GitHub sponsor Crypto donate PayPal.me donate PayPal donate Revolut donate Steam donate