If statement weirdness in Visual Studio 2008

前端 未结 6 993
梦如初夏
梦如初夏 2020-12-30 08:09

I\'ve come across a problem so strange, that I\'ve recorded my session because I didn\'t think anyone would belive me.

I came across a bug that seems to be at very f

6条回答
  •  离开以前
    2020-12-30 08:38

    I had exactly the same problem week ago. Also have VS2008, latest SP. WinForms application. The value was false but if body was always executed. I was doing same investigations as in your video. Here is my piece of code:

     if (CurrentFileFormatVersion > int.Parse(metaInfo.SimulationFileVersion))
         throw new SimulationFormatException(ws, ss);
    

    Running without debugger compiled as 'Release' was fine. Try it.

    I suppose there is a bug in VS2008 debugger. Somehow reproducible with 'if' and 'throw' keywords.

    EDIT: the 'executed' word above is wrong one of course. 'Stepped in but not executed' must be used instead.

提交回复
热议问题