You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e784392
Browse filesBrowse the repository at this point in the historyBrowse files
fix(sourcegen): generate a data source factory for [InstanceMethodDataSource] (#7225) (#7348)
* fix(sourcegen): generate a data source factory for [InstanceMethodDataSource] (#7225)
[InstanceMethodDataSource] went through the generic attribute writer and got no
Factory, so Native AOT fell back to a reflection member lookup that found no
trimmed field metadata. Route it through GenerateMethodDataSourceAttribute and
keep the declared attribute type so the engine still sees IAccessesInstanceData.
* fix(sourcegen): keep runtime row expansion and private methods for [InstanceMethodDataSource] (#7225)
- An object-typed property or method named by [InstanceMethodDataSource] decides its rows from the
runtime value, as the attribute's reflection lookup did before it had a generated factory.
- A parameterless private or protected data source method is read through a constant-name
typeof(T).GetMethod lookup that Native AOT keeps, like private fields and properties, instead of a
direct call the generated class cannot compile.
- Share the InstanceMethodDataSourceAttribute name as a constant.
* fix(sourcegen): skip generic overloads and keep null as an empty source for [InstanceMethodDataSource] (#7225)
A private parameterless data source method beside a parameterless generic
overload of the same name made the generated GetMethod lookup ambiguous; the
factory now filters out generic method definitions instead.
A null value from an [InstanceMethodDataSource] member became one null row,
so SkipIfEmpty no longer skipped the test as the reflection path does. The
generated factory now reads null as an empty source.
* fix(core): read a null Task or IAsyncEnumerable data source as empty (#7225)
FromTask and FromAsyncEnumerable (and their instance variants) awaited or enumerated
a null value and threw. The attribute's reflection path reads a null source as one with
no rows, so [InstanceMethodDataSource(..., SkipIfEmpty = true)] on such a member now
skips in source-gen mode as it does in reflection mode.
* fix(sourcegen): leave a void [InstanceMethodDataSource] method to the reflection fallback (#7225)
TUnit0011 only analyzes [MethodDataSource], so a void method named by
[InstanceMethodDataSource] reached the generated factory and failed with CS0030.
* fix(sourcegen): rebuild a single System.Tuple parameter from unwrapped row elements (#7225)
Generated data source factories unwrap a reference Tuple row into its elements, as they do a value tuple,
but the generated invoker only rebuilt value tuples, so a test taking one Tuple<...> parameter failed with
'Expected exactly 1 argument'. Reflection mode keeps the row whole. This affected [MethodDataSource] already
and [InstanceMethodDataSource] once it got a generated factory.
* fix(sourcegen): fall through to the argument-count switch for a single System.Tuple parameter (#7225)
Only rebuild the tuple when the row was unwrapped into its elements. A null
argument, a whole tuple, and an omitted optional parameter keep the ordinary
single-argument handling, as before the reference-tuple branch existed.
Also move IsReferenceTuple above FormatSingleArgumentCall's doc comment and
parenthesize the null-as-empty pattern.
* fix(core): keep a tuple row whole for a single tuple parameter of [InstanceMethodDataSource] (#7225)
A one-element System.Tuple row holding null, such as Tuple.Create<string?>(null),
was split into [null] by the generated factory, so the test got a null tuple.
Reflection mode keeps the row whole when the test takes a single tuple. The
FromInstance* helpers and new From*(DataGeneratorMetadata, ...) overloads now read
the parameter types from the metadata and do the same; [InstanceMethodDataSource]
passes the metadata to its static helpers.
* fix(sourcegen): preserve non-generic task source factories (#7225)
* refactor(sourcegen): build complete reflection reads for #7225
0 commit comments