Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

COM Interop - MissingMethodException

$
0
0

Hi All,

Our application has a number of COM Interop assemblies which we initialise through reflection. Unfortunately since I moved to a new Development Environment I have been getting MissingMethodException's when calling these.

The error I am getting is:

System.MissingMethodException: Method 'System.__ComObject.method name' not found.

   at ??.UseComObject(String ClassName, String MethodName, Object[] ParameterArray)

   at ??.UseComObject(String ClassName, String MethodName, Object[] ParameterArray)

The method throwing the error has the following code:

Type myType = null;
object objClass = null;
myType = Type.GetTypeFromProgID(ClassName); // get the type of object based on its ProgId from the Registry.
 objClass = Activator.CreateInstance(myType); // create an instance of the object.

// invoke the member, passing it the parameters
return myType.InvokeMember(MethodName, BindingFlags.InvokeMethod, null, objClass, ParameterArray);

 

If I change it to the following it works:

myType = Type.GetType(ClassName, true, true);               
objClass = Activator.CreateInstance(myType); // create an instance of the object.
                return myType.InvokeMember(MethodName, BindingFlags.DeclaredOnly |
                    BindingFlags.Public | BindingFlags.NonPublic |
                    BindingFlags.Instance | BindingFlags.InvokeMethod | BindingFlags.OptionalParamBinding | BindingFlags.Static,
                    null, objClass, ParameterArray);

I do not get the issue with VB6 COM Components registered in COM+. It is only .NET Interop Components.

They are registered thorugh a batch file as follows:

%windir%\Microsoft.NET\Framework\v4.0.30319\RegSvcs.exe component name

I do not wish to change this code until I find the cause of the issue as it is only a problem on my environment. If the assemblies are compiled on a seperate environment they work as expected.

Thus far some of the things I have tried include:

  1. Check the interops are visble in COM+
  2. Removing any old assemblies from machine
  3. Restarting machine
  4. Doing several clean builds and registrations in COM+ and removals from COM+
  5. Got latest on project
  6. Changed GUID on Class
  7. Set version number of assembly
  8. Reinstall Visual Studio 2012
  9. Reinstall .Net Framework 4.5
  10. Checked the COM+ settings against other environments to ensure they are consistent.

Any help on this would be great before I give up and look to reinstall my environment from scratch.

Barry


Viewing all articles
Browse latest Browse all 8156


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>