Bizarre ternary operator behavior in debugger on x64 platform

前端 未结 2 1933
日久生厌
日久生厌 2021-01-17 13:03

I\'m using a very simple ternary expression in my C# code:

helperClass.SomeData = helperClass.HasData ? GetSomeData() : GetSomeOtherData();

相关标签:
2条回答
  • 2021-01-17 13:50

    Taking Eric Lippert's advice that this is probably a bug, I've filed an official Connect bug for this issue: https://connect.microsoft.com/VisualStudio/feedback/details/684202

    Thanks everyone for your feedback!

    UPDATE: They got back to me and said they've fixed this corner case in the next version of the compiler. Hooray! :)

    0 讨论(0)
  • 2021-01-17 13:50

    to me this doesn't seem a bug in the debugger but possibly of the compiler...

    when changing the code to

    { helperClass.SomeData = helperClass.HasData ? GetSomeData() : GetSomeOtherData(); }
    

    the IL generated is different and the debugger works as expected...

    0 讨论(0)
提交回复
热议问题