locked
Problem with creating file in task chain

    Question

  • Hi all,

    Now I am suffering another problem with the following code:

    create_task(Windows::Storage::ApplicationData::Current->LocalFolder->CreateFolderAsync(L"XML", CreationCollisionOption::OpenIfExists)).then([this, folderCode](StorageFolder^ folder) ->IAsyncOperation<StorageFile^>^
    {
    return folder->CreateFileAsync(L"recent_list.xml", CreationCollisionOption::OpenIfExists);
    }).then([this](StorageFile^ file)->IAsyncOperation<XmlDocument^> ^{
    return XmlDocument::LoadFromFileAsync(file);
    }).then([this](XmlDocument^ doc){
    mXMLDocument = doc;
    });

    The code above can be built successfully as well, but it is being executing, part of them will not be executed which is following:

            }).then([this](StorageFile^ file)->IAsyncOperation<XmlDocument^> ^{
    return XmlDocument::LoadFromFileAsync(file);
    }).then([this](XmlDocument^ doc){
    mXMLDocument = doc;
    });

    Does any one knows what is wrong with those code? I do appreciate your help.

    Thursday, November 22, 2012 4:19 PM

Answers