NullReferenceException from SharpVectors.Renderers.Wpf.WpfSvgRendering.AdjustViewbox()
See original GitHub issueIn the most recent nuget package (1.4.0), we can hit the following exception:
System.NullReferenceException: Object reference not set to an instance of an object.
at SharpVectors.Renderers.Wpf.WpfSvgRendering.AdjustViewbox()
at SharpVectors.Renderers.Wpf.WpfSvgRendering.AfterRender(WpfDrawingRenderer renderer)
at SharpVectors.Renderers.Wpf.WpfRenderingHelper.RenderElement(ISvgElement svgElement)
at SharpVectors.Renderers.Wpf.WpfRenderingHelper.Render(ISvgDocument docElement)
at SharpVectors.Renderers.Wpf.WpfDrawingRenderer.Render(ISvgDocument node)
at SharpVectors.Converters.FileSvgReader.LoadFile(TextReader textReader)
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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (6 by maintainers)
Top Results From Across the Web
No results found
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 Free
Top 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
@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. Thanks for the help in tracing and fixing this issue.
@astarche @atmgrifter00 I have packed the above codes in
WpfTestThreadSafety
sample and used it to fix this issue. If there is no further issue, I will release Nuget package with version 1.4.5 on Monday.The issue with
WpfSvgRendering
: It was calling thebase.AfterRender
too early. Calling thebase.AfterRender
sets theIsReady
property totrue
, making it available and rightly taken by other threads.The issue with
SvgList
: The use of static dictionary. I have removed the static keyword for now, and will look into a better data structure later.