What is 'Just My Code'?

后端 未结 3 1004
攒了一身酷
攒了一身酷 2020-12-10 09:50

Visual Studio has an option (under Debugging / General) \"Enable Just My Code\"

What is \'Just My Code\'? Visual Studio doesn\'t explain the feature.

3条回答
  •  暖寄归人
    2020-12-10 10:45

    As long as the feature is pretty self-explanatory - debugger skips external code - I think it is also worth mentioning what actually counts as 'My Code' according to Microsoft. In context of the .NET projects that is:

    Not My Code:

    • any optimized library (e.g. Release Mode)
    • libraries without .pdb (no debugging symbols)
    • Classes or members marked with [DebuggerNonUserCode] or [DebuggerHidden]. Also [DebuggerStepThrough] affects it

    My Code:

    • Any project with loaded .pdb (with debugging symbols) for which none of the above applies

    An easy way to see how project dependencies will be treated by the debugger and if they have debugging symbols loaded is to check the Modules window (Debug -> Windows -> Modules, visible only during debugging), which offers a User Code column.

    On a practical side, any not-user-code is marked as [External Code], while debugging.

提交回复
热议问题