这肯定是VS2012的bug了:

当在metro开发中使用如下lambda表达式获取本地媒体资源,而项目工程的manifest文件中的caps中并没有勾选music libs、Pictures libs以及Video libs等几个复选框时,VS光荣的,挂掉了。必现,crash!


FileStruct* f =new FileStruct();


try

   {

volatile int status = 0;


task(StorageFile::GetFileFromPathAsync(ShowbizUtil::ANSI_2_Unicode(szFileFullPath))).then([=] (StorageFile^ file)

{

f->file = file;

return file->OpenAsync(FileAccessMode::Read);

}).then([=, &status] (Streams::IRandomAccessStream^ fileStream)//Streams::IRandomAccessStream^ stream)

{

status = 1;

try

{

f->stream = fileStream;

if(f->stream)

{

f->size = f->stream->Size;

}

}

catch (Exception^ e)

{

return;

}

}).wait();