fix: skip patch types that have no definition instead of throwing - #173
Open
divya0795 wants to merge 1 commit into
Open
fix: skip patch types that have no definition instead of throwing#173divya0795 wants to merge 1 commit into
divya0795 wants to merge 1 commit into
Conversation
Contributor
Author
|
Compile verification: dispatched this repo's own Result: success in ~1.7 min https://github.com/divya0795/Wand-Enhancer/actions/runs/30205236146 That satisfies "your code compiles without errors" from CONTRIBUTING.md. The manual-testing-against-WeMod step remains outstanding on my side, as flagged in the PR description. |
EnhancerConfig.GetInstance() returns entries for ActivatePro, DisableUpdates,
DevToolsOnF12 and RemoteWebPanelPreview. EPatchType also declares
DisableTelemetry = 4, which has no entry, and both lookups of that dictionary
indexed it directly:
var entries = enhancerConfig[entry]; // PatchAsar
foreach (var patchEntry in enhancerConfig[patchType]) // CouldFileContainRemainingPatch
A PatchConfig carrying DisableTelemetry would therefore abort the entire patch
run with an unhandled KeyNotFoundException, taking the other requested patches
with it.
This is not reachable today: PatchVectorsPopup exposes no control for
DisableTelemetry, and PatchConfig is only ever constructed there -- nothing
deserialises it -- so no supported path can put that value into PatchTypes.
It becomes reachable the moment a checkbox is added for it.
Look both lookups up with TryGetValue and skip a type that has no definition.
The type is deliberately left in remainingPatches, so instead of crashing the
run it now surfaces through the existing summary:
[ENHANCER] Failed to apply patches: DisableTelemetry. The version may not be supported.
which is the same channel used when a real patch fails to match. PatchAsar also
logs a warning naming the skipped type. Behaviour for every implemented patch
type is unchanged.
divya0795
force-pushed
the
fix/skip-unimplemented-patch-types
branch
from
July 26, 2026 14:32
4b5ce01 to
a4430f5
Compare
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.
Fixes #172
Problem
EnhancerConfig.GetInstance()has entries for four of the fiveEPatchTypemembers;DisableTelemetry = 4has none. Both consumers indexed the dictionary directly:A
PatchTypesset containingDisableTelemetrywould abort the entire run with an unhandledKeyNotFoundException, discarding the other requested patches — and doing so after backups have been made andapp.asarextracted.Change
TryGetValueat both sites, skipping any type with no definition.The skipped type is deliberately left in
remainingPatches, so rather than being silently dropped it falls through to the existing end-of-run summary:That is the same channel an unmatched patch already reports through.
PatchAsaradditionally logs[ENHANCER] No patch definition for {entry}, skippingatELogType.Warn.I considered instead adding an empty
DisableTelemetryentry toEnhancerConfig. That also stops the crash, but it makes a requested patch report success while doing nothing — worse than a clear failure.Behaviour for all four implemented patch types is unchanged: they still resolve, apply, and clear from
remainingPatchesexactly as before. One file,+17 / -2.Verification
No local Visual Studio/MSBuild environment, so this is not compile-verified locally. Compile evidence comes from dispatching this repo's own
.github/workflows/build.yml(fullbuild.ps1→ MSBuild,windows-latest) on my fork; run linked in a comment below.There is no C# test project in the repo, and no licensed WeMod install here, so CONTRIBUTING.md's manual-testing step is not satisfied. Given the guarded path cannot currently be entered, the meaningful check is that the four live patch types are unaffected — which is what the build plus your normal patch run would confirm.