The problem of automatic formatting

I have a problem when I try to add or change something in a file in just one line, the whole file is formatted at once. I cannot see these changes in the commit changes in Rider. However, when I look at what has changed on TortoiseGit, I have the whole file in changes. And if you push it to Git, you'll see all these changes.
I'll show you a small code snippet where this happens. I don't see any spaces or changes obviously (but Git counts it as a change in the code). These can be both small and large pieces of code. It doesn't matter what file format, whether .cs or .aspx.

My changes:

Auto changes:



Can you please check: Settings | Tools | Actions on Save, which options do you have enabled? If you disable them, does the issue occur?

Also, these changes should be displayed in Commit window. Are they displayed via terminal? What does git status return vs Tortoise git? 


I have everything turned off there (Settings | Tools | Actions on Save).

And yes, these automatic changes are also present in the terminal:


What is the nature of these changes? Just spacing?

Also, if you right-click on such a changed file, go to Local History, what is displayed there? Are changes present in entries? 


These unknown changes in Local History are highlighted by the warning “Content differs only in line separators and encoding”


It didn't help me.

I'd like to point out that if I make any changes in VS 2022, it does not automatically change anything there. Maybe it's some kind of setting in the Rider itself?


Can you take one file for an example:

1) What are it's endings in IDE? 

2) What are the line endings of files in the repo? 


1) I have CRLF (UTF-8)

2) What I see when I look at the changes with Rider and Tortoise. As you can see, my encoding is UTF-8 BOM (CRLF) both on the repository and when changing. I also highlighted the end of lines with arrows, it changes. Is it possible that Rider somehow changes this, or are there any settings for this?

3) Also, I have a question why I don't see this in Rider, how can I configure it?


We believe the problem is that files have inconsistent separators. 

Please see:

And these changes cannot be seen due to limitations above. 



Please sign in to leave a comment.