Skip to content

Inheritance is not consistently generated with xref #15

Closed

Description

@dev-mdean

This may not be an issue with DocFxForUnity, so please tell me if it isn't.

Seems like using xref is temperamental. I've done some testing on it here https://github.com/dev-mdean/DocFXTest.

  • Doesn't work when using .cs files for "metadata" : "src"

  • Doesn't work when multlple .csproj files are in the project

    • Some plugins, like LeanTouch, introduce these

    • Additional .csproj are referenced in Assembly-CSharp.csproj similar to below:

      ...
      <ItemGroup>
        <ProjectReference Include="AdditionalProject.csproj">
          <Project>{project-identifier}</Project>
          <Name>Project Name</Name>
          <ReferenceOutputAssembly>false</ReferenceOutputAssembly>
        </ProjectReference>
      </ItemGroup>
      ...
      
    • When running docfx in this case, the following warnings are generated:

      [20-09-15 04:00:57.025]Warning:[MetadataCommand.ExtractMetadata](/Users/matt.dean/Development/Unity Projects/R and D/DocFXTest/LeanTouch.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/matt.dean/Development/Unity Projects/R and D/DocFXTest/LeanTouch.csproj' with message: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets: (1675, 5): The "GetReferenceNearestTargetFrameworkTask" task failed unexpectedly.
        System.BadImageFormatException: Could not resolve field token 0x0400009a, due to: Could not load type of field 'NuGet.Build.Tasks.BuildTasksUtility+<>c:<>9__20_0' (10) due to: Could not resolve type with token 01000048 from typeref (expected class 'NuGet.Packaging.Signing.PackageVerificationResult' in assembly 'NuGet.Packaging, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Signing.PackageVerificationResult member:(null) assembly:/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/NuGet.Build.Tasks.dll type:<>c member:(null)
      File name: 'NuGet.Build.Tasks'
        at NuGet.Build.Tasks.BuildTasksUtility.LogInputParam (NuGet.Common.ILogger log, System.String name, System.String[] values) [0x00000] in <009987ec01cb40349878c8cf80e08eb8>:0 
        at NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask.Execute () [0x00020] in <009987ec01cb40349878c8cf80e08eb8>:0 
        at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <88c37ed7acf047d1b22c53e4ffb9f126>:0 
        at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <88c37ed7acf047d1b22c53e4ffb9f126>:0 
      [20-09-15 04:00:57.025]Warning:[MetadataCommand.ExtractMetadata](/Users/matt.dean/Development/Unity Projects/R and D/DocFXTest/Assembly-CSharp.csproj)Workspace failed with: [Failure] Msbuild failed when processing the file '/Users/matt.dean/Development/Unity Projects/R and D/DocFXTest/Assembly-CSharp.csproj' with message: /Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/15.0/bin/Microsoft.Common.CurrentVersion.targets: (1675, 5): The "GetReferenceNearestTargetFrameworkTask" task failed unexpectedly.
      System.BadImageFormatException: Could not resolve field token 0x0400009a, due to: Could not load type of field 'NuGet.Build.Tasks.BuildTasksUtility+<>c:<>9__20_0' (10) due to: Could not resolve type with token 01000048 from typeref (expected class 'NuGet.Packaging.Signing.PackageVerificationResult' in assembly 'NuGet.Packaging, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:NuGet.Packaging, Version=5.6.0.5, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:NuGet.Packaging.Signing.PackageVerificationResult member:(null) assembly:/Library/Frameworks/Mono.framework/Versions/6.10.0/lib/mono/msbuild/Current/bin/NuGet.Build.Tasks.dll type:<>c member:(null)
      File name: 'NuGet.Build.Tasks'
        at NuGet.Build.Tasks.BuildTasksUtility.LogInputParam (NuGet.Common.ILogger log, System.String name, System.String[] values) [0x00000] in <009987ec01cb40349878c8cf80e08eb8>:0 
        at NuGet.Build.Tasks.GetReferenceNearestTargetFrameworkTask.Execute () [0x00020] in <009987ec01cb40349878c8cf80e08eb8>:0 
        at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute () [0x00029] in <88c37ed7acf047d1b22c53e4ffb9f126>:0 
        at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask (Microsoft.Build.BackEnd.ITaskExecutionHost taskExecutionHost, Microsoft.Build.BackEnd.Logging.TaskLoggingContext taskLoggingContext, Microsoft.Build.BackEnd.TaskHost taskHost, Microsoft.Build.BackEnd.ItemBucket bucket, Microsoft.Build.BackEnd.TaskExecutionMode howToExecuteTask) [0x002a9] in <88c37ed7acf047d1b22c53e4ffb9f126>:0 
      [20-09-15 04:00:57.026]Warning:[MetadataCommand.ExtractMetadata]Invalid cref value "!:System.ArgumentOutOfRangeException" found in triple-slash-comments for Accelerate defined in ../Assets/Scripts/VehicleBase.cs Line 22, ignored.
      [20-09-15 04:00:57.026]Warning:[MetadataCommand.ExtractMetadata]Invalid cref value "!:System.OverflowException" found in triple-slash-comments for Accelerate defined in ../Assets/Scripts/VehicleBase.cs Line 22, ignored.
      [20-09-15 04:00:57.026]Warning:[MetadataCommand.ExtractMetadata]Invalid cref value "!:System.ArgumentOutOfRangeException" found in triple-slash-comments for Decelerate defined in ../Assets/Scripts/VehicleBase.cs Line 42, ignored.
      [20-09-15 04:00:57.026]Warning:[MetadataCommand.ExtractMetadata]Invalid cref value "!:System.OverflowException" found in triple-slash-comments for Decelerate defined in ../Assets/Scripts/VehicleBase.cs Line 42, ignored.
      

I have been able to get it to work with a very basic project, but that doesn't fit my use case well.

Do you have any experience with this?

Activity

  1. NormandErwan commented on Feb 19, 2021

    @NormandErwan
    Owner

    Hi, apologies for my very late answer. I'll try to reproduce on my machine.

  2. NormandErwan commented on Oct 18, 2026

    @NormandErwan
    Owner

    These errors come from the Mono MSBuild used by DocFX 2.59 and earlier. Since 2.60, DocFX is a dotnet tool that loads projects with the .NET SDK MSBuild, and this example now ships its own SDK-style project. Closing as resolved; please reopen with DocFX 2.64+ if it still happens.


    Generated by Claude Code

  3. NormandErwan commented on Oct 19, 2026

    @NormandErwan
    Owner

    On the inheritance itself: Documentation/DocFxForUnity.csproj compiles every Assets/**/*.cs file in one SDK-style project with the Unity managed DLLs referenced, so there is no .cs-file src and no dependency on the .csproj files Unity or plugins generate. For every tested DocFX version, the CI of #44 fails unless the generated Player page links Object, Component, Behaviour and MonoBehaviour (its inheritance chain) to the Unity docs.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions