Don't use AppDomain codepath for CurrentDomain

Template hosts should return null from ProvideTemplatingAppDomain if they
don't want to use an AppDomain, but check for AppDomain.CurrentDomain
and shortcircuit that as well.

Improves usability issue discovered in #170
This commit is contained in:
Mikayla Hutchinson 2023-12-06 15:10:44 -05:00
Родитель d5fb8e6431
Коммит 145334bd06
1 изменённых файлов: 4 добавлений и 1 удалений

Просмотреть файл

@ -82,7 +82,10 @@ namespace Mono.TextTemplating
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 ();
}