refactor: use nameof() in ArgumentNullException throws#815
Merged
louis1706 merged 1 commit intoExMod-Team:masterfrom May 3, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Refactors ArgumentNullException throws to use nameof(...) instead of hardcoded parameter-name strings, ensuring exception parameter names remain refactor-safe across the codebase.
Changes:
- Replace
"innerTypeDescriptor"withnameof(innerTypeDescriptor)inCommentGatheringTypeInspector. - Replace
"customItems"withnameof(customItems)in CustomItems extension methods. - Replace
"GroupId"withnameof(patchGroup.GroupId)inGlobalPatchProcessorpatch group validation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| EXILED/Exiled.Loader/Features/Configs/CommentGatheringTypeInspector.cs | Uses nameof(...) for constructor null-guard parameter naming. |
| EXILED/Exiled.CustomItems/API/Extensions.cs | Uses nameof(...) for customItems null checks in Register/Unregister. |
| EXILED/Exiled.API/Features/GlobalPatchProcessor.cs | Uses nameof(...) for patch group GroupId null/empty validation exceptions. |
louis1706
approved these changes
May 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Describe the changes
Replaces hardcoded string literals with
nameof()expressions inArgumentNullExceptionthrows so the parameter names stay in sync if the underlying parameter or property is ever renamed.Files touched:
Exiled.CustomItems/API/Extensions.cs-RegisterandUnregister(x2)Exiled.Loader/Features/Configs/CommentGatheringTypeInspector.cs- constructor (x1)Exiled.API/Features/GlobalPatchProcessor.cs-PatchAllandUnpatchAll(x2)For
GlobalPatchProcessor, the literal"GroupId"referenced the propertyPatchGroupAttribute.GroupId(the value being checked ispatchGroup.GroupId); switched tonameof(patchGroup.GroupId)to preserve the same string while making it refactor-safe.What is the current behavior?
Throws
ArgumentNullExceptionwith hardcoded string literals as parameter names.What is the new behavior? (if this is a feature change)
Same exception, same parameter name string, just sourced via
nameof().Does this PR introduce a breaking change?
No.
Other information:
N/A.
Types of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other