Exception Stack Trace difference between Debug and Release mode

前端 未结 1 774
轮回少年
轮回少年 2021-02-13 14:40

The code below generates different exception stack trace in both debug and release mode:

static class ET
{
    public static void E1()
    {
        throw new Ex         


        
1条回答
  •  情书的邮戳
    2021-02-13 14:46

    You are probably seeing the result of inlining. When you compile in debug mode, inlining is always turned off (so that debugging makes sense). When you compile in release mode, the compiler will remove certain methods (subject to a lot of rules) and insert their content into all of the call sites. This improves the overall performance of those methods by removing the method call overhead.

    0 讨论(0)
提交回复
热议问题