FlatSharp v3.0.0 Release Notes

Release Date: 2020-03-30 // almost 4 years ago
  • ๐Ÿ’ฅ 3.0 is a major release of FlatSharp, with new features and bug fixes. Please read the full notes below before upgrading, as there is a breaking change around enums declared in FBS files.

    Compiler Improvements

    • FlatSharp generates copy constructors for you
    • Increased compatibility with the flatc compiler from Google:
      • Support includes
      • Support quoted metadata
      • Fix a bug around the default numbering for enums (read the breaking change below)

    โš™ Runtime Improvements

    • Usability improvements with some new extension methods on ISerializer<T> for serializing and deserializing.
    • ๐Ÿ‘Œ Support for parsing using ReadOnlyMemory<byte>
    • ๐Ÿ‘Œ Support for Sorted Vectors
    • ๐ŸŽ Some scenarios will see a ~10% performance uplift (see the benchmarks folder)

    ๐Ÿ’ฅ Breaking Changes

    ๐Ÿš€ This release of FlatSharp fixes a bug related to enum numbering. Enums declared in FBS files in FlatSharp 2.X started their numbering at 1 if left unspecified:

    enum MyEnum : ubyte {
       First, Second, Third
    }
    

    Translated to

    public enum MyEnum : byte { First = 1, Second = 2, Third = 3, }
    

    This was a bug reported by @thomas-t1 in #30. The correct numbering starts at 0. In version 3.X, FlatSharp will generate this code instead:

    public enum MyEnum : byte { First = 0, Second = 1, Third = 2}
    

    โฌ†๏ธ This is a problem for any upgrades. If you have been using FlatSharp with FBS files to generate enums, please ensure that you have explicitly set the first member to 1 like so:

    enum MyEnum : ubyte {
       First = 1, Second, Third
    }
    

    This will allow you to preserve the old numbering.