toddams / RazorLight

Template engine based on Microsoft's Razor parsing engine for .NET Core
Apache License 2.0
1.51k stars 261 forks source link

RazorLightEngineBuilder throws unexpected exception when .AddDefaultNamespaces is used #394

Closed maxbanas closed 3 years ago

maxbanas commented 3 years ago

Describe the bug RazorLightEngineBuilder throws an exception when .AddDefaultNamespaces is used, even options is never set by .UseOptions:

RazorLight.RazorLightException : namespaces has conflicting settings, configure using either fluent configuration or setting an Options object.

To Reproduce Steps to reproduce the behavior:

new RazorLightEngineBuilder()
    .UseEmbeddedResourcesProject(typeof(Root))
    .AddDefaultNamespaces("123")
    .Build();

Expected behavior No exception should be thrown.