Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I was trawling through some of the IL of one of my assemblies (via ILDasm) and I noticed that all of my methods begin with a nop instruction.

Does anyone know why that is?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
315 views
Welcome To Ask or Share your Answers For Others

1 Answer

The assembly was compiled in debug mode. Nop instructions do not do anything (i.e have no side effects), but act as a convenient instruction to place a breakpoint.

Tip

If you need a place for an additional breakpoint for debugging purposes, you can force the inclusion of a Nop in a Debug build by adding a pair of empty braces, e.g.

_grid.PreviewMouseRightButtonDown += (sender, e) =>
{
    _isRightMouseDown = true;

    RowColumnIndex cell = _grid.PointToCellRowColumnIndex(e);
    {} //<------ Adding a Nop allows a breakpoint here.
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...