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

[Bug] 'ApiPageDocumentProcessor': Input string was not in a correct format. #10122

Open
moomiji opened this issue Jul 22, 2024 · 1 comment
Open
Labels
bug A bug to fix

Comments

@moomiji
Copy link

moomiji commented Jul 22, 2024

Describe the bug

Docfx generated MaaImageList.yml and MaaStringList.yml, but failed to build the html files.

After exclusion, it is caused by includeExplicitInterfaceImplementations being set to true in the metadata.
https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/blob/v1.8.8/docs/docfx.json#L18
I'm not familiar with docfx and couldn't get more information from the reported error.

D:\a\MaaFramework.Binding.CSharp\MaaFramework.Binding.CSharp\docs\api\MaaFramework.Binding.Buffers.MaaStringList.yml: error InvalidInputFile: Unable to load file 'api/MaaFramework.Binding.Buffers.MaaStringList.yml' via processor 'ApiPageDocumentProcessor': Input string was not in a correct format. Failure to parse near offset 91. Expected an ASCII digit.
D:\a\MaaFramework.Binding.CSharp\MaaFramework.Binding.CSharp\docs\api\MaaFramework.Binding.Buffers.MaaImageList.yml: error InvalidInputFile: Unable to load file 'api/MaaFramework.Binding.Buffers.MaaImageList.yml' via processor 'ApiPageDocumentProcessor': Input string was not in a correct format. Failure to parse near offset 90. Expected an ASCII digit.

Please check the specific logs: https://github.com/MaaXYZ/MaaFramework.Binding.CSharp/actions/runs/10040250759/job/27745904644#step:11:22

To Reproduce

dotnet tool install --global docfx --version 2.77.0

git clone --depth 1 --branch v1.8.8 https://github.com/MaaXYZ/MaaFramework.Binding.CSharp
cd .\MaaFramework.Binding.CSharp\docs
docfx

Expected behavior
MaaImageList.html and MaaStringList.html are built out.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: 2.77.0

Additional context
MaaImageList.cs
MaaStringList.cs

@moomiji moomiji added the bug A bug to fix label Jul 22, 2024
@filzrev
Copy link
Contributor

filzrev commented Jul 24, 2024

I've confirmed reported issue can be reproduced with following code/settings.

docfx.json

  "metadata": [
    {
      ...(omitted)...
      "outputFormat": "apiPage",
      "memberLayout": "separatePages",
      "includeExplicitInterfaceImplementations": true
    }
  ]

SourceCode

    public class CustomCollection<T> : ICollection<T>
    {
        int ICollection<T>.Count => throw new NotImplementedException();
        bool ICollection<T>.IsReadOnly => throw new NotImplementedException();
        void ICollection<T>.Add(T item) => throw new NotImplementedException();
        void ICollection<T>.Clear() => throw new NotImplementedException();
        bool ICollection<T>.Contains(T item) => throw new NotImplementedException();
        void ICollection<T>.CopyTo(T[] array, int arrayIndex) => throw new NotImplementedException();
        IEnumerator<T> IEnumerable<T>.GetEnumerator() => throw new NotImplementedException();
        IEnumerator IEnumerable.GetEnumerator() => throw new NotImplementedException();
        bool ICollection<T>.Remove(T item) => throw new NotImplementedException();
    }

On above settings.
Generated API Pages's yml contains unexpected chars {} on url attribute.
So it fails to format string with String.Format method.

url: ClassLibrary1.CustomCollection-1.System-Collections-Generic-ICollection{T}-Count.html#ClassLibrary1_CustomCollection_1_System_Collections_Generic_ICollection_T__Count

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

No branches or pull requests

2 participants