Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error extracting metadata for project. An item with the same key has already been added. #3778

Closed
ghost opened this issue Dec 18, 2018 · 3 comments
Assignees

Comments

@ghost
Copy link

ghost commented Dec 18, 2018

DocFX Version Used:

2.40.4.0

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

default

Steps to Reproduce:

  1. Ran the following docfx.json on an internal project (cannot supply)
{
  "metadata": [
    {
      "dest": "api",
      "disableDefaultFilter": false,
      "disableGitFeatures": false,
      "src": [
        {
          "exclude": ["**/bin/**", "**/obj/**"],
          "files": [
            "myproject.csproj"
          ],
          "src": ".."
        }
      ]
    }
  ],
  "build": {
    "cleanupCacheHistory": false,
    "content": [
      {
        "files": [
          "api/**.yml",
          "api/index.md"
        ]
      },
      {
        "files": [
          "articles/**.md",
          "articles/**/toc.yml",
          "toc.yml",
          "*.md"
        ]
      }
    ],
    "dest": "_site",
    "disableGitFeatures": false,
    "fileMetadataFiles": [],
    "globalMetadataFiles": [],
    "keepFileLink": false,
    "markdownEngineName": "markdig",
    "noLangKeyword": false,
    "overwrite": [
      {
        "exclude": [
          "bin/**",
          "obj/**",
          "_site/**"
        ],
        "files": [
          "apidoc/**.md"
        ]

      }
    ],
    "postProcessors": [],
    "resource": [
      {
        "files": [
          "images/**"
        ]
      }
    ],
    "template": [
      "default"
    ]
  }
}

Expected Behavior:

Documentation is generated

Actual Behavior:

[18-12-18 01:06:14.294]Info:Config file docfx.json found, start generating metadata...
[18-12-18 01:06:14.506]Info:[MetadataCommand.ExtractMetadata]Using msbuild C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\15.0\Bin as inner compiler.
[18-12-18 01:06:14.890]Info:[MetadataCommand.ExtractMetadata]Loading projects...
[18-12-18 01:06:21.325]Info:[MetadataCommand.ExtractMetadata]Generating metadata for each project...
[18-12-18 01:06:23.563]Info:[MetadataCommand]Completed Scope:MetadataCommand in 9095.811 milliseconds.
[18-12-18 01:06:23.564]Error:Error extracting metadata for C:/myprojects/myproject.csproj: Microsoft.DocAsCode.Exceptions.ExtractMetadataException: Error extracting metadata for project "C:/myprojects/myproject.csproj": System.ArgumentException: An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Microsoft.CodeAnalysis.SolutionState.CompilationTracker.d__30.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.CodeAnalysis.SolutionState.CompilationTracker.d__24.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.CodeAnalysis.SolutionState.CompilationTracker.d__22.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.CodeAnalysis.SolutionState.CompilationTracker.d__19.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.CodeAnalysis.SolutionState.CompilationTracker.d__32.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.CodeAnalysis.SolutionState.CompilationTracker.d__30.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.CodeAnalysis.SolutionState.CompilationTracker.d__24.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.CodeAnalysis.SolutionState.CompilationTracker.d__22.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.CodeAnalysis.SolutionState.CompilationTracker.d__19.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.RoslynProject.d__12.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__16.MoveNext()
at Microsoft.DocAsCode.Metadata.ManagedReference.ExtractMetadataWorker.d__16.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__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()
[18-12-18 01:06:23.567]Info:Completed in 9105.7346 milliseconds

The project does not have duplicate project references. The above was the only info I got using the verbose modifier. I am unable to troubleshoot without more info.

@herohua herohua self-assigned this Jan 22, 2019
@herohua
Copy link
Contributor

herohua commented Jan 22, 2019

@rwgridstone , is it possible for you to share a minimal project that can reproduce the issue? It would help us determine the root cause and possible fix. Thanks!

@ElanHasson
Copy link

See #2532 (comment)

@superyyrrzz
Copy link
Contributor

dupe of #2532

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants