Skip to content

[Bug] 2.70.1 causes random NullReferenceException failures with custom templates. #9146

Description

@esbenk

Describe the bug
When building sites with custom templates the 2.70.1 version causes random errors. I'm testing on a project with ~8000 yaml files with our own template (Doc support for https://marketplace.visualstudio.com/items?itemName=ms-dynamics-smb.al). On average 1/3 of the yaml files fails with

C:\src\aldoc\docs\reference\base-application\Page\Microsoft.InventoryMgt.Ledger.Value-Entries-Preview.yml: error InvalidInputFile: Unable to load file 'reference/base-application/Page/Microsoft.InventoryMgt.Ledger.Value-Entries-Preview.yml' via processor 'BusinessCentralApplicationObject': Object reference not set to an instance of an object.

The exception happens when trying to validate the yaml against the BusinessCentralObject schema. The exceptions is thrown in this line

https://github.com/dotnet/docfx/blob/5e266b2621c92b5ef5193ac69db4bfe73e486030/src/Docfx.Build.SchemaDriven/Validators/SchemaValidator.cs#L28C20-L28C20

It is caused by the update of JsonSchema.Net to version 5.00 in this PR #9041.

Reverting to version 4.1.8 solves the issue.

It is probably related to this bug in JsonSchema.Net:

json-everything/json-everything#502

To Reproduce
Steps to reproduce the behavior:

  1. Use custom template with schema.
  2. Build the project. If the project contains many files it will fail every time, smaller project build a couple of times.

Expected behavior
No random NullReferences when using custom templates.

Context (please complete the following information):

  • OS: Windows 11
  • Docfx version: [e.g. 2.70.1]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions