Extension Method Debugging

I found a problem when debugging a file that has extension methods in it. What happens is that I have a C# Program and an extension method is properly defined, works fine under normal circumstances. The I see that my extension method isn't behaving exactly as I want so I choose to attach the Visual Studio debugger to the LINQPad process. Then I add this line:

if(Debugger.IsAttached) Debugger.Break();

As expected visual studio breaks. If I have a file without extension methods in it this works exactly as expected. However, if I do have an extension method then the file shown in visual studio is peppered with #line directives and it breaks in the very wrong place.

This happens when I do it in a single file or use the new "My Extensions" file.

Note: I can work around this issue by turning the extension method into a regular method so it is more of an annoyance than anything else at this point.

Comments

Sign In or Register to comment.