Repository navigation
Remove [Experimental] From the BindableProperty Source Generators - #3461
Draft
TheCodeTraveler wants to merge 105 commits into
Draft
TheCodeTraveler wants to merge 105 commits into
TheCodeTraveler wants to merge 105 commits into
Conversation
… type (r1-11) Models hold type names instead of ITypeSymbol, outputs are grouped per type after Collect so unchanged types stay cached, and incremental-step tests cover unrelated edits, edits inside a type and symbol-free tracked outputs. The ArrayPool buffers are gone, so there is nothing left to clear. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…amed arguments, skips file-local types and static-constructor fields Adds SG and runtime tests for r1-04, r1-05, r1-06, r1-09, r1-21, r1-22, r2-03, r2-12 and r3-01. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Remove dead Roslyn setup from BindablePropertyModelTests; the old ITypeSymbol assertions (propertySymbol.Type vs ReturnType, DeclaringType) were replaced because they locked in r1-11. Add attached constructor and class+constructor merge cases to the caching tests, and named tracking steps for the model providers. Drop unread AttachedBindablePropertyModel DeclaringTypeName/IsDeclaringTypeNullable; move ShouldPostpendNullableToType into the generator; compute it once; pass method groups to RegisterSourceOutput. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ashing the generators (r1-10, r3-02) Adds an equatable diagnostic model carried through both pipelines, and test infrastructure (multi-file driver run, user-file diagnostics, DiagnosticResult support). Replaces the tests that locked in the old throws with tests that expect the diagnostics. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- r1-09: folded byte/sbyte/short/ushort/nint/nuint constants keep their own type via a cast - r3-01: file-local enum fold and default(FileLocalStruct) now use the creator instead of naming the type or boxing null - r1-05: static constructor guard only applies to fields without initializer or that the constructor mentions; replaces the SG test that locked in the broader (17.0.0-changing) behavior - Brush NotSame checks stay removed: MAUI caches the Color->Brush result, so identity is not the toolkit's to assert - Shared GeneratedCreateCallLookup test helper, unused DefaultAmount constants removed, stale test comments reworded Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Recursive file-local type check (type arguments, arrays, pointers), in arguments kept, static-constructor guard counts only writes, generic nested receiver keeps type arguments, KeywordNamedFieldsHost derives from BindableObject. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…modifier misuse as MCTSG010-022 (r2-07, r2-09, r2-10, r2-11, r1-23, r1-02, r1-03, r3-05, U5, U7, U8) Replaces two lock-in tests that expected no diagnostic for an initializer next to DefaultValueCreatorMethodName (now an Info). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Qualify callbacks imported with using static, report simple-name callbacks on file-local attached hosts, unbound generic qualifiers (MCTSG024) and bodyless or conditional callbacks (MCTSG025). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r helper always nested in the host (r2-02, r2-01, r1-14, U3, U10) Replaced expected-output tests and the strict-warning ID list that locked in the namespace-level helper and the process-wide static flag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…l host keyword, support record attached hosts (r1-02, r1-03, r2-05, U6) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t attached hosts; format Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copy unsafe, skip non-partial record attached hosts with MCTSG026, pin override-of-base-BP and creator-path hazards, tighten host tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…, fix read-only attached array typeof, drop @ from PropertyName Existing snapshot expectations were updated: they locked in unqualified type names and the "@Class" PropertyName (r1-15, DECIDED). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Escape contextual keywords (file, required, scoped) as type names, share the helper with the callback resolver, escape qualified nameof callbacks, derive the keyword test view from BindableObject, and reuse DeclaringTypeName for the helper cast. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…able value types, null-checked accessors, XML doc prefix, file-local type diagnostic (r2-08, r1-16, S02, D6, U4/S15, U13) Updated snapshot tests that locked in typeof(int) for nullable value types and expression-bodied accessors. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-06), read-only default OneWayToSource (S05/D4), documented key field (r1-17) Snapshot tests that locked in BindingMode 0 for read-only properties now expect OneWayToSource. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict in BindablePropertyAttributeSourceGenerator.cs: B0 replaced the
model's ITypeSymbol ReturnType with strings, so B2's r1-04 dynamic fix now
computes the typeof operand ("object" for dynamic) into
NonNullableReturnTypeName and carries a new IsDynamicReturnType bool for the
(object?) setter cast. B4's IsObsolete and AppendInitializingField are kept.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sts, U10 comment in the resolver B3 qualifies the declaring type in typeof() with global::, so B2's ResolvedDefaultValueConversionTests now expect typeof(global::TestNamespace.TestView). The assertions are otherwise unchanged. Adds the U10 WHY comment that B4's review deferred to the resolver: a host field from another partial file is read safely only because Roslyn orders generated trees after user trees. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
After the merge the cast is driven by the new IsDynamicReturnType model flag. Without it SetValue binds through the C# runtime binder (not trim-safe or NativeAOT-safe), yet every existing test passed (B2 review 3, nit 1). Rows for "", tr-TR and az-Latn-AZ, writable and read-only key setters. With the flag forced to false, exactly these new tests fail. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…the field the property's diagnostic, not always a warning Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Error-level [Obsolete] on a declared field no longer breaks generated code: the static constructors get a warning-level [Obsolete], and attached accessors read the field through an [Obsolete] helper. Sample member order and a using fixed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nerated accessors (MCTSG036) and merge same-named file-local hosts safely Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- MCTSG036 says "the generated GetMode method" or "the generated GetMode and SetMode methods" instead of a singular "method" for two accessors.
- The bug theory asserts the quoted least accessible type ('P.Mode', 'P.H.Secret', 'P.Modes.Mode') and the full accessor and setting phrase, so naming List<Mode> or Mode[] instead of Mode fails.
- New bug rows: an array of an internal enum, and a protected internal getter with an internal type (both CS0050 on origin/main).
- Renames: accessorsMoreAccessibleThanTheType, EffectiveAccessibility.GetForTypeAndContainers and GetForTypeIncludingTypeArguments.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…bleProperty] declarations so CS9248 no longer hides the MCTSG analyzer diagnostics on command-line builds (r4-01) Replaces the three EdgeCase tests that expected CS9248 next to the MCTSG005 (they locked in the bug). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ect (MCTSG037), a property type that cannot be stored as object (MCTSG038) and a non-field member named like the property field (MCTSG030) on the user's code (r4-02, r4-12, r4-07) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…essors of a skipped attached property so CS8795 no longer hides the MCTSG diagnostics (r4-01, attached part) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Use the field-backed stub body only under C# 14, make the MCTSG037 message one sentence, pin ID, severity and line in the new diagnostic tests, add skipped-with-initializer command-line rows, and tidy the stub helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…SG039, not as missing (r4-13) The old OtherCallbacks.Hidden row in MisuseDiagnosticTests locked in the misleading MCTSG010 classification, so it now expects MCTSG039. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…0.0 (r4-03) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…default is read before it is assigned (r4-04, r4-08) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…-global usings, and report the ones that cannot be reached (r4-10) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng types Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ons, report unreachable ones as MCTSG040 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…CTSG041 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…G011/MCTSG012, not as missing Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…moving the pragma lines Windows CI checks the file out with CRLF (* text=auto), so the "...\n" replacements never matched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of Change
[BindableProperty]and[AttachedBindableProperty<T>]are no longer experimental. This PR removes[Experimental("MCTEXP001")]from both attributes and fixes the generator bugs we found while testing them. It also adds diagnostics for code the generators can't handle, and an opt-in way to use the generated properties with MAUI's XAML source generator.Note
Draft: still in progress. It's open early so review can start. Still to do:
Breaking changes
BindingMode.OneWayToSource, like MAUI'sCreateReadOnlyandCreateAttachedReadOnly. This includesLazyView.IsLoaded.(ImageSource)"a.png", now goes to the default value creator, like the implicit form. Each instance gets its own value, andXProperty.DefaultValueisdefault(T).IsNullableor<int?>) registerstypeof(int?)with anulldefault, and settingnullstoresnull.Get{Name}andSet{Name}throwArgumentNullExceptionfor anullbindable. This includes the toolkit's own attached properties onDockLayout,StateContainer,StateView,MultiValidationBehavior,SetFocusOnEntryCompletedBehaviorand the AndroidNavigationBar.@event, registers the property nameeventinstead of@event.[Obsolete]and[Experimental]on a property are copied to its generatedXPropertyfield.BindablePropertyDiagnostic.BindablePropertyAttributeExperimentalDiagnosticId(MCTEXP001) is now[Obsolete]. It will be removed in .NET 12.What else changed
MCTSG005toMCTSG041(AnalyzerReleases.Unshipped.md). An Error is used only where the code already failed to build, with compiler errors in generated code or a generator crash. Analyzers report the rules, so they see members from other generators and work with.editorconfig.public static readonly BindableProperty XProperty;itself, plus a partialGetXfor attached properties. The generator writes the rest. MAUI's XAML source generator can see a declared field, so{DynamicResource},VisualStatesetters and{x:Static}work on MAUI 11.0.10.AccessModifier, with examples.Tests (latest local run)
CommunityToolkit.Maui.UnitTests: 12,840 passed, under both the default culture andtr-TR.pwsh eng/format.ps1is clean, and the library builds fornet11.0with 0 warnings.Linked Issues
PR Checklist
approved(bug) orChampioned(feature/proposal)mainat time of PR (6 commits behind; merges cleanly)Additional information
Tested locally on macOS. Device tests are still to come (see the note above).
🤖 Generated with Claude Code