Depending on the information we have about a template we improve the debugging experience:
- When the TemplateSource has a not null file path we tell Razor to generate Line pragmas (which leads to better stacktraces on exceptions)
- In the other case when we are in Debug mode we leave the temp files so we can debug into the templates.
- In the future we want to give the Caching layer the possibility to save the generated assemblies, this means we need to have a byte[] member in ICompiledTemplate for the assembly. (Currently this is only possible in Debug mode by copying the generated assembly). We will provide this in the CompilationData class.
- Improved the CompilationException by providing more details and explaining common pitfalls.