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

System.IndexOutOfRangeException: Index was outside the bounds of the array #221

Closed
evil-shrike opened this issue Mar 18, 2016 · 5 comments
Closed
Assignees

Comments

@evil-shrike
Copy link

@evil-shrike evil-shrike commented Mar 18, 2016

I run docfx against my codebase. It fails with the following error.
The problem is that it's impossible to say what is wrong - which file/xml comment cause the error.

Error: System.AggregateException: One or more errors occurred. ---> Microsoft.DocAsCode.Exceptions.ExtractMetadataException: Error extracting metadata for {"Items":{".\\api":["D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Client.Services/Client.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Core/Core.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DataSources/DataSources.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DataSources.Common/DataSources.Common.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DomainObjects/DomainObjects.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DomainObjects.Client/DomainObjects.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Interop/Interop.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService/ReportService.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService.Client/ReportService.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService.Services/ReportService.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server/Server.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server.Services/Server.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server.Services.Core/Server.Services.Core.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/SmartClient/SmartClient.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage/Storage.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.MsSql/Storage.MsSql.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.Oracle/Storage.Oracle.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.PostgreSql/Storage.PostgreSql.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.SQLite/Storage.SQLite.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices/TransferServices.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Client/TransferServices.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Common/TransferServices.Common.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Services/TransferServices.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Utils/Utils.csproj"]},"ApiFolderName":"","TocFileName":"toc.yml","IndexFileName":".manifest","PreserveRawInlineComments":false,"ForceRebuild":false}: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.GetXmlValue(XPathNavigator node)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel..ctor(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.CreateModel(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.VisitorHelper.FeedComments(MetadataItem item, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.DefaultVisit(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.GetYamlItem(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitMethod(IMethodSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__28`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext() ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.GetXmlValue(XPathNavigator node)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel..ctor(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.CreateModel(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.VisitorHelper.FeedComments(MetadataItem item, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.DefaultVisit(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.GetYamlItem(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitMethod(IMethodSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__28`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken)
   at Microsoft.DocAsCode.SubCommands.MetadataCommand.Exec(SubCommandRunningContext context)
   at Microsoft.DocAsCode.Program.ExecSubCommand(String[] args)
---> (Inner Exception #0) Microsoft.DocAsCode.Exceptions.ExtractMetadataException: Error extracting metadata for {"Items":{".\\api":["D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Client.Services/Client.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Core/Core.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DataSources/DataSources.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DataSources.Common/DataSources.Common.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DomainObjects/DomainObjects.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/DomainObjects.Client/DomainObjects.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Interop/Interop.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService/ReportService.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService.Client/ReportService.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/ReportService.Services/ReportService.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server/Server.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server.Services/Server.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Server.Services.Core/Server.Services.Core.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/SmartClient/SmartClient.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage/Storage.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.MsSql/Storage.MsSql.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.Oracle/Storage.Oracle.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.PostgreSql/Storage.PostgreSql.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Storage.SQLite/Storage.SQLite.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices/TransferServices.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Client/TransferServices.Client.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Common/TransferServices.Common.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/TransferServices.Services/TransferServices.Services.csproj","D:/Work/R-n-D/XFW3/Sources/Foundation/Repo/Src/Utils/Utils.csproj"]},"ApiFolderName":"","TocFileName":"toc.yml","IndexFileName":".manifest","PreserveRawInlineComments":false,"ForceRebuild":false}: System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.GetXmlValue(XPathNavigator node)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel..ctor(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.CreateModel(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.VisitorHelper.FeedComments(MetadataItem item, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.DefaultVisit(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.GetYamlItem(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitMethod(IMethodSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__28`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext() ---> System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.GetXmlValue(XPathNavigator node)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel..ctor(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.CreateModel(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.VisitorHelper.FeedComments(MetadataItem item, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.DefaultVisit(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.GetYamlItem(ISymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitMethod(IMethodSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter)
   at Microsoft.DocAsCode.EntityModel.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<GetMetadataFromProjectLevelCacheAsync>d__28`1.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<SaveAllMembersFromCacheAsync>d__24.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext()
   --- End of inner exception stack trace ---
   at Microsoft.DocAsCode.EntityModel.ExtractMetadataWorker.<ExtractMetadataAsync>d__14.MoveNext()<---

        10 Warning(s)
        1 Error(s)
@vicancy
Copy link
Contributor

@vicancy vicancy commented Mar 21, 2016

Thanks @evil-shrike for reporting the issue.

@vicancy
Copy link
Contributor

@vicancy vicancy commented Mar 21, 2016

Hi @evil-shrike , could you use the latest v1.6.2 to rerun your project and provide us the error details?

@evil-shrike
Copy link
Author

@evil-shrike evil-shrike commented Mar 21, 2016

Thanks for the fix. Running with 1.6.2 shows the reason - its a comment with xml inside:

Microsoft.DocAsCode.Plugins.DocumentException: Unable to extract comment from source code D:\Work\R-n-D\XFW3\Sources\Foundation\Repo\Src\Server\Domain\Configuration\Fluent\Fluent.cs: <member name="M:Croc.XFW3.Core.Configuration.Fluent.DomainSubsystemFactoryExtensions.AddLocalSessionFactory(Croc.XFW3.Core.Configuration.Fluent.DomainSubsystemFactory,System.String,System.String)">
    <summary>
    Описание локальной фабрики сессиии (узел interaction конфигурации подсистемы domain).
    </summary>
    <remarks>
    Эквивалентно:
    <interaction
        session-factory="Croc.XFW3.DomainObjects.Server.XLocalSessionFactory,Croc.XFW3.Server"
        read-session-connection-feature="read"
        update-session-connection-feature="update" />
    </remarks>
    <param name="factory"></param>
    <param name="readConnectionFeature"></param>
    <param name="updateConnectionFeature"></param>
    <returns></returns>
</member>
. Specified argument was out of the range of valid values.
Parameter name: current node's line number 15 exceeds the maximumn line number 14: <returns></returns> ---> System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: current node's line number 15 exceeds the maximumn line number 14: <returns></returns>
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.GetXmlValue(XPathNavigator node)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel..ctor(String xml, ITripleSlashCommentParserContext context)
   at Microsoft.DocAsCode.EntityModel.TripleSlashCommentModel.CreateModel(String xml, ITripleSlashCommentParserContext context)

Here's code:

    public static class DomainSubsystemFactoryExtensions
    {
        /// <summary>
        /// Описание локальной фабрики сессиии (узел interaction конфигурации подсистемы domain).
        /// </summary>
        /// <remarks>
        /// Эквивалентно:
        /// <interaction 
        ///     session-factory="Croc.XFW3.DomainObjects.Server.XLocalSessionFactory,Croc.XFW3.Server" 
        ///     read-session-connection-feature="read" 
        ///     update-session-connection-feature="update" />
        /// </remarks>
        /// <param name="factory"></param>
        /// <param name="readConnectionFeature"></param>
        /// <param name="updateConnectionFeature"></param>
        /// <returns></returns>
        public static DomainSubsystemFactory AddLocalSessionFactory(this DomainSubsystemFactory factory,
            string readConnectionFeature = null, string updateConnectionFeature = null)
        {
...
        }
    }

Well, probably it's an incorrect comment as < should be encoded with &lt; but it'd be better if the tool shows a warning instead failing..

After I encoded brackets docfx metadata succeeded.
Thanks!

p.s. unfortunately docfx build failed with:
Process is terminated due to StackOverflowException.
But it's another story.

@vicancy
Copy link
Contributor

@vicancy vicancy commented Mar 21, 2016

Thanks for the quick reply. ArgumentOutOfRangeException is definitely a code bug. We will fix that.

ansyral added a commit to ansyral/docfx that referenced this issue Apr 6, 2016
ansyral added a commit to ansyral/docfx that referenced this issue Apr 7, 2016
ansyral added a commit to ansyral/docfx that referenced this issue Apr 7, 2016
@ansyral ansyral closed this in 2609ae0 Apr 7, 2016
@ansyral ansyral reopened this Apr 7, 2016
@ansyral
Copy link
Contributor

@ansyral ansyral commented Apr 13, 2016

@evil-shrike it is already fixed in dev.

@ansyral ansyral closed this May 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.