Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reflector doesn't show class implementation

Tags:

.net

reflector

I'm trying to decompile a library but when I click on a class name or a method name, the implementation code is empty.

For example:

public bool MethodOne(string str)
{
    // nothing
}

What could it be?

like image 649
Federico Degrandis Avatar asked Nov 20 '09 21:11

Federico Degrandis


3 Answers

You may be trying to reflect reference assemblies used by Visual Studio to provide multi-targeting support. These assemblies are metadata-only and don't have any actual implementation.

If that is the case than you can use VSCommands 2010 extension to get path to the actual assembly with implementation.

assembly details http://vscommands.com/wp-content/uploads/2011/04/image12.png

like image 164
Jarek Kardas Avatar answered Sep 21 '22 14:09

Jarek Kardas


You might have opened a Reference Assembly or a PIA that doesn't have code in it.

The method body could actually be empty.

(Other possibilities?)

like image 28
Brian Avatar answered Sep 23 '22 14:09

Brian


I have seen this with the VSSDK assemblies too.

It could be a public provided interface library, but the actual implementation is 'hidden' somewhere. (Maybe in the GAC?)

The basic train of thought is:

  1. Compile code against some 'stub' assembly
  2. When loaded in the application, the stub assembly is not resolved, but the actual one

I suggest you place a breakpoint in the debugger, and see what is the actual loaded assembly and where it is loaded from.

like image 42
leppie Avatar answered Sep 22 '22 14:09

leppie