I quickly want to determine whether/when a set of events are triggered. Therefore I quickly assigned empty lambda's to them.
_session.TopologyStarted += () => { };
When tracing through the code when the event is triggered, the debugger goes into the anonymous function, allowing to debug it's execution. However, when setting a breakpoint on this line of code, a breakpoint is set on the assignment of the anonymous function to the event.
Is there a way to set a breakpoint within the anonymous function?
Set breakpoints in source code To set a breakpoint in source code, click in the far left margin next to a line of code. You can also select the line and press F9, select Debug > Toggle Breakpoint, or right-click and select Breakpoint > Insert breakpoint. The breakpoint appears as a red dot in the left margin.
Press F3 and then press F9 to add a breakpoint. This adds a breakpoint to the first method found using the trick.
An inline breakpoint can be set using Shift+F9 or through the context menu during a debug session. Inline breakpoints are shown inline in the editor. Inline breakpoints can also have conditions. Editing multiple breakpoints on a line is possible through the context menu in the editor's left margin.
In software development, a breakpoint is an intentional stopping or pausing place in a program, put in place for debugging purposes. It is also sometimes simply referred to as a pause.
Put your cursor in the anonymous function (between the {}'s) and press F9.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With