Skip to content

[xcode26.0] Merge main into xcode26.0. #23105

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

Merged
merged 12 commits into from
Jun 23, 2025

Conversation

rolfbjarne
Copy link
Member

No description provided.

mandel-macaque and others added 12 commits June 18, 2025 15:07
We are not yet fully doing the convesions needed for a block callback in
the native invoker call. We need the following:

```csharp
[BindingImpl (BindingImplOptions.GeneratedCode | BindingImplOptions.Optimizable)]
unsafe global::AudioUnit.AudioUnitStatus Invoke (ref global::AudioUnit.AudioUnitRenderActionFlags actionFlags, ref global::AudioToolbox.AudioTimeStamp timestamp, uint frameCount, nint outputBusNumber, global::AudioToolbox.AudioBuffers outputData, [BlockProxy (typeof (ObjCRuntime.Trampolines.NIDAURenderPullInputBlock))]global::AudioUnit.AURenderPullInputBlock? pullInputBlock)
{
  var outputData__handle__ = outputData.GetHandle ();
  using var block_pullInputBlock = Trampolines.SDAURenderPullInputBlock.CreateNullableBlock (pullInputBlock);
  BlockLiteral *block_ptr_pullInputBlock = null;
  if (pullInputBlock is not null)
    block_ptr_pullInputBlock = &block_pullInputBlock;
  var ret = (AudioUnitStatus) invoker (BlockPointer, (AudioUnitRenderActionFlags*) global::System.Runtime.CompilerServices.Unsafe.AsPointer<AudioUnitRenderActionFlags> (ref actionFlags), (global::AudioToolbox.AudioTimeStamp*) global::System.Runtime.CompilerServices.Unsafe.AsPointer<global::AudioToolbox.AudioTimeStamp> (ref timestamp), frameCount, outputBusNumber, outputData__handle__, (IntPtr) block_ptr_pullInputBlock);
  GC.KeepAlive (outputData);
  return ret!;
}
```

This change adds the declaration of the 'block_pullInputBlock', we will
add the assigment in comming PRs to make the reviews easier.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
…ines. (#23078)

Generates the creation of a BlockLiteral pointer aux variable that will
be used to pass a block callback to the invoker.

---------

Co-authored-by: GitHub Actions Autoformatter <github-actions-autoformatter@xamarin.com>
…2996)

Add validation for conflicting resources, showing a warning if the same
resource is found from multiple sources.

