Go To Usages / Declaration
Okay, I never got these functions to work correctly or reliably in VS 2003,
and was hoping that ReSharper would fix it. But it doesn't.
I have a solution that has many projects in it. If I go to one project
where I define a type X with a method foo on it, and right click and say
Find Usages Advanced... and select to search the entire solution, it says
"no usages found", even though it's used at least six times across all the
projects in the solution.
Worse, if I go to one of those usages and select resharper's "go to
Declaration", it takes me to the useless object browser. I want to get to
the CODE. I don't even know why the object browser exists, because I can't
get the CODE from it. What's going on here? I want IntelliJ's very nice
"go to declaration" that just takes me right to the code where the method is
defined and implemented.
Is this a bug? Is it broken? Or does it just not work the way I think it
should?
Please sign in to leave a comment.
ReSharper works only with C#. Have you selected a C# class?
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccjrlk$u0p$1@is.intellij.net...
2003,
>
>
can't
is
>
>
>
Yes, of course. All projects in the solution are 100% C#
In one project ("Bar"), I have a class X, and it has methods foo(Guid) and
foo(Guid, Guid) as over-loads.
If I do a find usages on the foo(Guid, Guid) it does find the four usages of
that method in project "Baz".
If I do a find usages on the foo(Guid), it does NOT find the single usage of
that method in project "Bax"
If I select the methd name in the usage in project Bax, and do a "go to
definition", it takes me to the correct place in the object browser (showing
me method foo(Guid) of class X). But I cannot get to the CODE.
Similarly if I select the "go to definition" from the foo(Guid, Guid) usages
in project Baz, it goes to the Object Browser, and does not allow me to get
to the code. In fact, I can't find any way to easily get to the code that
isn't manually searching for the tab, or searching for the class in the
solution explorer.
This is probably my biggest pain point in C# and visual studio... the
extreme difficulty of navigating code compared to IntelliJ. And the object
browser strikes me as utterly and completely useless since you cannot seem
to jump from it into the code. I mean, I already KNOW what method and class
are involved! Show me the implementation! :)
Help?
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:ccjrug$vri$1@is.intellij.net...
>
>
>
>
says
the
to
nice
method
it
>
>
Paul,
could you please describe which references exist among projects Bar, Baz and
Bax?
Basically, if 'Goto Declaration' brings you to the Object Browser, this
means that the declaration
is in an assembly referenced from the project. May be Baz and Bax reference
an assembly that is the
output of the Bar project rather than the Bar project directly? What kind of
projects Bar, Bax and Baz are -
class libraries, applications or what else ?
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccjs84$215$1@is.intellij.net...
>
>
>
>
>
>
>
>
>> ReSharper works only with C#. Have you selected a C# class?
>>
>> --
>> Andrey Simanovsky
>> Software Developer
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>>
>>
>>
>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>> news:ccjrlk$u0p$1@is.intellij.net...
>> > Okay, I never got these functions to work correctly or reliably in VS
>> 2003,
>> > and was hoping that ReSharper would fix it. But it doesn't.
>> >
>> > I have a solution that has many projects in it. If I go to one project
>> > where I define a type X with a method foo on it, and right click and
>> > say
>> > Find Usages Advanced... and select to search the entire solution, it
>> > "no usages found", even though it's used at least six times across all
>> > projects in the solution.
>> >
>> > Worse, if I go to one of those usages and select resharper's "go to
>> > Declaration", it takes me to the useless object browser. I want to get
>> > the CODE. I don't even know why the object browser exists, because I
>> can't
>> > get the CODE from it. What's going on here? I want IntelliJ's very
>> > "go to declaration" that just takes me right to the code where the
>> is
>> > defined and implemented.
>> >
>> > Is this a bug? Is it broken? Or does it just not work the way I think
>> > should?
>> >
>> >
>>
>>
>
How do you reference projects? Do you reference projects or project outputs
(as regular assemblies)? If you reference project outputs it is currently
expected behaviour (see
http://www.intellij.net/tracker/resharper/viewSCR?publicId=3312 for more
information).
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccjs84$215$1@is.intellij.net...
>
>
of
>
of
>
(showing
>
usages
get
>
object
class
>
>
project
say
get
think
>
>
It's just a regular reference. I wish it didn't matter. I hope that when
IntelliJ makes their own IDE for C#, they'll get rid of this ridiculous
distinction between "kinds of references"... I should be able to just set a
reference and everything should just work, whether in a development
environment or a shipping product. The way our (huge) product is
structured, all of these things are libraries, and there are so many of
them, that you just create a solution and work on the individual projects
you're interested in, because loading all of them would be too much, as
would having a dozen developers all stepping on the same copy of a solution
in source safe.
Anyway, if it's "expected behavior" that go to declaration doesn't actually
work the way I want it to (i.e. ALWAYS take me to the code, because anything
else is pointless), that still doesn't address the one other major problem:
The usage that ReShaper cannot seem to find.
Here's the actual code, in a project called "Baz":
GroupController gc = GroupController.NewGroupController();
Group newGroup = gc.Add(Guid.NewGuid());
Here's the definition of the Add method in project "Bar"
public class GroupController : BusinessController
{
...
public Group Add(Guid groupTypeKey)
{
...
return Add(groupTypeKey, systemKey);
}
...
}
If you right-click on the Add in "public Group Add(Guid groupTypeKey)", and
select find usages, it returns "No usages found", even though there is one,
right there, in project Baz, which compiles and runs just fine. This is the
same whether using the normal Find Usages, or the Find Usages Advanced...
This seems broken.
"Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in message
news:ccjste$6mk$1@is.intellij.net...
>
and
reference
of
>
and
usages
usage
that
seem
project
all
get
think
>
>
If Baz does not reference Bar as a project, ReSharper would not recognize
usages of elements declared in Bar in the source code of Baz.
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:ccjtr0$ce7$1@is.intellij.net...
a
solution
>
actually
anything
problem:
>
>
>
>
>
>
>
>
and
one,
the
>
>
>
>
kind
to
to
the
VS
and
it
I
very
>
>
Obviously the reference exists, right? I mean, otherwise it wouldn't
compile and run. I just checked, and the reference is indeed there.
Curioser and curioser.
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:ccjvri$ovn$1@is.intellij.net...
>
>
>
>
when
set
projects
Advanced...
Baz
this
foo(Guid)
Guid)
code
the
cannot
and
message
in
across
to
to
because
the
>
>
Could you please reproduce this problem in a sample solution (e.g with 2 projects and couple of classes)? You could then zip it and send to us.
--
Valentin Kipiatkov
Chief Scientist, Vice President of Product Development
JetBrains, Inc
http://www.jetbrains.com "Develop with pleasure!"
>> If Baz does not reference Bar as a project, ReSharper would not
>> recognize usages of elements declared in Bar in the source code of
>> Baz.
>>
>> --
>> Andrey Simanovsky
>> Software Developer
>> JetBrains, Inc
>> http://www.jetbrains.com
>> "Develop with pleasure!"
>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>> news:ccjtr0$ce7$1@is.intellij.net...
>>
>>> It's just a regular reference. I wish it didn't matter. I hope
>>> that
>>>
>>> IntelliJ makes their own IDE for C#, they'll get rid of this
>>> ridiculous distinction between "kinds of references"... I should be
>>> able to just
>>>
>> a
>>
>>> reference and everything should just work, whether in a development
>>> environment or a shipping product. The way our (huge) product is
>>> structured, all of these things are libraries, and there are so many
>>> of them, that you just create a solution and work on the individual
>>>
>>> you're interested in, because loading all of them would be too much,
>>> as would having a dozen developers all stepping on the same copy of
>>> a
>>>
>> solution
>>
>>> in source safe.
>>>
>>> Anyway, if it's "expected behavior" that go to declaration doesn't
>>>
>> actually
>>
>>> work the way I want it to (i.e. ALWAYS take me to the code, because
>>>
>> anything
>>
>>> else is pointless), that still doesn't address the one other major
>>>
>> problem:
>>
>>> The usage that ReShaper cannot seem to find.
>>>
>>> Here's the actual code, in a project called "Baz":
>>>
>>> GroupController gc = GroupController.NewGroupController(); Group
>>> newGroup = gc.Add(Guid.NewGuid());
>>>
>>> Here's the definition of the Add method in project "Bar"
>>>
>>> public class GroupController : BusinessController
>>> {
>>> ...
>>> public Group Add(Guid groupTypeKey)
>>> {
>>> ...
>>> return Add(groupTypeKey, systemKey);
>>> }
>>> ...
>>> }
>>> If you right-click on the Add in "public Group Add(Guid
>>> groupTypeKey)",
>>>
>> and
>>
>>> select find usages, it returns "No usages found", even though there
>>> is
>>>
>> one,
>>
>>> right there, in project Baz, which compiles and runs just fine.
>>> This is
>>>
>> the
>>
>>> same whether using the normal Find Usages, or the Find Usages
>>>
>>> This seems broken.
>>>
>>> "Dmitry Shaporenkov (JetBrains)" <dsha@jetbrains.com> wrote in
>>> message news:ccjste$6mk$1@is.intellij.net...
>>>
>>>> Paul,
>>>>
>>>> could you please describe which references exist among projects
>>>> Bar,
>>>>
>>> and
>>>
>>>> Bax?
>>>> Basically, if 'Goto Declaration' brings you to the Object Browser,
>>>> means that the declaration
>>>> is in an assembly referenced from the project. May be Baz and Bax
>>> reference
>>>
>>>> an assembly that is the
>>>> output of the Bar project rather than the Bar project directly?
>>>> What
>> kind
>>
>>> of
>>>
>>>> projects Bar, Bax and Baz are -
>>>> class libraries, applications or what else ?
>>>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>>>> news:ccjs84$215$1@is.intellij.net...
>>>>
>>>>> Yes, of course. All projects in the solution are 100% C#
>>>>>
>>>>> In one project ("Bar"), I have a class X, and it has methods
>>>>>
>>> and
>>>
>>>>> foo(Guid, Guid) as over-loads.
>>>>>
>>>>> If I do a find usages on the foo(Guid, Guid) it does find the four
>>>>>
>>> usages
>>>
>>>>> of
>>>>> that method in project "Baz".
>>>>> If I do a find usages on the foo(Guid), it does NOT find the
>>>>> single
>>>>>
>>> usage
>>>
>>>>> of
>>>>> that method in project "Bax"
>>>>> If I select the methd name in the usage in project Bax, and do a
>>>>> "go
>>>>>
>> to
>>
>>>>> definition", it takes me to the correct place in the object
>>>>> browser
>>>>> (showing
>>>>> me method foo(Guid) of class X). But I cannot get to the CODE.
>>>>> Similarly if I select the "go to definition" from the foo(Guid,
>>>>>
>>>>> usages
>>>>> in project Baz, it goes to the Object Browser, and does not allow
>>>>> me
>> to
>>
>>>>> get
>>>>> to the code. In fact, I can't find any way to easily get to the
>>> that
>>>
>>>>> isn't manually searching for the tab, or searching for the class
>>>>> in
>>>>>
>> the
>>
>>>>> solution explorer.
>>>>>
>>>>> This is probably my biggest pain point in C# and visual studio...
>>>>>
>>>>> extreme difficulty of navigating code compared to IntelliJ. And
>>>>> the
>>>>> object
>>>>> browser strikes me as utterly and completely useless since you
>>> seem
>>>
>>>>> to jump from it into the code. I mean, I already KNOW what method
>>>>>
>>>>> class
>>>>> are involved! Show me the implementation! :)
>>>>> Help?
>>>>>
>>>>> "Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in
>>>>>
>>>>> news:ccjrug$vri$1@is.intellij.net...
>>>>>
>>>>>> ReSharper works only with C#. Have you selected a C# class?
>>>>>>
>>>>>> --
>>>>>> Andrey Simanovsky
>>>>>> Software Developer
>>>>>> JetBrains, Inc
>>>>>> http://www.jetbrains.com
>>>>>> "Develop with pleasure!"
>>>>>> "Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
>>>>>> news:ccjrlk$u0p$1@is.intellij.net...
>>>>>>
>>>>>>> Okay, I never got these functions to work correctly or reliably
>>>>>>>
>> VS
>>
>>>>>> 2003,
>>>>>>
>>>>>>> and was hoping that ReSharper would fix it. But it doesn't.
>>>>>>>
>>>>>>> I have a solution that has many projects in it. If I go to one
>>>>>>>
>>> project
>>>
>>>>>>> where I define a type X with a method foo on it, and right click
>>>>>>>
>> and
>>
>>>>>>> say
>>>>>>> Find Usages Advanced... and select to search the entire
>>>>>>> solution,
>> it
>>
>>>>> says
>>>>>
>>>>>>> "no usages found", even though it's used at least six times
>>>>>>>
>>> all
>>>
>>>>> the
>>>>>
>>>>>>> projects in the solution.
>>>>>>>
>>>>>>> Worse, if I go to one of those usages and select resharper's "go
>>>>>>>
>>>>>>> Declaration", it takes me to the useless object browser. I want
>>>>>>>
>>> get
>>>
>>>>> to
>>>>>
>>>>>>> the CODE. I don't even know why the object browser exists,
>>>>>>>
>> I
>>
>>>>>> can't
>>>>>>
>>>>>>> get the CODE from it. What's going on here? I want IntelliJ's
>>>>>>>
>> very
>>
>>>>> nice
>>>>>
>>>>>>> "go to declaration" that just takes me right to the code where
>>>>>>>
>>>>> method
>>>>>
>>>>>> is
>>>>>>
>>>>>>> defined and implemented.
>>>>>>>
>>>>>>> Is this a bug? Is it broken? Or does it just not work the way
>>>>>>> I
>>>>>>>
>>> think
>>>
>>>>> it
>>>>>
>>>>>>> should?
>>>>>>>
Could you check the contents of the Baz.csproj file? Is there a tag of the
following form
under the references tag? Or is there a tag of the following form: ? -- Andrey Simanovsky Software Developer JetBrains, Inc http://www.jetbrains.com "Develop with pleasure!" "Paul Bradshaw" ]]> wrote in message
news:cck09g$rif$1@is.intellij.net...
>
recognize
ridiculous
of
as
groupTypeKey)",
is
single
"go
browser
me
in
the
click
solution,
"go
want
I
>
>
It's the latter... an assembly reference. That shouldn't matter in the
'finding references' should it?
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:cck1iu$3ch$1@is.intellij.net...
>
>
>
>
that
just
is
This
message
Bar,
What
four
allow
studio...
method
reliably
one
IntelliJ's
where
way
>
>
Unfortunately, at present it does: ReSharper does not try to find sources
for a given referenced assembly unless it is explicitly told to by using the
project references.
As I mentioned earlier, in
http://www.intellij.net/tracker/resharper/viewSCR?publicId=3312 there is a
similar problem (referencing of a C# project output assembly is done through
using directives in C++). Probably, ReSharper 1.0 will support only project
referencies, not references to project output assemblies.
--
Andrey Simanovsky
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
"Paul Bradshaw" <pbradshaw@advsol.com> wrote in message
news:cck4ie$k0s$1@is.intellij.net...
>
the
development
many
much,
because
there
Browser,
Bax
a
CODE.
foo(Guid,
the
class
And
doesn't.
resharper's
>
>
That is, sad to say, upsetting. We've had lots of problems with using
project references for solutions that have LOTS of projects and assemblies
(we're up to over 70 assemblies). These problems include Visual Studio just
being dog slow, as well as corruption of .SUO and .user files.
If the reference is an assembly reference, I presume reflection isn't enough
to find the references? I wouldn't even care so much about getting to the
source, as much as just knowing references exist! I guess this is a point
for the documentation, to emphasize that only project-references are
supported for things like go-to and find usages...
I do hope that assembly references are considered for support in future
versions of either ReSharper or any stand-alone C# IDE you guys build. I
miss how care-free Java was in this respect (just set the classpath and
forget it), and being able to go back to that kind of ability would be
great.
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:cck5nq$qqb$1@is.intellij.net...
the
>
a
through
project
>
>
>
>
wouldn't
message
is
a
doesn't
major
projects
directly?
the
do
you
in
to
right
times
I
exists,
the
>
>
I've verified that changing the reference to a project reference does in
fact allow the usage to be found.
The problem is that things like refactoring won't find necessary usages to
modify if they're in a module that is only referenced with an assembly
reference. I can see problems popping up because of this, and because it's
not instantly obvious what kind of references are in a project.
I wonder if it wouldn't be possible to add a new resharper option,
"References" that would map assembly references to projects? Reshaper could
just look through the solution and find all (non-system) assembly references
and provide a list of unique ones... and allow the user to specify (browse
two) a project file for each one. Then resharper would have a list of
projects associated with the assembly references, and could just use those
and "transparently" support assembly references. I'd love to see something
like that.
Any possibility of it getting into 1.0? 1.1?? :)
"Andrey Simanovsky (JetBrains)" <ands@jetbrains.com> wrote in message
news:cck5nq$qqb$1@is.intellij.net...
the
>
a
through
project
>
>
>
>
wouldn't
message
is
a
doesn't
major
projects
directly?
the
do
you
in
to
right
times
I
exists,
the
>
>