Click here to Skip to main content
15,895,142 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Problem executing BitmapDecoder.Save() in worker thread (solved through egregious kludge) Pin
fjparisIII30-May-09 12:38
fjparisIII30-May-09 12:38 
AnswerRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
Mark Salsbery31-May-09 8:30
Mark Salsbery31-May-09 8:30 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 11:42
fjparisIII31-May-09 11:42 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery31-May-09 12:26
Mark Salsbery31-May-09 12:26 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 13:50
fjparisIII31-May-09 13:50 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII31-May-09 18:46
fjparisIII31-May-09 18:46 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery31-May-09 20:18
Mark Salsbery31-May-09 20:18 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII1-Jun-09 5:42
fjparisIII1-Jun-09 5:42 
Mark Salsbery wrote:
And your kludge sounds horrific - I would dump that


I can't dump it until I refactor my code to replace my usage of the BackgroundWorker class with my own custom thread that does exactly the same thing only is STA instead of MTA: massive re-invention of the wheel. I was only sucked into using BackgroundWorker in the first place because it was recommended as an easy way to maintain a reactive UI while a background task was grinding away doing the real work.

If the reason all these people are having trouble with BitmapEncoder.Save() is because they are trying to execute it inside BackgroundWorker and BitmapEncoder.Save() can only be executed in an STA, why did the designers of BackgroundWorker make it an MTA? It makes BackgroundWorker useless for transforming bitmaps in the background, as long as WPF uses WIC (COM-based) to implement the BitmapEncoder classes.

How about warning us up front that we won't be able to transform bitmaps inside BackgroundWorker and that we'll have to roll our own threads with the exact same functionality provided by the BackgroundWorker events, ProgressChanged and RunWorkerCompleted?

It makes me suspicious about the probability of success in going through the effort of this refactoring. What if there's a good reason for running BackgroundWorker as MTA and if my own STA replacement won't work for these very same reasons? (Can you think of any?) Then I'm still out in the cold, stuck with my "horrific kludge," as you called it. In the meantime I've wasted several days going down a blind alley.
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 6:47
Mark Salsbery1-Jun-09 6:47 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
fjparisIII1-Jun-09 8:52
fjparisIII1-Jun-09 8:52 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 10:39
Mark Salsbery1-Jun-09 10:39 
General[Message Deleted] Pin
fjparisIII1-Jun-09 13:34
fjparisIII1-Jun-09 13:34 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 13:46
Mark Salsbery1-Jun-09 13:46 
General[Message Deleted] Pin
fjparisIII1-Jun-09 14:23
fjparisIII1-Jun-09 14:23 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 14:33
Mark Salsbery1-Jun-09 14:33 
General[Message Deleted] Pin
fjparisIII1-Jun-09 14:43
fjparisIII1-Jun-09 14:43 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 15:23
Mark Salsbery1-Jun-09 15:23 
General[Message Deleted] Pin
fjparisIII1-Jun-09 16:05
fjparisIII1-Jun-09 16:05 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 17:09
Mark Salsbery1-Jun-09 17:09 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread [modified] Pin
Mark Salsbery1-Jun-09 14:13
Mark Salsbery1-Jun-09 14:13 
General[Message Deleted] Pin
fjparisIII1-Jun-09 16:39
fjparisIII1-Jun-09 16:39 
GeneralRe: Problem executing BitmapDecoder.Save() in worker thread Pin
Mark Salsbery1-Jun-09 17:06
Mark Salsbery1-Jun-09 17:06 
General[Message Deleted] Pin
fjparisIII1-Jun-09 17:56
fjparisIII1-Jun-09 17:56 
General[Message Deleted] Pin
fjparisIII2-Jun-09 4:40
fjparisIII2-Jun-09 4:40 
General[Message Deleted] Pin
fjparisIII2-Jun-09 5:33
fjparisIII2-Jun-09 5:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.