Target .NET Standard 2.1, .NET 6, .NET 8 only (#8184)

* Target .NET Standard 2.1, .NET 6, .NET 8 only

* Remove mono usage

* Fix bat name ref

* Up deps

* Up deps

* Reinstate build-windows

* Fix name

---------

Co-authored-by: Derek Bailey <derekbailey@google.com>
This commit is contained in:
Björn Harrtell
2023-12-19 23:43:55 +01:00
committed by GitHub
parent e5fc3b16d8
commit 129ef422e8
15 changed files with 109 additions and 449 deletions

View File

@@ -24,17 +24,14 @@ FlatBuffers).
## Building the FlatBuffers C# library
The `FlatBuffers.csproj` project contains multitargeting for .NET Standard 2.1,
.NET Standard 2.0, and .NET Framework 4.6 (Unity 2017). Support for .NET
Framework 3.5 (Unity 5) is provided by the `FlatBuffers.net35.csproj` project.
In most cases (including Unity 2018 and newer), .NET Standard 2.0 is
recommended.
.NET 6 and .NET 8.
You can build for a specific framework target when using the cross-platform
[.NET Core SDK](https://dotnet.microsoft.com/download) by adding the `-f`
command line option:
~~~{.sh}
dotnet build -f netstandard2.0 "FlatBuffers.csproj"
dotnet build -f netstandard2.1 "FlatBuffers.csproj"
~~~
The `FlatBuffers.csproj` project also provides support for defining various
@@ -142,10 +139,10 @@ To use it:
`ByKey` only works if the vector has been sorted, it will
likely not find elements if it hasn't been sorted.
## Buffer verification
## Buffer verification
As mentioned in [C++ Usage](@ref flatbuffers_guide_use_cpp) buffer
accessor functions do not verify buffer offsets at run-time.
accessor functions do not verify buffer offsets at run-time.
If it is necessary, you can optionally use a buffer verifier before you
access the data. This verifier will check all offsets, all sizes of
fields, and null termination of strings to ensure that when a buffer
@@ -158,17 +155,17 @@ e.g. `Monster.VerifyMonster`. This can be called as shown:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if `ok` is true, the buffer is safe to read.
For a more detailed control of verification `MonsterVerify.Verify`
for `Monster` type can be used:
For a more detailed control of verification `MonsterVerify.Verify`
for `Monster` type can be used:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cs}
# Sequence of calls
FlatBuffers.Verifier verifier = new FlatBuffers.Verifier(buf);
var ok = verifier.VerifyBuffer("MONS", false, MonsterVerify.Verify);
# Or single line call
# Or single line call
var ok = new FlatBuffers.Verifier(bb).setStringCheck(true).\
VerifyBuffer("MONS", false, MonsterVerify.Verify);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if `ok` is true, the buffer is safe to read.
@@ -181,7 +178,7 @@ Verifier supports options that can be set using appropriate fluent methods:
* SetMaxTables - total amount of tables the verifier may encounter. Default: 64
* SetAlignmentCheck - check content alignment. Default: True
* SetStringCheck - check if strings contain termination '0' character. Default: true
## Text parsing