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

@@ -106,7 +106,7 @@ jobs:
exclude: exclude:
# Clang++15 10.3.0 stdlibc++ doesn't fully support std 23 # Clang++15 10.3.0 stdlibc++ doesn't fully support std 23
- cxx: clang++-15 - cxx: clang++-15
std: 23 std: 23
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@@ -186,34 +186,6 @@ jobs:
shell: bash shell: bash
run: echo "hashes=$(sha256sum Windows.flatc.binary.zip | base64 -w0)" >> $GITHUB_OUTPUT run: echo "hashes=$(sha256sum Windows.flatc.binary.zip | base64 -w0)" >> $GITHUB_OUTPUT
build-windows-2017:
name: Build Windows 2017
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: cmake
run: cmake -G "Visual Studio 16 2019" -A x64 -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
- name: build tool version 15 (VS 2017)
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=15.0
- name: test
run: Release\flattests.exe
build-windows-2015:
name: Build Windows 2015
runs-on: windows-2019
steps:
- uses: actions/checkout@v3
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: cmake
run: cmake -G "Visual Studio 14 2015" -A x64 -DCMAKE_BUILD_TYPE=Release -DFLATBUFFERS_STRICT_MODE=ON .
- name: build tool version 14 (VS 2015)
run: msbuild.exe FlatBuffers.sln /p:Configuration=Release /p:Platform=x64 /p:VisualStudioVersion=14.0
- name: test
run: Release\flattests.exe
build-dotnet-windows: build-dotnet-windows:
name: Build .NET Windows name: Build .NET Windows
runs-on: windows-2022-64core runs-on: windows-2022-64core
@@ -230,17 +202,17 @@ jobs:
- name: Setup .NET Core SDK - name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3 uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '3.1.x' dotnet-version: '8.0.x'
- name: Build - name: Build
run: | run: |
cd tests\FlatBuffers.Test cd tests\FlatBuffers.Test
dotnet new sln --force --name FlatBuffers.Core.Test dotnet new sln --force --name FlatBuffers.Test
dotnet sln FlatBuffers.Core.Test.sln add FlatBuffers.Core.Test.csproj dotnet sln FlatBuffers.Test.sln add FlatBuffers.Test.csproj
dotnet build -c Release ${{matrix.configuration}} -o out FlatBuffers.Core.Test.sln dotnet build -c Release ${{matrix.configuration}} -o out FlatBuffers.Test.sln
- name: Run - name: Run
run: | run: |
cd tests\FlatBuffers.Test cd tests\FlatBuffers.Test
out\FlatBuffers.Core.Test.exe out\FlatBuffers.Test.exe
build-mac-intel: build-mac-intel:
permissions: permissions:

View File

@@ -60,8 +60,7 @@ jobs:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: actions/setup-dotnet@v3 - uses: actions/setup-dotnet@v3
with: with:
dotnet-version: '6.0.x' dotnet-version: '8.0.x'
- name: Build - name: Build
run: | run: |
dotnet build Google.FlatBuffers.csproj -c Release dotnet build Google.FlatBuffers.csproj -c Release

View File

