.net 运行时可调用包装器上 VS2008 中的代码覆盖率

发布于 2024-08-03 14:46:13 字数 232 浏览 5 评论 0原文

我有一个 .DLL,其中包含 COM/DCOM 对象的 .NET 运行时可调用包装器。

我在 VS 2008 中用 C# 编写了一个测试套件,它调用上述 .DLL 中的服务器函数。

当代码覆盖率打开并运行测试套件时,代码覆盖率测试结果不会产生任何统计数据,并且未覆盖和覆盖块都显示为零。

有谁知道为什么会这样?

任何人都知道如何获得 .dll 上的代码覆盖率(.net 可调用包装器)?

I have a .DLL which contains .NET Runtime callable wrappers for COM/DCOM objects.

I have written a testing suite in C# in VS 2008 which calls our server functions which are in the abovementioned .DLL.

When code coverage was turned on and testing suite ran, code coverage test results did not yield any statistics and displayed zeroes for both Not Covered and Covered blocks.

Does anyone know why that would be the case?

Anyone knows how to get code coverage on .dll which are .net callable wrappers?

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

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

发布评论

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

评论(1

做个少女永远怀春 2024-08-10 14:46:13

我不确定您使用的代码覆盖引擎是如何工作的,但它们通常使用分析 API + 一些反射来确定执行了哪些托管代码。

我怀疑 RCW 主要是本机代码,在托管对象与其本机 COM 对应对象之间架起桥梁。

您可以通过在生成的互操作程序集(托管COM 对象的 RCW),并查看它们实际包含多少托管代码。

然而,一旦越过了互操作边界,一切就都丢失了,那么您就不再处于受管理的范围内。您需要一个本机覆盖工具来收集该方面的统计数据。

I don't know for sure how the code coverage engine you're using works, but they usually employ the profiling API + some reflection to figure out what managed code is executed.

I suspect RCWs are primarily native code, bridging between the managed objects and their native COM counterparts.

You could verify this by running .NET Reflector on the generated interop assemblies (which host the RCWs for your COM objects), and see how much managed code they actually contain.

Once you get past the interop border, however, all is lost, then you're no longer in managed territory. You'd need a native coverage tool to collect statistics from that side.

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