diff options
author | Jose <jose@zeroc.com> | 2017-12-04 14:10:28 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2017-12-04 14:10:28 +0100 |
commit | 68b48b98a3b56ae554073ab2927ed4cb88f966c4 (patch) | |
tree | 5897ed16118169ade4b91793d127bcf587eaa819 /cpp/src | |
parent | Fix missing IceSSL reference (diff) | |
download | ice-68b48b98a3b56ae554073ab2927ed4cb88f966c4.tar.bz2 ice-68b48b98a3b56ae554073ab2927ed4cb88f966c4.tar.xz ice-68b48b98a3b56ae554073ab2927ed4cb88f966c4.zip |
Add workaround for .NET Core optional failure
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/slice2cs/CsUtil.cpp | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/cpp/src/slice2cs/CsUtil.cpp b/cpp/src/slice2cs/CsUtil.cpp index a5c89f5742f..622d9a9b875 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 << "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 << "var tmp = " << stream << ".readBool(" << tag << ");"; + out << nl << param << " = tmp;"; + out << eb; + } + else + { + out << nl << param << " = " << stream << ".readBool(" << tag << ");"; + } } break; } |