RazorLight
RazorLight copied to clipboard
[Question] How to debug the cshtml template in VS 2017, Core 2.0 and RazorLight v2.0.0-beta1
Hi,
I am not able to debug the razor template in VS 2017, Core 2.0 and RazorLight v2.0.0-beta1
I'm working in a Web.Api project and in my controller I have the following:
var codeBase = Assembly.GetExecutingAssembly().CodeBase;
var uri = new UriBuilder(codeBase);
var dir = Path.GetDirectoryName(Uri.UnescapeDataString(uri.Path));
var template = File.ReadAllText($"{dir}/Templates/{templateName}.cshtml");
var engine = new RazorLightEngineBuilder()
.UseMemoryCachingProvider()
.Build();
var result = engine.CompileRenderAsync("templateKey", template, data).Result;
I tried different ways without success, how can I do to debug the razor template ?
Thanks.
I have had the same experience, debugging does not work. Your best bet is to just let the rendering fail and you might get an error message but not always, sometimes it just does not render the html in the problem areas.