fix: make obfuscated modern-.NET output runnable + run every app in tests (#103) - #105
Merged
Merged
Conversation
added 6 commits
September 21, 2026 17:34
…+ crash reporting (#103)
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 #103
Problem
Obfuscating a modern-.NET app (.NET 5+/10, e.g. a WinForms app) produced only the managed
.dllin the output folder — no runnable.exe. On .NET Framework the obfuscated.exeis itself runnable, so this never surfaced there; on modern .NET the launcher is a native apphost and the app also needs itsruntimeconfig.json/deps.json, none of which ConfuserEx copied. The reporter (a beginner) had aConfused/folder that could not be launched at all.Fix
ConfuserEngine.SaveModulesnow copies each modern-.NET module's runtime support files —<name>.runtimeconfig.json,<name>.deps.jsonand the apphost<name>.exe— next to the obfuscated module, so the output directory is directly runnable. It is a no-op on .NET Framework (those files don't exist).Controlled by a new project option
copyRuntimeFiles(default true, added to the.crprojschema). Set it tofalseto keep the previous "obfuscated modules only" output.Why the test suite never caught this — and the coverage work
The cross-framework tests only executed
.NET Framework .exesubjects; every net6/8/10 app was obfuscated but never launched, and only therenameprotection was exercised cross-framework. A "compiles but crashes on startup" bug (exactly #103's class) was structurally invisible.This PR closes that gap. Every runnable subject app is now actually executed after obfuscation:
--selftestmode shows the real main window off-screen and invisible, pumps the message loop, then a thread-pool watchdog terminates cleanly (exit 42). A--selftest-crashvariant throws once shown; the framework's unhandled-exception handlers catch it and report failure (non-42 exit,CRASH).Tests/Shared/*SelfTestHost.cs) keep this out of each of the ~15 subject apps.local-cion a developer machine (not just the paid GitHub runner).Housekeeping
Restructured the cross-framework test projects into per-app-type subfolders —
Tests/CrossFramework/{Console,WinForms,WPF,Library}/<Tfm>/andTests/CrossFramework/Test/— viagit mv(history preserved). Project/assembly names are unchanged; solution paths, project references and shared-file links were updated accordingly.Verification
Full local CI green on the final tree: lint, full-solution build (incl. the C++/CLI project), 218 tests passed / 0 failed / 1 skipped (the skip is the UI-interactive FlaUI GUI test), and packaging.
CrossFramework.Testalone is 55 passing, including all 24 UI self-run + 4 console self-tests. Confirmed the obfuscated net10 console/WinForms/WPF apps launch from the produced output folder.