Go To Declaration and the DebuggerStepThrough Attribute

When I use the Go To Declaration keystroke (F12) to a method overload that
is marked with the DebuggerStepThrough attribute, the file containing the
class is opened and selected, but the cursor is not placed on the method.
Is this the expected behaviour?

David


4 comments

Hello,

When I use the Go To Declaration keystroke (F12) to a method overload
that is marked with the DebuggerStepThrough attribute, the file
containing the class is opened and selected, but the cursor is not
placed on the method. Is this the expected behaviour?


I believe R# is not looking at the DebuggerStepThroughAttribute CA in this
situation. Usually R# would succeed in placing the caret on the desired method
if it knows the file to open. Could it be so that R# does not know which
file to open, reverts to Visual Studio, and the latter just opens the file?
What happens if you hit F12 with R# disabled (see Tools -> AddIns)?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

That appears to be the case.

When I disable R# and hit F12, the same (incorrect) functionality appears -
the correct file is opened but the cursor location is a random location (it
appears to be close to the last position that the cursor was in when the
file was saved).

"Serge Baltic" <baltic@intellij.net> wrote in message
news:dc0986bf13ee668cba3aa68c1686e@news.intellij.net...

Hello,

>
>> When I use the Go To Declaration keystroke (F12) to a method overload
>> that is marked with the DebuggerStepThrough attribute, the file
>> containing the class is opened and selected, but the cursor is not
>> placed on the method. Is this the expected behaviour?
>

I believe R# is not looking at the DebuggerStepThroughAttribute CA in this
situation. Usually R# would succeed in placing the caret on the desired
method if it knows the file to open. Could it be so that R# does not know
which file to open, reverts to Visual Studio, and the latter just opens
the file? What happens if you hit F12 with R# disabled (see Tools ->
AddIns)?

>

-
Serge Baltic
JetBrains, Inc - http://www.jetbrains.com
"Develop with pleasure!"

>



0

Hello,

Okay, let's see if it's OK that R# does not know how to go to the method
:) Could you please give more details on the case? Is it ASPX, or late binding,
or something else?


Serge Baltic
JetBrains, Inc — http://www.jetbrains.com
“Develop with pleasure!”


0

This happens all the time when the class that contains the declaration is in a class library.  The code using it does not matter, except that it must be in another file.  (We do not use partial classes so I have not tested them.)  If the code using the method is in the same file (which in our case is always the same class/structure except for an occasional nested class), then F12 finds the correct line of code.  (Both with R# enabled and disabled.)  No late binding involved - a straight standard call.
 
Our environment is a mix of normal class library assemblies, and an ASP.NET Web site (standard web forms web site - not a web application.)  I have seen this behavior from everywhere in the solution, so it does not appear to matter what type of file the calling code exists in.
 
I just did a quick test, and the expected functionality (e.g. placing the cursor on the correct line) works when the member is a property.  So it is only for methods and functions that it fails.
 
The place that this came to light is on a method overload that just delegates to another overload of the same method.   I.E.:
 
File LookupData.cs
 
public class LookupData
{
]]>    
    public string Find(string filter) {
         return Find(filter, false);
    }
 
    public string Find(string filter, bool isCaseSensitive) {
         ...
    }
}
 
File OtherFile.cs
 
public class OtherFile
{
    ...
    string lookup = F|ind("data item");
    ...
}
 
with the cursor on the |.
 
> Hello,
>
> Okay, let's see if it's OK that R# does not know how to go to the method
]]>&gt; :) Could you please give more details on the case? Is it ASPX,
or late binding, > or something else?
>
> —
> Serge Baltic
> JetBrains, Inc — http://www.jetbrains.com
> “Develop with pleasure!”
>
> ]]>

0

Please sign in to leave a comment.