Bug only occurring when compile optimization enabled

前端 未结 5 1866
無奈伤痛
無奈伤痛 2020-12-23 11:21

I came across a bug in code that is only reproduced when the code is built with optimizations enabled. I\'ve made a console app that replicates the logic for testing (code

5条回答
  •  猫巷女王i
    2020-12-23 12:04

    value == new string[0]
    

    The above looks like a weird statement to me. You are comparing two string arrays with an equals statement. That will only result in true if they both point to the same array, which is quite unlikely. This doesn't explain yet why this code behaves differently in an optimized version.

提交回复
热议问题