Skip to content

Commit

Permalink
💥🐛Change DataMember ordering to 1-indexed (#1360)
Browse files Browse the repository at this point in the history
Related #1200
Fixes #1356

Apparently, protobuf-net does not support 0-indexed order values.

- Change `DataMember` explicit order from 0-indexed to 1-indexed

Some investigation indicates that the actual order value is not important, only the relative ordering:
#1356 (comment)

- WCF should tolerate this, according to its docs. #1356 (comment)
- Binary formatters hopefully only care about relative ordering and thus still compatible?
	- Protobuf-net, it never worked and should be OK
	- [BinaryFormatter](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.serialization.formatters.binary.binaryformatter?view=net-8.0) is obsolete and generally not recommended for years, so hopefully no users are affected
	- A bunch of others exist too, haven't looked into how they handle this
- XML/JSON serializers should tolerate any order, can't imagine it breaking these?
  • Loading branch information
angularsen committed Feb 14, 2024
1 parent e86eb17 commit 750df85
Show file tree
Hide file tree
Showing 124 changed files with 248 additions and 248 deletions.
4 changes: 2 additions & 2 deletions CodeGen/Generators/UnitsNetGen/QuantityGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,13 @@ namespace UnitsNet
/// <summary>
/// The numeric value this quantity was constructed with.
/// </summary>
[DataMember(Name = ""Value"", Order = 0)]
[DataMember(Name = ""Value"", Order = 1)]
private readonly {_quantity.ValueType} _value;
/// <summary>
/// The unit this quantity was constructed with.
/// </summary>
[DataMember(Name = ""Unit"", Order = 1)]
[DataMember(Name = ""Unit"", Order = 2)]
private readonly {_unitEnumName}? _unit;
");
GenerateStaticConstructor();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Acceleration.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/AmountOfSubstance.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/AmplitudeRatio.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Angle.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ApparentEnergy.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ApparentPower.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Area.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/AreaDensity.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/AreaMomentOfInertia.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/BitRate.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Capacitance.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Compressibility.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Density.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/Duration.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/DynamicViscosity.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricAdmittance.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricCharge.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricChargeDensity.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricConductance.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricConductivity.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions UnitsNet/GeneratedCode/Quantities/ElectricCurrent.g.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 750df85

Please sign in to comment.