ArthurHub / HTML-Renderer

Cross framework (WinForms/WPF/PDF/Metro/Mono/etc.), Multipurpose (UI Controls / Image generation / PDF generation / etc.), 100% managed (C#), High performance HTML Rendering library.
https://htmlrenderer.codeplex.com/
BSD 3-Clause "New" or "Revised" License
1.27k stars 528 forks source link

using Dictionary for caching causes multi-thread issues. #63

Open hippasus opened 7 years ago

hippasus commented 7 years ago

In RAdapter and FontsHandler, Dictionaries are used to cached brushes, pens and fonts.

Single instance pattern is used by PdfSharpAdapter, and this instance is used by all HtmlContainers generated during system running time.

It causes problem when using this single instance in a multi-thread environment. Refer Here

Please replace Dictionary with ConcurrentDictionary.

aajahid commented 5 years ago

I can assure this bug. This happened for us and had to spent hours to figure out the issue.