You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When analyzing a method of some class TestClass : ITest and checking its usages, dnSpy might show no usages at all since it does not show usages which are invoked by the interface ITest.
How To Reproduce
Create a class which implements an interface and call a method on that class via its interface.
interfaceITest{publicvoidMyMethod();}classTestClass:ITest{publicvoidMyMethod(){}}ITestfoo=new TestClass();
foo.MyMethod();// <-- This call will not be found if TestClass.MyMethod is analyzed for usages
Expected Behavior
Its found
Actual Behavior
Its not found
Additional Context
No response
The text was updated successfully, but these errors were encountered:
This is because the analyzer analyzes direct usages within CIL bodies, When you compile the code you provided you can see that the call to MyMethod is performed via a callvirt instruction with the operand being the interface method.
If you want to find places where TestClass.MyMethod is indirectly called through an interface method, analyze the usages of ITest.MyMethod instead.
Perhaps its not a bug report but rather a feature request then to show those usages over the interface or abstract class. I'm not sure if that's even possible to implement though as it would require some non trivial analysis and might be out of scope since its already somewhat doable by just looking up the usages of the parent.
dnSpyEx version
6.4.0
Describe the Bug
When analyzing a method of some class
TestClass : ITest
and checking its usages, dnSpy might show no usages at all since it does not show usages which are invoked by the interfaceITest
.How To Reproduce
Create a class which implements an interface and call a method on that class via its interface.
Expected Behavior
Its found
Actual Behavior
Its not found
Additional Context
No response
The text was updated successfully, but these errors were encountered: