Commit Graph
575 Commits
Author SHA1 Message Date
Christoph Wille 2ec4ee851d Go back to Sbom 4.1.5 bc of build warnings eg "Unhandled exception caught when trying to open "D:\\a\\ILSpy\\ILSpy\\ICSharpCode.ILSpyX\\bin\\Release\\ICSharpCode.ILSpyX.11.1.0.9858.c05ed6db.temp\\_manifest\\spdx_2.2\\manifest.spdx.json"" 2026-10-05 08:42:34 +02:00
Christoph Wille c2d51a80b9 Remove DiasymReader from restore entirely (update other NuGet packages as well) 2026-10-05 08:01:59 +02:00
Christoph Wille 1c7e0efef0 Generate SBOM only on integration build 2026-10-05 07:37:41 +02:00
Christoph Wille 067122455a NuGet September 2026 Updates including .NET 11 RC1 with nearest Roslyn 2026-09-09 07:15:11 +02:00
Daniel Grunwald 5526400b17 Extend InferType() to every ILInstruction
Change InferType() to an abstract method and implement for every ILInstruction.
With this change, we now always have enough information to create a variable of an appropriate type to store the result of evaluating the instruction.
This previously was not the case for instructions producing "other value type", for which the stacktype-based fallback incorrectly produced `object`.
2026-08-30 21:25:45 +02:00
Christoph Wille cdeae656fe NuGet August 2026 Updates (#3981)
* Set v11 RTM
* Update features in README.md
* Remove the two 900-iteration process-list scroll tests
* Keep Svg.Controls.Skia.Avalonia at 12.0.0.13
* 10.0.11 and Roslyn for net11p7
* Fix module-scan test failing when PowerShell's NGen images are stale
* Opt Pack NuGets out of the MSBuild server to fix SBOM generation
2026-08-11 21:56:11 +02:00
Christoph Wille b888153f24 NuGet 07/26 updates and .NET 11 P6 Roslyn 2026-07-14 20:46:08 +02:00
Siegfried Pammer c3abc68771 Use SDK default Compile items in ICSharpCode.Decompiler
The project listed all 576 source files as explicit <Compile Include> with
EnableDefaultItems=false, so every new file had to be added by hand. Switch to
the SDK's default **/*.cs glob and keep only the exclusions that are actually
needed:

- Properties/DecompilerVersionInfo.cs is generated before build and absent when
  the glob is evaluated on a clean checkout, so it is still included explicitly
  (with a paired Remove to avoid a duplicate once a prior build produced it).
- DecompilerVersionInfo.template.cs is a placeholder template, never compiled.

Also delete the hand-written DecompilerAstNodeAttribute.cs: the source generator
emits this attribute (RegisterPostInitializationOutput), so the on-disk copy was
stale dead code -- never compiled, and parameterless where real usages pass
[DecompilerAstNode(hasPatternPlaceholder: true)]. Removing it drops what would
otherwise be a third exclusion.

Default None globbing stays off so the explicit None entries remain the
authoritative list. The evaluated Compile set is identical to the previous 576
files; verified by a clean build with the version file both present and absent.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 11:30:15 +02:00
Siegfried Pammer 33d44f7828 Rename the Roles token-text constants to Tokens
After the Role and TokenRole hierarchies were removed, the Roles class no
longer held any roles -- only the punctuation and keyword text the output
visitor writes (LPar, Arrow, ClassKeyword, ...). The name was a misleading
vestige of the deleted system. Rename it to Tokens, which is what it now
is; the constants and their values are unchanged.

Also refresh the CSharpSlotInfo doc, which still described slot identity as
the successor to the removed node.Role == Roles.X comparison.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer 1cc8a62f95 Delete TokenRole; carry token text as constants
TokenRole was a printer-side descriptor whose only jobs were holding a token's
text and giving the writers an identity to single out specific tokens. The text
becomes plain const strings on the nodes, and the few identity checks are
reexpressed as node-stack context: interpolation braces are recognized by an
Interpolation on the writer's stack, record class versus struct coloring keys
off TypeDeclaration.ClassType, and the accessor/this/base/override cases fall
out of the surrounding node. WriteKeyword/WriteToken drop the descriptor
parameter. The constants are named for what the token is: a keyword, a symbol
token, or a modifier.
Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer 9285a7328d Delete the Role hierarchy; key the child API on SlotKind
Slot identity already lived in node.Slot/CSharpSlotInfo/SlotKind after
the storage flip, so the parallel Role/Role<T> child model was redundant.
The Role-keyed mutation/query API is reexpressed over SlotKind, and the
role-index packing on AstNode flags is gone.

Because a node's Slot is now derived from its index in its parent rather
than stored on the child, the located-AST reattach in
InsertMissingTokensDecorator must capture the child's slot kind before
Remove() detaches it.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer fe41cfeca5 Delete the NodeType enum and other dead node members
NodeType was NRefactory's coarse node category, but only three reads remained
here: two checks now expressed as "is not Trivia" and one debug assert for the
pattern category. Remove the enum, the abstract property, every per-node
override, and the generator's emission, preserving the pattern-placeholder case
through an IPatternPlaceholder marker interface the output-visitor assert
checks. Also remove the unused PrimitiveExpression.AdvanceLocation helper.
Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer 89e7f5b662 Expose node.Slot and key child positions on SlotKind
Introduce the successor to node.Role for child-slot identity: the generator
emits a CSharpSlotInfo per [Slot], exposed as node.Slot, plus a shared SlotKind
enum for the polymorphic "is this node in an embedded-statement / condition /
base-type slot?" comparisons a per-node identity cannot express. Migrate the
printer and transform position checks from node.Role to node.Slot and
node.Slot.Kind, and read identifier children and role-keyed writes through the
typed properties. Role is still present and is removed later; output is
unchanged.
Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer 77d57b91dc Drop token nodes and move comments and directives to trivia
Comments and preprocessor directives were positional children interleaved
into the child list, and punctuation, keywords and operators were token-node
children. Add a leading/trailing trivia side-channel for comments and
directives, emit it from the output visitor, and re-home every comment
receiver onto it (including inside-block comments as comment-only empty
statements and undecodable attribute arguments as an ErrorExpression). With
locations and sequence points no longer sourced from token nodes, stop
reconstructing them on the locations path and delete CSharpTokenNode,
CSharpModifierToken and InsertSpecialsDecorator. The AST no longer carries
token children or positional comments; output is byte-identical.
Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-23 07:43:42 +02:00
Siegfried Pammer c174e4d6b1 Add the AST source generator for the C# syntax tree
Introduce a Roslyn source generator that emits the visitor boilerplate for
the C# AST from [DecompilerAstNode]-tagged node declarations: the
IAstVisitor interface, the AcceptVisitor overloads, the pattern-placeholder
nodes, and the initial DoMatch support. AccessorKind lets an accessor's
keyword be chosen independently of its role, an early step toward shedding
the NRefactory role model.
2026-06-23 07:43:42 +02:00
Siegfried Pammer 67533d767f Compute public-key tokens with a managed SHA-1
On FIPS-mode systems the platform crypto provider refuses to create
SHA-1 instances (OpenSSL: error:03000098 invalid digest), so merely
displaying a strong-named assembly's identity failed. The public-key
token is a non-secret identity hash whose algorithm is fixed by
ECMA-335, so the two token sites now use dotnet/runtime's managed
Sha1ForNonSecretPurposes, vendored with its license header intact and
shielded from the repo formatter via generated_code in .editorconfig
so future upstream syncs diff cleanly. IncrementalHash was considered
and rejected: like SHA1.Create(), it resolves the digest through the
host crypto policy, and Roslyn's equivalent token code also relies on
the platform SHA-1, so it offers no precedent for FIPS safety.

Assisted-by: Claude:claude-fable-5:Claude Code
2026-06-13 09:45:15 +00:00
Christoph Wille da57bad452 Merge pull request #3758 from icsharpcode/christophwille/nu0626
NuGet June 2026 Updates
2026-06-10 16:21:11 +02:00
Siegfried Pammer e0cde005f9 Carry all publish RIDs in the core-library lock files
ICSharpCode.Decompiler / ILSpyX / BamlDecompiler set RestoreLockedMode but
declared no RuntimeIdentifiers, so their lock files were RID-agnostic. A
RID-specific 'dotnet publish -r <rid>' of ILSpy (which declares all four
distribution RIDs) propagated the RID to these locked project references and
failed restore with NU1004 unless --no-restore or --force-evaluate was used.
Declare the same win-x64;win-arm64;linux-x64;osx-arm64 set on the three
libraries and regenerate the locks so a locked-mode publish works for every
platform out of the box.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-10 00:11:56 +02:00
Siegfried Pammer 667f6ad5f8 Add pwsh dev scripts, repo-wide lock files, and CI NuGet caching
Replace the Windows-only .bat helpers (clean / debugbuild / releasebuild /
restore / updatedeps and BuildTools/format) with cross-platform pwsh
scripts at the repo root: restore.ps1, build.ps1 (-Configuration), clean.ps1,
updatedeps.ps1 and BuildTools/format.ps1, alongside the existing publish.ps1.

Enable a packages.lock.json for every project by hoisting
RestorePackagesWithLockFile into the root Directory.Build.props (the four
core libraries set it individually before) and commit the generated locks,
so restores are repeatable and CI can cache packages off them.

Cache the NuGet packages folder in the three setup-dotnet workflows
(build-ilspy, build-frontends, codeql-analysis), keyed on the lock files
per the setup-dotnet caching guidance.

Scope the Debug "Verify package contents" check to the *.filelist outputs
it actually generates. A project's packages.lock.json is keyed only by
(framework, RID), with no host-OS axis, so a lock produced on Linux
legitimately differs from one produced on Windows whenever an OS-conditional
PackageReference applies (Debug+Windows pulls Microsoft.DiaSymReader*). The
Windows restore then rewrites those locks; that churn must not fail a step
whose job is to police the VSIX/MSI file lists.

Also drop the dead ILSpy.BamlDecompiler publish line from
publishlocaldev.ps1, mirroring the earlier publish.ps1 fix.

Assisted-by: Claude:claude-opus-4-8:Claude Code
2026-06-09 00:58:19 +02:00
Siegfried Pammer 1bfa3b821f Reduce runtime-async manual await pattern (non-Task awaitables) to Await.
Roslyn's runtime-async lowering uses AsyncHelpers.Await(Task) for Task awaitables (already handled by TransformAsyncHelpersAwaitToAwait in EarlyExpressionTransforms) but emits a manual GetAwaiter / get_IsCompleted / AsyncHelpers.UnsafeAwaitAwaiter / GetResult sequence for non-Task awaitables — YieldAwaitable, ConfiguredCancelableAsyncEnumerable.Enumerator from await foreach, etc. Add a new RuntimeAsyncManualAwaitTransform invoked from AsyncAwaitDecompiler's runtime-async dispatch that recognizes the three-block shape (head with stloc awaiter + IsCompleted check + branch, pause block calling UnsafeAwaitAwaiter, completed block starting with GetResult), strips the suspend machinery, and replaces the GetResult call with an Await IL instruction. When GetAwaiter takes the address of a temporary set in the same block, also drop the temporary store and use the underlying awaitable expression.

This collapses the LoadsToCatch await-Task.Yield bodies. AsyncForeach should benefit too (its MoveNextAsync awaits go through this path).
2026-05-20 22:30:42 +02:00
Siegfried PammerandClaude Opus 4.7 255e73f3a0 Reverse runtime-async lowering of try-finally and try-catch with await.
Roslyn's runtime-async lowering flattens these into a TryCatch[object] with a captured-rethrow pattern (try-finally) or a TryCatch[T] with a flag-int discriminator and a guarded post-catch body (try-catch). Add a new transform invoked from AsyncAwaitDecompiler when the state-machine matches fail and the method has the runtime-async impl bit; it pattern-matches both shapes and rewrites them back to TryFinally / TryCatch with the original catch body inlined into the handler.

The state-machine and runtime-async lowerings of try-finally use the same catch-handler shape and the same dominator-based finally-body extraction, so promote those to internal static helpers (MatchObjectStoreCatchHandler, MoveDominatedBlocksToContainer) on AwaitInFinallyTransform and call them from the new transform. Filter-bearing catches and multi-handler tries are still left to the standard pipeline.

Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
2026-05-20 22:30:41 +02:00
Christoph Wille 5833ee57a4 Updates for .NET Preview 4 2026-05-13 08:32:01 +02:00
Christoph Wille f99b4a21a7 Nuget package updates 04/26 2026-04-14 20:01:48 +02:00
Christoph Wille 29bc5f204b Merge pull request #3680 from icsharpcode/csharp14/extensions
Dedicated UI and Decompiler APIs for C# 14 extensions
2026-03-21 15:37:37 +01:00
Christoph Wille c0d26255fa .NET Update 10.0.4 to 10.0.5 (#3681) 2026-03-18 13:38:11 +01:00
Siegfried Pammer 98d764a169 Add a treenode and decompiler APIs for extensions. 2026-03-16 22:41:21 +01:00
Christoph Wille 2f311c233d Roslyn 5.3.0 (#3665)
NuGet updates 4/26 including Roslyn 5.3.0
2026-03-11 09:48:40 +01:00
Christoph Wille a1e2a4aa91 NuGet Update 02/26 (#3663)
* NuGet Update 02/26
* Update to latest build agent software
* Use Wix 6.0.2, manually install version-locked WixToolset.UI.wixext extension
2026-02-14 09:48:48 +01:00
Siegfried Pammer d3e12d0ebf Migrate from .ruleset to .editorconfig 2025-12-29 19:24:31 +01:00
Siegfried Pammer 0cd53418ad Add ILAmbience 2025-12-21 13:47:18 +01:00
Christoph Wille 1070b03468 NuGet December 2025 Updates (#3634) 2025-12-11 09:11:00 +01:00
Christoph Wille ac8503c005 .NET 10 RTM Package Update (#3609) 2025-11-11 15:36:39 +01:00
Christoph Wille 4f11813829 .NET 10 RC2 packages (#3599)
Note: transport feed had only 106 for dotnet-format and ILCompiler.Reflection.ReadyToRun.Experimental
2025-10-15 17:31:05 +02:00
Peter Crabtree e1e16b64f5 dev: Strip BOM mark from text files 2025-08-28 20:56:19 -04:00
Daniel Grunwald dd4bf7d8a4 Fix #3518 by replacing FixLoneIsInst with an inlining restriction.
This way we avoid having to extract later, as we will never inline if the `isinst` argument if this could result in it being unrepresentable in C#.
This commit also refactors inlining restrictions to avoid requiring special cases in ILInlining itself.

But when making this change, I discovered that this broke our pattern-matching tests, and that the weird IL with double `isinst` is indeed generated by the C# compiler for `if (genericParam is StringComparison.Ordinal)` style code. So instead we also allow `isinst` with a `box(expr-without-side-effects)` argument to be represented with the `expr is T ? (T)expr : null` emulation.
2025-08-23 14:26:28 +02:00
Christoph Wille afcdcec146 Update for .NET 10 Preview 7 packages (#3537)
* Update NUnit (was: 4.3.2) to 4.4 and MTP (was: 1.7.3) to 1.8.1 (had to add VSTestBridge explicitly to override ref complaints by compiler)
* Update to .NET 10 Preview 7 NuGet packages
* Update dotnet-format
2025-08-13 11:02:45 +02:00
Christoph Wille 99165b7ce2 Update Humanizer (#3532) 2025-08-10 10:45:04 +02:00
Siegfried Pammer 9157122462 Add ExtensionDeclaration syntax node 2025-08-04 08:53:33 +02:00
Siegfried Pammer 3b0939d99c Add ExtensionInfo: mapping of extension members to extension implementations and more. 2025-08-04 08:53:33 +02:00
Siegfried Pammer 7ea2c8f32f Remove dead code 2025-08-02 15:40:54 +02:00
Siegfried Pammer 9dde97414a Rename ResolvedUsingScope to UsingScope 2025-08-02 11:02:25 +02:00
Siegfried Pammer c9e3790adc Remove UnresolvedUsingScope 2025-08-02 11:00:31 +02:00
Siegfried Pammer d0fc0411fb Update to C# 13 and fix field keyword 2025-08-01 11:08:36 +02:00
Daniel Grunwald 90cd265e89 Update System.Reflection.Metadata dependency to 9.0.0.
Add explicit System.Security.Cryptography.Pkcs dependency to avoid security vulnerability warning in ILSpyCmd.
Suppress security vulnerability warnings in test projects.
2025-08-01 09:29:35 +02:00
Siegfried Pammer f0c80e4a80 Silence NU1510 2025-07-30 22:00:43 +02:00
Christoph Wille 36d2135ecf .NET 10.0 Preview5 NuGet Updates (#3511)
Bump all Microsoft.* and System.* to 10.0.0-preview5
Microsoft.CodeAnalysis.* to 4.14.0
Update other dependencies to latest
2025-07-09 13:40:43 +02:00
Siegfried Pammer e4ebe20602 Upgrade dotnet target framework to net10 2025-07-04 19:08:07 +02:00
Siegfried Pammer 79f7a188b0 Add support for C# 12 inline array expressions 2025-06-15 17:22:07 +02:00
Siegfried Pammer 978c31ca5e Add PropertyAndEventBackingFieldLookup to improve performance of MemberIsHidden. 2025-06-15 16:19:59 +02:00
Christoph Wille 3ed6da38df NuGet updates 04/25 (#3459) 2025-04-13 09:49:49 +02:00