Closed pascalberger closed 3 years ago
Finally getting a chance to look into this bug - some observations:
test.txt
file won't trigger the problem. That suggests it's at least partly related to the existing pipelines in Statiq Web.Actually, the Markdown thing makes sense because the exception is happening inside the Razor engine and only Markdown, HTML, and Razor files are processed by Razor (as defined in the Statiq Web pipelines).
Another data point is that the bug is happening for any class defined in the global namespace, not just pipelines. In the call stack I can see it's being triggered during namespace writing in the Razor engine when generating code.
So...pretty sure the issue is that the IExecutionContext.Namespaces
collection is getting a null value for the global namespace. That collection is automatically populated based on reflecting every object in every reference at startup. I suspect that when a reflected object doesn't have a namespace (I.e. the global namespace), we just add the result of the namespace reflection (which is null) to the collection.
Fixed, will go out with the next release.
I get an exception in Content/PostProcess pipeline:
Repro steps
Create this csproj:
Create this
program.cs
input\index.md
Workaround
Move pipeline into namespace: