I'm the author of a multi-threaded Windows service that renders HTML to PDF using HtmlRenderer and PDFSharp. It quickly became apparent that these libraries are not thread safe when exceptions started blowing during concurrent processing.
I'm probably just at the tip of the iceberg here, but the biggest thread safety issue would appear to be the static Instance method on the PdfSharpAdapter class.
public static PdfSharpAdapter Instance;
Actually it's not so much this one shared static instance as it is the base class RAdapter is not designed to be thread safe at all. In my case it was blowing up on concurrent access to the _fontsHandler font cache.
If anyone has similar experience or comments, I'd like to hear them. Happy to suggest modifications to the code base to make it thread safe but this "Open Source" stuff is somewhat new to me so I don't even know where to begin, hence this post.
Regards,
Bradley Peet
I'm probably just at the tip of the iceberg here, but the biggest thread safety issue would appear to be the static Instance method on the PdfSharpAdapter class.
public static PdfSharpAdapter Instance;
Actually it's not so much this one shared static instance as it is the base class RAdapter is not designed to be thread safe at all. In my case it was blowing up on concurrent access to the _fontsHandler font cache.
If anyone has similar experience or comments, I'd like to hear them. Happy to suggest modifications to the code base to make it thread safe but this "Open Source" stuff is somewhat new to me so I don't even know where to begin, hence this post.
Regards,
Bradley Peet