Skip to content

[Version 9.0] Feature support for module initializers - #1467

Draft
BillWagner wants to merge 2 commits into
draft-v9from
v9-module-initializer
Draft

[Version 9.0] Feature support for module initializers#1467
BillWagner wants to merge 2 commits into
draft-v9from
v9-module-initializer

Conversation

@BillWagner

@BillWagner BillWagner commented Nov 11, 2025

Copy link
Copy Markdown
Member

@BillWagner
BillWagner force-pushed the v9-module-initializer branch from efd1e69 to dd16a7c Compare November 11, 2025 21:06
@RexJaeschke RexJaeschke added this to the C# 9.0 milestone Nov 12, 2025
@RexJaeschke RexJaeschke added type: feature This issue describes a new feature Review: pending Proposal is available for review labels Nov 12, 2025
@RexJaeschke RexJaeschke added Review: in progress at least one person is reviewing this and removed Review: pending Proposal is available for review labels Nov 30, 2025
@BillWagner
BillWagner force-pushed the v9-module-initializer branch from 124cf4c to 6fedb51 Compare April 10, 2026 20:08
Add support for module initializers

Add support for module initializers

fix md formatting
@BillWagner
BillWagner force-pushed the v9-module-initializer branch from 6fedb51 to d7c3231 Compare May 12, 2026 21:18
@BillWagner

Copy link
Copy Markdown
Member Author

I attempted to rebase this PR onto the updated draft-v9 after the latest TC49-TG2 committee meeting but encountered conflicts that need author resolution. Please rebase locally onto draft-v9 and resolve them. Thanks!

@jskeet jskeet self-assigned this Aug 10, 2026
Comment thread standard/attributes.md
- `System.Runtime.CompilerServices.AsyncMethodBuilderAttribute` ([§23.5.5](attributes.md#2355-the-asyncmethodbuilder-attribute)), which is used to establish a task builder for an async method.
- `System.Runtime.CompilerServices.CallerLineNumberAttribute` ([§23.5.6.2](attributes.md#23562-the-callerlinenumber-attribute)), `System.Runtime.CompilerServices.CallerFilePathAttribute` ([§23.5.6.3](attributes.md#23563-the-callerfilepath-attribute)), and `System.Runtime.CompilerServices.CallerMemberNameAttribute` ([§23.5.6.4](attributes.md#23564-the-callermembername-attribute)), which are used to supply information about the calling context to optional parameters.
- `System.Runtime.CompilerServices.EnumeratorCancellationAttribute` ([§23.5.8](attributes.md#2358-the-enumeratorcancellation-attribute)), which is used to specify parameter for the cancellation token in an asynchronous iterator.
- `System.Runtime.CompilerServices.ModuleInitializer` (§module-init-attr), which is used to mark a method as a module initializer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
- `System.Runtime.CompilerServices.ModuleInitializer` (§module-init-attr), which is used to mark a method as a module initializer.
- `System.Runtime.CompilerServices.ModuleInitializerAttribute` (§module-init-attr), which is used to mark a method as a module initializer.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

(See #1789 for other times where we might want to add the suffix.)

Comment thread standard/attributes.md

Specifies the parameter representing the `CancellationToken` for an asynchronous iterator ([§15.15](classes.md#1515-synchronous-and-asynchronous-iterators)). The argument for this parameter shall be combined with the argument passed to `IAsyncEnumerable<T>.GetAsyncEnumerator(CancellationToken)`. This combined token shall be polled by `IAsyncEnumerator<T>.MoveNextAsync()` ([§15.15.5.2](classes.md#151552-advance-the-enumerator)). The tokens shall be combined into a single token as if by `CancellationToken.CreateLinkedTokenSource` and its `Token` property. The combined token will be canceled if either of the two source tokens are canceled. The combined token is seen as the argument to the asynchronous iterator method ([§15.15](classes.md#1515-synchronous-and-asynchronous-iterators)) in the body of that method.

It is an error if the `System.Runtime.CompilerServices.EnumeratorCancellation` attribute is applied to more than one parameter. The compiler may produce a warning if:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See #1789

@jskeet jskeet left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think this is ready for wider review, knowing that the comments in #992 will still need to be addressed in a future PR. I think it would be fine to create issues for those comments as a simpler way of tracking them. (I'm happy to do that if we don't want to try to fix them in this PR.)

@jskeet jskeet added meeting: discuss This issue should be discussed at the next TC49-TG2 meeting Review: complete at least one person has reviewed this and removed Review: in progress at least one person is reviewing this labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meeting: discuss This issue should be discussed at the next TC49-TG2 meeting Review: complete at least one person has reviewed this type: feature This issue describes a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants