-
Notifications
You must be signed in to change notification settings - Fork 137
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
NullReferenceException from SharpVectors.Renderers.Wpf.WpfSvgRendering.AdjustViewbox() #115
Comments
True, but the normal procedure will involve
Looking at your stack, it seems the |
Ah, I see. If it helps, this is the code snippet that I believe is responsible for the noted exception call stack:
Now, the object that holds on to this method may have been created off the UI-thread, but this doesn't seem inherently problematic, since the |
It's actually _drawGroup that's null. You can only hit this if you're running the above code in parallel. Here's the test I use that reproduces ~90% of the time:
I think the issue is with the _cacheRendering dictionary in WpfRendering.Create. When I see the exception, there are 2 threads that each have different elements with the same LocalName ("svg"). That code will give each of them the same WpfSvgRenderingNode, which they then Render on in parallel. This exposes that NullReferenceException if one thread clears _drawGroup with the call to Initialize while the other thread is between the null-check and dereference of _drawGroup in AdjustViewbox. |
That was my initial thought, since that is the most unique change in the release 1.4. Thanks for investigating this issue. |
@astarche @atmgrifter00 |
- Renamed some long name folders - Added support for textArea element for Tiny 1.2 specs - WPF Rendering: Fixed thread safety issues as reported in #115 - Added WpfTestThreadSafety to test threading support. Codes by @astarche @atmgrifter00
@astarche @atmgrifter00 The issue with The issue with |
We don't know of anything else that would hold up a new release from our (me and @astarche) perspective. |
@atmgrifter00 Thanks for the feedback. The Nuget package is now publicly available and tagged as Version 1.5.0. I had already started tagging the sources as version 1.5.0 so decided to keep that version so as not to break the W3C test logs. |
Well, crud. I've found another issue, but as it's unrelated to the other one, I'm just going to have to file a new one. |
So far it seems the fix to this issue is holding! |
In the most recent nuget package (1.4.0), we can hit the following exception:
Now, I haven't completely wrapped my head around what might be the root cause, but if I were to guess it would be that
_context
is null here. Looking at how_context
is supposed to be initialized it's hard to see how it would ever be not null, as the public constructor for WpfSvgRendering only offers the one argument for initialization which will ultimately pass null to the base constructor to initialize_context
with.The text was updated successfully, but these errors were encountered: