StorageFile.CreateStreamedFileAsync throws wrong thread exception
See original GitHub issueDescribe the bug
var storageFile = await StorageFile.CreateStreamedFileAsync("test.png", OnStorageFileNeeded, null)
throws a COMException with is claiming to be on the wrong thread. This is happening for me on the UI thread, which I think should work and has worked in WinUI 2. (I have some difficulty in providing more information, as for me VisualStudio 2019 16.10 Preview 2.1 becomes completely unresponsive when this exception is encountered. Restarting explorer.exe enabled me to recover from this exception.)
Expected behavior Should not throw exception, this was working in UWP / WinUI 2.
Version Info
NuGet package version: WinUI 3 - Project Reunion 0.5: 0.5.5
Windows app type:
UWP | Win32 |
---|---|
Yes |
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
October 2020 Update (19042) | Yes |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
StorageFile.CreateStreamedFileAsync Method
This method lets the app produce the data on-demand by specifying a function to be invoked when the StorageFile that represents the stream...
Read more >c# - Wrong Thread Exception when changing an object's ...
It throws a WRONG_THREAD exception. It's the same for all these other events. I also tried using the await CoreApplication.MainView.
Read more >[Solved]-UWP share feature not working in Windows 10 ...
it seems that createstreamedfileasync method does not work properly with share contract in mobile. we've logged this issue internally and i will update...
Read more >StorageFile.OpenStreamForReadAsync, Windows.Storage ...
Storage.StorageFile class is used to open a stream for reading the contents of a file asynchronously. This method returns a System.Threading.Tasks.Task object ...
Read more >FTP Endeavor II – Upload and Download Files - Can Bilgin
Using the StorageFile abstraction, we can easily make the ftp ... throw new FtpException( string . ... CreateStreamedFileAsync(path.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This seems to be working now 🥳
I believe this is the same issue as https://github.com/microsoft/CsWinRT/issues/612 . I am able to repro to this issue and should able to confirm whether my fix resolves it or not once I am done.