Skip to content

Conversation

mandel-macaque
Copy link
Member

Add part of the class validator that will analyze a class and will check for several things in the propertites and methods:

  1. Validates all fields and properties using the PropertyOrField validator.
  2. Validates that WeakDelegates do not use the same strong delegate name.
  3. Selectors are unique.

Added a end to end test for the class analyzer.

mandel-macaque and others added 4 commits August 20, 2025 12:16
Weak delegate properties have to start with 'Weak' or provide a strong
delegate name for the rgen to generate a unique valid name.

Added tests to ensure that both the PropertyValidator and
PropertyOrFieldValidator return the correct error.
Add part of the class validator that will analyze a class and will check
for several things in the propertites and methods:

  1. Validates all fields and properties using the PropertyOrField
     validator.
  2. Validates that WeakDelegates do not use the same strong delegate
     name.
  3. Selectors are unique.

Added a end to end test for the class analyzer.
@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

/// <param name="diagnostics">When this method returns, contains diagnostics for any duplicate selectors; otherwise, an empty array.</param>
/// <param name="location">The code location to be used for the diagnostics.</param>
/// <returns><c>true</c> if all selectors are unique; otherwise, <c>false</c>.</returns>
bool SelectorsAreUnique (Binding binding, RootContext context,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selectors can actually be duplicated, it's only a problem if they're exported, which doesn't happen if the [Sealed] attribute is present.

Here's an example:

macios/src/foundation.cs

Lines 5378 to 5388 in 052a9e9

[Internal]
[Sealed]
[Export ("replaceObjectAtIndex:withObject:")]
void _ReplaceObject (nint index, IntPtr withObject);
/// <param name="index">To be added.</param>
/// <param name="withObject">To be added.</param>
/// <summary>To be added.</summary>
/// <remarks>To be added.</remarks>
[Export ("replaceObjectAtIndex:withObject:")]
void ReplaceObject (nint index, NSObject withObject);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can leave it as a warning that can be disabled with a #prama so that we know it is a not common situation.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #1062fa8] Build passed (Build packages) ✅

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [PR Build #1062fa8] Build passed (Detect API changes) ✅

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ API diff for current PR / commit

.NET ( No breaking changes )

✅ API diff vs stable

.NET ( No breaking changes )

ℹ️ Generator diff

Generator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes)

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #1062fa8] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1062fa8] Tests on macOS X64 - Mac Sonoma (14) passed 💻

All tests on macOS X64 - Mac Sonoma (14) passed.

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1062fa8] Tests on macOS arm64 - Mac Sequoia (15) passed 💻

All tests on macOS arm64 - Mac Sequoia (15) passed.

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1062fa8] Tests on macOS M1 - Mac Monterey (12) passed 💻

All tests on macOS M1 - Mac Monterey (12) passed.

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

💻 [CI Build #1062fa8] Tests on macOS M1 - Mac Ventura (13) passed 💻

All tests on macOS M1 - Mac Ventura (13) passed.

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #1062fa8] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 121 tests passed 🎉

Tests counts

✅ cecil: All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (iOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (MacCatalyst): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (macOS): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (Multiple platforms): All 1 tests passed. Html Report (VSDrops) Download
✅ dotnettests (tvOS): All 1 tests passed. Html Report (VSDrops) Download
✅ framework: All 2 tests passed. Html Report (VSDrops) Download
✅ fsharp: All 4 tests passed. Html Report (VSDrops) Download
✅ generator: All 5 tests passed. Html Report (VSDrops) Download
✅ interdependent-binding-projects: All 4 tests passed. Html Report (VSDrops) Download
✅ introspection: All 6 tests passed. Html Report (VSDrops) Download
✅ linker: All 44 tests passed. Html Report (VSDrops) Download
✅ monotouch (iOS): All 8 tests passed. Html Report (VSDrops) Download
✅ monotouch (MacCatalyst): All 15 tests passed. Html Report (VSDrops) Download
✅ monotouch (macOS): All 9 tests passed. Html Report (VSDrops) Download
✅ monotouch (tvOS): All 8 tests passed. Html Report (VSDrops) Download
✅ msbuild: All 2 tests passed. Html Report (VSDrops) Download
✅ windows: All 3 tests passed. Html Report (VSDrops) Download
✅ xcframework: All 4 tests passed. Html Report (VSDrops) Download
✅ xtro: All 1 tests passed. Html Report (VSDrops) Download

Pipeline on Agent
Hash: 1062fa8e497d027b0736ad4c8eec9eaaf0dcde84 [PR build]

@mandel-macaque mandel-macaque merged commit 2705bc6 into main Sep 8, 2025
40 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/class-validator-properties-and-fields branch September 8, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants