Guest User

Untitled

a guest
Aug 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. Passing parameter into Task's Action delegate result in exception
  2. Task.Factory.StartNew(() => RenderThumb(UriSource)).ContinueWith((bs) =>
  3. {....}, TaskScheduler.FromCurrentSynchronizationConext());
  4.  
  5. private BitmapSource RenderThumb(string uriSource)
  6. {
  7.  
  8. Stream imageStream = File.OpenRead(uriSource);
  9. ...
  10. return bitmapSource;
  11. }
  12.  
  13. string uriSource = UriSource;
  14.  
  15. Task.Factory.StartNew(() => RenderThumb(uriSource )).ContinueWith((bs) =>
  16. {....}, TaskScheduler.FromCurrentSynchronizationConext());
  17.  
  18. Task.Factory.StartNew(() => RenderThumb(UriSource)).ContinueWith((bs) => {....}, TaskScheduler.FromCurrentSynchronizationConext());
  19.  
  20. Task.Factory.StartNew((s) => RenderThumb(s as String), UriSource).ContinueWith((bs) =>
  21. {...}, TaskScheduler.FromSynchronizationContext());
Add Comment
Please, Sign In to add comment