Skip to content

[Bug] NullPointerException during content generation #9782

@thejonan

Description

@thejonan

Describe the bug
A NullPointerException during tool execution, after updating to version 2.75.3 (previous version used is 2.66.2 and the error did not show up).

Here's the stack trace:

NullReferenceException: Object reference not set to an instance of an object.
  at ConfigFilterRuleItem get_Rule() in ConfigFilterRuleItemUnion.cs:57
  at bool CanVisitCore(IEnumerable<ConfigFilterRuleItemUnion> ruleItems, SymbolFilterData symbol) in ConfigFilterRule.cs:
     30
  at bool CanVisitApi(SymbolFilterData symbol) in ConfigFilterRule.cs:20
  at bool <IncludeApi>g__IncludeApiDefault|1(ISymbol symbol) in SymbolFilter.cs:46
  at bool <IncludeApi>b__0(ISymbol _) in SymbolFilter.cs:40
  at TValue GetOrAdd(TKey key, Func<TKey, TValue> valueFactory)
  at bool IncludeApi(ISymbol symbol) in SymbolFilter.cs:31
  at IEnumerable<INamespaceSymbol> GetAllNamespaces(IAssemblySymbol assembly, SymbolFilter filter) in SymbolHelper.cs:106
  at IEnumerable<TResult> SelectManyIterator<TSource,TCollection,TResult>(IEnumerable<TSource> source, Func<TSource,
     IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
  at bool MoveNext()
  at IEnumerable<TResult> SelectManyIterator<TSource,TCollection,TResult>(IEnumerable<TSource> source, Func<TSource,
     IEnumerable<TCollection>> collectionSelector, Func<TSource, TCollection, TResult> resultSelector)
  at bool MoveNext()
  at void AddRange(IEnumerable<T> items)
  at bool ReserveOrAdd(IEnumerable<T> items)
  at TResult[[]] ToArray()
  at void CreateManagedReference((ValueTuple<IAssemblySymbol, Compilation> symbol) assemblies, ExtractMetadataConfig
     config, DotnetApiOptions options) in DotnetApiCatalog.ManagedReference.cs:19
  at async Task <Exec>g__Build|5_0(ExtractMetadataConfig config, DotnetApiOptions options) in DotnetApiCatalog.cs:123
  at async Task Exec(MetadataJsonConfig config, DotnetApiOptions options, string configDirectory, string outputDirectory)
     in DotnetApiCatalog.cs:75
  at void <Execute>b__0() in DefaultCommand.cs:45
  at int Run(LogOptions options, Action run) in CommandHelper.cs:48
  at int Execute(CommandContext context, Options options) in DefaultCommand.cs:31
  at Task<int> Execute(CommandContext context, CommandSettings settings) in CommandOfT.cs:40
  at Task<int> Execute(CommandTree leaf, CommandTree tree, CommandContext context, ITypeResolver resolver, IConfiguration
     configuration) in CommandExecutor.cs:144
  at async Task<int> Execute(IConfiguration configuration, IEnumerable<string> args) in CommandExecutor.cs:83
  at async Task<int> RunAsync(IEnumerable<string> args) in CommandApp.cs:84

Here is a (modified) configuration file:

{
  "metadata": [{
    "src": [{
      "files": ["CoreProject.csproj"],
      "src": "../"
    }, {
      "files": ["DependentProject1.csproj", "DependentProject2.csproj"],
      "src": "../"
    }],
    "dest": "api",
    "filter": "docfx-filter-config.yml",
    "disableGitFeatures": true,
    "disableDefaultFilter": false
  }],
  "build": {
    "content": [{
      "files": ["**.yml", "**.md"],
      "exclude": "docfx-filter-config.yml"
    }],
    "resource": [{
      "files": ["images/**"]
    }],
    "overwrite": [{
      "files": ["**.md"],
      "exclude": [
        "obj/**",
        "bin/**",
        "_site/**"
      ]
    }],
    "dest": "../public",
    "_globalMetadata": {
      "_appTitle": "Custom API",
      "_enableSearch": true
    },
    "globalMetadataFiles": [],
    "fileMetadataFiles": [],
    "template": ["default"],
    "postProcessors": [],
    "noLangKeyword": false,
    "keepFileLink": false,
    "cleanupCacheHistory": true,
    "disableGitFeatures": true,
    "force": true
  }
}

And here is the filter file referred:

apiRules:
- include:
  uidRegex: ^MyCompany\.MyNamespace\.Core.+
- exclude:
  uidRegex: _[^.]+$

The command used to invoke the generation is:

./bin/docfx Docs/docfx.json --serve

Context (please complete the following information):

  • macOS (Sonoma 14.3.1)
  • Linux (mcr.microsoft.com/dotnet/sdk:7.0 docker image).
  • Docfx version: 2.75.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions