Engine.Razor.RunCompile Error

Multi tool use
Engine.Razor.RunCompile Error
Scenario
I use template with Engine Razor. I have piece of code like this:
if (Engine.Razor.IsTemplateCached("template", null))
{
htmlBody = Engine.Razor.Run("template", null, email);
}
else
{
htmlBody = Engine.Razor.RunCompile(template, "template", null, email);
}
Problem
But I receive error in else:
System.InvalidOperationException: 'The same key was already used for another template!'
CONTEXT Error occurs after:
RazorEngine.Templating.TemplateParsingException
E.g i give bad templete and received above error(Template). Next i gave proper template and received error InvalidOperationEx. it seems that after first exception my template is saved, but
Engine.Razor.IsTemplateCached("template", null
returns false. I suppose to delete template from cache but it is impossible.
sorry I have already edited. Engine.Razor.RunCompile(template, "template", null, email);
– zolty13
Jul 2 at 14:40
Any ideas, i Add context to my question.
– zolty13
Jul 3 at 8:36
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
At which line, please?
– CodeNotFound
Jul 2 at 14:38