-
-
Notifications
You must be signed in to change notification settings - Fork 130
Closed
Milestone
Description
Environments:
- CSharpier Version: 1.1.0
- Running CSharpier via: dotnet cli
- Operating System: Mac Os Sequoia 15.6
- .csharpierrc Settings: not used
- .editorconfig Settings:
root = true
[*]
end_of_line = lf
[*.md]
max_line_length = 80
[*.cs]
charset = utf-8
max_line_length = 200
indent_size = 4
indent_style = space
insert_final_newline = false
trim_trailing_whitespace = true
# Sort using and Import directives with System.* appearing first
dotnet_sort_system_directives_first = true
# Use language keywords where applicable
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion
# Suggest more modern language features when available
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_explicit_tuple_names = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_inlined_variable_declaration = true:suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion
# New line preferences
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
resharper_csharp_keep_existing_initializer_arrangement = true # https://youtrack.jetbrains.com/issue/RSRP-486359
csharp_new_line_between_query_expression_clauses = true
# Indentation preferences
csharp_indent_block_contents = true
csharp_indent_braces = false
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = flush_left
# Space preferences
csharp_space_after_cast = false
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_after_comma = true
csharp_space_after_dot = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_after_semicolon_in_for_statement = true
csharp_space_around_binary_operators = before_and_after
csharp_space_around_declaration_statements = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_before_comma = false
csharp_space_before_dot = false
csharp_space_before_open_square_brackets = false
csharp_space_before_semicolon_in_for_statement = false
csharp_space_between_empty_square_brackets = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_declaration_name_and_open_parenthesis = false
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_square_brackets = false
# Prefer "var" only where type is obvious
csharp_style_var_for_built_in_types = true:silent
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:silent
# Prefer constructs to have an expression-body, when they will be a single line
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion
Steps to reproduce:
In the cli run:
dotnet csharpier format .
Expected behavior:
Files in the project are formatted successfully.
Actual behavior:
dotnet csharpier format .
Unhandled exception: System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string. (Parameter 'startIndex')
at System.String.ThrowSubstringArgumentOutOfRange(Int32 startIndex, Int32 length)
at System.String.Substring(Int32 startIndex, Int32 length)
at CSharpier.Core.PrinterOptions.GetFormatter(String filePath) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Core/PrinterOptions.cs:line 41
at CSharpier.Cli.EditorConfig.EditorConfigSections.ConvertToPrinterOptions(String filePath, Boolean ignoreDirectory) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/EditorConfig/EditorConfigSections.cs:line 21
at CSharpier.Cli.Options.OptionsProvider.GetPrinterOptionsForAsync(String filePath, CancellationToken cancellationToken) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/Options/OptionsProvider.cs:line 143
at CSharpier.Cli.CommandLineFormatter.<>c__DisplayClass1_1.<<FormatPhysicalFiles>g__FormatFile|0>d.MoveNext() in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/CommandLineFormatter.cs:line 245
--- End of stack trace from previous location ---
at CSharpier.Cli.CommandLineFormatter.FormatPhysicalFiles(CommandLineFormatterResult commandLineFormatterResult, CommandLineOptions commandLineOptions, IFileSystem fileSystem, IConsole console, ILogger logger, CancellationToken cancellationToken) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/CommandLineFormatter.cs:line 307
at CSharpier.Cli.CommandLineFormatter.Format(CommandLineOptions commandLineOptions, IFileSystem fileSystem, IConsole console, ILogger logger, CancellationToken cancellationToken) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/CommandLineFormatter.cs:line 116
at CSharpier.Cli.FormattingCommands.FormatOrCheck(String[] directoryOrFile, Boolean check, Boolean skipValidation, Boolean skipWrite, Boolean writeStdout, Boolean noCache, Boolean noMSBuildCheck, Boolean includeGenerated, Boolean compilationErrorsAsWarnings, String configPath, String ignorePath, String stdinPath, LogLevel logLevel, LogFormat logFormat, CancellationToken cancellationToken) in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/FormattingCommands.cs:line 199
at CSharpier.Cli.FormattingCommands.<>c__DisplayClass0_0.<<CreateFormatCommand>b__0>d.MoveNext() in /home/runner/work/csharpier/csharpier/Src/CSharpier.Cli/FormattingCommands.cs:line 62
--- End of stack trace from previous location ---
at System.CommandLine.Invocation.AnonymousCommandHandler.InvokeAsync(InvocationContext context)
at System.CommandLine.Invocation.InvocationPipeline.<>c__DisplayClass4_0.<<BuildInvocationChain>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass17_0.<<UseParseErrorReporting>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass12_0.<<UseHelp>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass22_0.<<UseVersionOption>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass19_0.<<UseTypoCorrections>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<UseSuggestDirective>b__18_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass16_0.<<UseParseDirective>b__0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c.<<RegisterWithDotnetSuggest>b__5_0>d.MoveNext()
--- End of stack trace from previous location ---
at System.CommandLine.Builder.CommandLineBuilderExtensions.<>c__DisplayClass8_0.<<UseExceptionHandler>b__0>d.MoveNext()
Metadata
Metadata
Assignees
Labels
No labels