-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed
Labels
Area-CompilersDocumentationTestTest failures in roslyn-CITest failures in roslyn-CITest-GapDescribes a specific feature or scenario that does not have test coverageDescribes a specific feature or scenario that does not have test coverage
Milestone
Description
Championed issue: dotnet/csharplang#2608
Specification: https://github.com/dotnet/csharplang/blob/master/proposals/module-initializers.md
- LangVer
missing module init type:[ModuleInit(typeof(Missing))]module init type has a use-site error[ModuleInit(typeof(A))]whereAcan't be fully loaded (A defined in a library, but it's base type is referenced in another library which is not referenced in current/client library)- test some netmodule scenarios (adding multiple modules within an assembly)
- attribute on local functions
- attribute on static and non-static methods
- attribute on methods with parameters
- attribute on non-void methods
- attribute on generic methods
- attribute on methods directly or indirectly in a generic type, method is generic and not generic
- attribute on methods inaccessible on the module level
- attribute on method inside an added .NET module compiled from IL. Expect the method to be not executed.
- attribute on multiple methods in source. Expect methods are executed in lexical order. The spec should clarify the order.
- different methods decorated with different attributes (extern aliases). Should make no difference, all methods should be executed.
- methods decorated with the attribute using constructor other than default are ignored.
- multiple attributes on the same method (change attribute definition to allow multiple applications)
- attributes on legacy partial methods: on definition, on implementation, on both (change attribute definition to allow multiple applications)
- attributes on new-style partial methods: on definition, on implementation, on both (change attribute definition to allow multiple applications)
- attributes on a static constructor
- attributes on methods in an interface
- attributes on non-method declarations (change attribute definition to allow), should be ignored.
- attribute on conditional method
- attribute is conditional
- attribute on an obsolete method
- Error when attribute is used in VB
No warning when module initializer method initializes a static field with a non-nullable reference typeseems to be a difficult analysis to reason about correctly. Test plan for "module initializers" feature #40500 (comment)- Expected semantics for
static int field = default;when module initializer also writes tofield- the optimization should not be a problem because the static constructor will run before the module initializer can write anything.
BCL
- Add type to BCL
- API request New API: ModuleInitializerAttribute runtime#35749
- API review New API: ModuleInitializerAttribute runtime#35749 (comment)
- API implementation New API: ModuleInitializerAttribute runtime#35749
LDM
- write and review speclet
- decide what to do for VB
- verdict: no support and error on usage of well-known attribute Codegen for module initializers feature #43281 (comment)
FYI @jnm2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-CompilersDocumentationTestTest failures in roslyn-CITest failures in roslyn-CITest-GapDescribes a specific feature or scenario that does not have test coverageDescribes a specific feature or scenario that does not have test coverage