stride3d / stride3d/stride

Move codegen from AssemblyProcessor into Roslyn based solution

Open
#1,048 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Build enhancement
Dominant language
C#
Stars
7.8k
Forks
1.2k
Avg merge
2d 17h
Merged PRs (30d)
49

Description

I've had contact with AssemblyProcessor's codegen for data serializers on two occasions so far and while doable, moving around the code is not very intuitive and the codegen itself often quite fragile, because for the most part its involved in manual IL emit using Mono.Cecil data structures.

The current setup is working well for a lot of cases, but more and more we can find edge cases (especially with generic types) that will require modifications to the how code is generated. It's likely that the complexity of this tool will only increase, the way it's written now, and increase the modification (and debugging) costs even further.

As such I'm proposing to look into alternative approaches like the source generators. This issue will be used for tracking ideas and bottlenecks related to migrating. One of the main things is that we need to be able to come up with a black box design description of the current codegen setup.

The processors to consider for migration:

  • AssemblyScanProcessor
  • SerializationProcessor
  • ModuleInitializerProcessor

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by mapping the current behavior of AssemblyScanProcessor, SerializationProcessor, and ModuleInitializerProcessor, including their Mono.Cecil-based code generation. Read the linked Roslyn source-generators material and produce a black-box design description that identifies migration bottlenecks and edge cases, especially around generic types.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers, tooling
Issue type
Refactor
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.