Question

I am trying to write a COM server that employs the .NET profiling API. This COM server will run on Windows Mobile 6 devices. The purpose of this COM server is to profile .NET applications running on the same device. However, I am not able to find the following header files in the Windows Mobile SDKs:

  1. cor.h
  2. corprof.h

Does this mean that I need to port these header files using the corresponding versions available in the Windows (Desktop) SDK?

It's these header files which define the family of ICorProfilerCallBack interfaces that are so crucial to using the .NET Profiling API.

I have taken a look at these header files present in the Windows SDK and I have found that they contain a lot of platform specific information related to the object model of the .NET framework and also the format of a PE file representing a .NET assembly. It seems that I require intimate knowledge of the implementation details in these areas of .NET to successfully port. Are there any alternatives ?

Was it helpful?

Solution

The problem you're running into is that you made an incorrect assumption at the outset that the Compact Framework supports any of the ICorProfilerCallBack interfaces. It does not. If you want to do profiling, a few paths have been followed in the past by other profilers I've seen/used:

  1. Use reflection to rebuild and instrument the CF assemblies on the desktop. Using your own proprietary publishing paradigm, you can push out function enter/exit messages and things like that. This is useful for code profiling, but not so much for memory profiling.
  2. Build Mono.Cecil for the CF and use it to instrument/emit right on the target device. This is slower, but more portable.
  3. Use the completely undocumented memory profiling APIs in the CF like the CF CLR Profiler uses. I've hunted for any docs on these and come up empty, and I've tried pushing to get Microsoft to open source the tool on Codeplex, but I've made zero progress on either, so this would be a lot of reverse engineering of network packets with the existing tool and Wireshark.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top