Why do I need an explicit ToString() when using a conditional operator?

后端 未结 1 1849
情话喂你
情话喂你 2021-01-25 05:04

I\'ve got the following code to compose a simple SOAP Post form data value:

     var postParameters = new Dictionary
        {
           {         


        
相关标签:
1条回答
  • 2021-01-25 05:23

    To confirm that this is just an aberration - the VS IDE is reporting the variable as NULL (in the mouse hover + Immediate Window), but only when debugging the unit tests individually with the R# NUnit test runner. Debugging under the console App reports the value correctly in the IDE.

    i.e. This only happens when debugging, under the Resharper NUnit TestRunner.

    As soon as the variable is accessed by further code (e.g. Assert / Console.Writeline etc), it is clear that the value is NOT actually null.

    I've added a console app to GitHub and a screenshot here

    None of the unit tests actually fail, i.e. the value isn't actually null :-)

    • R# 7.1.3 C# Edition (2224)
    • NUnit 2.6.1.12217
    0 讨论(0)
提交回复
热议问题