summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorJose <jose@zeroc.com>2018-02-08 17:01:07 +0100
committerJose <jose@zeroc.com>2018-02-08 17:01:07 +0100
commitaf748bcaa77373ea3d6185f5da6e2964ebe07400 (patch)
tree19302a6959332a85d4b766aca6a5d2a0bb91265b /cpp
parentMerge remote-tracking branch 'origin/matlab' into 3.7 (diff)
parentMerge remote-tracking branch 'origin/3.7' into netcore (diff)
downloadice-af748bcaa77373ea3d6185f5da6e2964ebe07400.tar.bz2
ice-af748bcaa77373ea3d6185f5da6e2964ebe07400.tar.xz
ice-af748bcaa77373ea3d6185f5da6e2964ebe07400.zip
Merge remote-tracking branch 'origin/netcore' into 3.7
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/slice2cs/CsUtil.cpp32
1 files changed, 30 insertions, 2 deletions
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp
index a5c89f5742f..7be2eb5a716 100644
--- a/cpp/src/slice2cs/CsUtil.cpp
+++ b/cpp/src/slice2cs/CsUtil.cpp
@@ -842,7 +842,21 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << param << " = " << stream << ".readByte(" << tag << ");";
+ //
+ // BUGFIX: with .NET Core reading the byte optional directly in the
+ // result struct can fails unexpectly with optimized builds.
+ //
+ if(param.find(".") != string::npos)
+ {
+ out << sb;
+ out << nl << "var tmp = " << stream << ".readByte(" << tag << ");";
+ out << nl << param << " = tmp;";
+ out << eb;
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readByte(" << tag << ");";
+ }
}
break;
}
@@ -854,7 +868,21 @@ Slice::CsGenerator::writeOptionalMarshalUnmarshalCode(Output &out,
}
else
{
- out << nl << param << " = " << stream << ".readBool(" << tag << ");";
+ //
+ // BUGFIX: with .NET Core reading the bool optional directly in the
+ // result struct fails unexpectly with optimized builds.
+ //
+ if(param.find(".") != string::npos)
+ {
+ out << sb;
+ out << nl << "var tmp = " << stream << ".readBool(" << tag << ");";
+ out << nl << param << " = tmp;";
+ out << eb;
+ }
+ else
+ {
+ out << nl << param << " = " << stream << ".readBool(" << tag << ");";
+ }
}
break;
}