Fixes #19029.
… an object in the finalizer queue. (#23072)

The following happens:

1. An instance of a custom NSObject subclass is created, with both a native instance
   and the corresponding managed wrapper.

2. Native code creates a weak reference to the native instance.

3. No other managed code references the managed instance, and there's no non-weak
   native reference to the native instance, so the GC schedules the managed instance
   for finalization.

4. Native code fetches the native instance from the weak reference.

5. Native code thinks it can do whatever it wants with the native instance, because
   it got a perfectly valid (and retained) native instance. Unfortunately, there's no way
   to stop the managed instance from being finalized (which happens on a background
   thread anyway, so there's no thread-safe way to do it), which means havoc ensues.

The most frequent manifestation of this problem has been like this:

    ObjCRuntime.RuntimeException: Failed to marshal the Objective-C object 0x13d566800 (type: Microsoft_Maui_Platform_MauiTextField). Could not find an existing managed instance for this object, nor was it possible to create a new managed instance (because the type 'Microsoft.Maui.Platform.MauiTextField' does not have a constructor that takes one NativeHandle argument).
       at ObjCRuntime.Runtime.MissingCtor(IntPtr , IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
       at ObjCRuntime.Runtime.ConstructNSObject[NSObject](IntPtr , Type , MissingCtorResolution , IntPtr , RuntimeMethodHandle )
       at ObjCRuntime.Runtime.ConstructNSObject[NSObject](IntPtr , Type , MissingCtorResolution )
       at ObjCRuntime.Runtime.ConstructNSObject(IntPtr , IntPtr , MissingCtorResolution )
       at ObjCRuntime.Runtime.GetNSObject(IntPtr , MissingCtorResolution , Boolean )
       at ObjCRuntime.Runtime.GetNSObject(IntPtr )
       at ObjCRuntime.Runtime.InvokeConformsToProtocol(IntPtr , IntPtr )
       at ObjCRuntime.Runtime.invoke_conforms_to_protocol(IntPtr obj, IntPtr protocol, IntPtr* exception_gchandle)
       Exception_EndOfInnerExceptionStack

but other problems can also occur.

This is a rather complicated issue to fix, because:

* There's no way to be notified when native code creates a weak reference to a
  native instance.
* There's not even a way to know if anybody has a weak reference to a native
  instance.
* I also looked into manually clearing the weak references for a native
  instance, but that's not possible either.

However, it is possible to basically say "nope!" when native code tries to
fetch a native instance from a weak reference:

We override the '[NSObject retainWeakReference]' method for all custom
NSObject subclasses, and return FALSE if the corresponding managed object has
been scheduled for finalization (otherwise call the base class implementation).

The ['[NSObject retainWeakReference]'][1] method is public, but it's not
documented how it's supposed to behave. Fortunately, the corresponding [source
code][2] is public, so we can figure out the semantics ourselves: return
`TRUE` if the object can be / was retained, `FALSE` otherwise.

* Fixes #21648.
* Fixes dotnet/maui#28261.
* Fixes #19076.

Might also fix the following issues:

* #22867
* #19579
* #4207
* https://bugzilla.xamarin.com/show_bug.cgi?id=34242 (https://web.archive.org/web/20170630214134/https://bugzilla.xamarin.com/show_bug.cgi?id=34242)

[1]: https://developer.apple.com/documentation/foundation/nsproxy/retainweakreference
[2]: https://github.com/apple-oss-distributions/objc4/blob/f126469408dc82bd3f327217ae678fd0e6e3b37c/runtime/NSObject.mm#L539-L541
…1: Build ID 11793019 (#23081)

This is the pull request automatically created by the OneLocBuild task in the build process to check-in localized files generated based upon translation source files (.lcl files) handed-back from the downstream localization pipeline. If there are issues in translations, visit https://aka.ms/icxLocBug and log bugs for fixes. The OneLocBuild wiki is https://aka.ms/onelocbuild and the localization process in general is documented at https://aka.ms/AllAboutLoc.

---------
Brings important changes around Xamarin deprecation and Mac paths:

- Updated Xamarin.Messaging to 18.0.136-g9e200fbc6d
- Added target before SayHello to set default Messaging context path values
- Adapted code to Messaging API changes
- IL merge BouncyCastle.Cryptography (new SSH.NET dependency)
- Updated from old Xamarin path to new maui path in test scripts
- Fixed CompileNativeCode to correctly resolve dotnet packs paths

---------

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
Some of the delegates in the framework were wrong.
…1: Build ID 11794572 (#23089)

Localized file check-in by OneLocBuild Task: Build definition ID 14411: Build ID 11794572 (#23089)

This is the pull request automatically created by the OneLocBuild task in the build process to check-in localized files generated based upon translation source files (.lcl files) handed-back from the downstream localization pipeline. If there are issues in translations, visit https://aka.ms/icxLocBug and log bugs for fixes. The OneLocBuild wiki is https://aka.ms/onelocbuild and the localization process in general is documented at https://aka.ms/AllAboutLoc.
@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: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

✅ [CI Build #582ecb6] Build passed (Build macOS tests) ✅

Pipeline on Agent
Hash: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

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

Pipeline on Agent
Hash: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🚀 [CI Build #582ecb6] Test results 🚀

Test results

✅ All tests passed on VSTS: test results.

🎉 All 117 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 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: 582ecb6a43a97f8a009110a82822211ca4a611fb [PR build]

@rolfbjarne rolfbjarne merged commit dc6dab1 into xcode26.0 Jun 23, 2025
44 checks passed
@rolfbjarne rolfbjarne deleted the dev/rolf/bump-main-in-xcode26.0-2025-06-20 branch June 23, 2025 08:21
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.

5 participants