This error cropped up today for the first time.
Repo: https://github.com/aspnet/Blazor.Docs
Example: https://ci.appveyor.com/project/DanielRoth/blazor-docs/builds/21904702
DocFX Version Used: 2.40.8
Build failed.
[19-01-26 06:52:09.802]Error:Error extracting metadata for C:/projects/blazor-docs/src/Microsoft.AspNetCore.Blazor.Browser.dll,C:/projects/blazor-docs/src/Microsoft.AspNetCore.Blazor.dll,C:/projects/blazor-docs/src/Microsoft.AspNetCore.Blazor.Server.dll,C:/projects/blazor-docs/src/Microsoft.JSInterop.dll,C:/projects/blazor-docs/src/Mono.WebAssembly.Interop.dll: System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at Microsoft.DocAsCode.Metadata.ManagedReference.MergeCommentsHelper.GetAllItemByCommentId(Dictionary`2 items, MetadataItem item)
at Microsoft.DocAsCode.Metadata.ManagedReference.MergeCommentsHelper.PatchMetadataItem(MetadataItem assembly, IEnumerable`1 list)
at Microsoft.DocAsCode.Metadata.ManagedReference.MergeCommentsHelper.MergeComments(MetadataItem item, IEnumerable`1 commentFiles)
at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>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.<ExtractMetadataAsync>d__11.MoveNext()
0 Warning(s)
1 Error(s)
Command exited with code 1
[UPDATE] If I drop to the last patch release ...
- cinst docfx --version 2.40.7
... it builds. https://github.com/aspnet/Blazor.Docs/pull/387
Just wanted to note that we are seeing this same regression between 2.40.7 and 2.40.8. If you need any additional information, I am happy to provide it.
This must be related to #3936 . We will fix it ASAP.
Is there a way to get the source for a previous working version that does not have this error?
My assumption was that the 'stable' branch is the answer, but still, the same error happens on that.
Thanks,
@mezzo9 ... Yes, just grab a prior release to 2.40.8 from https://github.com/dotnet/docfx/releases ... 2.40.7 seems ok. I have our AppVeyor using 2.40.7 ... no :boom: at the moment.
Thank you very much @guardrex.
I also got the latest from dev, and the fix @superyyrrzz provided worked.
everything is back to normal now.
Thanks all for your help.
2.40.9 fixed this issue. It is available on Nuget, and will soon available on Chocolatey once approved.
Thank you for reporting the issue!
Is this a new issue then? seen today with nuget docfx.console v2.49.0.
Build failed.
1> [20-02-26 03:59:37.576]Error:Error extracting metadata for [name].csproj: System.ArgumentNullException: Der Wert darf nicht NULL sein.
1> Parametername: key
1> bei System.ThrowHelper.ThrowArgumentNullException(ExceptionArgument argument)
1> bei System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
1> bei System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.CopyInherited.Copy(MetadataItem dest, String srcName, ResolverContext context)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.CopyInherited.InheritDoc(MetadataItem dest, ResolverContext context)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.CopyInherited.<>c__DisplayClass0_0.<Run>b__1(MetadataItem current, MetadataItem parent)
1> bei Microsoft.DocAsCode.Common.TreeIterator.Preorder[T](T current, T parent, Func`2 childrenGetter, Func`3 action)
1> bei Microsoft.DocAsCode.Common.TreeIterator.Preorder[T](T current, T parent, Func`2 childrenGetter, Func`3 action)
1> bei Microsoft.DocAsCode.Common.TreeIterator.Preorder[T](T current, T parent, Func`2 childrenGetter, Func`3 action)
1> bei Microsoft.DocAsCode.Common.TreeIterator.Preorder[T](T current, T parent, Func`2 childrenGetter, Func`3 action)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.CopyInherited.Run(MetadataModel yaml, ResolverContext context)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.YamlMetadataResolver.ExecutePipeline(MetadataModel yaml, ResolverContext context)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.YamlMetadataResolver.ResolveMetadata(Dictionary`2 allMembers, Dictionary`2 allReferences, Boolean preserveRawInlineComments)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ResolveAndExportYamlMetadata>d__19.MoveNext()
1> bei System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
1> bei System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__13.MoveNext()
1> --- Ende der Stapel眉berwachung vom vorhergehenden Ort, an dem die Ausnahme ausgel枚st wurde ---
1> bei System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
1> bei System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
1> bei Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.<ExtractMetadataAsync>d__11.MoveNext()
1> 0 Warning(s)
1> 1 Error(s)
A workaround that fixed the error for me:
docfx.json specify a glob pattern for .cs files instead of the .csproj file.MSBUILD_EXE_PATH environment variable.
$env:MSBUILD_EXE_PATH="c:\Program Files\dotnet\sdk\3.1.101\MSBuild.dll"
UPD: After updating to 2.49 things got better: building of docs succeeds, but only if I clean up after building the dll via dotnet build, i.e. remove all the bin and obj folders.
Most helpful comment
Is this a new issue then? seen today with nuget docfx.console v2.49.0.