summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBjörn Harrtell <bjornharrtell@users.noreply.github.com>2021-02-23 18:34:20 +0100
committerGitHub <noreply@github.com>2021-02-23 09:34:20 -0800
commitcbbbaa61b34c31f17773c2fef354c31664e9562e (patch)
treefcd7e13a98f401046c37835a3c0bf0cf1a4f6f65 /src
parentffc2ef77caeb6b04e89db952c65216982db44698 (diff)
downloadflatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.tar.gz
flatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.tar.bz2
flatbuffers-cbbbaa61b34c31f17773c2fef354c31664e9562e.zip
[C#] Fix truncated ArraySegment<byte> if elementSize != 1 (#6462)
* WIP: Fix returned truncated ArraySegment<byte> if elementSize is not byte * Fix * Regenerated test code
Diffstat (limited to 'src')
-rw-r--r--src/idl_gen_csharp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/idl_gen_csharp.cpp b/src/idl_gen_csharp.cpp
index a5423a23..fed1169f 100644
--- a/src/idl_gen_csharp.cpp
+++ b/src/idl_gen_csharp.cpp
@@ -845,6 +845,8 @@ class CSharpGenerator : public BaseGenerator {
code += "Bytes() { return ";
code += "__p.__vector_as_arraysegment(";
code += NumToString(field.value.offset);
+ code +=
+ ", " + NumToString(SizeOf(field.value.type.VectorType().base_type));
code += "); }\n";
code += "#endif\n";