AsJPGStreamAsync() crashes on UWP
See original GitHub issueDescription
Calling SaveAsJpegStream on UWP crashes the application.
Steps to Reproduce
Call await AsJPGStreamAsync()
in any async method in a UWP application. The app will crash with exception “The application called an interface that was marshalled for a different thread”
The reason why this crashes is because WriteableBitmap.PixelBuffer is called on a different thread than the one where the WriteableBitmap was created on.
This can be fixed by removing .ConfigureAwait(false) in TaskParameterExtensions.AsJPGStreamAsync()
public static async Task<Stream> AsJPGStreamAsync(this TaskParameter parameters, int quality = 80)
{
var result = await AsWriteableBitmapAsync(parameters).ConfigureAwait(false);
// the line above should not have ConfigureAwait(false)
var stream = await result.AsJpegStreamAsync(quality).ConfigureAwait(false);
return stream;
}
Basic Information
- Version with issue: 2.4.11
- Last known good version: ?
- Platform: UWP
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:7
Top Results From Across the Web
App Center Crashes for UWP/WinUI - Visual Studio
App Center Crashes will automatically generate a crash log every time your app crashes. The log is first written to the device's storage...
Read more >UWP App crash at different screens when using it for a long ...
In our UWP app we have XAML screens with ListView, Grid, ScrollView, ItemsControl like UWP elements. To show HTML content we use Web...
Read more >UWP application crashes on file write
I try to write to file with UWP application running on Windows IoT 10 Core, but application closes unexpectedly. The code: private async...
Read more >Roblox UWP crashes after 2-3 seconds of startup
I have a typical problem like everyone else - Roblox UWP refuses to work, ... Roblox UWP crashes after 2-3 seconds of startup....
Read more >Windows Explorer crashes when opening folder with a ...
After installing VS17 Update 1, I can no longer open any folder with a Typescript file in it in Windows Explorer (Windows 10)....
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
Same error with both AsPNGStreamAsync and AsJPGStreamAsync. Thanks @Ruddy2007 , rolling back to 2.4.10.972 solved it.
FYI the change was made here: https://github.com/luberda-molinet/FFImageLoading/commit/03b6b64bda350731b9db1fc4ab5bbc59becb4235
Rolling back to version
2.4.10.972
is the last working version before this issue.