Problem while calling Create/GetFolderAsync() method RRS feed

  • Question

  • Hi all,

    I am suffering a problem with following code:

    create_task(Windows::ApplicationModel::Package::Current->InstalledLocation->CreateFolderAsync("XML")).then([this](StorageFolder^ folder)


    create_task(Windows::ApplicationModel::Package::Current->InstalledLocation->GetFolderAsync("XML")).then([this](StorageFolder^ folder){});

    The code can be successfully built, but always throws exception:

    An invalid parameter was passed to a function that considers invalid parameters fatal.

    Any one here knows how the invalid parameter exception comes and give me some suggestion here? Thank you.

    Wednesday, November 7, 2012 2:43 PM


All replies

  • Hi  goldkyo,

    In your case you can create folder under Application data folder.

    Because application not having full privilege in Installed Location.

    please see this thread -


    • Marked as answer by goldkyo Thursday, November 22, 2012 4:17 PM
    Wednesday, November 7, 2012 7:48 PM
  • Hi BhashTech,

    Thank you for your help, your way works for the problem I was facing. But 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.

    Wednesday, November 21, 2012 3:24 PM