Skip to content

Add .Net support - #15

Merged
buzzer-re merged 6 commits into
mainfrom
dev
Oct 5, 2026
Merged

buzzer-re merged 6 commits into
mainfrom
dev

Conversation

@buzzer-re

Copy link
Copy Markdown
Owner

No description provided.

buzzer-re and others added 6 commits September 20, 2026 20:19
Add the MIT LICENSE file and ship it in the wheel, fill in authors, URLs,
keywords, and classifiers, and read the version from tocode.__version__
so it is defined once. `uv build` produces an sdist and a wheel that pass
`twine check`; the wheel contains only the tocode package.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The PyPI distribution is tocode-cli; assert the installed command stays
`tocode` so a rename cannot slip through.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`tocode App.dll` (also .exe, apphost launchers, single-file bundles, and
.nupkg packages, detected by content) now exports managed code without
dnSpy/ILSpy installed: dnlib and ICSharpCode.Decompiler (MIT) are loaded
through pythonnet, so only a .NET 9+ runtime is needed. (The libraries are
downloaded on demand; see the follow-up commit.)

- src/raw/<Assembly>/<Namespace>/.../<Type>.cs per top-level type, with a
  matching .il that keeps the bytecode (RVA, raw bytes, metadata tokens),
  plus Properties/AssemblyInfo.cs, Manifest.il, and a .csproj per assembly.
- Per-method C# and IL line ranges; lambdas, local functions, and
  async/iterator state machines are linked to the method that owns them.
- assemblies.json, types.json, functions.json, function-index.json,
  strings.json (user strings with ldstr xrefs), imports.json
  (cross-assembly members and P/Invoke), exports.json, reachable.json,
  namespace-graph.json, resources.json (+ decoded .resources),
  container.json, and triage.json.
- Native code (mixed-mode images, bundled native libraries, P/Invoke
  targets next to the input) goes through the native runner like APK .so
  files; framework/runtime parts of bundles and packages are listed but
  only decompiled with --include-framework. --as-native keeps the old path.
- PE/CLR/bundle parsing and the IL token scan are pure Python (validated
  against dnlib on every opcode); decompilation runs in recycled worker
  processes and a crashing or hanging type fails alone.

The native memory floor is now TOCODE_NATIVE_MIN_FREE_MB (the APK name
still works) and the waiting state shows in the heartbeat.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
NativeAOT symbols (mangled generic instantiations) and long C++ template
names exceed the 255-byte path component limit, so exporting a NativeAOT
binary crashed while writing the checkpoint record of a cluster named after
such a function. Names longer than 120 characters are now truncated and
suffixed with a short hash so they stay unique.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ToCode no longer ships any DLL. The first .NET export asks once whether to
download dnlib 4.5.0 and ICSharpCode.Decompiler 11.1 from nuget.org and
remembers the answer; non-interactive runs are never prompted and point to
`tocode --setup-dotnet`, which downloads without asking or re-verifies and
repairs an existing install.

Each download is checked against SHA-256 hashes pinned in
backends/dotnet_libs.py, for the .nupkg and for the extracted DLL, and the
file is re-hashed after it is written. Normal runs only check that the files
are present. Libraries live per user (XDG data dir, Application Support, or
LOCALAPPDATA; TOCODE_DOTNET_LIB_DIR overrides).

Also: the --no-native help now says it applies to .NET input too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The README now only points to DEVELOPMENT.md, which covers setup, local
backends for testing, running tests and the quality gate, checking changes on
real exports, dependency rules, and releasing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@buzzer-re
buzzer-re merged commit 046f173 into main Oct 5, 2026
8 checks passed
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.

1 participant