jeudi 18 juin 2020

Access to virtual method table

I have a mono.cecil based lib where I need to find all implementations of some virtual method X. The thing is that the method X is different each time. It could be any virtual methods. I think it could be possible only if vtable is available somehow. Because the methods like Equals(...) could have hundreds of implementations. If it helped, I would be fine to limit the search by some certain assembly.

The only way I see now is described below:

  1. Get DeclaringType of the virtual method.
  2. Find all inherited types in the assembly.
  3. Analyze each type if it has an implementation for the method.

The approach is not optimal. Even if I added some cache, it would still be so slow because of assembly analysis but the execution path is critical. If you see any other solution, please share it.





Aucun commentaire:

Enregistrer un commentaire