dotnet / dotnet/docfx

ArgumentOutOfRangeException on metadata task

Open
#4,341 10 comments 1 reaction 0 assignees View on GitHub
dotnet
Dominant language
C#
Stars
4.4k
Forks
890
Avg merge
2h 11m
Merged PRs (30d)
10

Description

**Operation System**: (`Windows` or `Linux` or `MacOS`)
Windows

**DocFX Version Used**:
2.41.0.0

**Template used**: (`default` or `statictoc` or contain custom template)
default

**Steps to Reproduce**:

1. Run `docfx` with this config against my project with a whole lot of `.csproj` files:
```
{
"metadata": [
{
"src": [
{
"files": [
"**/*.csproj"
],
"exclude": [
"**/*Test*/*"
],
"src": "../../"
}
],
"dest": "api",
"disableGitFeatures": true,
"disableDefaultFilter": false
}
],
"build": {
"content": [
{
"files": [
"api/**.yml",
"api/index.md"
]
},
{
"files": [
"toc.yml",
"*.md"
]
}
],
"resource": [
{
"files": [
"images/**"
]
}
],
"overwrite": [
{
"files": [
"apidoc/**.md"
],
"exclude": [
"obj/**",
"_site/**"
]
}
],
"dest": "site",
"globalMetadataFiles": [],
"fileMetadataFiles": [],
"template": [
"default"
],
"postProcessors": [],
"markdownEngineName": "markdig",
"noLangKeyword": false,
"keepFileLink": false,
"cleanupCacheHistory": false,
"disableGitFeatures": false
}
}
```

**Expected Behavior**:
Metadata is generated.

**Actual Behavior**:
Get the following exception:
```
[19-04-09 08:15:33.021]Error:Error extracting metadata for D:/TeamCity/BuildAgent/work/c0a0e3e2b15ea307/ProductName/UI/UI.csproj: System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at System.Collections.Generic.List`1.get_Item(Int32 index)
at Microsoft.DocAsCode.Metadata.ManagedReference.SpecIdHelper.<>c__DisplayClass4_0.b__0(Match match)
at System.Text.RegularExpressions.RegexReplacement.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat)
at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)
at Microsoft.DocAsCode.Metadata.ManagedReference.SpecIdHelper.GetSpecId(ISymbol symbol, IReadOnlyList`1 typeGenericParameters, IReadOnlyList`1 methodGenericParameters)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.AddInheritedMembers(INamedTypeSymbol symbol, INamedTypeSymbol type, Dictionary`2 dict, IReadOnlyList`1 typeParamterNames)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.GenerateInheritance(INamedTypeSymbol symbol, MetadataItem item)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
at Microsoft.DocAsCode.Metadata.ManagedReference.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol)
at Microsoft.DocAsCode.Metadata.ManagedReference.RoslynMetadataExtractor.Extract(ExtractMetadataOptions options)
at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.GetMetadataFromProjectLevelCache(IBuildController controller, IInputParameters key)
at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.d__13.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.d__11.MoveNext()
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.