A reader asked:
I’ve been reading up the issues with using .NET for property handlers. I know you can’t using .NET Interop to create a property handler without getting into issues with the version of the .NET framework. I discovered though that .NET Assemblies can be registered and used as COM objects. Could one implement the required functions of IPropertyStore in c++ and then inside those functions make calls to a COM object that does all the real work?
I know you said that you feel property handlers should be written in c/c++ for performance reasons but would this get around the issue of the framework version issue?
This is a very good question, but the answer is “probably not”.
The reason is that property handlers cannot cause .NET code to get loaded in the caller’s process which is not supported. It has nothing to do with performance. So you cannot get around the issue by writing a C++ stub that calls a .NET COM object in the same process.
The only thing that works is to write a C++ stub that calls a .NET class running in a different process altogether. But that’s a lot more work, introduces a lot of failure paths, may introduce subtle interactions, etc.
Raymond Chen digs into the reasons with this post: http://blogs.msdn.com/1317290.aspx
[Update 2007-06-04: I found another article (from 2006) which repeats this warning: http://msdn.microsoft.com/msdnmag/issues/04/01/WindowsShell/default.aspx]