docfx icon indicating copy to clipboard operation
docfx copied to clipboard

[Bug] Handling attributes with missed types passed as args

Open mikasoukhov opened this issue 11 months ago • 7 comments

Describe the bug

When assembly (placed as a .net ref source) contains type with TypeConverter attribute (I don't know, maybe any other attribute causes the same) applied to some property and this attribute accepts type from assembly that doesn't present in src folder we will get the following error:

System.IO.InvalidDataException
  HResult=0x80131501
  Message=Fail to parse id for symbol  in namespace .
  Source=Docfx.Dotnet
  StackTrace:
   at Docfx.Dotnet.YamlModelGenerator.AddSpecReference(ISymbol symbol, IReadOnlyList`1 typeGenericParameters, IReadOnlyList`1 methodGenericParameters, Dictionary`2 references, SymbolVisitorAdapter adapter) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\YamlModelGenerator.cs:line 129
   at Docfx.Dotnet.SymbolVisitorAdapter.AddSpecReference(ISymbol symbol, IReadOnlyList`1 typeGenericParameters, IReadOnlyList`1 methodGenericParameters) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 415
   at Docfx.Dotnet.SymbolVisitorAdapter.GetConstantValueForArgumentInfo(TypedConstant arg) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 807
   at Docfx.Dotnet.SymbolVisitorAdapter.GetArgumentInfo(TypedConstant arg) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 797
   at Docfx.Dotnet.SymbolVisitorAdapter.GetArguments(AttributeData attr) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 770
   at Docfx.Dotnet.SymbolVisitorAdapter.<GetAttributeInfo>b__32_3(AttributeData attr) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 749
   at System.Linq.Enumerable.WhereSelectArrayIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereEnumerableIterator`1.ToList()
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at Docfx.Dotnet.SymbolVisitorAdapter.GetAttributeInfo(ImmutableArray`1 attributes) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 744
   at Docfx.Dotnet.SymbolVisitorAdapter.VisitNamedType(INamedTypeSymbol symbol) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 195
   at Docfx.Dotnet.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 505
   at Docfx.Dotnet.SymbolVisitorAdapter.VisitNamespace(INamespaceSymbol symbol) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 132
   at Docfx.Dotnet.SymbolVisitorAdapter.VisitDescendants[T](IEnumerable`1 children, Func`2 getChildren, Func`2 filter) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 505
   at Docfx.Dotnet.SymbolVisitorAdapter.VisitAssembly(IAssemblySymbol symbol) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\ManagedReference\Visitors\SymbolVisitorAdapter.cs:line 116
   at Docfx.Dotnet.DotnetApiCatalog.CreateManagedReference(List`1 assemblies, ExtractMetadataConfig config, DotnetApiOptions options) in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\DotnetApiCatalog.ManagedReference.cs:line 25
   at Docfx.Dotnet.DotnetApiCatalog.<<Exec>g__Build|3_0>d.MoveNext() in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\DotnetApiCatalog.cs:line 120
   at Docfx.Dotnet.DotnetApiCatalog.<Exec>d__3.MoveNext() in C:\StockSharp\docfx_sources\src\Docfx.Dotnet\DotnetApiCatalog.cs:line 72
   at Docfx.DefaultCommand.<>c__DisplayClass1_0.<Execute>b__0() in C:\StockSharp\docfx_sources\src\docfx\Models\DefaultCommand.cs:line 45
   at Docfx.CommandHelper.Run(LogOptions options, Action run) in C:\StockSharp\docfx_sources\src\docfx\Models\CommandHelper.cs:line 48
   at Docfx.DefaultCommand.Execute(CommandContext context, Options options) in C:\StockSharp\docfx_sources\src\docfx\Models\DefaultCommand.cs:line 31
   at Spectre.Console.Cli.Command`1.Spectre.Console.Cli.ICommand.Execute(CommandContext context, CommandSettings settings)
   at Spectre.Console.Cli.CommandExecutor.<Execute>d__2.MoveNext()

Expected behavior

  1. Show be displayed some more specific information. I think there must be an error catching somewhere higher on the stack. Now is no chanсe to understand what's wrong without run it under debugging in VS.
  2. Do not stop build process. Ignore it, write into log, but not stop it. It is not a critical error.

Context (please complete the following information):

  • OS: Windows
  • Docfx version: 2.75.3

mikasoukhov avatar Mar 16 '24 19:03 mikasoukhov