Simple C# Noop Statement
If you really want noop, then this defines a nameless action that doesn't do anything, and then invokes it, causing nothing to happen:
((Action)(() => { }))();
The standard empty statement/noop operation in c# is
;
as in:
if (true)
;
(relevant documentation)
this specifically addresses your use case (just place a break-point on the ; line, or otherwise step to it), is minimal, and is directly supported by the environment just for this purpose (so you even if you're doing complex things, like looking at the compiled source, you won't have any additional noise/etc.. to worry about from the compiler/optimizer/etc...) - and has the additional benefit of putting up a warning, as a reminder to clean it out of your code when you're done debugging/push to production
If you want to break into the method you could hardcode a breakpoint:
System.Diagnostics.Debugger.Break();
Alternatively if you don't compile in release mode, the following line will emit IL which you can break on:
var a = 1;
You could also write a Debug.Break() that is specific to your machine:
[Conditional("DEBUG")]
[Obsolete("Please remove me before checkin.")]
public static void Break()
{
#IF DEBUG
if (Dns.GetHostName() == "PROTECTORONE")
Debugger.Break();
#ENDIF
}
Note that because of [Conditional("DEBUG")]
that method will not get called in call sites during a RELEASE build.