question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullReferenceException from SharpVectors.Renderers.Wpf.WpfSvgRendering.AdjustViewbox()

See original GitHub issue

In 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:closed
  • Created 4 years ago
  • Comments:11 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
paulushubcommented, Oct 28, 2019

@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.

2reactions
paulushubcommented, Oct 26, 2019

@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 the base.AfterRender too early. Calling the base.AfterRender sets the IsReady property to true, 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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

No results found

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found