jlamfers/RazorMachine

An expression is too long or complex to compile - CS1647

Opened this issue · 2 comments

I saw this exception today in my logs in live environment, We are using this to parse contents for email body. And it threw this randomly after processing some 3/4000 emails.

Xipton.Razor.Core.TemplateCompileException: error CS1647: An expression is too long or complex to compile
at Xipton.Razor.Core.TemplateFactory.CheckCompileResults(GeneratorResults generatorResults, CompilerResults compilerResults, String templateContent, String generatedSource)
at Xipton.Razor.Core.TemplateFactory.CreateAssembly(String resourceName, String rootNamespace, String className, String content, String& generatedSource)
at Xipton.Razor.Core.TemplateFactory.CreateBucket(String reqestedPath)
at System.Collections.Concurrent.ConcurrentDictionary2.GetOrAdd(TKey key, Func2 valueFactory)
at Xipton.Razor.Core.TemplateFactory.CreateTemplateInstance(String requestedVirtualTemplateName, Boolean throwExceptionOnVirtualPathNotFound)
at Xipton.Razor.TemplateBase.Xipton.Razor.Core.ITemplateController.TryApplyLayout()
at Xipton.Razor.RazorMachine.ExecuteUrl(String templateVirtualPath, Object model, Object viewbag, Boolean skipLayout, Boolean throwExceptionOnVirtualPathNotFound)
at Xipton.Razor.RazorMachine.ExecuteContent(String templateContent, Object model, Object viewbag, Boolean skipLayout)

I tried parsing the same email locally(same model, same template) and it worked.
this is the version that we are using - Xipton.Razor.dll, v4.0.30319

I have seen the same problem in production also. As a work around, we are going to reboot our mail program every evening and see if this makes a difference. We use it as a Windows Service, but it kicks in every few weeks...