- The following code fails on
osx.10.12-x64 runtime in release mode but succeeds in debug mode.
- It succeeds on
win81-x64 in release and debug mode
- I didn't check any other runtimes.
public static Foo Deserialize(Stream stream)
{
using (var r = new BinaryReader (stream))
{
return new Foo (r.ReadString (), r.ReadDecimal ());
}
}
The method ReadDecimal is called before ReadString. Surprisingly this happens only with runtime methods. If we use custom methods instead (for example extensions methods which trace the order of execution) , the code works.
Find attached the zip file which contains the netcoreapp1.1 project that reproduce the issue: I have used the following commands to publish the project:
dotnet restore -r osx.10.12-x64 ParametersEvaluationOrderTest.csproj
dotnet publish -r osx.10.12-x64 -c release ParametersEvaluationOrderTest.csproj
osx.10.12-x64runtime inreleasemode but succeeds indebugmode.win81-x64inreleaseanddebugmodeThe method
ReadDecimalis called beforeReadString. Surprisingly this happens only with runtime methods. If we use custom methods instead (for example extensions methods which trace the order of execution) , the code works.Find attached the zip file which contains the
netcoreapp1.1project that reproduce the issue: I have used the following commands to publish the project: