New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception when running in multi-threaded environment #35
Comments
Well, I wouldn't expect anything different. Why are you opening a window in a new thread? That's a pretty unusual thing to do... In any case, it's not a scenario I intend to support. If you really need to do that, you can try to |
Using WpfAnimatedGif within devexpress control also fails with the message:
|
Not sure what DevExpress is doing here, but I suspect |
Closing due to inactivity |
I too am affected by this. It seems not that unusual a thing to do - beyond the hobby project scope. |
Hi @lsim, It's not a problem with the library, it's due to how WPF works. If an Did you try what I suggested to @dusansmail and @igharrac? i.e. freezing the image? They never said if it worked for them. |
That part of our code isn't my specific area of expertise - so I can't say yet how we might work around the issue. My main source of bafflement is that even when window and controls are all created on the same STA thread (not the Main thread), it still exhibits this behavior. I'll study it some more - I'm probably overlooking something. I'll look into if and when we create a .. and try to remember to report back here with my findings. Thanks for a super speedy reply btw |
It works fine outside the main thread so long as all our gif-showing windows are run on the same STA thread. My concern was that even this wouldn't be enough. Despite our efforts to clean up after each such window is closed, something relating to the gif must remain, which gives rise to the thread related exception when the next window initializes. Until now, we have spun up a new STA thread for each such window. I think we can probably make this work in our project. |
@lsim this might be because animations are cached (so that if you have the same GIF images shown multiple times, the animation isn't reconstructed every time). Each animation is removed from the cache when the last instance of the GIF is cleared. Maybe try to clear the |
Unfortunately, that experiment is probably out the scope of my current situation now that I have things working again. I would have to rewire the xaml bindings in a semi complicated setup. If that cache is the root of the problem, maybe it could be a candidate for a |
If it's indeed the cause of the problem, yes, that would probably solve it. |
Try to open window with gif image in new thread, first time it works.
Try to open other window with gif image in new thread, fails miserably:
The text was updated successfully, but these errors were encountered: