There is an unsaved comment in progress. You will lose your changes if you continue. Are you sure you want to reopen the work item?
Incorrect Caching behaviour for the layout
I've found the one issue, but I don't know how to fix it correctly. Maybe you can help.
Imagine that you have 2 templates, and both use the same layout file. Layout doesn't have "@model" declaration while template 1 has "@model List<..>" and template 2 has "@model MyClass".
When you perform RazorEngine.Razor.Parse(template1, model1, ...);, Razor caches
layout and remembers the type of the current model.
When you perform RazorEngine.Razor.Parse(template2, model2, ...);, Razor loads layout from the cache but throws an exception because it tries to cast model2 to the type of model1.
On my mind, Razor shouldn't remember the type of the model for the layout caching.