dotnet / dotnet/templating

More context in template engine crashes

Open
#9,317 0 comments 0 reactions 0 assignees View on GitHub
triage:transfer-to-sdk
Dominant language
No language data
Stars
1.7k
Forks
399
Avg merge
3d 5h
Merged PRs (30d)
39

Description

### Is your feature request related to a problem? Please describe.

I'm maintaining a couple of templates and sometimes the template engine crashes and stops on some file.

The detailed log just says
>...
>[2025-09-09 09:55:41.597] [Debug] [Microsoft.TemplateEngine.Edge.Template.TemplateCreator] => [Execute] => [Template content generation]: Template content generation finished, took 90 ms
>Failed to create template.
>Details: Error while processing file /src/MyTemplate/doc.md
>Object reference not set to an instance of an object.

Often I can work out what the problem is, e.g. unbalanced #if, but not always.

### Describe the solution you'd like.

Would it be possible to include more context in the error message? At least a stack trace which gives some kind of hint of what the problem is.

Not interested in a solution for the specific case with the markdown file above (I just removed it from the template), but for future problems.

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.