-
Notifications
You must be signed in to change notification settings - Fork 543
[RGen] Bump the version of Roslyn and other nugets. #23234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WeakDelegate properties are marched as a ArgumentSemantic.Weak which in a normal case would mean that we do not mark them as dirty, but that is not the case for eak delegates since we do know we provide a strong delegate in the class. For example bgen will generate the following for a weak delegate: ```csharp [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] object? __mt_WeakDataSource_var; [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] public virtual NSObject? WeakDataSource { [Export ("dataSource", ArgumentSemantic.Weak)] get { global::UIKit.UIApplication.EnsureUIThread (); NSObject? ret; if (IsDirectBinding) { ret = Runtime.GetNSObject (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend (this.Handle, Selector.GetHandle ("dataSource")), false)!; } else { ret = Runtime.GetNSObject (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper (this.SuperHandle, Selector.GetHandle ("dataSource")), false)!; } MarkDirty (); __mt_WeakDataSource_var = ret; return ret!; } [Export ("setDataSource:", ArgumentSemantic.Weak)] set { global::UIKit.UIApplication.EnsureUIThread (); var value__handle__ = value.GetHandle (); if (IsDirectBinding) { global::ObjCRuntime.Messaging.void_objc_msgSend_NativeHandle (this.Handle, Selector.GetHandle ("setDataSource:"), value__handle__); } else { global::ObjCRuntime.Messaging.void_objc_msgSendSuper_NativeHandle (this.SuperHandle, Selector.GetHandle ("setDataSource:"), value__handle__); } GC.KeepAlive (value); MarkDirty (); __mt_WeakDataSource_var = value; } } ``` And the followign for the strong delegate: ```csharp [BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)] public IQLPreviewControllerDataSource DataSource { get { return (WeakDataSource as IQLPreviewControllerDataSource)!; } set { var rvalue = value as NSObject; if (!(value is null) && rvalue is null) throw new ArgumentException ("The object passed of type " + value.GetType () + " does not derive from NSObject"); WeakDataSource = rvalue; } } ``` With this commit the same happens for rgen. This is not the complete fix because we will need to still generate the strong delegate in rgen, that will happen in follow up change (needs a new flag/api to mark the property).
This commit allows to generate the strong delegate for a weak delegate in a bindings. The API provides two ways to configure the strong property: 1. StrongDelegateType: provide a Type for the new property. 2. StrongDelegateName: Allow to choose the generated property name. If empty the name will be the name of the WeakDelefate with the Weak prefix removed. We have some tests updates: 1. Remove the warnings from the tests. Some are due to the API being experimenta, other due to a rename. We will remove all errors in a comming PR. 2. Remove the strong delegate property from the test source since it is now generated. This completes the work for support properties (so far).
Bump the version of the Roslyn nugets which allows use to check if there are any compilation warnings/errors in the code used for the tests. This simplifies the debug process when we have a mistake in the test code. Some warnings that are incorrect from the roslyn analyzers had to be ignored, tests show that the warning is a false positive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR bumps the versions of various Roslyn and related NuGet packages to help identify compilation warnings/errors in test code and simplify debugging when test mistakes occur. Additionally, it suppresses the RS1039 false-positive warnings in a couple of test files and adds an assertion to ensure no error diagnostics are produced during code generation.
- Updated NuGet package versions across multiple test and source projects.
- Added #pragma directives to disable RS1039 warnings in tests.
- Asserted that no error diagnostics occur in generated code for improved test reliability.
Reviewed Changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
tests/rgen/Microsoft.Macios.Transformer.Tests.csproj | Bumped package versions and added asset declarations for improved dependency management. |
tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs | Disabled RS1039 warning around symbol retrieval. |
tests/rgen/Microsoft.Macios.Generator.Tests.csproj | Bumped package versions for Roslyn and testing libraries. |
tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs | Disabled RS1039 warning around symbol retrieval. |
tests/rgen/Microsoft.Macios.Generator.Tests/BaseGeneratorTestClass.cs | Added assertions to verify no error diagnostics after code generation. |
Other csproj files | Updated NuGet package versions to align with Roslyn updates. |
Comments suppressed due to low confidence (2)
tests/rgen/Microsoft.Macios.Transformer.Tests/Attributes/BindAsDataTests.cs:126
- [nitpick] Consider adding a comment explaining why the RS1039 warning is being disabled to provide context for future maintainers.
#pragma warning disable RS1039
tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsTests.cs:207
- [nitpick] Consider adding a comment explaining the rationale for disabling the RS1039 warning, to clarify that it addresses a known false positive.
#pragma warning disable RS1039
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
❗ API diff for current PR / commit (Breaking changes).NET ( ❗ Breaking changes ❗ )✅ API diff vs stable.NET ( No breaking changes )ℹ️ Generator diffGenerator Diff: vsdrops (html) vsdrops (raw diff) gist (raw diff) - Please review changes) Pipeline on Agent |
✅ [CI Build #4a5c34d] Build passed (Build macOS tests) ✅Pipeline on Agent |
💻 [CI Build #4a5c34d] Tests on macOS X64 - Mac Sonoma (14) passed 💻✅ All tests on macOS X64 - Mac Sonoma (14) passed. Pipeline on Agent |
💻 [CI Build #4a5c34d] Tests on macOS M1 - Mac Monterey (12) passed 💻✅ All tests on macOS M1 - Mac Monterey (12) passed. Pipeline on Agent |
💻 [CI Build #4a5c34d] Tests on macOS arm64 - Mac Sequoia (15) passed 💻✅ All tests on macOS arm64 - Mac Sequoia (15) passed. Pipeline on Agent |
💻 [CI Build #4a5c34d] Tests on macOS M1 - Mac Ventura (13) passed 💻✅ All tests on macOS M1 - Mac Ventura (13) passed. Pipeline on Agent |
🔥 [CI Build #4a5c34d] Test results 🔥Test results❌ Tests failed on VSTS: test results 0 tests crashed, 2 tests failed, 117 tests passed. Failures❌ dotnettests tests (Multiple platforms)
Html Report (VSDrops) Download ❌ monotouch tests (macOS)
Html Report (VSDrops) Download Successes✅ cecil: All 1 tests passed. Html Report (VSDrops) Download Pipeline on Agent |
…23235) Create two helper methods that will allow to interact with a tcs which is used in Async methods. --------- Co-authored-by: GitHub Actions Autoformatter <[email protected]>
🔥 [CI Build #de62f1b] Build failed (Build packages) 🔥Build failed for the job 'Build packages' (with job status 'Failed') Pipeline on Agent |
🔥 [PR Build #de62f1b] Build failed (Detect API changes) 🔥Build failed for the job 'Detect API changes' (with job status 'Failed') Pipeline on Agent |
Bump the version of the Roslyn nugets which allows use to check if there are any compilation warnings/errors in the code used for the tests. This simplifies the debug process when we have a mistake in the test code.
Some warnings that are incorrect from the roslyn analyzers had to be ignored, tests show that the warning is a false positive.