Skip to content

Remove 43 unused DotNet alias declarations - #11013

Open
Darrick (darjoo) wants to merge 1 commit into
mainfrom
darjoo-delete-dead-dotnet-aliases-82f
Open

Remove 43 unused DotNet alias declarations#11013
Darrick (darjoo) wants to merge 1 commit into
mainfrom
darjoo-delete-dead-dotnet-aliases-82f

Conversation

@darjoo

@darjoo Darrick (darjoo) commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

What & why

The DotNet Aliases app exists purely to publish CLR type aliases that dependent apps inherit; it contains no code, just app.json, README.md and dotnet.al. Over time it accumulated alias declarations that nothing consumes. This PR deletes 43 type(...) declarations that have zero consumers anywhere in the repository.

This is a straight deletion rather than a deprecation. DotNet interop requires target: OnPrem (and this app is OnPrem), while partner/AppSource extensions target Cloud, so no external extension can declare a DotNet variable at all and therefore cannot consume an inherited alias either. That makes these declarations first-party-internal surface with no external audience. There is also nothing to obsolete: AL does not support obsoletion metadata on dotnet declarations.

Deletion only. No consuming AL code, tests, or app.json files were touched. The diff is 168 deletions and 0 insertions in a single file.

Declarations removed per assembly:

assembly before after removed
DocumentFormat.OpenXml 63 53 10
netstandard 198 177 21
System.Security.Cryptography.Xml 16 9 7
MimeKit 10 8 2
MailKit 7 5 2
System.Drawing.Common 15 14 1

Total type() declarations go from 517 to 474. All 49 assembly(...) blocks are retained and none is emptied.

Linked work

Fixes AB#647963

How I validated this

  • I read the full diff and it contains only changes I intended.
  • I built the affected app(s) locally with no new analyzer warnings.
  • I ran the change in Business Central and confirmed it behaves as expected.
  • I added or updated tests for the new behavior, or explained below why none are needed.

What I tested and the outcome

I did not compile this change, and the two unchecked boxes above are accurate. Docker Desktop is not installed on my machine and no alc.exe is present, so the container route in LOCAL_DEV_ENV.md was unavailable. Please treat compilation and runtime behavior as unverified and rely on CI plus a reviewer with a working container. Everything below is static verification only.

Zero-usage scan, run both before and after the deletion:

  • Scanned all 36,684 .al files under src with :\s*DotNet\s+"?<alias>"?\s*[;)] for each of the 43 aliases. Result: 0 usages for all 43, both before and after.
  • A deliberately looser scan, DotNet\s+"?<alias>"?\b across every other .al file, also returned no references. This catches usages outside a plain variable declaration.
  • The scan was repo-wide on purpose. Aliases are inherited across app dependencies, so "unused in the declaring app" is not sufficient. For example src\Layers\W1\Tests\TestRunner-Internal\dotnet.al declares only Process and Environment yet uses WindowsIdentity, SecurityIdentifier and ProcessStartInfo inherited from Tests-TestLibraries.
  • Each of the 43 aliases was confirmed to be declared exactly once repo-wide, so matching by alias name is unambiguous. After the change all 43 resolve to no declaration.

Structural verification:

  • A structural parse of dotnet.al reports 0 errors and final brace depth 0 both before and after; brace counts balance at 524/524.
  • assembly(...) block count is unchanged at 49, and the per-assembly counts in the table above were asserted programmatically.
  • The diff is pure deletion: git diff --numstat reports 0 168.
  • Pre-existing formatting quirks in the file were preserved rather than silently normalized: the 7 "blank line after {" occurrences and the 1 double-blank-line remain, and no new "blank line before }" was introduced.

No tests were added because this removes declarations that have no consumers; there is no behavior to test, and any incorrect deletion would surface as a compile error rather than a runtime failure.

Risk & compatibility

Low risk, but worth a careful look at three near-miss cases that were deliberately kept:

  • SymmetricAlgorithm vs Cryptography.SymmetricAlgorithm. The CLR type System.Security.Cryptography.SymmetricAlgorithm was declared twice under different aliases. The unused "SymmetricAlgorithm" alias in DotNet Aliases is removed; the "Cryptography.SymmetricAlgorithm" alias in Cryptography Management\src\dotnet.al is untouched and still has its 10 usages and 3 public interface pins. Note this was also the single declaration in the file where the CLR name was unquoted, so a regex expecting a quoted name would have missed it.
  • EncoderParameter[] vs the scalar types. Only the array form, aliased EncoderParameterList, is removed. EncoderParameter and EncoderParameters each have a usage and remain.
  • Backticked generic arity. EnumValue`1 and Nullable`1 contain a literal backtick and were matched literally. The other 7 backticked generic declarations in the file are untouched.

Compatibility: because no first-party code references these aliases and no Cloud-target extension can consume a DotNet alias at all, no breaking change is expected. There is no data, upgrade, permissions, or telemetry impact.

Follow-up: a related cleanup covering 5 further dead aliases (4 in the W1/CZ test-library dotnet.al files, plus SHA1Managed in Cryptography Management\src\dotnet.al) is out of scope here and not included in this PR.

Delete 43 `type(...)` alias declarations from the DotNet Aliases app that
have zero consumers anywhere in the repository.

DotNet interop requires `target: OnPrem`, and partner/AppSource extensions
target `Cloud`, so no external extension can declare a `DotNet` variable and
therefore cannot consume an inherited alias. These declarations are
first-party-internal surface with no external audience, so removal is a
straight deletion rather than a deprecation. AL does not support obsoletion
metadata on `dotnet` declarations.

Verified before deleting:
- Repo-wide scan of all 36,684 .al files for
  `:\s*DotNet\s+"?<alias>"?\s*[;)]` returned 0 usages for all 43 aliases.
- Each alias is declared exactly once repo-wide, so matching by alias name
  is unambiguous.
- A looser `DotNet\s+"?<alias>"?\b` scan across all other .al files also
  returned no references.

Removed per assembly:
- DocumentFormat.OpenXml            63 -> 53  (10 removed)
- netstandard                      198 -> 177 (21 removed)
- System.Security.Cryptography.Xml  16 -> 9   ( 7 removed)
- MimeKit                           10 -> 8   ( 2 removed)
- MailKit                            7 -> 5   ( 2 removed)
- System.Drawing.Common             15 -> 14  ( 1 removed)

Total declarations 517 -> 474. All 49 assembly blocks are retained and none
is emptied.

Deliberately kept, as these are similar but in use:
- `Cryptography.SymmetricAlgorithm` in Cryptography Management (10 usages);
  only the separate, unused `SymmetricAlgorithm` alias for the same CLR type
  was removed.
- `EncoderParameter` and `EncoderParameters`; only the array form
  `EncoderParameter[]` / `EncoderParameterList` was removed.

No consuming code, tests or app.json files were modified.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added AL: System Application Team: Integrations GitHub request for Integrations area labels Sep 3, 2026
@github-actions github-actions Bot added this to the Version 30.0 milestone Sep 3, 2026
@darjoo
Darrick (darjoo) marked this pull request as ready for review September 3, 2026 14:07
@darjoo
Darrick (darjoo) requested review from a team September 3, 2026 14:07
Comment thread src/System Application/App/DotNet Aliases/src/dotnet.al

@WaelAbuSeada Wael (WaelAbuSeada) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AL: System Application Team: Integrations GitHub request for Integrations area

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants