Skip to content

Conversation

mandel-macaque
Copy link
Member

Do not allow selectors to be null or empty.

mandel-macaque and others added 8 commits August 19, 2025 10:45
Add the baseic checks to ensue that a user did not use any of the fields
of the ExportAttribute<T> that are only allowed with
ExportAttribute<Method>.
1. Make sure that the native prefix/suffix does not have white spaces.
2. Make sure that the async method name does not have white spaces.
3. Make sure that the different type names do not have white spaces.

Tests got added for all the new strategies.
Passing the RootContext will allow to provide the compilation
information such as the target platform of the current compilation this
can be used to make better decisions.
… and a set of validators.

Move the analyzer to use the Validator approach, this removes the need
to add some code duplication to parse the AST. This new approach re-uses
the data model of rgen to parse the AST and uses a validator to ensure
that the data struct is correct.

The SmartEnumsAnalyzer will be remove in later commits as soon as we
have the SmartEnumValidator implemented with the same checks.
This commit implements the validation of SmartEnums. There are some
changes in how we generate the enums since we now can relay on the
analyzer to raise errors and be just let the struct parse the
ast/semantic model.

The analyzer checks for the following errors:

1. A SmartEnum must have at least ONE memeber that points to a native
   value. We allow to have other memebers without it to allow things
   such as "FIRST = LAST".
2. All fields should be unique. We cannot have two fields pointing to
   the same native value.
3. The fields are a valid identifier.
4. The library paths are set when in a custom namespace.
5. The library paths should not be set when working with a Apple
   framework.
6. Ensure that if a enum or enum value is present in the compilation,
   that the platform is marked as supported.
The validator makes sure that:

1. The selector is not null.
2. The selector has no white spaces.
3. No flgas that will be ignored are used. If they are we raise a
   warning.
4. Fields are partial.
5. Fields are static.
6. If a field or any of its accessors was marked as unsupported but is
   present in the compilation platform, we raise an error.

This class will later be used to validate fields on a class.
Do not allow selectors to be null or empty.
@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 #de4c39b] Tests on macOS X64 - Mac Sonoma (14) passed 💻

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

Pipeline on Agent
Hash: de4c39bfb826f80d603eddee55534cfa80af3fb2 [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

🚀 [CI Build #de4c39b] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 115 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 4 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 11 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: de4c39bfb826f80d603eddee55534cfa80af3fb2 [PR build]

@mandel-macaque mandel-macaque force-pushed the dev/mandel/field-validator branch from c1d3e60 to f1e21b4 Compare August 21, 2025 11:59
Base automatically changed from dev/mandel/field-validator to main September 2, 2025 20:55
@mandel-macaque mandel-macaque force-pushed the dev/mandel/string-null-or-empty branch from b9d109e to db1d4ec Compare September 2, 2025 21:17
@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@vs-mobiletools-engineering-service2

This comment has been minimized.

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #db1d4ec] Build passed (Build packages) ✅

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #db1d4ec] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@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: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@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: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #d924e12] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: db1d4ec2f558a1845a2bd24f9daaba9b942acbe0 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: d924e123f3242f113944e83730c88f7daec212c6 [PR build]

@mandel-macaque
Copy link
Member Author

Tests pass but there is a bug in the CI timeout:
Screenshot 2025-09-03 at 9 53 16 AM

@mandel-macaque mandel-macaque merged commit c15d0ab into main Sep 3, 2025
39 of 42 checks passed
@mandel-macaque mandel-macaque deleted the dev/mandel/string-null-or-empty branch September 3, 2025 13:53
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