Antaris/RazorEngine — Issue #5: Templates exchanged between concurrent users
Author: shez
Created: 2011-11-25 21:37:42+00:00
State: open

Hi,

We have a case where we send emails to users using razor engine in a web service. Its so happening that two users who did some processing at the exact same time got each others email message. We read comments on your blogs in which you mention the design issue with razor engine.

"The key change that prompted this was the overwhelming need to run RazorEngine in parallel/multi-threaded scenarios. Because of how RazorEngine v2 was laid out under the hood, there were a number of mistakes that were made in its design, and thread-safety was a big one. Currently, attempting to run RazorEngine v2.1 in a multi-threaded way nearly always ends badly, you’ll get a hideous amount of mangled template output and/or failed compiles. This has prompted me to redesign the API to support multi-threaded scenarios natively."

We cannot wait for the release of v3. Is there a neat stop-gap solution that you suggest to overcome this issue?

Thanks,
Shez