Why can't a place a breakpoint on a closing brace?

As shown from the image, the debugger broke at the breakpoint at the return statement.  However I am unable to place a breakpoint in any of the subsequent closing braces. Why not? Visual Studio allows this. 
This is decompiled code.



It shows ‘Unable to resolve method at postion’.

(This forum software doesn't support editing posts?)



Thank you for contacting Rider support.

Placing a breakpoint on closing braces is not allowed by design. For most assemblies (Release), we just can't do it technically. Most assemblies (NuGet, dll) are built and published as a release assembly. Such an assembly is optimized and contains no nop instructions that is required for a breakpoint to be placed on closing brace.

I verified this behavior in Visual Studio and could see it also doesn't allow placing a breakpoint on a closing brace (in decompiled or system assemblies). (see the attachments)

Would you mind double-checking if VS behaves the same way for you? If VS actually allows placing a breakpoint on a closing brace in decompiled assemblies, we would appreciate it if you could share a screencast that demonstrates this, so that we can take another look at this behavior.

Have a nice day!


Please sign in to leave a comment.