Why method get() of task throws std::exception or Platform::Exception? RRS feed

  • Question

  • Following is Abnormal codes:

    StorageFolder^ dl=KnownFolders::DocumentsLibrary;
    StorageFile^ file=task<StorageFile^>( dl->GetFileAsync( ref new String("path") ) ).get() ;

    Somethings must be introduced:

    1 The exception is random appearing instead  of being always thrown.

    2 Althrougn i might cancel the problem by repeating excecuting codes above until succesfully in exception handling function by loop,it seems risky.

    3 This situation does not exist when using asynchronous method then().

    4 the exception might be either std::exception or Platform that appears randomly and it contain no information.

    why likes this and how could i do? 

    Thursday, April 5, 2012 9:23 AM