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

generate-doc: System.ArgumentException with const property #1569

Closed
Roiskia opened this issue Oct 24, 2024 · 0 comments · Fixed by #1570
Closed

generate-doc: System.ArgumentException with const property #1569

Roiskia opened this issue Oct 24, 2024 · 0 comments · Fixed by #1570
Assignees

Comments

@Roiskia
Copy link

Roiskia commented Oct 24, 2024

I used the generate-doc command and recieved an System.AggregateException: One or more errors occurred. ( (Parameter 'symbol')) error.

roslynator version: 0.9.2.0

the command:
roslynator generate-doc .\example.sln -o doc/ref --host docusaurus --heading "example" -v diag

See the example below to reproduce the error. The problem seems to be the const keyword on the Baz.Foo member. Without it, the command completes successfully.

/// <summary>
/// Lorem ipsum dolor sit amet.
/// </summary>
public enum Foo
{
    /// <value>
    /// Consetetur sadipscing elitr.
    /// </value>
    Bar = 1 << 0
}

public class Baz
{
    public const Foo Default = Foo.Bar;
}
Compiled solution 'C:\Users\user\source\example\example.sln' (in 194 ms)
Relative path from root file to output directory is ''.
Generate documentation root to 'C:\Users\user\source\example\doc\ref\index.md'.
Documentation root successfully generated to 'C:\Users\user\source\example\doc\ref\index.md'.
Generate documentation to 'doc/ref'
(...)
System.AggregateException: One or more errors occurred. ( (Parameter 'symbol'))
 ---> System.ArgumentException:  (Parameter 'symbol')
   at Roslynator.EnumSymbolInfo.Create(INamedTypeSymbol symbol) in /_/src/Core/EnumSymbolInfo.cs:line 81
   at Roslynator.EnumUtility.GetConstituentFields(Object value, INamedTypeSymbol enumType) in /_/src/Core/EnumUtility.cs:line 14
   at Roslynator.Documentation.DocumentationWriter.<>c__DisplayClass137_0.<WriteTable>g__WriteConstantValue|2(IFieldSymbol fieldSymbol) in /_/src/Documentation/DocumentationWriter.cs:line 1533
   at Roslynator.Documentation.DocumentationWriter.WriteTable(IEnumerable`1 symbols, String heading, Int32 headingLevel, String header1, String header2, SymbolDisplayFormat format, SymbolDisplayAdditionalMemberOptions additionalOptions, Boolean addLink, Boolean canIncludeInterfaceImplementation, INamedTypeSymbol containingType) in /_/src/Documentation/DocumentationWriter.cs:line 1461
   at Roslynator.Documentation.DocumentationWriter.WriteFields(IEnumerable`1 fields, INamedTypeSymbol containingType) in /_/src/Documentation/DocumentationWriter.cs:line 1075
   at Roslynator.Documentation.DocumentationGenerator.GenerateType(TypeDocumentationModel typeModel) in /_/src/Documentation/DocumentationGenerator.cs:line 732
   at Roslynator.Documentation.DocumentationGenerator.Generate(CancellationToken cancellationToken)+MoveNext() in /_/src/Documentation/DocumentationGenerator.cs:line 184
   at Roslynator.CommandLine.GenerateDocCommand.ExecuteAsync(ProjectOrSolution projectOrSolution, CancellationToken cancellationToken) in /_/src/CommandLine/Commands/GenerateDocCommand.cs:line 234
   at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(String path, MSBuildWorkspace workspace, CancellationToken cancellationToken) in /_/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 164
   at Roslynator.CommandLine.MSBuildWorkspaceCommand`1.ExecuteAsync(IEnumerable`1 paths, String msbuildPath, IEnumerable`1 properties) in /_/src/CommandLine/Commands/MSBuildWorkspaceCommand.cs:line 89
   at Roslynator.CommandLine.Program.GenerateDocAsync(GenerateDocCommandLineOptions options) in /_/src/CommandLine/Program.cs:line 738
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at Roslynator.CommandLine.Program.<>c.<Main>b__0_3(MSBuildCommandLineOptions options) in /_/src/CommandLine/Program.cs:line 181
   at CommandLine.ParserResultExtensions.MapResult[T1,T2,TResult](ParserResult`1 result, Func`2 parsedFunc1, Func`2 parsedFunc2, Func`2 notParsedFunc)
   at Roslynator.CommandLine.Program.Main(String[] args) in /_/src/CommandLine/Program.cs:line 169
@Roiskia Roiskia changed the title generate-doc: System.ArgumentException with const Enum Members generate-doc: System.ArgumentException with const members Oct 24, 2024
@Roiskia Roiskia changed the title generate-doc: System.ArgumentException with const members generate-doc: System.ArgumentException with const property Oct 24, 2024
@josefpihrt josefpihrt self-assigned this Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants