.net 运行时可调用包装器上 VS2008 中的代码覆盖率
我有一个 .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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定您使用的代码覆盖引擎是如何工作的,但它们通常使用分析 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.