Skip to content

[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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

mandel-macaque
Copy link
Member

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.

mandel-macaque and others added 5 commits June 27, 2025 18:57
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.
@mandel-macaque mandel-macaque requested a review from Copilot June 28, 2025 15:53
Copy link
Contributor

@Copilot Copilot AI left a 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

@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

❗ API diff for current PR / commit (Breaking changes)

.NET ( ❗ 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: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #4a5c34d] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [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)

1 tests failed, 0 tests passed.
  • DotNet tests: Failed (Execution failed with exit code 1)

Html Report (VSDrops) Download

❌ monotouch tests (macOS)

1 tests failed, 8 tests passed.
  • monotouch-test/macOS/Debug (managed static registrar): Failed (Test run failed.
    Tests run: 3172 Passed: 3059 Inconclusive: 7 Failed: 1 Ignored: 112)

Html Report (VSDrops) Download

Successes

✅ 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 (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 15 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: 4a5c34dbcf335bfafa60511393a060d4da353610 [PR build]

Base automatically changed from dev/mandel/generate-strong-delegate to main June 30, 2025 11:53
@mandel-macaque mandel-macaque marked this pull request as draft June 30, 2025 17:04
…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]>
@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #de62f1b] Build failed (Build packages) 🔥

Build failed for the job 'Build packages' (with job status 'Failed')

Pipeline on Agent
Hash: de62f1bc448f0e887e6871f9a9a6180098f5bbc6 [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [PR Build #de62f1b] Build failed (Detect API changes) 🔥

Build failed for the job 'Detect API changes' (with job status 'Failed')

Pipeline on Agent
Hash: de62f1bc448f0e887e6871f9a9a6180098f5bbc6 [PR build]

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.

2 participants