में फ़ाइलकुछ अपवाद है जब पहुँच जब मैं WinRT में फ़ाइलों तक पहुँचने मैं कुछ समस्याएं हैं WinRT
प्रश्न 1:
var file = await StorageFile.GetFileFromPathAsync(filePath);
कभी कभी GetFileFromPathAsync एक फेंक होगा अपवाद "RPC सर्वर उपलब्ध नहीं है"।
प्रश्न 2:
MusicProperties musicProp = await file.Properties.GetMusicPropertiesAsync();
कभी कभी यह होगा एक अपवाद फेंकता है:
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)).
प्रश्न 3:
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)).
:
QueryOptions query = new QueryOptions(CommonFileQuery.OrderByMusicInfo, extensionList);
StorageFileQueryResult queryResult = folder.CreateFileQueryWithOptions(query);
IReadOnlyList<IStorageFile> files = await queryResult.GetFilesAsync();
कभी कभी यह एक अपवाद फेंक होगा
ये अपवाद हर समय फेंक नहीं जाएंगे, लेकिन कभी-कभी। क्यूं कर?