[Version 9.0] Feature support for module initializers - #1467
Draft
BillWagner wants to merge 2 commits into
Draft
Conversation
BillWagner
force-pushed
the
v9-module-initializer
branch
from
November 11, 2025 21:06
efd1e69 to
dd16a7c
Compare
BillWagner
force-pushed
the
v9-module-initializer
branch
from
April 10, 2026 20:08
124cf4c to
6fedb51
Compare
Add support for module initializers Add support for module initializers fix md formatting
BillWagner
force-pushed
the
v9-module-initializer
branch
from
May 12, 2026 21:18
6fedb51 to
d7c3231
Compare
Member
Author
|
I attempted to rebase this PR onto the updated |
jskeet
reviewed
Aug 24, 2026
| - `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. |
Contributor
There was a problem hiding this comment.
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. |
Contributor
There was a problem hiding this comment.
(See #1789 for other times where we might want to add the suffix.)
jskeet
reviewed
Aug 24, 2026
|
|
||
| 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: |
jskeet
reviewed
Aug 24, 2026
jskeet
left a comment
Contributor
There was a problem hiding this comment.
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.)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the work in #992
There are a number of comments on #992 that aren't addressed yet: