diff --git a/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs b/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs index 80c18a2..97ba0f8 100644 --- a/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs +++ b/Mono.TextTemplating/Mono.TextTemplating/CompiledTemplate.cs @@ -82,7 +82,10 @@ internal void SetTemplateContentForAppDomain (string content) TemplateProcessor CreateTemplateProcessor () { var domain = host.ProvideTemplatingAppDomain (templateContentForAppDomain); - if (domain == null) { + + // hosts are supposed to return null of they don't want to use a domain + // but check for CurrentDomain too so we can optimize if they do that + if (domain == null || domain == AppDomain.CurrentDomain) { return new TemplateProcessor (); }