locked
Nested Tasks

    Question

  • create_task(picker->PickSingleFileAsync()).then([this](StorageFile^ file)
    	{
    		StorageFolder^ baseFolder = Package::Current->InstalledLocation;
    		Platform::String^ s = baseFolder->Path;
    		create_task(file->CopyAsync(baseFolder)).then([this](StorageFolder^ folder)
    		{
    		});
    	});

    I'm trying to use the picker to find a file, then copy that file to the local directory, once it's picked. But, I get an error when I nest create_tasks from the ppltasks.h file.

    Any help?

    Saturday, January 5, 2013 6:09 PM

Answers

  • Hi DualOpAmp,

    I think you need to write the second create_task in the ".then" part of the first Create_task. Please try once in that way.

    Regards

    Raja KPV


    raja

    • Marked as answer by Jesse Jiang Friday, January 11, 2013 3:26 AM
    Saturday, January 5, 2013 6:54 PM

All replies

  • Hi DualOpAmp,

    I think you need to write the second create_task in the ".then" part of the first Create_task. Please try once in that way.

    Regards

    Raja KPV


    raja

    • Marked as answer by Jesse Jiang Friday, January 11, 2013 3:26 AM
    Saturday, January 5, 2013 6:54 PM
  • Did you find a solution ? I'm seeing crashes with nested tasks myself and sometimes it's not even tasks, it's just message boxes or license API calls. For some reason these tasks only want to be created from the main thread...
    Monday, January 28, 2013 10:42 PM