Moles 不为某些功能生成委托的原因是什么?

发布于 2024-12-19 18:15:00 字数 290 浏览 3 评论 0原文

对于某些实例方法,我似乎遇到了 Moles 生成委托的令人困惑的问题。

我不会显示确切的方法(尽管我会指出它是一个 Web 服务代理方法,其参数前面有无数的属性),但我会提出标题中的上述问题:

什么是Moles 不为某些方法生成委托的原因?

我在手册中注意到的唯一与此问题几乎无关的事情是,如果私有方法的参数对生成的程序集不可见,则不会生成其受尊重的委托。鉴于我的问题是如何使用公共代理 Web 服务方法的,必须有更多原因来解释为什么不生成委托。

预先感谢您的帮助!

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!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

纸短情长 2024-12-26 18:15:00

Moles 不会为所有方法生成委托。此外,Microsoft Moles 参考手册,第 4 页和第 5 页包含简单概述了哪些痣类型与各种绕行机制相关。例如,当您应该使用存根时,您可能会使用摩尔类型。第 14 页概述了 Moles 类型的一些限制:

  • Moles 框架仅支持有限数量的方法签名 — 最多
    10 个参数,其中最后一个参数可以是 out 或 ref 参数。
    不支持带有指针的方法签名。
  • 密封类或静态方法不能被存根,因为存根类型依赖于
    虚拟方法分派。对于这种情况,请使用“摩尔”中描述的摩尔类型
    本文档后面的“类型”。

如果阅读 Microsoft Moles 参考手册无法解决您的问题,请发布一个不会走弯路的方法的简化示例。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文