locked
Global Array cause an exception during start of App,HRESULT:0x8001010E

    Question

  • Array<MyClass^>^ g_Array = ref new Array<MyClass^>
    {
     ref new MyClass(ref new Class1()),
     ref new MyClass(ref new Class2()),
     ref new MyClass(ref new Class3())
    }

    The exception happened before enter the constructor of Class1.

    HERESULT:0x8001010E

    Platform::WrongThreadException ^ at memory location .

    I do not know how to fix it, could anyone tell me ?

    Thanks :) !

    Thursday, August 9, 2012 3:10 AM

Answers

  • From the error it appears you managed to execute this on a thread other than the UI thread. You'll need to get back to the UI thread for these UI components to initialize.


    David Lamb

    • Marked as answer by root.ember Friday, August 10, 2012 12:35 AM
    Friday, August 10, 2012 12:01 AM
    Moderator

All replies

  • Class1 ... 3 are UI Control class

    Thursday, August 9, 2012 4:32 AM
  • From the error it appears you managed to execute this on a thread other than the UI thread. You'll need to get back to the UI thread for these UI components to initialize.


    David Lamb

    • Marked as answer by root.ember Friday, August 10, 2012 12:35 AM
    Friday, August 10, 2012 12:01 AM
    Moderator
  • I put this initialization into UI object function, and fix the error. Thanks!
    Friday, August 10, 2012 12:35 AM