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
Source map: record call sites for [GenerateReactorWrapper] factories and the calls that take them - #1426
Controls wrapped with [GenerateReactorWrapper] (SettingsCard, RadialGauge, …) got no source-map interceptor entry, and neither did any DSL call taking one as an argument (VStack(8, SettingsCard(...)), HStack(8, gauge) where var gauge = RadialGauge(...).Width(140)). DevTools therefore saw untagged elements, get-source found no call site, and component roots showed as a bare StackPanel.
Root cause: generators run against the same input compilation and cannot see each other's output. For Reactor.SourceMap.Generator, a wrapper factory does not exist: the call binds to nothing, and the containing call fails overload resolution or binds with an error-typed argument. Both were dropped.
The fix has two halves:
Wrapper calls.Reactor.Wrappers.Generator knows its factories' signatures, so it now intercepts calls to them itself (WrapperGenerator.SourceMap.cs).
It is gated on ReactorSourceMap and on InterceptorsNamespaces accepting Microsoft.UI.Reactor.Generated, with the compiler's parent-namespace and global rule.
It only claims calls that bind to nothing, so a wrapper factory visible through a referenced library is still handled by the source-map generator and is never double-intercepted.
Like every other Reactor interceptor, it stamps an argument implicitly converted to Element (a string label, for example) with that argument's own position. It never writes into a params array passed in normal form, and it skips any argument whose type could change once the wrappers exist.
Calls that contain them.Reactor.SourceMap.Generator re-binds the containing call speculatively.
Each sub-expression that is certainly the wrapper record is replaced with an Element placeholder. The record's generated base is Element, so it converts and overloads like that. Other inferred types use a non-constant placeholder.
The binding is accepted only when no candidate could be chosen differently once the record is complete, every argument is accounted for, and each placeholder position is valid.
Anything that could bind differently after generation fails closed and is left unstamped, as before. That includes:
overloads reachable only by the record: interfaces, delegates, conversions, nested and constrained generics;
hand-written methods that a hidden generated factory or a generated Set/On* member would outrank, including inherited, aliased and implicit-receiver ones and method groups;
lambdas whose bodies choose an overload, inferred locals, and calls with dynamic arguments.
The generator never risks CS9144 (interceptor signature mismatch) to gain coverage.
Shared logic. Helpers used by both generators are in a linked SourceMapShared.cs.
Fast path. A per-type syntactic check keeps code that never touches a wrapper record on exactly main's path. Wrapper-free projects behave identically to main.
Two main bugs that could produce CS9144 were fixed along the way: method-group arguments, and explicit type arguments that name a wrapper record.
Follow-up alternative, not taken: bind against a compilation augmented with the wrapper generator's output. This was rejected for now because it duplicates the wrapper emit and costs a second semantic model per affected tree. The placeholder binding covers a strict subset of it. The trade-off is recorded in the SourceMapInterceptorGenerator.WrapperFactories.cs header.
Coverage and perf, measured with an offline harness that runs both generators, interleaved with main on the same machine:
Live interception tests in tests/Reactor.SourceMap.Tests. Compiling this project is itself the CS9144 oracle; each fail-closed rule has a case that does not build without it.
WrapperFactoryInterceptionTests: rewritten from characterization to positive tests, plus argument stamping, normal-form params arrays, dynamic arguments, and wrappers that declare : Element themselves.
New files: WrapperFactoryCompetitorTests, WrapperGeneratedMemberTests, WrapperInheritedMemberTests, WrapperAliasMemberTests, WrapperImplicitReceiverTests and WrapperFactoryNameofTests.
SourceMapVisibleWrapperFactoryTests: wrapper factory visible in-compilation, via MetadataReference and ProjectReference, and for a wrapper that declares its own base.
SourceMapWrapperFastPathTests: a route theory over fast-path versus slow-path shapes, an attribute-alias test, an expanding-generic stack-overflow guard, a hidden-factory method-group case, and a positive control.
Mutation checks. Every regression was mutation-checked: each fails against the generator without its fix (CS9144, a wrong stamp, an IndexOutOfRangeException, or an extra wrong interceptor). The exceptions are two cases the previous generator already declined, which are kept as regression cover.
Docs.docs/_pipeline/templates/source-mapping.md.dt was updated and compiled with dotnet run --project tools/Reactor.DocPipeline -- compile --topic source-mapping.
CHANGELOG. Added an entry under "Fixed".
Validation commands and results on the final head:
dotnet test tests/Reactor.SourceMap.Tests -p:Platform=x64 in Debug and in Release: passed, 192/192 each.
dotnet test tests/Reactor.Tests -c Release -p:Platform=x64 over the nine generator test classes: passed, 175/175.
dotnet run --project tests/Reactor.AppTests.Host -c Debug -p:Platform=x64 -- --self-test --filter Wrap: 155/155 ok.
The same selftest command with --filter SourceMap: 38/38 ok.
CI on the head: green, including Build solution, Unit Tests, Selftests, Packaged and AOT Selftests, and E2E.
Earlier on this branch, before the review fixes:
dotnet restore Reactor.slnx then dotnet build Reactor.slnx --no-restore -c Release: succeeded, 0 errors. The restore used a mirror feed and NuGetAudit=false, because this machine's NuGet vulnerability feed is unreachable (NU1900).
The full dotnet test tests/Reactor.Tests -c Release -p:Platform=x64: passed, 15,125 succeeded, 64 skipped, 0 failed.
Risk / breaking changes
No public API change.CallSite.Signature in the generator's internal model is now nullable.
Behavior. More call sites get source-map entries when ReactorSourceMap is on.
Calls whose overload choice could change once the wrapper records are complete are deliberately left unstamped (fail closed). The trade-off is missing coverage, never a compile error.
With ReactorSourceMap off, there is no change.
Perf-sensitive path. The generators run on every build and edit. Measured costs:
about +3% generator CPU on a wrapper-heavy project;
no change for wrapper-free code (syntactic fast path).
…d their containers
The source-map generator cannot see factories Reactor.Wrappers.Generator emits
(no generator sees another's output), so calls to them were never stamped, and
every DSL call taking one as an argument failed to bind and was dropped too.
- Reactor.Wrappers.Generator now intercepts calls to the factories it emits,
gated on ReactorSourceMap=true AND Microsoft.UI.Reactor.Generated being in
InterceptorsNamespaces (it loads into every consumer compilation).
- The source-map generator recognises unbound wrapper-factory calls (records
their site for declared names/fingerprints) and re-binds containing DSL calls
speculatively with each wrapper call replaced by its element type.
- Position, path-map and transparency rules are shared via SourceMapShared.cs,
linked into both generators.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…isible factories
- Re-bind containing calls when an argument is any value typed as an
incomplete wrapper record (explicit locals, fields, typed helpers).
- Keep non-wrapper inferred types verbatim (a string local stays a string),
abandon bindings whose types merely contain the record, and decline method
groups with an overload taking the record itself or a type parameter, so an
interceptor can never target an overload the real compilation does not pick.
- Accept a visible wrapper factory only from metadata or .Wrapper.g.cs output.
- Tests: PathMap parity, transparent helpers, chained locals, overload pair,
enclosing-type / global / ambiguous using static lookup; stale comments.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…binding
The overload-stability guard only looked at the speculative winner's own type
and at parameters typed exactly as the wrapper record. An overload taking an
interface the record implements (IEquatable<FooElement>), a delegate returning
it (Func<FooElement>), or a competing using-static overload could still win in
the real compilation, making the emitted interceptor CS9144. The guard now
inspects every candidate visible at the call site and walks type arguments,
array elements and delegate signatures. WrapperFactoryOverloadTests pins all
three routes (each is a CS9144 build break with the old guard).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…nversions in the re-bind guard
- Walk the constructed invoke signature of generic delegates too
(delegate FooElement Maker<T>()).
- For Q.M(...), add Q and its base types' same-named methods to the candidates.
- Treat a parameter type declaring a conversion operator from the record (and
any conversion operator on the record) as reachable only by the record; do
not chain through operators, as C# applies at most one.
WrapperFactoryOverloadTests pins each (CS9144 without the guard).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…ent; gate on wrapper presence
- Re-check an already-resolved call whenever any value in its arguments is
typed as (or with) a wrapper record, not only when its top-level argument
types are errors.
- Walk each substituted value up to the call: value-preserving steps pass it
on; casts, explicit creations and calls whose every candidate returns one
type end the walk; <T>(this T) => T modifiers pass it on; anything else
abandons the re-bind. Depth-exhausted local inference, residual error-typed
locals and types that merely contain the record abandon it too.
- Skip all of it in a compilation that declares no wrapper record, and have the
wrapper generator reject calls by a per-compilation factory-name set before
binding (gallery: +23-46 ms, interleaved minimums at parity with main).
WrapperFactoryOverloadTests pins each route.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…r inference
- HasUnresolvedArgument now asks every value expression's type, so
default(FooElement) and casts to the record also trigger a re-check.
- A var local whose initializer is (still) the record is inferred as the record,
so its uses inside nested calls are position-checked like a direct wrapper call.
- Compare candidate return types ignoring nullability (object.ToString() is
string?, a record's override is string).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…records whole
- After rewriting, every expression in the arguments must be replaced, on a
validated path from a replacement (including nested calls whose result type
is fixed), or free of error types, wrapper-mentioning types and failed
bindings; otherwise the binding is declined, whether re-bound or original.
- Any error-typed expression anywhere in the arguments now triggers the check.
- Replace a record-typed expression whole only when its real type is certainly
the record (declared variable/member/parameter, default/new/cast, or a call
whose every candidate returns it); otherwise descend and position-check.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
- A local typed as the record is trusted whole only when its type is written
down or its var initializer itself flows to the record.
- A method-group argument whose candidates' signatures name a wrapper record,
or type arguments that name one (constraints the record does not satisfy
yet), decline interception in compilations with wrapper records. The latter
two were CS9144 on main as well.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…root walk
- An implicitly typed local (var, foreach var, deconstruction, out var, var
pattern) whose declaring statement depends on a wrapper record is re-derived
or declines: var content = Content(card) is a string here and an Element in
the real compilation (Button(string) vs Button(Element)); pre-existing on main.
- CheckPosition: a modifier call that is itself the inference root
(var sized = g.Width(140)) now ends the walk at the root.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
- Implicitly typed lambda parameters take their type from the call the lambda
is passed to; follow its receiver and other arguments
(new[] { content }.Select(item => Button(item))).
- Narrow out var / var pattern / deconstruction / foreach to the node that
decides the type, and cut cycles instead of failing closed, so ordinary
TryParse(..., out var n) and UseState<string[]>([...]) tuples keep their
stamps in wrapper projects.
- Ignore Roslyn's error-typed OmittedArraySizeExpression (string[]) and the
nameof identifier.
- Memoize the walk per compilation, query only value-producing nodes, and
cache the incomplete-wrapper set: on Reactor.AppTests.Host (wrappers, ~8000
call sites) zero sites lost vs main, 17 gained, generator time +5-15%;
wrapper-free projects unchanged.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…st path
- Query 'x as FooElement', operators and all other non-trivial expressions in
the dependency walk (only literals, interpolation shells, parentheses,
lambdas, this/base, typeof/sizeof are skipped); 'x as FooElement' is a
certain record, so such calls are re-bound and stamped.
- out var: follow the receiving call's receiver and other arguments.
- Query range variables: follow the clause that introduces them.
- Per-member fast path: a member none of whose identifiers names a wrapper
record, factory, alias of one, or a member whose signature mentions one skips
the wrapper analysis (synthesized record members are ignored; a user-defined
operator/conversion mentioning a record disables the fast path).
Reactor.AppTests.Host: generator time at parity with main, 0 sites lost, 17
gained.
- Driver Run() can complete the wrapper record after generation, so
SourceMapWrapperFastPathTests check interceptors against the real binding.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
…osed types
- Fast-path scope is the outermost type declaration (base lists, primary
constructors and the record's own body count) or the whole file for
top-level statements.
- A type is tainted if it is a wrapper record, has a tainted type argument or
delegate signature, or is a source type with a tainted base/interface; this
is used by the dependency walk, and tainted type names are indexed.
- Operators, conversions, indexers and implicitly called members
(Deconstruct, GetEnumerator, Current, GetAwaiter, Add, Invoke, ...) that
involve a record disable the fast path; this/base are queried.
- A factory-name token counts only when it does not bind (wrapper factory
names often equal Reactor's own).
- Wrapper records and the related-name set are found syntactically first
(seconds -> ~70 ms on Reactor.AppTests.Host): generator time +4% vs main,
0 sites lost, 17 gained.
SourceMapWrapperFastPathTests pins each route against the completed record.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
Artifact sizes for 2983e6f vs the base branch (db02633).
Packages (compressed .nupkg)
Artifact
base
PR
Δ
Microsoft.UI.Reactor.nupkg
1.93 MB
1.97 MB
+42.1 KB (+2.13%)
⚠️
Microsoft.UI.Reactor.Advanced.nupkg
493.9 KB
493.9 KB
-4 B (0.00%)
≈
Microsoft.UI.Reactor.Devtools.nupkg
287.9 KB
287.9 KB
+15 B (+0.01%)
≈
Assemblies in Microsoft.UI.Reactor
Artifact
base
PR
Δ
Reactor.Analyzers.dll
411.5 KB
411.5 KB
+0 B (0.00%)
≈
Reactor.dll
2.70 MB
2.70 MB
+0 B (0.00%)
≈
Reactor.Localization.Generator.dll
16.0 KB
16.0 KB
+0 B (0.00%)
≈
Reactor.Wrappers.Abstractions.dll
10.5 KB
10.5 KB
+0 B (0.00%)
≈
Reactor.Wrappers.Generator.dll
99.5 KB
144.0 KB
+44.5 KB (+44.72%)
⚠️
Assemblies in Microsoft.UI.Reactor.Advanced
Artifact
base
PR
Δ
Reactor.Advanced.dll
1.00 MB
1.00 MB
+0 B (0.00%)
≈
Assemblies in Microsoft.UI.Reactor.Devtools
Artifact
base
PR
Δ
Microsoft.UI.Reactor.Devtools.dll
787.5 KB
787.5 KB
+0 B (0.00%)
≈
✅ smaller / ⚠️ larger / ≈ within noise. Sizes come from a Release dotnet pack on the CI runner: packages are the compressed .nupkg download size, assemblies the uncompressed DLL inside it. workflow run.
This PR addresses #1425 by extending Reactor’s source mapping to generated wrapper factories and surrounding DSL calls, improving DevTools attribution for wrapped controls.
Changes:
Adds wrapper-owned interceptors and conservative rebinding of calls containing wrapper values.
Shares call-site and transparency logic between generators.
Adds regression coverage and updates source-mapping documentation.
Coverage for 2983e6f vs the base branch (db02633) — unit + selftest merged.
Metric
base
PR
Δ
Line
87.78%
87.79%
+0.01 pp
≈
Branch
76.88% (1004/1306)
76.95% (1005/1306)
+0.07 pp
≈
No coverage change beyond the noise floor. ✅
✅ higher / ⚠️ lower / ≈ within noise. Δ is in percentage points; coverage is unit + selftest merged (Debug x64) on the CI runner. Cobertura reports attached to the workflow run as artifacts.
- An explicit type argument naming a wrapper record, at any depth, makes
the call wrapper-dependent and unaccounted (constraint-filtered overloads).
- A type parameter constrained to a wrapper record is tainted.
- A member or call on a receiver whose type can change is not replaced whole.
- An implicitly typed lambda parameter is never certainly the record.
- CheckPosition judges the root's own step: a cast root is its cast type.
Each has a live regression in WrapperFactoryOverloadTests that fails the
build with CS9144 against the previous generator.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
For var gauge = FakeGauge().Width(140), DeclaredNameOf stops at the modifier because its return type is unresolved before wrapper generation, leaving CallSite.DeclaredName null. Extend the fluent-chain handling in SourceMapInterceptorGenerator.StaticInfo.cs to recognize validated record-preserving wrapper modifiers, and add a declared-name assertion for this form.
Handle invisible factories with explicitly declared wrapper bases
For [GenerateReactorWrapper(...)] partial record GaugeElement : Element;, the base is already visible but the generated Gauge() factory is not. This gate skips its static source-map facts and containing-call rebinding, so the independently stamped wrapper call still lacks its declared name and file fingerprint. Enable invisible-factory handling for locally declared wrapper factories as well as incomplete bases, and add an explicit-base regression.
- A method group converted to a delegate type naming a wrapper record is
wrapper-dependent (From(Make) into Func<FooElement, object>).
- A source type with a conversion operator to a wrapper record is tainted.
- A conditional only keeps the record as the root type when both arms are
the record; lag ? gauge : new object() is an object.
- Argument stamping without IOperation uses normal params form whenever the
argument implicitly converts to the params array type itself.
Each has a regression in WrapperFactoryOverloadTests (CS9144 at build, or
IndexOutOfRangeException at run time, against the previous generator).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
- A nested type of a generic (Outer<T>.Nested) is treated by its containing
type's arguments in ContainsTypeParameter and ReachableOnlyByTheRecord.
- Unqualified factory lookup follows each enclosing type's base chain, so
an inherited generated factory is found (ResolveUnboundCall,
InvisibleFactoryOwners).
- The generated-member guard only trusts a bound member that IS the
generated one (.Wrapper.g.cs), not a hand-written member on the record.
- ResolveUnboundCall rejects calls with a dynamic argument, which are
dynamically dispatched once the factory exists.
Regressions: NestedTypeOfAGenericOverTheRecord_IsNotTrusted,
FactoryInheritedByAnEnclosingRecord_OutranksAnImportedRival,
HandWrittenMemberBesideAGeneratedOne_IsNotTrusted (CS9144 against the
previous generator) and DynamicArgument_IsNeverIntercepted.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Human assessment is needed because wrapper-dependent binding and inference can break generated interceptor compilation, while factory filtering can suppress valid mappings from referenced assemblies.
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Wrapper-dependent binding, aliased callbacks, and implicit receivers can produce invalid interceptors that break otherwise valid builds, while the regression tests can miss generator exceptions.
- Generated invocable member names include those the wrapper record's own
attributes spell ([WrapAlias] Level -> Level / OnLevelChanged, ...).
- An unqualified Set(...)/On*(...) inside a wrapper record (or a type
deriving from one) has an implicit receiver that may gain the generated
member; it is judged like x.Set(...).
- Generator test drivers assert that no generator threw, so an exception can
no longer satisfy a 'no interceptor' assertion.
Regressions: AliasedCallbackPropertyThatHidesAnExtension_IsNotTrusted and
UnqualifiedCallToAGeneratedInstanceMember_IsNotInterceptedAsTheHelper
(CS9144 against the previous generator); ArgumentThatBecomesDynamic_IsNeverIntercepted
as regression cover.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Critical inference flaws can miss arguments that become dynamic after wrapper generation and ignore explicit generic type widening, leading to invalid interceptors and incorrect overload selection.
A fluent modifier called with an explicit type argument (Identity<object>())
decides its own result type, so CheckPosition no longer passes the wrapper
record through it.
Regression: ModifierWithAnExplicitTypeArgument_KeepsItsWiderType (CS9144
against the previous generator).
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 32d1eda3-a8e5-45c4-8d23-ffcffab5c974
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Nested-call analysis overlooks hidden wrapper factories, allowing the rewrite to select a different overload than the completed compilation and produce CS9144.
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
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.
Summary
Controls wrapped with
[GenerateReactorWrapper](SettingsCard,RadialGauge, …) got no source-map interceptor entry, and neither did any DSL call taking one as an argument (VStack(8, SettingsCard(...)),HStack(8, gauge)wherevar gauge = RadialGauge(...).Width(140)). DevTools therefore saw untagged elements,get-sourcefound no call site, and component roots showed as a bareStackPanel.Root cause: generators run against the same input compilation and cannot see each other's output. For
Reactor.SourceMap.Generator, a wrapper factory does not exist: the call binds to nothing, and the containing call fails overload resolution or binds with an error-typed argument. Both were dropped.The fix has two halves:
Wrapper calls.
Reactor.Wrappers.Generatorknows its factories' signatures, so it now intercepts calls to them itself (WrapperGenerator.SourceMap.cs).ReactorSourceMapand onInterceptorsNamespacesacceptingMicrosoft.UI.Reactor.Generated, with the compiler's parent-namespace andglobalrule.Element(a string label, for example) with that argument's own position. It never writes into a params array passed in normal form, and it skips any argument whose type could change once the wrappers exist.Calls that contain them.
Reactor.SourceMap.Generatorre-binds the containing call speculatively.Elementplaceholder. The record's generated base isElement, so it converts and overloads like that. Other inferred types use a non-constant placeholder.Set/On*member would outrank, including inherited, aliased and implicit-receiver ones and method groups;dynamicarguments.The generator never risks CS9144 (interceptor signature mismatch) to gain coverage.
Shared logic. Helpers used by both generators are in a linked
SourceMapShared.cs.Fast path. A per-type syntactic check keeps code that never touches a wrapper record on exactly main's path. Wrapper-free projects behave identically to main.
Two main bugs that could produce CS9144 were fixed along the way: method-group arguments, and explicit type arguments that name a wrapper record.
Follow-up alternative, not taken: bind against a compilation augmented with the wrapper generator's output. This was rejected for now because it duplicates the wrapper emit and costs a second semantic model per affected tree. The placeholder binding covers a strict subset of it. The trade-off is recorded in the
SourceMapInterceptorGenerator.WrapperFactories.csheader.Coverage and perf, measured with an offline harness that runs both generators, interleaved with main on the same machine:
Reactor.AppTests.Host(wrappers present, ~8k call sites)Linked issue / spec
Fixes #1425. Related to #1421.
Test plan
tests/Reactor.SourceMap.Tests. Compiling this project is itself the CS9144 oracle; each fail-closed rule has a case that does not build without it.WrapperFactoryInterceptionTests: rewritten from characterization to positive tests, plus argument stamping, normal-form params arrays,dynamicarguments, and wrappers that declare: Elementthemselves.WrapperFactoryOverloadTests: overload stability, interfaces, delegates, conversions, method groups,var/out var/query/lambda inference, constraints, nested generics and non-constant placeholders.WrapperFactoryCompetitorTests,WrapperGeneratedMemberTests,WrapperInheritedMemberTests,WrapperAliasMemberTests,WrapperImplicitReceiverTestsandWrapperFactoryNameofTests.tests/Reactor.Tests:WrappersGenerator/WrapperGeneratorSourceMapTests: gate, namespace-prefix rule, transparency, signature fidelity.SourceMapVisibleWrapperFactoryTests: wrapper factory visible in-compilation, viaMetadataReferenceandProjectReference, and for a wrapper that declares its own base.SourceMapWrapperFastPathTests: a route theory over fast-path versus slow-path shapes, an attribute-alias test, an expanding-generic stack-overflow guard, a hidden-factory method-group case, and a positive control.IndexOutOfRangeException, or an extra wrong interceptor). The exceptions are two cases the previous generator already declined, which are kept as regression cover.docs/_pipeline/templates/source-mapping.md.dtwas updated and compiled withdotnet run --project tools/Reactor.DocPipeline -- compile --topic source-mapping.Validation commands and results on the final head:
dotnet test tests/Reactor.SourceMap.Tests -p:Platform=x64in Debug and in Release: passed, 192/192 each.dotnet test tests/Reactor.Tests -c Release -p:Platform=x64over the nine generator test classes: passed, 175/175.WrapperGeneratorSourceMapTests,SourceMapVisibleWrapperFactoryTests,SourceMapWrapperFastPathTests,SourceMapTransparentGeneratorTests,WrapperGeneratorTests,PathMapParityTests,PassThroughFactoryDriftTests,ReactorSourceFormatTests,HookSlotTableTests.dotnet run --project tests/Reactor.AppTests.Host -c Debug -p:Platform=x64 -- --self-test --filter Wrap: 155/155 ok.--filter SourceMap: 38/38 ok.Earlier on this branch, before the review fixes:
dotnet restore Reactor.slnxthendotnet build Reactor.slnx --no-restore -c Release: succeeded, 0 errors. The restore used a mirror feed andNuGetAudit=false, because this machine's NuGet vulnerability feed is unreachable (NU1900).dotnet test tests/Reactor.Tests -c Release -p:Platform=x64: passed, 15,125 succeeded, 64 skipped, 0 failed.Risk / breaking changes
CallSite.Signaturein the generator's internal model is now nullable.ReactorSourceMapis on.ReactorSourceMapoff, there is no change.