string.IsNullOrEmpty returns true when supplied string is not null

后端 未结 3 995
日久生厌
日久生厌 2021-01-12 18:05

I have a unit test that calls a method on an object passing in a string.

One of the first things that the method being called does is to check the string for null or

3条回答
  •  悲&欢浪女
    2021-01-12 18:34

    The contents of filePath are definitely not null (and not empty), so that leaves us with two options:

    • You have a wider scope variable (i.e. global variable) named filePath, which is empty on null
    • Your debugger is referencing an older version of the binaries. In that case, claear and rebuild the solution

    Update

    Your question update makes me think the second option (of the above) is the one

提交回复
热议问题