C# 'is' type check on struct - odd .NET 4.0 x86 optimization behavior

前端 未结 6 941
孤城傲影
孤城傲影 2021-02-02 07:20

Update: I have filed a bug report with Microsoft Connect, please vote for it!

Update 2: Microsoft have marked the bug report as fixed

6条回答
  •  梦毁少年i
    2021-02-02 07:55

    To answer your last question you can add the MethodImpl attribute with the option MethodImplOptions.NoInlining to your IsGuid method as an workaround to fix the problem.

    I just made a simple test of switching between Debug and Release configuration for x86 on the .NET 4.0 and this seems to resolve the problem. I haven't yet run your runtests.bat though.

    You should also submit an issue in Connect if one is not yet submitted and link it from your question.

提交回复
热议问题