codecadwallader / codemaid

CodeMaid is an open source Visual Studio extension to cleanup and simplify our C#, C++, F#, VB, PHP, PowerShell, JSON, XAML, XML, ASP, HTML, CSS, LESS, SCSS, JavaScript and TypeScript coding.
http://www.codemaid.net
GNU Lesser General Public License v3.0
1.92k stars 362 forks source link

CodeMaid Crashes on Cleanup of Very Long File #844

Open RichardWhitfield opened 3 years ago

RichardWhitfield commented 3 years ago

Environment

Description

I have an auto generated csharp file in an OSS project which I am using that has just over 75,000 lines. CodeMaid doesn't seem to be able to cope with this. Not sure if it's worth the time to try and fix this...doesn't seem to be maxing out any specs for CPU or memory, it just crashes. I'll just avoid running CodeMaid on this file for now but it means I can't just use the clean project or clean solution options which is a minor inconvenience.

Steps to recreate

  1. This is the GitHub link to the very long file in question: https://github.com/Autodesk/revit-ifc/blob/master/Source/Revit.IFC.Export/Exporter/ExporterInitializer_PsetDef.cs
  2. Hopefully it's not just my computer that it's killing.

Current behavior

Crashing and not cleaning.

Expected behavior

Not crashing and cleaning.

codecadwallader commented 3 years ago

Thanks for reporting the issue. There definitely is a linear effect from the size of the file to the demands on CPU/memory as it is all processed at once.

A workaround you could use is to add that file to the list of excluded files within options. I believe it's at CodeMaid->Options->Cleaning->File Types where you can specify which files to include/exclude. We do attempt to ignore some auto-generated files (e.g. *.Designer.cs for Windows Forms) since it's generally not helpful to clean them. It sounds like your file would be a good candidate to be excluded!

Hope it helps!