Skip to content

Refactoring/cleanup for IlSpyCmd to Prepare for Multithreading (Stacked PR #4)#5

Open
petercrabtree wants to merge 5 commits into
masterfrom
feature/multithread-ilspycmd-prep
Open

Refactoring/cleanup for IlSpyCmd to Prepare for Multithreading (Stacked PR #4)#5
petercrabtree wants to merge 5 commits into
masterfrom
feature/multithread-ilspycmd-prep

Conversation

@petercrabtree
Copy link
Copy Markdown
Owner

I decided to split this out to make reviewing easier.

Copilot AI review requested due to automatic review settings August 26, 2025 02:03

This comment was marked as outdated.

@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch from c44f4d6 to d0725ab Compare August 26, 2025 03:12
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from d0d159e to 610123b Compare August 26, 2025 03:12
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch from d0725ab to a234f45 Compare August 26, 2025 04:34
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from 610123b to 6d984e9 Compare August 26, 2025 04:34
Repository owner deleted a comment from Copilot AI Aug 26, 2025
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch 2 times, most recently from a68086b to b091a3f Compare August 26, 2025 20:16
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from 6d984e9 to aebe02a Compare August 26, 2025 20:16
@petercrabtree petercrabtree changed the title Refactoring/cleanup for IlSpyCmd to Prepare for Multithreading Refactoring/cleanup for IlSpyCmd to Prepare for Multithreading (Stacked PR #4) Aug 26, 2025
@petercrabtree petercrabtree requested a review from Copilot August 26, 2025 20:23
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refactors and cleans up the ILSpyCmd codebase to prepare for multithreading support. The changes focus on code organization, parameter handling, and method extraction to improve maintainability.

  • Refactors the main execution flow by extracting methods and improving parameter passing
  • Updates code style and formatting for better consistency
  • Adds ReSharper settings and improves error handling patterns

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
ILSpy.sln.DotSettings Adds ReSharper configuration for code formatting and custom dictionary entries
ValidationAttributes.cs Updates validation error message for better clarity
IlspyCmdProgram.cs Major refactoring of the main program class with method extraction and improved parameter handling
DotNetToolUpdateChecker.cs Adds explanatory comment for exception handling

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

if (obj.CreateCompilableProjectFlag && string.IsNullOrEmpty(obj.OutputDirectory))
{
return new ValidationResult("--project cannot be used unless --outputdir is also specified");
return new ValidationResult("you must specify --outputdir (-o) when using --project (-p)");
Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error message uses lowercase 'you' which is inconsistent with typical error message conventions. Consider using 'You must specify...' or a more formal structure like 'Output directory (-o) must be specified when using --project (-p)'.

Suggested change
return new ValidationResult("you must specify --outputdir (-o) when using --project (-p)");
return new ValidationResult("Output directory (--outputdir, -o) must be specified when using --project (-p).");

Copilot uses AI. Check for mistakes.
Comment on lines +276 to +281
if (outputDirectory == null)
{
var values = EntityTypes.SelectMany(v => v.Split(',', ';')).ToArray();
HashSet<TypeKind> kinds = TypesParser.ParseSelection(values);
if (outputDirectory != null)
{
string outputName = Path.GetFileNameWithoutExtension(fileName);
output = File.CreateText(Path.Combine(outputDirectory, outputName) + ".list.txt");
}

return ListContent(fileName, output, kinds);
await app.Error.WriteLineAsync("Output directory (-o) must be specified when creating a project (-p).");
return ProgramExitCodes.EX_USAGE;
}
else if (ShowILCodeFlag || ShowILSequencePointsFlag)

Copy link

Copilot AI Aug 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This validation check is redundant because the ProjectOptionRequiresOutputDirectoryValidation attribute already validates this condition at the command-line parsing level. The validation will prevent execution from reaching this point when the condition fails.

Copilot uses AI. Check for mistakes.
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from aebe02a to 7b4461b Compare August 26, 2025 21:04
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch 2 times, most recently from 7f9cc0b to dca1a8b Compare August 26, 2025 21:10
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from 7b4461b to bcc21db Compare August 26, 2025 21:10
Repository owner deleted a comment from Copilot AI Aug 26, 2025
Repository owner deleted a comment from Copilot AI Aug 26, 2025
Repository owner deleted a comment from Copilot AI Aug 26, 2025
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from bcc21db to d396a02 Compare August 26, 2025 21:24
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch from dca1a8b to 07922a9 Compare August 26, 2025 21:24
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from d396a02 to d1f76ae Compare August 27, 2025 02:49
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch 3 times, most recently from cf305a6 to 137f93e Compare August 29, 2025 00:50
By passing around instances explicitly in methods,
it makes safely refactoring into parallel decompilation easier,
because it's easy to find every instance of anything that needs
to be duplicated for each thread.

refactor: Extract RunAsync method from OnExecuteAsync

Making dependencies more explicit by passing parameters instead of using instance fields.
Inlines ResolveOutputDirectory and UpdateSettings helper methods for simplicity.
@petercrabtree petercrabtree force-pushed the dev/dev-env-clean-no-bom branch from b3b3fa1 to b4fb59a Compare August 29, 2025 00:59
@petercrabtree petercrabtree force-pushed the feature/multithread-ilspycmd-prep branch from 137f93e to 8103b3e Compare August 29, 2025 00:59
Base automatically changed from dev/dev-env-clean-no-bom to master October 18, 2025 17:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants