Describe the bug
Running docs-builder serve on a docset whose docset.yml toc references a Markdown file that does not exist causes a global unhandled System.NullReferenceException while building navigation lookups, instead of a clear validation error.
Stack trace (abbreviated):
System.NullReferenceException: Object reference not set to an instance of an object.
at Elastic.Documentation.Navigation.NavigationItemExtensions.BuildNavigationLookupsRecursive(INavigationItem, ConditionalWeakTable`2, Dictionary`2)
at Elastic.Documentation.Navigation.NavigationItemExtensions.BuildNavigationLookups(INavigationItem, ConditionalWeakTable`2)
at Elastic.Markdown.IO.DocumentationSet..ctor(BuildContext, ILoggerFactory, ICrossLinkResolver)
at Documentation.Builder.Http.ReloadableGeneratorState..ctor(ILoggerFactory, IDirectoryInfo, IDirectoryInfo, BuildContext, Boolean)
at Documentation.Builder.Http.DocumentationWebHost..ctor(ILoggerFactory, String, Int32, ScopedFileSystem, ScopedFileSystem, IConfigurationContext, Boolean)
at Documentation.Builder.Commands.ServeCommand.<Serve>d__4.MoveNext()
Expected behavior
docs-builder serve (or a normal build) should report a diagnostic that the TOC entry points to a missing file (path + docset.yml location), and exit without an unhandled exception.
Steps to reproduce
Tested with docs-builder 1.7.0 (install script from README).
-
Create an empty directory and a docs folder inside it.
-
Add docs/docset.yml:
icon: magnifyWithPlus
registry: internal
toc:
- file: index.md
-
Do not create docs/index.md (the TOC must reference a file that is absent).
-
From the repository root (parent of docs/), run:
-
Observe the process crash with NullReferenceException as above.
Minimal tree:
repro-root/
docs/
docset.yml # toc -> index.md only
Tooling
Describe the bug
Running
docs-builder serveon a docset whosedocset.ymltocreferences a Markdown file that does not exist causes a global unhandledSystem.NullReferenceExceptionwhile building navigation lookups, instead of a clear validation error.Stack trace (abbreviated):
Expected behavior
docs-builder serve(or a normal build) should report a diagnostic that the TOC entry points to a missing file (path +docset.ymllocation), and exit without an unhandled exception.Steps to reproduce
Tested with docs-builder 1.7.0 (install script from README).
Create an empty directory and a
docsfolder inside it.Add
docs/docset.yml:Do not create
docs/index.md(the TOC must reference a file that is absent).From the repository root (parent of
docs/), run:Observe the process crash with
NullReferenceExceptionas above.Minimal tree:
Tooling