none
An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred . RRS feed

  • Question

  • Hi i am trying to develop an connection app for wpf with the mobile broadband api but the  code wil not run furthter than the interface call giving me the .COM error

    when i call : IMbnInterface[] interfaces = (IMbnInterface[])infMgr.GetInterfaces();

    "

    An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in Communication Manager.exe

    Additional information: De service is niet gestart. (Uitzondering van HRESULT: 0x80070426)

    "

    I tried a lot of thing suggested bij the community. But still no luck. 

    This is a laptop with visual studio 2015 windows 10

    "

    class ConnectionEventsSink : IMbnConnectionEvents
            {
                public ConnectionEventsSink() { }
                public void OnConnectComplete(IMbnConnection newConnection, uint requestID, int status)
                {
                    Console.WriteLine("OnConnectComplete");
                }
                public void OnConnectStateChange(IMbnConnection newConnection)
                {
                    MBN_ACTIVATION_STATE activationState;
                    string profileName;
                    newConnection.GetConnectionState(out activationState, out profileName);
                    Console.WriteLine("OnConnectStateChange - " + profileName + " - " + activationState);
                }

                public void OnDisconnectComplete(IMbnConnection newConnection, uint requestID, int status)
                {
                    Console.WriteLine("OnDisconnectComplete");
                }

                public void OnVoiceCallStateChange(IMbnConnection newConnection)
                {
                    Console.WriteLine("OnVoiceCallStateChange");
                }

            }

            private void mobile_checkBox_Checked(object sender, RoutedEventArgs e)
            {
                MbnInterfaceManager mbnInfMgr = new MbnInterfaceManager();
                IMbnInterfaceManager infMgr = (IMbnInterfaceManager)mbnInfMgr;

                IMbnInterface[] interfaces = (IMbnInterface[])infMgr.GetInterfaces();
                foreach (IMbnInterface mobileInterface in interfaces)
                {

                    MBN_INTERFACE_CAPS caps = mobileInterface.GetInterfaceCapability();
                    MBN_PROVIDER provider = mobileInterface.GetHomeProvider();
                    MBN_READY_STATE readyState = mobileInterface.GetReadyState();
                    IMbnRadio radio = (IMbnRadio)mobileInterface;

                    Console.WriteLine();
                    Console.WriteLine("Manufacturer:        " + caps.manufacturer);
                    Console.WriteLine("Model:               " + caps.model);
                    Console.WriteLine("DeviceID:            " + caps.deviceID);
                    Console.WriteLine("FirmwareInfo:        " + caps.firmwareInfo);
                    Console.WriteLine("Ready State :        " + readyState.ToString());
                    Console.WriteLine("HardwareRadioState:  " + radio.HardwareRadioState.ToString());
                    Console.WriteLine("SoftwareRadioState:  " + radio.SoftwareRadioState.ToString());
                    Console.WriteLine("InterfaceID:         " + mobileInterface.InterfaceID);
                    Console.WriteLine("Provider:            " + provider.providerName);
                    Console.WriteLine("ProviderID:          " + provider.providerID);
                    Console.WriteLine("ProviderState:       " + provider.providerState);

                }

                Console.ReadKey();

            }
    Sunday, January 28, 2018 9:04 PM

All replies

  • Try using try/catch. You can then get an error message.

    I went to Visual Studio Tools menu and executed the "Error Lookup" tool. When I look up 0x80070426 I get "The service has not been started.". That is the message you would get when you use try/catch. Does that message help?



    Sam Hobbs
    SimpleSamples.Info

    • Marked as answer by mwalima Tuesday, January 30, 2018 3:25 PM
    • Unmarked as answer by mwalima Wednesday, January 31, 2018 1:28 PM
    Monday, January 29, 2018 11:29 PM
  • Yes it does, 

    When i used the try catch it runs smoothly but i still get an error on tablet with mobile broadband network when the code tries to collect the interfaces

    IMbnInterface[] interfaces = (IMbnInterface[])infMgr.GetInterfaces(); ==error

    NetworkInterface[] networkIntrInterfaces = NetworkInterface.GetAllNetworkInterfaces(); ==gives all interfaces

    Tuesday, January 30, 2018 3:27 PM
  • I came across System.Runtime.InteropServices.COMException while opening a project solution. Sometimes user doesn't have enough priveleges to run some COM Methods. I ran Visual Studio as Administrator and the exception was gone.

    Wednesday, February 7, 2018 2:58 PM