Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support to process assemblies with generics <T> #183

Open
wants to merge 298 commits into
base: main
Choose a base branch
from

Conversation

josesimoes
Copy link
Member

@josesimoes josesimoes commented Mar 21, 2025

Description

  • Rework metadata tables to include elements to hold data on generic types and instances.
  • Add support for MethodSpec and TypeSpec.
  • Rework most of the tables to include data for generic types and instances.
  • Add sanity checks and code in a bunch of several places.
  • Rewrote PDBX writer from XML to json.
  • Add new extensions to improve usage.
  • Rewrote dumper to follow format from ILDASM.
  • Add new unit tests to cover changes.
  • Update dumper and writer unit tests.
  • Update dependencies on console, msbuild tasks and core.
  • Update sub-modules to ref generic branches (to be replaced with main, following merge).
  • Code style fixes throughout source files.
  • Add/update license header in all source files.

Motivation and Context

How Has This Been Tested?

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Introduced automated changelog generation with categorized entries and a consistent template.
    • Added a workflow that automatically creates release notes when new tags are pushed.
  • Chores

    • Updated various project dependencies to enhance performance, security, and compatibility, including the addition of new dependencies and updates to existing ones.
    • Refined build pipeline configurations with improved triggers, variable management, and task adjustments.
    • Adjusted file inclusion settings to streamline processing.
    • Removed outdated configuration files to simplify project structure, including several development container configurations and settings for Visual Studio Code.

- Update dump layout to make it closer to ILDASM.
- nF tokens are now used along with real tokens.
- Strings are now output.
- Destination args are now output.
- Inline types are now output.
- IL offsets are now output.
- Add new enums for nF Metadata tokens, encoded inline types and PE tables.
- Add unit tests.
- Add member refs table.
- Add code to init refs.
- Fix several tokens output.
- Fix TypeSpec output.
- Need to have all the others properly filled in order to get parameters types.
- Add crawler to find generic parameter type.
- Generic param PE record now includes parameter type.
- Add extension to encode typeRef.
- Add helper class to encode/decode type tokens.
- Rework dumper to make use of these.
@josesimoes
Copy link
Member Author

Unit tests running nanoCLR failed as expected as the nanoCLR is not the correct version.

private byte[] GetSignature(Collection<GenericParameter> genericParameters)
{
using (var buffer = new MemoryStream())
using (var writer = new BinaryWriter(buffer)) // Only Write(Byte) will be used
Copy link
Member

Choose a reason for hiding this comment

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

minimal: rather than the 2 using in 2 lines, maybe use the brackets as well? (super minimal)

Copy link
Member Author

Choose a reason for hiding this comment

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

I was using this patter as it's the "new" one instead of the tradicional with brackets... isn't this correct?

dummyMirror1 = anotherClass.DummyProperty;
_ = anotherClass.DummyProperty;

Console.WriteLine($"Accessed property on class: {dummyMirror1}");
Copy link
Member

Choose a reason for hiding this comment

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

same line right after

Copy link
Member

@Ellerbach Ellerbach left a comment

Choose a reason for hiding this comment

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

couple of comments, overall looks great! I did revie the native part on the nf-interpreter!

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.

4 participants