Skip to content

Commit

Permalink
Plan for .NET 7 integration (#1378)
Browse files Browse the repository at this point in the history
* Plan for .NET 7 integration
  • Loading branch information
AaronRobinsonMSFT authored Aug 6, 2021
1 parent 397ccce commit cd76a36
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions designs/RuntimeConsumption.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Integration into dotnet/runtime

The prototype phase of the `DllImport` source generator is complete. The process and work done was tracked at [dotnet/runtime@43060](https://github.com/dotnet/runtime/issues/43060). The results of the prototype have provided us with some confidence that the current approach is viable and can move forward to consume the source generator in the .NET 7 timeframe. The plan for integration into the dotnet/runtime repository follows.

Converting the prototype into a production ready product is required prior to consumption in the product. This means integration will be done in two phases, production-ready and consumption, that can be done in parallel in many cases. There is a third phase that is considered a stretch goal – productization.

## Production-ready

The following items must be considered to make this prototype production-ready.

**Move source from dotnet/runtimelab** – Move the prototype source from its branch in [dotnet/runtimelab](https://github.com/dotnet/runtimelab/tree/feature/DllImportGenerator/DllImportGenerator) to [dotnet/runtime](https://github.com/dotnet/runtime). Guidance on destination can be found at [`project-guidelines.md`](https://github.com/dotnet/runtime/blob/main/docs/coding-guidelines/project-guidelines.md) – plan is under `libraries/System.Runtime.InteropServices`. Commit history should be retained during this move.
- Includes unit and scenario test integration into the `libraries/` pattern.

**Attributes into `System.Private.CoreLib`** – Prior to productization, triggering and support attributes should be moved into a global space for consumption by `NetCoreApp`.

**Product impact tenets** – Size impact, security, and convention reviews. Patterns have been uncovered that could be improved upon in the source generation step. Collapsing some of these patterns would help with reducing size impact and addressing potential security issues. Code generation convention changes may result in API proposals for marshal helpers – see [struct marshalling](./StructMarshalling.md).

**UX** – Source generators can run from a command line build as well as from the IDE. Running from within the IDE will impact the UX of the IDE and therefore performance investigations are needed to ensure the generator doesn't degrade the developer inner-loop.

**Stakeholder feedback** – An exit criteria for the prototype was to reach out to stakeholders and get feedback on the experience and generated code. Responses to all feedback prior to product consumption is expected.

## Consumption

The following items must be considered to make the prototype consumable in [dotnet/runtime repository](https://github.com/dotnet/runtime).

**In-box source generation** – Guidance for [providing an in-box source generator has been documented](https://github.com/dotnet/designs/blob/main/accepted/2021/InboxSourceGenerators.md). The document should be considered a primary source for best-practices that will eventually be needed for productization.

**Versioning/Shipping/Servicing** – Partially captured in the "In-box source generation" document, but stated item is being called out.

**Merge in feature branch** – Integration work for updates to `NetCoreApp` have started in [`feature/use-dllimport-generator`](https://github.com/dotnet/runtime/tree/feature/use-dllimport-generator).
- Question on the impact of [source build](https://github.com/dotnet/source-build) for dotnet/runtime.

## Productization

The following items must be considered to make this prototype into a product.

**Localization** – We must ensure user observed messages are properly localized and adhere to the Globalization/Localization tenets.

**API Review** – [`GeneratedDllImportAttribute`](https://github.com/dotnet/runtime/issues/46822); Supporting [attributes](https://github.com/dotnet/runtime/issues/46838) and marshalling helper types.

**Distribution** – The consumption of the source generator product is assumed to be in-box and/or as a standalone NuPkg. If not distributed as NuPkg there is no known additional work here.

**Documentation/Sample** – Productization will require new documentation and at least one official example.

0 comments on commit cd76a36

Please sign in to comment.