Skip to content

Commit e0995ea

Browse files
committed
fix: minor corrections to ViewLocator implementation
- Update BindingGenerator XML doc to mention all three pipelines (A, B, C) - Make DefaultViewLocator _lock instance-scoped instead of static since it only guards the per-instance _mappings dictionary
1 parent 815afd7 commit e0995ea

2 files changed

Lines changed: 11 additions & 10 deletions

File tree

src/ReactiveUI.Binding.SourceGenerators/BindingGenerator.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,10 @@ namespace ReactiveUI.Binding.SourceGenerators;
1515

1616
/// <summary>
1717
/// The main incremental source generator entry point for ReactiveUI property observation and binding.
18-
/// Orchestrates two pipelines:
18+
/// Orchestrates three pipelines:
1919
/// Pipeline A (Type Detection): Detects notification mechanisms and generates high-affinity fallback binders.
2020
/// Pipeline B (Invocation Detection): Detects WhenChanged/WhenChanging/Bind calls and generates per-invocation code.
21+
/// Pipeline C (View Dispatch): Scans IViewFor&lt;T&gt; implementations and generates AOT-safe view locator dispatch.
2122
/// </summary>
2223
[Generator]
2324
public class BindingGenerator : IIncrementalGenerator

src/ReactiveUI.Binding/View/DefaultViewLocator.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,21 @@ namespace ReactiveUI.Binding;
1313
/// </summary>
1414
public sealed class DefaultViewLocator : IViewLocator
1515
{
16-
/// <summary>
17-
/// Synchronization lock for thread-safe access to mappings.
18-
/// </summary>
19-
#if NET9_0_OR_GREATER
20-
private static readonly Lock _lock = new();
21-
#else
22-
private static readonly object _lock = new();
23-
#endif
24-
2516
/// <summary>
2617
/// Source-generated dispatch function set by the generated code.
2718
/// Signature: (viewModelInstance, contract) returns IViewFor or null.
2819
/// </summary>
2920
private static Func<object, string, IViewFor?>? _generatedDispatch;
3021

22+
/// <summary>
23+
/// Synchronization lock for thread-safe access to this instance's mappings.
24+
/// </summary>
25+
#if NET9_0_OR_GREATER
26+
private readonly Lock _lock = new();
27+
#else
28+
private readonly object _lock = new();
29+
#endif
30+
3131
/// <summary>
3232
/// Runtime explicit mappings from (viewModelType, contract) to view factory.
3333
/// Uses copy-on-write semantics for thread safety.

0 commit comments

Comments
 (0)