Skip to content

Csharpier CLI consumes insane amounts of RAM if indent_size is set to 0 #1736

@alastairlundy

Description

@alastairlundy

Hi,
I noticed that when using CSharpier CLI if a .editorconfig has indent_space set to 0 and indent_style is set that Csharpier CLI consumes ever increasing amounts of RAM if run and eventually will crash or cause the system to freeze.

If indent_space is above 0 then there's no issue, it specifically only occurs when it's set to 0.

My Device's specs are:
Intel core i7-1260P (4x P cores + 8x E Cores)
Intel Arc Xe iGPU
48GB DDR5-4800

I have these .NET SDKs installed:

8.0.121 [/usr/lib/dotnet/sdk]
9.0.111 [/usr/lib/dotnet/sdk]
10.0.100-rc.2.25502.107 [/usr/lib/dotnet/sdk]

Environments:

  • CSharpier Version: 1.1.2
  • Running CSharpier via: dotnet cli (as global tool)
  • Operating System: Linux Mint 22.2 (based on Ubuntu 24.04.x LTS)
  • .csharpierrc Settings:
  • .editorconfig Settings:

Only indent_size and indent_style are relevant to the issue. Without them Csharpier CLI works normally.

[*.{cs,csx}]
indent_size = 0
indent_style = tab
csharp_style_var_for_built_in_types = false
csharp_style_var_elsewhere = false
dotnet_separate_import_directive_groups = true
max_line_length = 100

Steps to reproduce:

  1. Open a terminal program in a .NET project directory
  2. Add the .editorconfig file with the configured indent_size and indent_style settings
  3. Run csharpier format . in the terminal

Expected behavior:
Should run normally and complete within a few seconds.

Actual behavior:
Increasingly consumes more and more RAM (starts under 1GB but have seen it go up much higher) until the system locks up or CSharpier CLI runs out of memory and crashes.

For example:

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions