1

i'm curious about detouring calls in shims of fakes framework. What's its inside mechanism or inner principle? how does microsoft implement it?

Hoping for your help,thanks a lot!

zhyy2008z
  • 37
  • 5
  • As far as I know, this is done by modifying the IL of the program and substituting the shim's properties if they have a delegate. – Magus Dec 02 '13 at 15:42
  • @Magus I always assumed there was a hook somewhere. Shims are significantly slower than 'regular' code. – Gusdor Dec 03 '13 at 13:42

1 Answers1

1

Fakes is a productised version of the Moles framework which came out of Microsoft Research. You can refer to the publicly available references for the Moles framework to get a handle on how Shims work.

In short the redirection is implemented using the .net profiler callbacks.

Refer

  1. You can see the explanation on stackoverflow for Moles from the creator of Moles himself
  2. Pex and Moles Website
  3. Presentation which has some details by the creator of Moles
Community
  • 1
  • 1
allen
  • 4,627
  • 1
  • 22
  • 33