[WP8] Exceptions in C++ CX Runtime component RRS feed

  • Question

  • Hello!

    I am using some c++ libraries in my project for windows phone 8. I developed runtime component dll to wrap c++ functionality and use it from c# code. But when I use it (with native only debugger), I see some strange exceptions like this:

    First-chance exception at 0x776E277C in TaskHost.exe: Microsoft C++ exception: HRException at memory location 0x005AE528.

    First-chance exception at 0x776E277C in TaskHost.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.

    I thought that is problem in my code, but when I download Windows Runtime Component Sample (http://code.msdn.microsoft.com/wpapps/Windows-Runtime-Component-fb644b34), I saw same exceptions when I tap on 'compute asynchronously' in sample.

    Call stack:

    > KERNELBASE.DLL!_RaiseException@16() Unknown
      MSVCRT.DLL!__CxxThrowException@8() Unknown
      coreclr.dll!ThrowHR(long) Unknown
      coreclr.dll!WinRTTypeNameConverter::GetManagedTypeFromWinRTTypeNameInternal(class SString *,bool *) Unknown
      coreclr.dll!WinRTTypeNameConverter::GetManagedTypeFromWinRTTypeName(unsigned short const *,bool *) Unknown
      coreclr.dll!GetClassFromIInspectable(struct IUnknown *,bool *,bool *,bool *) Unknown
      coreclr.dll!COMInterfaceMarshaler::InitializeObjectClass(struct IUnknown *) Unknown
      coreclr.dll!COMInterfaceMarshaler::FindOrCreateObjectRefInternal(struct IUnknown * *,class MethodTable *,bool) Unknown
      coreclr.dll!GetObjectRefFromComIP(class Object * *,struct IUnknown * *,class MethodTable *,class MethodTable *,unsigned long) Unknown
      coreclr.dll!UnmarshalObjectFromInterface(class Object * *,struct IUnknown * *,class MethodTable *,class MethodTable *,unsigned long) Unknown
      coreclr.dll!StubHelpers::InterfaceMarshaler__ConvertToManaged(struct IUnknown * *,class MethodTable *,unsigned long,class MethodTable *) Unknown
      02ad3104() Unknown

    What is the reason of these exceptions? How can I avoid exceptions? I think that these exceptions can slow down code execution speed, and I want get rid of them.

    Can anyone help me?

    Thank you!

    Tuesday, January 14, 2014 12:12 PM


  • Some exceptions are bound to occur, but as long as they are caught, your app should be fine.  If they occur in your app's code, you might be able to get rid of them completely, but if they are in lower-level code, you will have to live with them.

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Tuesday, January 14, 2014 1:16 PM