@@ -24,17 +24,14 @@ FlatBuffers).
## Building the FlatBuffers C# library ## Building the FlatBuffers C# library
The `FlatBuffers.csproj` project contains multitargeting for .NET Standard 2.1, 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 .NET 6 and .NET 8.
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.
You can build for a specific framework target when using the cross-platform 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` [.NET Core SDK](https://dotnet.microsoft.com/download) by adding the `-f`
command line option: command line option:
~~~{.sh} ~~~{.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 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 `ByKey` only works if the vector has been sorted, it will
likely not find elements if it hasn't been sorted. 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 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 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 access the data. This verifier will check all offsets, all sizes of
fields, and null termination of strings to ensure that when a buffer 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. if `ok` is true, the buffer is safe to read.
For a more detailed control of verification `MonsterVerify.Verify` For a more detailed control of verification `MonsterVerify.Verify`
for `Monster` type can be used: for `Monster` type can be used:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cs} ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cs}
# Sequence of calls # Sequence of calls
FlatBuffers.Verifier verifier = new FlatBuffers.Verifier(buf); FlatBuffers.Verifier verifier = new FlatBuffers.Verifier(buf);
var ok = verifier.VerifyBuffer("MONS", false, MonsterVerify.Verify); var ok = verifier.VerifyBuffer("MONS", false, MonsterVerify.Verify);
# Or single line call # Or single line call
var ok = new FlatBuffers.Verifier(bb).setStringCheck(true).\ var ok = new FlatBuffers.Verifier(bb).setStringCheck(true).\
VerifyBuffer("MONS", false, MonsterVerify.Verify); VerifyBuffer("MONS", false, MonsterVerify.Verify);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
if `ok` is true, the buffer is safe to read. 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 * SetMaxTables - total amount of tables the verifier may encounter. Default: 64
* SetAlignmentCheck - check content alignment. Default: True * SetAlignmentCheck - check content alignment. Default: True
* SetStringCheck - check if strings contain termination '0' character. Default: true * SetStringCheck - check if strings contain termination '0' character. Default: true
## Text parsing ## Text parsing

View File

@@ -43,11 +43,11 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Text; using System.Text;
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
using System.Buffers.Binary; using System.Buffers.Binary;
#endif #endif
#if ENABLE_SPAN_T && !UNSAFE_BYTEBUFFER && !NETSTANDARD2_1 #if ENABLE_SPAN_T && !UNSAFE_BYTEBUFFER
#warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined #warning ENABLE_SPAN_T requires UNSAFE_BYTEBUFFER to also be defined
#endif #endif
@@ -55,7 +55,7 @@ namespace Google.FlatBuffers
{ {
public abstract class ByteBufferAllocator public abstract class ByteBufferAllocator
{ {
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public abstract Span<byte> Span { get; } public abstract Span<byte> Span { get; }
public abstract ReadOnlySpan<byte> ReadOnlySpan { get; } public abstract ReadOnlySpan<byte> ReadOnlySpan { get; }
public abstract Memory<byte> Memory { get; } public abstract Memory<byte> Memory { get; }
@@ -103,7 +103,7 @@ namespace Google.FlatBuffers
InitBuffer(); InitBuffer();
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public override Span<byte> Span => _buffer; public override Span<byte> Span => _buffer;
public override ReadOnlySpan<byte> ReadOnlySpan => _buffer; public override ReadOnlySpan<byte> ReadOnlySpan => _buffer;
public override Memory<byte> Memory => _buffer; public override Memory<byte> Memory => _buffer;
@@ -237,7 +237,7 @@ namespace Google.FlatBuffers
return SizeOf<T>() * x.Count; return SizeOf<T>() * x.Count;
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public static int ArraySize<T>(Span<T> x) public static int ArraySize<T>(Span<T> x)
{ {
return SizeOf<T>() * x.Length; return SizeOf<T>() * x.Length;
@@ -246,7 +246,7 @@ namespace Google.FlatBuffers
// Get a portion of the buffer casted into an array of type T, given // Get a portion of the buffer casted into an array of type T, given
// the buffer position and length. // the buffer position and length.
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public T[] ToArray<T>(int pos, int len) public T[] ToArray<T>(int pos, int len)
where T : struct where T : struct
{ {
@@ -274,7 +274,7 @@ namespace Google.FlatBuffers
return ToArray<byte>(0, Length); return ToArray<byte>(0, Length);
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public ReadOnlyMemory<byte> ToReadOnlyMemory(int pos, int len) public ReadOnlyMemory<byte> ToReadOnlyMemory(int pos, int len)
{ {
return _buffer.ReadOnlyMemory.Slice(pos, len); return _buffer.ReadOnlyMemory.Slice(pos, len);
@@ -337,7 +337,7 @@ namespace Google.FlatBuffers
((input & 0xFF00000000000000UL) >> 56)); ((input & 0xFF00000000000000UL) >> 56));
} }
#if !UNSAFE_BYTEBUFFER && (!ENABLE_SPAN_T || !NETSTANDARD2_1) #if !UNSAFE_BYTEBUFFER && !ENABLE_SPAN_T
// Helper functions for the safe (but slower) version. // Helper functions for the safe (but slower) version.
protected void WriteLittleEndian(int offset, int count, ulong data) protected void WriteLittleEndian(int offset, int count, ulong data)
{ {
@@ -377,7 +377,7 @@ namespace Google.FlatBuffers
} }
return r; return r;
} }
#elif ENABLE_SPAN_T && NETSTANDARD2_1 #elif ENABLE_SPAN_T
protected void WriteLittleEndian(int offset, int count, ulong data) protected void WriteLittleEndian(int offset, int count, ulong data)
{ {
if (BitConverter.IsLittleEndian) if (BitConverter.IsLittleEndian)
@@ -427,7 +427,7 @@ namespace Google.FlatBuffers
#endif #endif
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public void PutSbyte(int offset, sbyte value) public void PutSbyte(int offset, sbyte value)
{ {
@@ -487,7 +487,7 @@ namespace Google.FlatBuffers
} }
} }
} }
#elif ENABLE_SPAN_T && NETSTANDARD2_1 #elif ENABLE_SPAN_T
public void PutStringUTF8(int offset, string value) public void PutStringUTF8(int offset, string value)
{ {
AssertOffsetAndLength(offset, value.Length); AssertOffsetAndLength(offset, value.Length);
@@ -652,7 +652,7 @@ namespace Google.FlatBuffers
// that contains it. // that contains it.
ConversionUnion union; ConversionUnion union;
union.intValue = 0; union.intValue = 0;
union.floatValue = value; union.floatValue = value;
WriteLittleEndian(offset, sizeof(float), (ulong)union.intValue); WriteLittleEndian(offset, sizeof(float), (ulong)union.intValue);
} }
@@ -664,7 +664,7 @@ namespace Google.FlatBuffers
#endif // UNSAFE_BYTEBUFFER #endif // UNSAFE_BYTEBUFFER
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public sbyte GetSbyte(int index) public sbyte GetSbyte(int index)
{ {
AssertOffsetAndLength(index, sizeof(sbyte)); AssertOffsetAndLength(index, sizeof(sbyte));
@@ -698,7 +698,7 @@ namespace Google.FlatBuffers
return Encoding.UTF8.GetString(buffer, len); return Encoding.UTF8.GetString(buffer, len);
} }
} }
#elif ENABLE_SPAN_T && NETSTANDARD2_1 #elif ENABLE_SPAN_T
public string GetStringUTF8(int startPos, int len) public string GetStringUTF8(int startPos, int len)
{ {
return Encoding.UTF8.GetString(_buffer.Span.Slice(startPos, len)); return Encoding.UTF8.GetString(_buffer.Span.Slice(startPos, len));
@@ -765,7 +765,7 @@ namespace Google.FlatBuffers
#if ENABLE_SPAN_T // && UNSAFE_BYTEBUFFER #if ENABLE_SPAN_T // && UNSAFE_BYTEBUFFER
ReadOnlySpan<byte> span = _buffer.ReadOnlySpan.Slice(offset); ReadOnlySpan<byte> span = _buffer.ReadOnlySpan.Slice(offset);
return BinaryPrimitives.ReadUInt64LittleEndian(span); return BinaryPrimitives.ReadUInt64LittleEndian(span);
#else #else
fixed (byte* ptr = _buffer.Buffer) fixed (byte* ptr = _buffer.Buffer)
{ {
return BitConverter.IsLittleEndian return BitConverter.IsLittleEndian
@@ -885,16 +885,16 @@ namespace Google.FlatBuffers
} }
/// <summary> /// <summary>
/// Copies an array segment of type T into this buffer, ending at the /// Copies an array segment of type T into this buffer, ending at the
/// given offset into this buffer. The starting offset is calculated /// given offset into this buffer. The starting offset is calculated
/// based on the count of the array segment and is the value returned. /// based on the count of the array segment and is the value returned.
/// </summary> /// </summary>
/// <typeparam name="T">The type of the input data (must be a struct) /// <typeparam name="T">The type of the input data (must be a struct)
/// </typeparam> /// </typeparam>
/// <param name="offset">The offset into this buffer where the copy /// <param name="offset">The offset into this buffer where the copy
/// will end</param> /// will end</param>
/// <param name="x">The array segment to copy data from</param> /// <param name="x">The array segment to copy data from</param>
/// <returns>The 'start' location of this buffer now, after the copy /// <returns>The 'start' location of this buffer now, after the copy
/// completed</returns> /// completed</returns>
public int Put<T>(int offset, ArraySegment<T> x) public int Put<T>(int offset, ArraySegment<T> x)
where T : struct where T : struct
@@ -921,7 +921,7 @@ namespace Google.FlatBuffers
offset -= numBytes; offset -= numBytes;
AssertOffsetAndLength(offset, numBytes); AssertOffsetAndLength(offset, numBytes);
// if we are LE, just do a block copy // if we are LE, just do a block copy
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
MemoryMarshal.Cast<T, byte>(x).CopyTo(_buffer.Span.Slice(offset, numBytes)); MemoryMarshal.Cast<T, byte>(x).CopyTo(_buffer.Span.Slice(offset, numBytes));
#else #else
var srcOffset = ByteBuffer.SizeOf<T>() * x.Offset; var srcOffset = ByteBuffer.SizeOf<T>() * x.Offset;
@@ -942,17 +942,17 @@ namespace Google.FlatBuffers
} }
/// <summary> /// <summary>
/// Copies an array segment of type T into this buffer, ending at the /// Copies an array segment of type T into this buffer, ending at the
/// given offset into this buffer. The starting offset is calculated /// given offset into this buffer. The starting offset is calculated
/// based on the count of the array segment and is the value returned. /// based on the count of the array segment and is the value returned.
/// </summary> /// </summary>
/// <typeparam name="T">The type of the input data (must be a struct) /// <typeparam name="T">The type of the input data (must be a struct)
/// </typeparam> /// </typeparam>
/// <param name="offset">The offset into this buffer where the copy /// <param name="offset">The offset into this buffer where the copy
/// will end</param> /// will end</param>
/// <param name="ptr">The pointer to copy data from</param> /// <param name="ptr">The pointer to copy data from</param>
/// <param name="sizeInBytes">The number of bytes to copy</param> /// <param name="sizeInBytes">The number of bytes to copy</param>
/// <returns>The 'start' location of this buffer now, after the copy /// <returns>The 'start' location of this buffer now, after the copy
/// completed</returns> /// completed</returns>
public int Put<T>(int offset, IntPtr ptr, int sizeInBytes) public int Put<T>(int offset, IntPtr ptr, int sizeInBytes)
where T : struct where T : struct
@@ -980,7 +980,7 @@ namespace Google.FlatBuffers
// if we are LE, just do a block copy // if we are LE, just do a block copy
#if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
unsafe unsafe
{ {
var span = new Span<byte>(ptr.ToPointer(), sizeInBytes); var span = new Span<byte>(ptr.ToPointer(), sizeInBytes);
span.CopyTo(_buffer.Span.Slice(offset, sizeInBytes)); span.CopyTo(_buffer.Span.Slice(offset, sizeInBytes));
} }
@@ -1001,7 +1001,7 @@ namespace Google.FlatBuffers
return offset; return offset;
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
public int Put<T>(int offset, Span<T> x) public int Put<T>(int offset, Span<T> x)
where T : struct where T : struct
{ {

View File

@@ -235,7 +235,7 @@ namespace Google.FlatBuffers
_space = _bb.Put<T>(_space, ptr, sizeInBytes); _space = _bb.Put<T>(_space, ptr, sizeInBytes);
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
/// <summary> /// <summary>
/// Puts a span of type T into this builder at the /// Puts a span of type T into this builder at the
/// current offset /// current offset
@@ -399,7 +399,7 @@ namespace Google.FlatBuffers
Put<T>(ptr, sizeInBytes); Put<T>(ptr, sizeInBytes);
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
/// <summary> /// <summary>
/// Add a span of type T to the buffer (aligns the data and grows if necessary). /// Add a span of type T to the buffer (aligns the data and grows if necessary).
/// </summary> /// </summary>
@@ -533,10 +533,10 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable boolean value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable boolean value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddBool(int o, bool? x) { if (x.HasValue) { AddBool(x.Value); Slot(o); } } public void AddBool(int o, bool? x) { if (x.HasValue) { AddBool(x.Value); Slot(o); } }
/// <summary> /// <summary>
/// Adds a SByte to the Table at index `o` in its vtable using the value `x` and default `d` /// Adds a SByte to the Table at index `o` in its vtable using the value `x` and default `d`
/// </summary> /// </summary>
@@ -551,7 +551,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable sbyte value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable sbyte value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddSbyte(int o, sbyte? x) { if (x.HasValue) { AddSbyte(x.Value); Slot(o); } } public void AddSbyte(int o, sbyte? x) { if (x.HasValue) { AddSbyte(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -568,7 +568,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable byte value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable byte value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddByte(int o, byte? x) { if (x.HasValue) { AddByte(x.Value); Slot(o); } } public void AddByte(int o, byte? x) { if (x.HasValue) { AddByte(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -585,7 +585,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable int16 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable int16 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddShort(int o, short? x) { if (x.HasValue) { AddShort(x.Value); Slot(o); } } public void AddShort(int o, short? x) { if (x.HasValue) { AddShort(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -602,7 +602,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable uint16 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable uint16 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddUshort(int o, ushort? x) { if (x.HasValue) { AddUshort(x.Value); Slot(o); } } public void AddUshort(int o, ushort? x) { if (x.HasValue) { AddUshort(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -619,7 +619,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable int32 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable int32 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddInt(int o, int? x) { if (x.HasValue) { AddInt(x.Value); Slot(o); } } public void AddInt(int o, int? x) { if (x.HasValue) { AddInt(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -636,7 +636,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable uint32 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable uint32 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddUint(int o, uint? x) { if (x.HasValue) { AddUint(x.Value); Slot(o); } } public void AddUint(int o, uint? x) { if (x.HasValue) { AddUint(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -653,7 +653,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddLong(int o, long? x) { if (x.HasValue) { AddLong(x.Value); Slot(o); } } public void AddLong(int o, long? x) { if (x.HasValue) { AddLong(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -670,7 +670,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable int64 value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddUlong(int o, ulong? x) { if (x.HasValue) { AddUlong(x.Value); Slot(o); } } public void AddUlong(int o, ulong? x) { if (x.HasValue) { AddUlong(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -687,7 +687,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable single value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable single value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddFloat(int o, float? x) { if (x.HasValue) { AddFloat(x.Value); Slot(o); } } public void AddFloat(int o, float? x) { if (x.HasValue) { AddFloat(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -704,7 +704,7 @@ namespace Google.FlatBuffers
/// </summary> /// </summary>
/// <param name="o">The index into the vtable</param> /// <param name="o">The index into the vtable</param>
/// <param name="x">The nullable double value to put into the buffer. If it doesn't have a value /// <param name="x">The nullable double value to put into the buffer. If it doesn't have a value
/// it will skip writing to the buffer.</param> /// it will skip writing to the buffer.</param>
public void AddDouble(int o, double? x) { if (x.HasValue) { AddDouble(x.Value); Slot(o); } } public void AddDouble(int o, double? x) { if (x.HasValue) { AddDouble(x.Value); Slot(o); } }
/// <summary> /// <summary>
@@ -739,7 +739,7 @@ namespace Google.FlatBuffers
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
/// <summary> /// <summary>
/// Creates a string in the buffer from a Span containing /// Creates a string in the buffer from a Span containing
/// a UTF8 string. /// a UTF8 string.

View File

@@ -1,57 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{28C00774-1E73-4A75-AD8F-844CD21A064D}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FlatBuffers</RootNamespace>
<AssemblyName>FlatBuffers</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\net35</OutputPath>
<IntermediateOutputPath>obj\Debug\net35</IntermediateOutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\net35</OutputPath>
<IntermediateOutputPath>obj\Release\net35</IntermediateOutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<Compile Include="ByteBuffer.cs" />
<Compile Include="ByteBufferUtil.cs" />
<Compile Include="FlatBufferBuilder.cs" />
<Compile Include="FlatBufferConstants.cs" />
<Compile Include="FlatBufferVerify.cs" />
<Compile Include="IFlatbufferObject.cs" />
<Compile Include="Offset.cs" />
<Compile Include="Struct.cs" />
<Compile Include="Table.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project Sdk="Microsoft.NET.Sdk" ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>netstandard2.1;netstandard2.0;net46</TargetFrameworks> <TargetFrameworks>netstandard2.1;net6.0;net8.0</TargetFrameworks>
<Description>A cross-platform memory efficient serialization library</Description> <Description>A cross-platform memory efficient serialization library</Description>
<PackageVersion>23.5.26</PackageVersion> <PackageVersion>23.5.26</PackageVersion>
<Authors>Google LLC</Authors> <Authors>Google LLC</Authors>
@@ -30,12 +30,8 @@
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants> <DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="('$(ENABLE_SPAN_T)' == 'true') And (('$(TargetFramework)' == 'netstandard2.0') Or ('$(TargetFramework)' == 'net46'))">
<PackageReference Include="System.Memory" Version="4.5.4" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="All" /> <PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="all" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@@ -90,7 +90,7 @@ namespace Google.FlatBuffers
return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length return offset + bb.GetInt(offset) + sizeof(int); // data starts after the length
} }
#if ENABLE_SPAN_T && (UNSAFE_BYTEBUFFER || NETSTANDARD2_1) #if ENABLE_SPAN_T && UNSAFE_BYTEBUFFER
// Get the data of a vector whoses offset is stored at "offset" in this object as an // Get the data of a vector whoses offset is stored at "offset" in this object as an
// Spant&lt;byte&gt;. If the vector is not present in the ByteBuffer, // Spant&lt;byte&gt;. If the vector is not present in the ByteBuffer,
// then an empty span will be returned. // then an empty span will be returned.

View File

@@ -1,203 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\ByteBufferUtil.cs">
<Link>FlatBuffers\ByteBufferUtil.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\IFlatbufferObject.cs">
<Link>FlatBuffers\IFlatbufferObject.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Offset.cs">
<Link>FlatBuffers\Offset.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferBuilder.cs">
<Link>FlatBuffers\FlatBufferBuilder.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferConstants.cs">
<Link>FlatBuffers\FlatBufferConstants.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\FlatBufferVerify.cs">
<Link>FlatBuffers\FlatBufferVerify.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Struct.cs">
<Link>FlatBuffers\Struct.cs</Link>
</Compile>
<Compile Include="..\..\net\FlatBuffers\Table.cs">
<Link>FlatBuffers\Table.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example2\Monster.cs">
<Link>MyGame\Example2\Monster.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Any.cs">
<Link>MyGame\Example\Any.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\AnyAmbiguousAliases.cs">
<Link>MyGame\Example\AnyAmbiguousAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\AnyUniqueAliases.cs">
<Link>MyGame\Example\AnyUniqueAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Color.cs">
<Link>MyGame\Example\Color.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Race.cs">
<Link>MyGame\Example\Race.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Monster.cs">
<Link>MyGame\Example\Monster.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Referrable.cs">
<Link>MyGame\Example\Referrable.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Stat.cs">
<Link>MyGame\Example\Stat.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Test.cs">
<Link>MyGame\Example\Test.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestSimpleTableWithEnum.cs">
<Link>MyGame\Example\TestSimpleTableWithEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TypeAliases.cs">
<Link>MyGame\Example\TypeAliases.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Vec3.cs">
<Link>MyGame\Example\Vec3.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\Ability.cs">
<Link>MyGame\Example\Ability.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\ArrayTable.cs">
<Link>MyGame\Example\ArrayTable.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\ArrayStruct.cs">
<Link>MyGame\Example\ArrayStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\NestedStruct.cs">
<Link>MyGame\Example\NestedStruct.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestEnum.cs">
<Link>MyGame\Example\TestEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\InParentNamespace.cs">
<Link>MyGame\InParentNamespace.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\EnumInNestedNS.cs">
<Link>NamespaceA\NamespaceB\EnumInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\StructInNestedNS.cs">
<Link>NamespaceA\NamespaceB\StructInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\TableInNestedNS.cs">
<Link>NamespaceA\NamespaceB\TableInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\NamespaceB\UnionInNestedNS.cs">
<Link>NamespaceA\NamespaceB\UnionInNestedNS.cs</Link>
</Compile>
<Compile Include="..\namespace_test\NamespaceA\TableInFirstNS.cs">
<Link>NamespaceA\TableInFirstNS.cs</Link>
</Compile>
<Compile Include="..\union_vector\Attacker.cs">
<Link>union_vector\Attacker.cs</Link>
</Compile>
<Compile Include="..\union_vector\BookReader.cs">
<Link>union_vector\BookReader.cs</Link>
</Compile>
<Compile Include="..\union_vector\Character.cs">
<Link>union_vector\Character.cs</Link>
</Compile>
<Compile Include="..\union_vector\Movie.cs">
<Link>union_vector\Movie.cs</Link>
</Compile>
<Compile Include="..\union_vector\Rapunzel.cs">
<Link>union_vector\Rapunzel.cs</Link>
</Compile>
<Compile Include="..\optional_scalars\OptionalByte.cs">
<Link>optional_scalars\OptionalByte.cs</Link>
</Compile>
<Compile Include="..\optional_scalars\ScalarStuff.cs">
<Link>optional_scalars\ScalarStuff.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\ABC.cs">
<Link>KeywordTest\ABC.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\public.cs">
<Link>KeywordTest\public.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\KeywordsInTable.cs">
<Link>KeywordTest\KeywordsInTable.cs</Link>
</Compile>
<Compile Include="..\KeywordTest\KeywordsInUnion.cs">
<Link>KeywordTest\KeywordsInUnion.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test1_generated.cs">
<Link>nested_namespace_test\nested_namespace_test1_generated.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test2_generated.cs">
<Link>nested_namespace_test\nested_namespace_test2_generated.cs</Link>
</Compile>
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
</Compile>
<Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
<Link>union_value_collsion\union_value_collision_generated.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="clean.sh" />
<None Remove="NetTest.sh" />
<None Remove="packages.config" />
<None Remove="README.md" />
</ItemGroup>
<ItemGroup>
<Content Include="..\monsterdata_test.mon">
<Link>Resources\monsterdata_test.mon</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="..\monsterdata_test.json">
<Link>Resources\monsterdata_test.json</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>

View File

@@ -1,52 +1,32 @@
<?xml version="1.0" encoding="utf-8"?> <Project Sdk="Microsoft.NET.Sdk">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup> <PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{9DB0B5E7-757E-4BD1-A5F6-279390331254}</ProjectGuid>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder> <TargetFrameworks>net6.0;net8.0</TargetFrameworks>
<RootNamespace>FlatBuffers.Test</RootNamespace>
<AssemblyName>FlatBuffers.Test</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<RuntimeIdentifier>win</RuntimeIdentifier>
<LangVersion>4</LangVersion>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<Compile Remove="Properties\AssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'"> <PropertyGroup Condition="'$(UnsafeByteBuffer)' == 'true'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants> <DefineConstants>$(DefineConstants);UNSAFE_BYTEBUFFER</DefineConstants>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> <PropertyGroup Condition="'$(EnableSpanT)' == 'true'">
</ItemGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<ItemGroup> <DefineConstants>$(DefineConstants);ENABLE_SPAN_T</DefineConstants>
<Reference Include="System" /> </PropertyGroup>
<Reference Include="System.Core">
</Reference> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
</ItemGroup> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs"> <Compile Include="..\..\net\FlatBuffers\ByteBuffer.cs">
<Link>FlatBuffers\ByteBuffer.cs</Link> <Link>FlatBuffers\ByteBuffer.cs</Link>
@@ -123,12 +103,12 @@
<Compile Include="..\MyGame\Example\ArrayStruct.cs"> <Compile Include="..\MyGame\Example\ArrayStruct.cs">
<Link>MyGame\Example\ArrayStruct.cs</Link> <Link>MyGame\Example\ArrayStruct.cs</Link>
</Compile> </Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\NestedStruct.cs"> <Compile Include="..\MyGame\Example\NestedStruct.cs">
<Link>MyGame\Example\NestedStruct.cs</Link> <Link>MyGame\Example\NestedStruct.cs</Link>
</Compile> </Compile>
<Compile Include="..\MyGame\Example\LongEnum.cs">
<Link>MyGame\Example\LongEnum.cs</Link>
</Compile>
<Compile Include="..\MyGame\Example\TestEnum.cs"> <Compile Include="..\MyGame\Example\TestEnum.cs">
<Link>MyGame\Example\TestEnum.cs</Link> <Link>MyGame\Example\TestEnum.cs</Link>
</Compile> </Compile>
@@ -192,19 +172,19 @@
<Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs"> <Compile Include="..\nested_namespace_test\nested_namespace_test3_generated.cs">
<Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link> <Link>nested_namespace_test\nested_namespace_test3_generated.cs</Link>
</Compile> </Compile>
<Compile Include="Assert.cs" /> <Compile Include="..\union_value_collsion\union_value_collision_generated.cs">
<Compile Include="ByteBufferTests.cs" /> <Link>union_value_collsion\union_value_collision_generated.cs</Link>
<Compile Include="FlatBufferBuilderTests.cs" /> </Compile>
<Compile Include="FlatBuffersFuzzTests.cs" />
<Compile Include="FlatBuffersTestClassAttribute.cs" />
<Compile Include="FlatBuffersTestMethodAttribute.cs" />
<Compile Include="FuzzTestData.cs" />
<Compile Include="Lcg.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="FlatBuffersExampleTests.cs" />
<Compile Include="TestTable.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup>
<None Remove=".gitignore" />
<None Remove="clean.sh" />
<None Remove="NetTest.sh" />
<None Remove="packages.config" />
<None Remove="README.md" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<Content Include="..\monsterdata_test.mon"> <Content Include="..\monsterdata_test.mon">
<Link>Resources\monsterdata_test.mon</Link> <Link>Resources\monsterdata_test.mon</Link>
@@ -215,15 +195,9 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content> </Content>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="packages.config" /> <PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project> </Project>

View File

@@ -4,8 +4,8 @@
set TEMP_BIN=.tmp set TEMP_BIN=.tmp
@REM Run the .NET Core tests @REM Run the .NET tests
set CORE_FILE=FlatBuffers.Core.Test set CORE_FILE=FlatBuffers.Test
set CORE_PROJ_FILE=%CORE_FILE%.csproj set CORE_PROJ_FILE=%CORE_FILE%.csproj
set CORE_SLN_FILE=%CORE_FILE%.sln set CORE_SLN_FILE=%CORE_FILE%.sln
dotnet new sln --force --name %CORE_FILE% dotnet new sln --force --name %CORE_FILE%

View File

@@ -1,7 +1,6 @@
#!/bin/sh #!/bin/sh
PROJ_FILE=FlatBuffers.Test.csproj PROJ_FILE=FlatBuffers.Test.csproj
CORE_PROJ_FILE=FlatBuffers.Core.Test.csproj
TEMP_DOTNET_DIR=.dotnet_tmp TEMP_DOTNET_DIR=.dotnet_tmp
TEMP_BIN=.tmp TEMP_BIN=.tmp
@@ -18,37 +17,20 @@ $DOTNET new sln
$DOTNET sln add $PROJ_FILE $DOTNET sln add $PROJ_FILE
$DOTNET restore -r linux-x64 $PROJ_FILE $DOTNET restore -r linux-x64 $PROJ_FILE
# Testing C# on Linux using Mono. # Testing with default options.
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
mono $TEMP_BIN/FlatBuffers.Test.exe $TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN rm -fr $TEMP_BIN
# Repeat with unsafe versions # Repeat with unsafe versions
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
mono $TEMP_BIN/FlatBuffers.Test.exe
rm -fr $TEMP_BIN
rm FlatBuffers.Test.sln
rm -rf obj
$DOTNET new sln
$DOTNET sln add $CORE_PROJ_FILE
$DOTNET restore -r linux-x64 $CORE_PROJ_FILE
# Testing C# on Linux using .Net Core.
msbuild -property:Configuration=Release,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN
# Repeat with unsafe versions
msbuild -property:Configuration=Release,UnsafeByteBuffer=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe $TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN rm -fr $TEMP_BIN
# Repeat with SpanT versions # Repeat with SpanT versions
msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $CORE_PROJ_FILE msbuild -property:Configuration=Release,EnableSpanT=true,OutputPath=$TEMP_BIN -verbosity:quiet $PROJ_FILE
$TEMP_BIN/FlatBuffers.Core.Test.exe $TEMP_BIN/FlatBuffers.Core.Test.exe
rm -fr $TEMP_BIN rm -fr $TEMP_BIN
rm FlatBuffers.Core.Test.sln rm FlatBuffers.Test.sln
rm -rf obj rm -rf obj

Binary file not shown.

Binary file not shown.

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net35" /> <package id="Newtonsoft.Json" version="13.0.3" />
</packages> </packages>