Repository navigation
Commit 2d2819d
Address review: bind-existing-instance and required-nested coverage
Add the tests requested in review of dotnet#95006:
- CanBindExistingInstance_InitOnlyCollectionOnParameterlessConstructorType:
binds onto an already-existing instance of a parameterless-ctor type with an
init-only collection, asserting the configured items are appended into the
existing collection exactly once (not duplicated). This exercises the
!boundThroughConstructor branch of BindCore, which only runs for existing
instances. Runs under both binders.
- CanBind_RequiredNestedComplexOnParameterlessConstructorType_SettableSetter and
_InitOnlySetter (net only, since required needs RequiredMemberAttribute):
assert the bound runtime values of a required nested complex property for both
a settable and an init-only setter, complementing the compile-only
RequiredPropertyOnParameterlessConstructorType generator test.
Also document the known non-public-setter limitation: SetOnInit only considers
public setters, so a required or init-only property with a non-public (e.g.
internal) setter is not routed through the object initializer and a required
property in that shape still produces CS9035, left out of scope here.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: 1a0d7ac2-f2a3-4526-93ab-36bf1a23933f1 parent c92b8d6 commit 2d2819d
3 files changed
Lines changed: 83 additions & 0 deletions
File tree
- src/libraries/Microsoft.Extensions.Configuration.Binder
- gen/Specs/Members
- tests/Common
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
321 | 335 | | |
322 | 336 | | |
323 | 337 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1918 | 1918 | | |
1919 | 1919 | | |
1920 | 1920 | | |
| 1921 | + | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
| 1926 | + | |
| 1927 | + | |
| 1928 | + | |
| 1929 | + | |
| 1930 | + | |
| 1931 | + | |
| 1932 | + | |
| 1933 | + | |
| 1934 | + | |
| 1935 | + | |
| 1936 | + | |
| 1937 | + | |
| 1938 | + | |
| 1939 | + | |
| 1940 | + | |
| 1941 | + | |
| 1942 | + | |
| 1943 | + | |
| 1944 | + | |
| 1945 | + | |
| 1946 | + | |
| 1947 | + | |
| 1948 | + | |
| 1949 | + | |
| 1950 | + | |
| 1951 | + | |
| 1952 | + | |
| 1953 | + | |
| 1954 | + | |
| 1955 | + | |
| 1956 | + | |
| 1957 | + | |
| 1958 | + | |
| 1959 | + | |
| 1960 | + | |
| 1961 | + | |
| 1962 | + | |
| 1963 | + | |
| 1964 | + | |
| 1965 | + | |
| 1966 | + | |
| 1967 | + | |
| 1968 | + | |
| 1969 | + | |
| 1970 | + | |
| 1971 | + | |
| 1972 | + | |
| 1973 | + | |
| 1974 | + | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
| 1980 | + | |
| 1981 | + | |
| 1982 | + | |
| 1983 | + | |
| 1984 | + | |
| 1985 | + | |
| 1986 | + | |
1921 | 1987 | | |
1922 | 1988 | | |
1923 | 1989 | | |
| |||
0 commit comments