none
COM Interop - MissingMethodException RRS feed

  • Question

  • 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

    Wednesday, April 9, 2014 2:42 PM

All replies

  • Hello,

    It seems that all possible solutions that you have already done, but it was still there. I am trying to involve someone experienced to help look into this case, if we have any result, we will tell you.

    Regards.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Thursday, April 10, 2014 6:11 AM
    Moderator
  • Hi Fred,

    That would be very useful. I was considering a reinstall of COM+ to see if it helps but could not find a method to do this on Windows 7 Enterprise.   

    Regards,

    Barry

    Thursday, April 10, 2014 10:43 AM
  • Hi,

    >>reinstall com+ windows 7

    You can check this KB:

    http://support.microsoft.com/kb/315296


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 11, 2014 9:52 AM
    Moderator
  • Hi Fred,

    I had seen that article when troubleshooting but it does not relate to WIndows 7 unfortunately.

    These steps are applicable to the operating systems that are  mentioned in the "applies to" section.            These steps do not apply to Windows Vista, Windows Server 2008, Windows Server 2008 R2, or Windows 7

    Regards,

    Barry

    Friday, April 11, 2014 12:49 PM