Why doesn't the null coalescing operator (??) work in this situation?

前端 未结 2 1254
隐瞒了意图╮
隐瞒了意图╮ 2021-01-11 09:19

I\'m getting an unexpected NullReferenceException when I run this code, omitting the fileSystemHelper parameter (and therefore defaulting it to nul

2条回答
  •  再見小時候
    2021-01-11 09:41

    Someone else experienced the same problem in this question. Interestingly it is also using a this._field = expression ?? new ClassName(); format. It could be some kind of issue with the debugger, as writing the value out seemed to produce the correct results for them.

    Try adding debug/log code to show the value of the field after assignment to eliminate weirdness in the attached debugger.

提交回复
热议问题