Skip to content

Commit 22d59bb

Browse files
Update README.md
1 parent 6c218a3 commit 22d59bb

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ Install-Package RazorEngineCore
3838
* [Switch from RazorEngine cshtml templates](https://github.com/adoconnection/RazorEngineCore/wiki/Switch-from-RazorEngine-cshtml-templates)
3939
* [Azure Functions FileNotFoundException workaround](https://github.com/adoconnection/RazorEngineCore/wiki/Azure-Functions-FileNotFoundException-workaround)
4040
* [@Html implementation example](https://github.com/adoconnection/RazorEngineCore/wiki/@Html-implementation-example)
41+
* [Debugging](https://github.com/adoconnection/RazorEngineCore/wiki/Debugging)
42+
4143

4244
## Extensions
4345
* [wdcossey/RazorEngineCore.Extensions](https://github.com/wdcossey/RazorEngineCore.Extensions)
@@ -89,6 +91,23 @@ string result = template.Run(instance =>
8991
Console.WriteLine(result);
9092
```
9193

94+
#### Debugging
95+
Compile template with ```IncludeDebuggingInfo()``` option and call ```EnableDebugging()``` before running template
96+
If template was compiled with ```IncludeDebuggingInfo()``` option, saveing and loading will keep original template source code and pdb.
97+
```cs
98+
IRazorEngineCompiledTemplate template2 = razorEngine.Compile(templateText, builder =>
99+
{
100+
builder.IncludeDebuggingInfo();
101+
});
102+
103+
template2.EnableDebugging(); // optional path to output directory
104+
105+
string result = template2.Run(new
106+
{
107+
Title = "Welcome"
108+
});
109+
```
110+
92111
#### Save / Load compiled templates
93112
Most expensive task is to compile template, you should not compile template every time you need to run it
94113
```cs

0 commit comments

Comments
 (0)