Tengo algunos problemas cuando accedo a los archivos en WinRTalguna excepción cuando el acceso al archivo en WinRT
la pregunta 1:
var file = await StorageFile.GetFileFromPathAsync(filePath);
veces la GetFileFromPathAsync generará un "servidor de la RPC no está disponible" excepción.
la pregunta 2:
MusicProperties musicProp = await file.Properties.GetMusicPropertiesAsync();
él a veces produce una excepción:
Unable to cast COM object of type 'Windows.Storage.FileProperties.MusicProperties' to interface type 'Windows.Storage.FileProperties.IMusicProperties'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{BC8AAB62-66EC-419A-BC5D-CA65A4CB46DA}' failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).
la pregunta 3:
QueryOptions query = new QueryOptions(CommonFileQuery.OrderByMusicInfo, extensionList);
StorageFileQueryResult queryResult = folder.CreateFileQueryWithOptions(query);
IReadOnlyList<IStorageFile> files = await queryResult.GetFilesAsync();
veces será una excepción:
Unable to cast COM object of type 'Windows.Storage.StorageFile' to interface type 'Windows.Storage.IStorageFile'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{C7034384-F12E-457A-89DA-69A5F8186D1C}' failed due to the following error: The application called an interface that was marshalled for a different thread. (Exception from HRESULT: 0x8001010E (RPC_E_WRONG_THREAD)).
Estas excepciones no se lanzarán todo el tiempo, pero a veces. ¿Por qué?