From 22d59bb0b178fc3abc11f512c5b3b0796cf187f0 Mon Sep 17 00:00:00 2001 From: Alexander Selishchev Date: Fri, 17 Nov 2023 18:49:15 +0300 Subject: [PATCH] Update README.md --- README.md | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/README.md b/README.md index 74e07cd..092c2a0 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,8 @@ Install-Package RazorEngineCore * [Switch from RazorEngine cshtml templates](https://github.com/adoconnection/RazorEngineCore/wiki/Switch-from-RazorEngine-cshtml-templates) * [Azure Functions FileNotFoundException workaround](https://github.com/adoconnection/RazorEngineCore/wiki/Azure-Functions-FileNotFoundException-workaround) * [@Html implementation example](https://github.com/adoconnection/RazorEngineCore/wiki/@Html-implementation-example) +* [Debugging](https://github.com/adoconnection/RazorEngineCore/wiki/Debugging) + ## Extensions * [wdcossey/RazorEngineCore.Extensions](https://github.com/wdcossey/RazorEngineCore.Extensions) @@ -89,6 +91,23 @@ string result = template.Run(instance => Console.WriteLine(result); ``` +#### Debugging +Compile template with ```IncludeDebuggingInfo()``` option and call ```EnableDebugging()``` before running template +If template was compiled with ```IncludeDebuggingInfo()``` option, saveing and loading will keep original template source code and pdb. +```cs +IRazorEngineCompiledTemplate template2 = razorEngine.Compile(templateText, builder => +{ + builder.IncludeDebuggingInfo(); +}); + +template2.EnableDebugging(); // optional path to output directory + +string result = template2.Run(new +{ + Title = "Welcome" +}); +``` + #### Save / Load compiled templates Most expensive task is to compile template, you should not compile template every time you need to run it ```cs