c++eventswindows-phone-8out-of-process

Windows Runtime (WP 8) out of process component and raising / subscription events


I've made out-of-process WR/WP8 component with own background thread. It handles SIP stack internally and runs in background thread. It is modified code from ChatterBox MSDN example. https://code.msdn.microsoft.com/windowsapps/ChatterBox-VoIP-sample-app-b1e63b8b

Last days I add delegates to raise events from component. In C++/CX it is:

  public delegate void OnLogMessage(Platform::String^ msg);

  public ref class Logger sealed
  {

  public:

    Logger();
    virtual ~Logger();

    void FlushLog();

    event OnLogMessage^ OnLogMessage;
  };

There is subscription to event in C# code:

BackgroundProcessController.Instance.Logger.OnLogMessage += new   IntTalk.OnLogMessage(mLogger_OnLogMessage);

It builds ok.

But during debug I see exception:

A first chance exception of type 'System.Exception' occurred in mscorlib.ni.dll

Additional information: Interface not registered (Exception from HRESULT: 0x80040155)

If there is a handler for this exception, the program may be safely continued.

Proxy stub DLL is generated. I checked .h/.c files - they include some code for events.

What can be cause of this issue?


Solution

  • When debugging in native mode the same code I observed the "Interface not registered" exception. Short search resulted in this reference:

    'Interface not Registered' error on ATL out-of-process callback interface

    But I use C++/CX, no IDL at all. I checked the ChatterBox demo (which was starting point for my VoIP application) - they do not use Windows Runtime events at all.

    So I stopped my attempts in this direction.

    Another possible ways can be: