Skip to content

[net11.0] [tools/msbuild] Add InlineDlfcnMethodsStep as an opt-in custom linker step#24889

Draft
rolfbjarne wants to merge 37 commits intonet11.0from
dev/rolf/inline-dlfcn-net11.0
Draft

[net11.0] [tools/msbuild] Add InlineDlfcnMethodsStep as an opt-in custom linker step#24889
rolfbjarne wants to merge 37 commits intonet11.0from
dev/rolf/inline-dlfcn-net11.0

Conversation

@rolfbjarne
Copy link
Member


⚠️ This is a pull request only to see what happens after #24888 gets merged into net11.0. ⚠️

⚠️ No need to review this, it won't be merged. ⚠️


… step

Add a new custom linker step that replaces runtime `Dlfcn.dlsym` calls with
direct native symbol lookups via P/Invokes to `__Internal`. This improves
startup performance and app size, and ensures the native linker can see symbol
references that would otherwise only be resolved at runtime.

Two modes are supported, controlled by the `InlineDlfcnMethods` MSBuild
property:

* `strict`: inlines all calls to `ObjCRuntime.Dlfcn` APIs.
* `compatibility`: only inlines calls that reference symbols from `[Field]`
  attributes.

Post-trimming MSBuild targets ensure native code is only generated for symbols
that survive trimming (ILTrim or NativeAOT):

* `_CollectPostILTrimInformation`: scans trimmed assemblies for surviving
  inlined dlfcn P/Invokes, with per-assembly caching for incremental builds.
* `_CollectPostNativeAOTTrimInformation`: reads unresolved symbols from the
  NativeAOT object file or static library and filters for inlined dlfcn symbols.
* `_PostTrimmingProcessing`: generates native C code for surviving symbols and
  adds it to the native link inputs.

Extends `MachO.cs` with LC_SYMTAB parsing to read unresolved symbols from both
Mach-O object files and static libraries.

Contributes towards #17693.
@rolfbjarne rolfbjarne requested a review from Copilot March 12, 2026 12:35
@rolfbjarne rolfbjarne added the do-not-merge Do not merge this pull request label Mar 12, 2026
Copy link
Contributor

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 brings the [tools/msbuild] InlineDlfcnMethodsStep work into the net11.0 branch, wiring up an opt-in (and for .NET 11+ defaulted) custom linker step that inlines ObjCRuntime.Dlfcn symbol lookups and adds post-trimming MSBuild processing to generate native glue only for surviving symbols. It also updates tests and documentation around native symbol handling.

Changes:

  • Add linker steps to inline Dlfcn calls and emit a symbol list for later build steps.
  • Add MSBuild targets/tasks to collect post-trim surviving symbols (ILTrim + NativeAOT) and generate/compile native C glue.
  • Update runtime/framework code and tests for new array/enum helpers, symbol handling, and Xcode 26.3 support.

Reviewed changes

Copilot reviewed 42 out of 44 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/mtouch/Errors.resx Adds new MX225x messages for InlineDlfcnMethodsStep warnings.
tools/mtouch/Errors.designer.cs Regenerates resource accessors for new MX225x strings.
tools/linker/MonoTouch.Tuner/ProcessExportedFields.cs Collects [Field] symbol names for compatibility mode.
tools/linker/MonoTouch.Tuner/ListExportedSymbols.cs Avoids exported symbol listing logic when inline-dlfcn is enabled.
tools/dotnet-linker/Steps/InlineDlfcnMethodsStep.cs New linker step that rewrites ObjCRuntime.Dlfcn call sites to generated P/Invokes.
tools/dotnet-linker/Steps/GenerateInlinedDlfcnNativeCodeStep.cs New linker step that writes a symbol list to intermediate output.
tools/dotnet-linker/LinkerConfiguration.cs Plumbs new InlineDlfcnMethods settings and symbol collections through linker configuration.
tools/dotnet-linker/AppBundleRewriter.cs Adds a few additional type/method references used by new rewriting logic.
tools/common/SdkVersions.cs Updates max iOS simulator version to 26.3.
tools/common/MachO.cs Adds LC_SYMTAB parsing and support for reading unresolved symbols from Mach-O/object/static libraries.
tests/xharness/Jenkins/TestVariationsFactory.cs Adds new test variations to exercise inline-dlfcn modes.
tests/monotouch-test/VideoToolbox/VTDecompressionSessionTests.cs Ensures async frames complete via WaitForAsynchronousFrames in tests.
tests/monotouch-test/ObjCRuntime/RegistrarTest.cs Uses global-qualified MetalKit types to avoid ambiguity.
tests/monotouch-test/ObjCRuntime/DlfcnTest.cs Adds test coverage for [Field]-backed constants and caching behavior.
tests/monotouch-test/NetworkExtension/NEHotspotEapSettingsTest.cs New tests for SupportedEapTypes roundtrip/null behavior.
tests/monotouch-test/Metal/MTKMeshTest.cs New test for MTKMesh.FromAsset API behavior.
tests/monotouch-test/Foundation/NSArray1Test.cs Adds tests for NSArray.EnumsFromHandle behavior.
tests/monotouch-test/Foundation/AttributedStringTest.cs Removes a field-symbol existence test that is no longer relevant.
tests/monotouch-test/CoreText/FontTest.cs Makes AppleColorEmoji font creation resilient and loosens a bounds assertion.
tests/monotouch-test/CoreGraphics/BitmapContextTest.cs Computes adaptive buffer sizes from parameters and adds checked arithmetic.
tests/monotouch-test/CoreFoundation/ProxyTest.cs Removes a field-symbol existence test that is no longer relevant.
tests/common/test-variations.csproj Adds variations for static registrar and inline-dlfcn modes (plus define).
tests/common/TestRuntime.cs Adds Xcode 26.3 mapping logic for version checks.
tests/cecil-tests/Documentation.KnownFailures.txt Removes a known-failure entry tied to NSArray.EnumsFromHandle docs.
src/bgen/Generator.cs Updates generator output for wrapped-array properties to deal with nullable changes.
src/UIKit/UIFontDescriptor.cs Switches CascadeList to a non-null array helper that drops nulls.
src/NetworkExtension/NEHotspotEapSettings.cs Uses new enum-array helper to return a non-null array.
src/MetalKit/MTKMesh.cs Makes sourceMeshes out parameter nullable.
src/Foundation/NSArray.cs Adds new array helpers, updates EnumsFromHandle signature/implementation, and adds non-null enum helper.
src/CoreGraphics/CGFont.cs Makes CreateWithFontName return nullable and switches to TransientCFString usage.
msbuild/Xamarin.MacDev.Tasks/Tasks/PostTrimmingProcessing.cs New task to generate native C glue for surviving symbols.
msbuild/Xamarin.MacDev.Tasks/Tasks/ComputeNativeAOTSurvivingNativeSymbols.cs New task to compute surviving inline-dlfcn symbols from NativeAOT unresolved list.
msbuild/Xamarin.MacDev.Tasks/Tasks/CompileNativeCode.cs Ensures output directory exists before compiling native code.
msbuild/Xamarin.MacDev.Tasks/Tasks/CollectUnresolvedNativeSymbols.cs New task to extract unresolved symbols from a native static library/object file.
msbuild/Xamarin.MacDev.Tasks/Tasks/CollectPostILTrimInformation.cs New task to scan trimmed assemblies for surviving inline-dlfcn P/Invokes (with caching).
global.json Updates pinned SDK/tooling versions.
eng/Version.Details.props Dependency-flow version details update (but currently invalid XML).
dotnet/targets/Xamarin.Shared.Sdk.targets Wires custom linker steps + post-trimming MSBuild targets; adds .NET 11 defaults for InlineDlfcnMethods.
docs/code/native-symbols.md New documentation describing native symbol handling + inline-dlfcn pipeline.
docs/building-apps/build-properties.md Documents the InlineDlfcnMethods property and defaults.
NuGet.config Adds a new package source entry.
Make.config Special-cases Xcode 26.3 for simulator runtime selection.
.github/copilot-instructions.md Notes a repo-specific MSBuild convention about DeviceSpecificIntermediateOutputPath.
Files not reviewed (1)
  • tools/mtouch/Errors.designer.cs: Language not supported
Comments suppressed due to low confidence (1)

eng/Version.Details.props:33

  • The top-level is missing its closing tag before starting the next (the file now has a nested PropertyGroup), which makes this XML invalid and will break MSBuild imports. Add the missing after the last property in the first group (after MicrosoftDotNetXHarnessiOSSharedPackageVersion).
    <MicrosofttvOSSdknet100_262PackageVersion>26.2.10223</MicrosofttvOSSdknet100_262PackageVersion>
    <!-- dotnet-xharness dependencies -->
    <MicrosoftDotNetXHarnessiOSSharedPackageVersion>10.0.0-prerelease.25516.4</MicrosoftDotNetXHarnessiOSSharedPackageVersion>
  <!--Property group for alternate package version names-->
  <PropertyGroup>
    <!-- dotnet-dotnet dependencies -->
    <MicrosoftDotNetArcadeSdkVersion>$(MicrosoftDotNetArcadeSdkPackageVersion)</MicrosoftDotNetArcadeSdkVersion>

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +959 to +966
reader.BaseStream.Position = streamBasePosition + symtab.symoff;
var nlistSize = is64bitheader ? 16 : 12;
for (uint i = 0; i < symtab.nsyms; i++) {
var n_strx = reader.ReadUInt32 ();
var n_type = reader.ReadByte ();
var n_sect = reader.ReadByte ();
var n_desc = reader.ReadInt16 ();
if (is64bitheader)
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

In GetUnresolvedSymbols, the locals nlistSize, n_sect, and n_desc are assigned but never used. This will trigger compiler warnings (and may fail the build if warnings are treated as errors). Consider removing these locals and just reading/discarding the bytes (or use '_' discards) to advance the reader.

Copilot uses AI. Check for mistakes.
} finally {
CFString.ReleaseNative (nameHandle);
}
var nameHandle = new TransientCFString (name);
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

TransientCFString must be disposed. Here it's created without a using/Dispose, which will leak the native CFString. Use 'using var nameHandle = new TransientCFString (name);' (or otherwise Dispose) before calling CGFontCreateWithFontName.

Suggested change
var nameHandle = new TransientCFString (name);
using var nameHandle = new TransientCFString (name);

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +11
using System.Linq;

Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

The added 'using System.Linq;' doesn't appear to be used anywhere in this file. If warnings are treated as errors, this can break the test build; remove the unused using directive.

Suggested change
using System.Linq;

Copilot uses AI. Check for mistakes.
Comment on lines +1098 to +1112
<data name="MX2254" xml:space="preserve">
<value>Unsupported primitive field type '{0}' for symbol '{1}' in method '{2}'. Sub-optimal but functional code will be generated. Please file an issue at https://github.com/dotnet/macios/issues/new.</value>
</data>

<data name="MX2255" xml:space="preserve">
<value>Unknown or unsupported Dlfcn pattern: '{0}' in method '{1}'. The call will not be inlined. Please file an issue at https://github.com/dotnet/macios/issues/new.</value>
</data>

<data name="MX2256" xml:space="preserve">
<value>The field type '{0}' for symbol '{1}' in method '{2}' does not appear to be an NSObject subclass. This may cause a runtime failure.</value>
</data>

<data name="MX2257" xml:space="preserve">
<value>Unknown IL sequence for method with call to Dlfcn.CachePointer: '{0}' in method '{1}'. The call will not be inlined. Please file an issue at https://github.com/dotnet/macios/issues/new.</value>
</data>
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

These new error messages already end with a period, which results in the generated XML doc comments in Errors.designer.cs ending with a double period (".../new.."). Consider removing the trailing period from the resource string(s) to avoid the duplicated punctuation in generated docs.

Copilot uses AI. Check for mistakes.
Comment on lines +741 to +752
public static T []? EnumsFromHandle<T> (NativeHandle handle) where T : System.Enum
#else
public static T []? EnumsFromHandle<T> (NativeHandle handle) where T : struct, IConvertible
#endif
{
if (handle == NativeHandle.Zero)
return null;
#if !XAMCORE_5_0
if (!typeof (T).IsEnum)
throw new ArgumentException ("T must be an enum");
#endif

var c = GetCount (handle);
T [] ret = new T [c];
return ArrayFromHandleDropNullElements<T> (handle, (element) => (T) Enum.ToObject (typeof (T), Runtime.GetNSObject<NSNumber> (element)?.LongValue ?? 0));
}
Copy link

Copilot AI Mar 12, 2026

Choose a reason for hiding this comment

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

EnumsFromHandle now calls ArrayFromHandleDropNullElements(...), but all ArrayFromHandleDropNullElements overloads in this file constrain T to 'class, INativeObject'. Since T is an enum/struct here, this won't compile. Consider implementing enum-specific logic here (similar to the previous loop over NSNumber elements) or call an overload that supports value types.

Copilot uses AI. Check for mistakes.
@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.

@rolfbjarne rolfbjarne force-pushed the dev/rolf/inline-dlfcn-net11.0 branch from fd820f0 to 297c02d Compare March 12, 2026 15:15
@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.

rolfbjarne and others added 14 commits March 16, 2026 12:43
Replace the string-based InlineDlfcnMethods property with a strongly-typed
InlineDlfcnMethodsMode enum with Disabled, Strict, and Compat values.

The parser accepts 'compatibility' as an alias for Compat to maintain
compatibility with existing MSBuild property values.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This pull request updates the following dependencies

## From https://github.com/dotnet/dotnet

- **Subscription**: [30303172-6f12-44a9-887a-ea8520fce068](https://maestro.dot.net/subscriptions?search=30303172-6f12-44a9-887a-ea8520fce068)
- **Build**: [20260311.3](https://dev.azure.com/dnceng/internal/_build/results?buildId=2923915) ([305713](https://maestro.dot.net/channel/9626/github:dotnet:dotnet/build/305713))
- **Date Produced**: March 11, 2026 12:48:21 PM UTC
- **Commit**: [6eb2f3d82a8f1298c6e9e5f7f23482656ba25d04](dotnet/dotnet@6eb2f3d)
- **Branch**: [release/10.0.3xx](https://github.com/dotnet/dotnet/tree/release/10.0.3xx)

- **Dependency Updates**:
  - From [10.0.0-beta.26160.113 to 10.0.0-beta.26161.103][1]
     - Microsoft.DotNet.Arcade.Sdk
     - Microsoft.DotNet.Build.Tasks.Feed
     - Microsoft.DotNet.SharedFramework.Sdk
  - From [10.0.300-preview.26160.113 to 10.0.300-preview.0.26161.103][1]
     - Microsoft.NET.Sdk
  - From [10.0.300-preview.26160.113 to 10.0.300-preview.26161.103][1]
     - Microsoft.TemplateEngine.Authoring.Tasks

[1]: dotnet/dotnet@37ac471...6eb2f3d
…NSObject type has been loaded. (#24875)

The GC calls 'is_class_finalization_aware', and this might happen before the
managed NSObject type has been loaded, so make sure the method copes with this
scenario.

This becomes more frequent with 'dotnet watch' / Hot Reload, because these
features run code before Runtime.Initialize, also making it more probable that
a GC will happen that early.
…source header (#24883)

Add a new --deepsplit CLI option that generates one .cs file per source
header instead of a single ApiDefinition.cs. This makes it easier to
navigate large framework bindings and map generated C# types back to
their original Objective-C headers.

The implementation adds a DeepSplitMassager that extracts the source
header filename from each declaration's Clang annotation via
Cursor.TryGetPresumedLoc, creates a DocumentSyntaxTree per unique header
basename, and distributes declarations accordingly. Struct and enum
declarations are consolidated in StructsAndEnums.cs. Declarations
without source location info fall back to ApiDefinition.cs.

Example: binding FBSDKCoreKit with --deepsplit produces 194 files
(FBSDKAccessToken.cs, FBSDKGraphRequest.cs, etc.) instead of a single
7,688-line ApiDefinition.cs.

Fixes #23024.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This pull request updates the following dependencies

## From https://github.com/dotnet/xharness

- **Subscription**: [02e03784-16b3-4ced-b02a-3715797fc7da](https://maestro.dot.net/subscriptions?search=02e03784-16b3-4ced-b02a-3715797fc7da)
- **Build**: [20260311.3](https://dev.azure.com/dnceng/internal/_build/results?buildId=2924125) ([305731](https://maestro.dot.net/channel/2/github:dotnet:xharness/build/305731))
- **Date Produced**: March 11, 2026 4:30:21 PM UTC
- **Commit**: [2ceb56d52379a8f2a684bbb7a90436aa401a7420](dotnet/xharness@2ceb56d)
- **Branch**: [main](https://github.com/dotnet/xharness/tree/main)

- **Dependency Updates**:
  - From [11.0.0-prerelease.26160.2 to 11.0.0-prerelease.26161.3][1]
     - Microsoft.DotNet.XHarness.iOS.Shared

[1]: dotnet/xharness@c32a777...2ceb56d
* Improve nullability annotations for FromArrayNative<T> (accept NSArray?, return T[]?).
* Rewrite FromArrayNative<T> to use ArrayFromHandleDropNullElements.
* Update CAKeyFrameAnimation.GetValuesAs to return T[]?.
* Fix SecSharedCredential.RequestSharedWebCredential to handle nullability correctly.
* Update XML docs for SecSharedCredential.RequestSharedWebCredential.
* Add tests for SecSharedCredential.RequestSharedWebCredential.

Contributes towards #17285.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…workflow (#24876)

Add workflow_dispatch trigger so the workflow can be run manually from the
GitHub Actions UI on any branch, including PR branches.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Fix a couple of places where transient strings weren't disposed.

And to make sure this doesn't happen again, add a new Roslyn analyzer (RBI0042) that
reports an error when transient strings are declared as local variables without the
'using' keyword.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…1: Build ID 13567384 (#24901)

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.
This pull request updates the following dependencies

## From https://github.com/dotnet/xharness

- **Subscription**: [02e03784-16b3-4ced-b02a-3715797fc7da](https://maestro.dot.net/subscriptions?search=02e03784-16b3-4ced-b02a-3715797fc7da)
- **Build**: [20260316.1](https://dev.azure.com/dnceng/internal/_build/results?buildId=2928089) ([306403](https://maestro.dot.net/channel/2/github:dotnet:xharness/build/306403))
- **Date Produced**: March 16, 2026 10:28:21 PM UTC
- **Commit**: [581c6a9cd9ad947ab638bd1c81557e5eb9f0b89d](dotnet/xharness@581c6a9)
- **Branch**: [main](https://github.com/dotnet/xharness/tree/main)

- **Dependency Updates**:
  - From [11.0.0-prerelease.26164.3 to 11.0.0-prerelease.26166.1][1]
     - Microsoft.DotNet.XHarness.iOS.Shared

[1]: dotnet/xharness@6fe0045...581c6a9
This pull request updates the following dependencies

## From https://github.com/dotnet/dotnet

- **Subscription**: [30303172-6f12-44a9-887a-ea8520fce068](https://maestro.dot.net/subscriptions?search=30303172-6f12-44a9-887a-ea8520fce068)
- **Build**: [20260316.9](https://dev.azure.com/dnceng/internal/_build/results?buildId=2928041) ([306420](https://maestro.dot.net/channel/9626/github:dotnet:dotnet/build/306420))
- **Date Produced**: March 17, 2026 12:07:37 AM UTC
- **Commit**: [e116d98b2087d751e7a13818cb2c14ea64af3ba3](dotnet/dotnet@e116d98)
- **Branch**: [release/10.0.3xx](https://github.com/dotnet/dotnet/tree/release/10.0.3xx)

- **Dependency Updates**:
  - From [10.0.0-beta.26165.106 to 10.0.0-beta.26166.109][1]
     - Microsoft.DotNet.Arcade.Sdk
     - Microsoft.DotNet.Build.Tasks.Feed
     - Microsoft.DotNet.SharedFramework.Sdk
  - From [10.0.300-preview.0.26165.106 to 10.0.300-preview.0.26166.109][1]
     - Microsoft.NET.Sdk
  - From [10.0.300-preview.26165.106 to 10.0.300-preview.26166.109][1]
     - Microsoft.TemplateEngine.Authoring.Tasks

[1]: dotnet/dotnet@695853e...e116d98
rolfbjarne and others added 21 commits March 17, 2026 10:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
)

* Improve nullability annotations for ArrayFromHandleFunc<T> (return T?[]?).
* Add an ArrayFromHandleDropNullElements overload with Converter and NSNullBehavior parameters.
* Update DictionaryContainer.GetArray and GetArrayOfDictionariesValue to use ArrayFromHandleDropNullElements.
* Update NSUrlSessionConfiguration.ProxyConfigurations to use NonNullArrayFromHandleDropNullElements.
* Update PdfAnnotation.QuadrilateralPoints to return CGPoint[]? and use ArrayFromHandle.
* Update XML docs for ArrayFromHandleFunc, ProxyConfigurations and QuadrilateralPoints.

Contributes towards #17285.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…kefile fragments for csproj anymore. (#24890)

There's no need, because just running 'dotnet' runs our local .NET now.
)

Parallel make (e.g. 'make all -j8', 'make world') has been hanging
for a while at the end of the build. This is a long-standing issue
(#13355) that has been patched
three times
(#15407,
#21315,
#22300) without fully fixing the
root cause.

The problem: when using parallel make, GNU Make uses a jobserver with
pipe-based file descriptors to coordinate sub-makes. The dotnet CLI
can start background build servers (MSBuild server, Roslyn/VBCSCompiler)
that inherit these file descriptors but never close them. Make then
waits for those file descriptors to close (which won't happen until
the servers exit - which they typically do about 10 minutes without
activity), thinking there are still active jobs.

The previous workaround attempted to shut down and force-kill dotnet
processes after the build via a 'shutdown-build-server' target. This
approach was unreliable because:
- The shutdown ran from a double-colon all-hook:: rule with no
  prerequisites, so with -j it could execute in parallel with (or
  before) the actual build, killing nothing.
- Build servers started by later subdirectories (e.g. tests/) after
  the dotnet/ shutdown were never killed.
- The process-matching regex pattern might not match all server
processes.

Ideally this would be fixed in when launching the build servers, by
making them not inherit handles. Unfortunately this is currently not
possible: dotnet/runtime#13943 (although this
might change in a not so
distant future: dotnet/runtime#123959)

The workaround: disable build servers entirely via environment variables
in
Make.config:
- DOTNET_CLI_USE_MSBUILD_SERVER=0: prevents the MSBuild server
  https://learn.microsoft.com/en-us/visualstudio/msbuild/msbuild-server

https://github.com/dotnet/msbuild/blob/main/documentation/MSBuild-Server.md
- UseSharedCompilation=false: prevents the Roslyn compiler server
(VBCSCompiler)
  dotnet/roslyn#27975
- MSBUILDDISABLENODEREUSE=1: prevents MSBuild node reuse
  https://github.com/dotnet/msbuild/wiki/MSBuild-Tips-&-Tricks

This eliminates the root cause - no background servers means no
inherited file descriptors means no hang. The shutdown-build-server
target and its invocations are removed as they are no longer needed.

Additionally, 'make world' now prints the installed workloads at the
end of the build for visibility.

Build without changes:
> make world  2149.57s user 258.32s system 107% cpu 37:30.19 total

Build with changes:
> make world  2242.74s user 286.38s system 354% cpu 11:52.55 total

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Replace Driver.Log with Report(MX2255 warning) for unknown Dlfcn patterns
- Replace (string) ldstr.Operand! casts with pattern matching (is not string)
- Replace all 900x warning codes with consistent 2255 code

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…cOS CI (#24908)

The test fails intermittently when the keychain has stale entries from
previous runs, causing Query to return ItemNotFound while Add returns
DuplicateItem.

Fix the flakiness with three changes:
- Clean up any stale keychain entry before the test starts
- In SaveUserPassword, handle the DuplicateItem race by removing the
  stale entry and retrying the add
- Wrap the test body in try/finally to ensure cleanup on failure
- Fix the missing $ in TEST 3's interpolated string assertion

Fixes #24860

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…24878)

When disposing an NSUrlSessionHandler backed by a background NSUrlSession and immediately creating a new handler with the same background session identifier, the new session could fail with 'Task created in a session that has been invalidated'.

This happened because InvalidateAndCancel() is asynchronous - it marks the session for invalidation but doesn't wait for it to complete. Apple reuses the same native session object for background sessions with the same identifier, so creating a new session before invalidation completes returns the already-invalidated session.

Fix by detecting this scenario in the test, and marking the test as inconclusive.

Fixes #24376

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…uments. Fixes #24892. (#24911)

The PlatformTypeMappingMassager did not recurse into child nodes (such as type
arguments inside Action<> or Func<>) because the VisitMemberType and
VisitSimpleType overrides did not call their base implementations. This meant
that types like NSURLResponse inside Action<NSData, NSURLResponse> were never
mapped to their .NET equivalents (NSUrlResponse).

Fix by calling base.VisitMemberType/VisitSimpleType before processing the type
itself, so children (type arguments) are mapped first.

Added a test case with a block parameter containing mapped types.

Fixes #24892.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…24840. (#24845)

Static frameworks were included in _PostProcessingItem (which feeds
dsymutil/strip) even though they aren't copied to the app bundle.
This caused dsymutil to try to process frameworks that don't exist.

The fix reuses the _FilteredFrameworkToPublish item group (produced by
_ComputeFrameworkFilesToPublish) instead of _ResolvedNativeReference
when building the _PostProcessingItem list for frameworks. This ensures
only dynamic frameworks that will actually be present in the app bundle
are included. An explicit dependency on _ComputeFrameworkFilesToPublish
is added to _CollectItemsForPostProcessingDependsOn in the SDK targets.

Fixes #24840

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* Improve nullability annotations for GetItem<T> (return T?).
* Add ToArrayDropNullElements instance methods for converting NSArray to managed arrays.
* Update NSArray<TKey> indexer to return TKey?.
* Update NSMutableArray<TValue> indexer to return TValue? with [DisallowNull] for the setter.
* Update PdfBorder.DashPattern and PdfAnnotationMarkup.QuadrilateralPoints to use ToArrayDropNullElements.
* Update VTCompressionProperties to handle nullable GetItem return values.
* Obsolete MPMediaQuery.GetItem/GetSection/GetCollection in favor of array properties.
* Update XML docs for all modified members.

Contributes towards #17285.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
…20260318055049745 to main (#24918)

LEGO: Pull request from lego/hb_5df43909-4a19-4f55-bc3f-9ea8fccf3c82_20260318055049745 to main with localized lcls
… type mapping (#24913)

When two types in the platform assembly map to the same native name,
prefer the standard protocol interface (named "I" + nativeName, e.g.
INSCopying for native "NSCopying") over a [Model] class stub.

Previously, collisions between a [Model] class (e.g. NSCopying with
[Protocol()]) and the protocol interface (INSCopying with
[Protocol(Name="NSCopying")]) would cause both mappings to be
dropped entirely. Now the standard protocol interface wins, so types
like NSCopying in generic constraints are correctly mapped to
INSCopying.

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This pull request updates the following dependencies

## From https://github.com/dotnet/dotnet

- **Subscription**: [30303172-6f12-44a9-887a-ea8520fce068](https://maestro.dot.net/subscriptions?search=30303172-6f12-44a9-887a-ea8520fce068)
- **Build**: [20260317.11](https://dev.azure.com/dnceng/internal/_build/results?buildId=2928892) ([306642](https://maestro.dot.net/channel/9626/github:dotnet:dotnet/build/306642))
- **Date Produced**: March 17, 2026 9:45:30 PM UTC
- **Commit**: [853c0311d71c9991dbf3ec6e7324c0ff349700da](dotnet/dotnet@853c031)
- **Branch**: [release/10.0.3xx](https://github.com/dotnet/dotnet/tree/release/10.0.3xx)

- **Dependency Updates**:
  - From [10.0.0-beta.26166.109 to 10.0.0-beta.26167.111][1]
     - Microsoft.DotNet.Arcade.Sdk
     - Microsoft.DotNet.Build.Tasks.Feed
     - Microsoft.DotNet.SharedFramework.Sdk
  - From [10.0.300-preview.0.26166.109 to 10.0.300-preview.0.26167.111][1]
     - Microsoft.NET.Sdk
  - From [10.0.300-preview.26166.109 to 10.0.300-preview.26167.111][1]
     - Microsoft.TemplateEngine.Authoring.Tasks

[1]: dotnet/dotnet@e116d98...853c031
* Use web sockets to connect the endpoints when doing hot reload / dotnet watch.
* Change the defaults when launching desktop apps and we're in 'dotnet watch' mode:
	* Always open app in a new instance.
	* Wait for exit enabled.
	* Pipe stdout/stderr to the current terminal.
* Validate that the project wasn't built with a build configuration that would prevent Hot Reload from working.

Contributes towards #24782.
@rolfbjarne rolfbjarne force-pushed the dev/rolf/inline-dlfcn-net11.0 branch from 297c02d to 8bf1c02 Compare March 19, 2026 07:52
@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 [CI Build #8bf1c02] Build failed (Build packages) 🔥

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

Pipeline on Agent
Hash: 8bf1c02b5ba1e6a0870a153a892610e40fcb879a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

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

Pipeline on Agent
Hash: 8bf1c02b5ba1e6a0870a153a892610e40fcb879a [PR build]

@vs-mobiletools-engineering-service2
Copy link
Collaborator

🔥 Failed to compare API and create generator diff 🔥

** Error: Working directory isn't clean - check build log for more information.

Pipeline on Agent
Hash: 8bf1c02b5ba1e6a0870a153a892610e40fcb879a [PR build]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-merge Do not merge this pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants