Note that there are some explanatory texts on larger screens.

plurals
  1. POCom+ late binding c# 4.0
    primarykey
    data
    text
    <p>In my program I create Com+ objects dynamicly (late binding) using </p> <pre><code>Type comObjectType = Type.GetTypeFromProgID(progId, true); object comObject = Activator.CreateInstance(comObjectType); </code></pre> <p>And then call one of the methods using reflection</p> <pre><code>object result = comObjectType.InvokeMember(MethodToActivate, BindingFlags.InvokeMethod, null, comObjec, new object[] {....}); </code></pre> <p>It works greate in .Net 1.1/2.0/3.5</p> <p>Now I'm trying to run the <strong>same code</strong> on the same machine (Windows XP) compiled for .Net 4.0, but I've got a </p> <pre><code>Exception: Method 'System.__ComObject.{MethodName}' not found. </code></pre> <p>I've got the exception for most of Com+ objects (not for all). Does anybody know what is the problem? Why do I get the exception in FW 4.0 environment? What should I do to avoid it?</p> <p>Thanks a lot, Daniel</p> <p>After some more investigation I have discovered that some of the Com+ proxies are created as <code>System._ComObject</code> (those are the native ones, I suppose), and some are created as <code>System.Runtime.Remoting.Proxies._TransparentProxy</code> (I think that those are .Net Com+ objects). Method invocation works fine for those that are created as <code>System._ComObject</code> and does not work for <code>System.Runtime.Remoting.Proxies._TransparentProxy</code>. The most intersting fact is that in .Net 2.0 the all the objects are created in the same way (<code>_ComObject</code> and <code>_TransparentProxy</code>) but the method invocation does work fine. Another interesting fact is that I can see the "missing" method in the debugger using reflecton</p> <p><code>((System.EnterpriseServices.RemoteServicedComponentProxy)((((System.Runtime.Remoting.Proxies.__TransparentProxy)(ObjectToActivate)))._rp)).ProxiedType.GetMethods()</code></p> <p>I thought for some moment that it could be a security issue, but I run the code as WindowsService logged on as a user with Administrator privileges </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload