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:
- Get DeclaringType of the virtual method.
- Find all inherited types in the assembly.
- 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