Skip to content

fix(core): don't create PDB files when debug=false#32

Merged
mcpolo99 merged 1 commit into
pre-releasefrom
fix/pdb-debug-false
Jun 7, 2026
Merged

fix(core): don't create PDB files when debug=false#32
mcpolo99 merged 1 commit into
pre-releasefrom
fix/pdb-debug-false

Conversation

@mcpolo99

@mcpolo99 mcpolo99 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Fixes #16

Cherry-pick of mkaring#532 — applies all code-level changes from the upstream PR:

Summary

  • Skip PDB creation when debug=false: Adds early return in the Debug phase of ConfuserEngine when context.Project.Debug is false, preventing unnecessary PDB file generation
  • Remove hardening instruction count limit: Removes the > 150 instruction count skip in HardeningPhase, allowing all protection helper methods to be inlined into .cctor regardless of size
  • Pin decrypted bytes with GCHandle: Uses GCHandle.Alloc with GCHandleType.Pinned in both Compressor and CompressorCompat to prevent GC from relocating decrypted assembly bytes during Assembly.Load/LoadModule, then properly frees the handle after use

Test plan

  • Build the solution and verify no compilation errors
  • Run ConfuserEx with debug=false and confirm no .pdb files are created in output
  • Run ConfuserEx with debug=true and confirm .pdb files are still created
  • Test with packer protection enabled to verify Compressor GCHandle changes work correctly
  • Test hardening protection with methods larger than 150 instructions

🤖 Generated with Claude Code

@mcpolo99 mcpolo99 force-pushed the fix/pdb-debug-false branch 2 times, most recently from 89501e6 to 1e16766 Compare June 7, 2026 16:46
@mcpolo99 mcpolo99 changed the base branch from master to pre-release June 7, 2026 16:52
@mcpolo99 mcpolo99 merged commit b596de6 into pre-release Jun 7, 2026
11 checks passed
@mcpolo99 mcpolo99 deleted the fix/pdb-debug-false branch June 7, 2026 16:56
mcpolo99 added a commit that referenced this pull request Jun 10, 2026
* fix(ci): add pre-release branch to CI triggers (#36)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): fix WPF relative resource renaming (#30)

* fix WPF relative resource renaming

* Update Confuser.Renamer/Analyzers/WPFAnalyzer.cs

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Ryan <smbserv@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* fix(core): support .NET Standard library obfuscation (#31)

* Add types in referencing assembly to netstandard DLL.

Types defined in AssemblyRefs of netstandard (e.g. mscorlib) will be moved to netstandard. Therefore, subsequence ModuleDef.Find will return AssemblyRef to netstandard. As a result, the confused module will only reference to netstandard.

* Remove AssemblyAttributes.PA_NoPlatform from assembly.

Net standard project may refer to NuGet package (e.g. System.ComponentModel.Composition) in order to use the Framework libraries. However, DLL in NuGet may have this attribute set but the actual Framework DLL does not. As a result, dnlib treats them as different assemblies and confused DLL will reference to two identical assemblies.

* Fix assembly reference to assemblies that hidden by netstandard assembly.

TargetModule.GetAssemblyRef returns null if type is defined in assembly hidden by netstandard. This change searches assemblies hidden by netstandard and returns the fixed type reference.

* Returns the method from CorLib of module to be confused instead from runtime.

MSBuild may runs on .net framework and runtime help will reference to mscorlib instead of netstandard. This change try resolve it from CorLib before from runtime type.

---------

Co-authored-by: KC Ip <kamchuen.ip@hidglobal.com>

* fix(core): don't create PDB files when debug=false (upstream mkaring#532) (#32)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): fix generic name parsing null case (upstream mkaring#516) (#33)

When preserveGenericParams is true but name is null or empty,
ParseGenericName would crash. Add a null/empty guard to prevent this.

Cherry-pick of mkaring#516.

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* 修复控制流保护在#153的错误 (#34)

注意到 mkaring 在 1.4.0版本中对控制流保护做出了误操作(272行)
将src => statementLast.Contains(src),错误修改成了src => !statementLast.Contains(src),导致了保护后的程序出现了错误的循环,这里特此做出修复!

Co-authored-by: wujiayang2007 <52036257+wujiayang2007@users.noreply.github.com>

* feat(core): add wildcard module loading in .crproj (upstream mkaring#481) (#35)

Cherry-pick of mkaring#481 — allows using wildcards like
*.dll in module paths to batch-load modules from the base directory.

The Load method now accepts an optional baseDirRoot parameter to
resolve relative base directory paths. New internal helpers AddModule,
IsWildcard, and BatchLoadModules handle wildcard expansion using
Directory.GetFiles with TopDirectoryOnly search.

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): skip renaming of DataContract/DataMember/JsonProperty attributed types and members (#38)

Detect serialization-related attributes and exclude decorated types and
members from renaming to prevent WCF/DataContract serialization breakage
at runtime.

Attributes now checked:
- DataContractAttribute on types
- DataMemberAttribute on fields and properties
- EnumMemberAttribute on enum fields

Fixes mcpolo99/private-ConfuserEx#9
Upstream: mkaring#147

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): preserve anonymous type constructor arg names for JSON serialization (#39)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(cli): add --snkey and --snkeypass options for CI/CD signing (#40)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(runtime): catch ReflectionTypeLoadException in packer startup (#41)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(protections): use non-throwing resolution in ref proxy mild mode for external types (#42)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): handle FnPtr type signatures instead of throwing NotSupportedException (#43)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(renamer): skip renaming WPF theme resources in themes/Generic.xaml (#44)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(protections): skip unresolvable external types in ref proxy phase (#45)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(analysis): enable .NET analyzers and configure severity rules (#50)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(analysis): add Roslynator.Analyzers for broader code quality coverage (#51)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(analysis): resolve analyzer warnings and suppress noisy rules (#52)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* fix(core): improve error message for .NET 6+ native host .exe files (#19) (#56)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* docs: update README for ConfuserExx fork — fix links, add features, modernize (#57)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(core): tolerate missing dependencies — warn instead of crash (#4) (#58)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(renamer): add opt-in overload confusion — rename methods with different signatures to same name (#25)

* feat(ci): add pre-release builds with downloadable binaries (#pre-release) (#61)

Co-authored-by: RandomCrocodile <mawi@polosab.com>

* feat(core): auto-detect .NET runtime paths for assembly resolution (#55)

* feat(core): auto-detect .NET Core/5+/6/7/8+ runtime paths for assembly resolution (#12)

* fix(core): probe all installed .NET runtime versions for cross-version dependencies (#12)

* refactor(core): add logging to DotNetCorePathResolver, address review feedback (#12)

---------

Co-authored-by: RandomCrocodile <mawi@polosab.com>

---------

Co-authored-by: RandomCrocodile <mawi@polosab.com>
Co-authored-by: Ryan <smbserv@qq.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: KC Ip <kamchuen.ip@hidglobal.com>
Co-authored-by: wujiayang2007 <52036257+wujiayang2007@users.noreply.github.com>
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.

Don't create PDB files when debug=false (upstream PR #532)

1 participant