Question

I seem to have this perplexing issue with Moles not generating delegates, for some instance methods.

Instead of showing the exact method (Although I will denote that it's a web service proxy method, with a myriad of attributes prepending it's parameters) I'll instead pose the aforementioned question from the title:

What are the reasons for Moles not to generate delegates for some methods??

The only thing I've noticed in the manual that barely has any relevance to this issue, is the mention of private methods not getting their respected delegates generated if their parameters are not visible to the generated assembly. Seeing as how my problem is with a public proxy web service method, there has to be more reasons as to why delegates aren't generated.

Thanks in advance for your help!

Was it helpful?

Solution

Moles does not generate delegates for all methods. Also, the Microsoft Moles Reference Manual, pages 4 and 5 contain a simplified overview of what moles types are associated with the various detour mechanisms. For example, you may be using a mole type when you should be using a stub. Page 14 outlines some limitations of mole types:

  • The Moles framework supports only a limited number of method signature—up to 10 arguments, where the last argument can be an out or ref argument. Method signatures with pointers are not supported.
  • Sealed classes or static methods cannot be stubbed because stub types rely on virtual method dispatch. For such cases, use mole types as described in “Mole Types” later in this document.

If reading the Microsoft Moles Reference Manual doesn't provide answers to your problem, please post a simplified example of a method that is not generating detours.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top