Skip to content

Conversation

@jkoritzinsky
Copy link
Member

Start an implementation of ilasm in C# in src/tools/ilasm. ANTLR4 is used to build the grammar.

I decided to structure it as a library (with a frontend to come later) to match ILVerify/ILVerification.

This implementation is far from complete. The grammar is missing any updates from the last year or two and much is untested and unimplemented.

It has one passing test for a simple case so far.

Putting out a PR now so other team members and community members can work on it.

Contributes to #121847

…l representation we can construct a metadata image from.
…concepts (and some easy cases to knock out now)
…reprocessor.

Add some basic tests for the preprocessor
…ods that we can't implement E2E due to SRM limitations (found some!)
…efs when possible, correctly handle MethodRefSig scenarios.
Copilot AI review requested due to automatic review settings December 2, 2025 19:18
@huoyaoyuan
Copy link
Member

This is a great advantage of keeping ilasm/ildasm in C++

I think we can continue the discussion in #121847. Since the metadata reader is expected to be replaced by DNMD, the precondition can change here.

@jkotas
Copy link
Member

jkotas commented Dec 3, 2025

How are we expected to collaborate on this? Apparently it needs to fulfill more functionalities. Should we merge it as scaffold and open more PRs?

Yes, it is the idea.

I would like to confirm that we don't care about losing such an ability.

I do not mind with losing this. We actually reached a point where it tends to be easier to prototype new functionality like that in NAOT first. NAOT uses managed System.Reflection.Metadata.

Since the metadata reader is expected to be replaced by DNMD

This is not a committed plan. (If we were to do this, it needs to come with measurable user-observable improvements and it needs to replace the existing metadata reader completely.)

@jkoritzinsky jkoritzinsky marked this pull request as ready for review December 11, 2025 23:07
@jkoritzinsky
Copy link
Member Author

Marking this as ready-for-review as I've done some cleanup and I think this is in a decent state to be experimental in main.

Copy link
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

It is hard to review a code bomb like this in details. I have only done a cursory review. LGTM

Copy link
Member

@MichalStrehovsky MichalStrehovsky left a comment

Choose a reason for hiding this comment

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

:shipit:

@jkoritzinsky
Copy link
Member Author

I apologize for the code bomb. My initial intention of finishing this project as a holiday hackathon a few years back and breaking out the work into multiple (more manageable) PRs didn't exactly work out.

@jkoritzinsky
Copy link
Member Author

/ba-g unrelated timeout in threading tests.

@jkoritzinsky jkoritzinsky enabled auto-merge (squash) December 15, 2025 18:42
@jkoritzinsky jkoritzinsky merged commit 09716ec into dotnet:main Dec 15, 2025
181 of 190 checks passed
@jkoritzinsky jkoritzinsky deleted the ilasm branch December 15, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants