Skip to content

Instantly share code, notes, and snippets.

@rolfbjarne
rolfbjarne / plan.md
Created July 22, 2026 15:35
dotnet/macios #16678 - Linker attribute removal analysis and implementation plan

Issue #16678: removable linker attributes

Goal

Reduce linked application size by removing macios platform-assembly custom attributes once every build-time and runtime consumer has finished with them. Except for attributes proven safe to remove unconditionally, only remove attributes when assembly preparation and post-processing are both enabled with the trimmable-static registrar.

Findings

There are three existing removal mechanisms:

@rolfbjarne
rolfbjarne / cluster_A_result.md
Last active July 9, 2026 13:58
dotnet/macios #3590 — Span<T> API survey (candidate identification) @ commit 8111cb6c

Cluster A — Span API Survey Report

Below is the complete markdown for cluster_A_result.md. Since no file-write tool is available in this environment, the content is returned here for the main agent to persist.


Cluster A

Frameworks surveyed: CoreFoundation, CoreGraphics, CoreText, CoreMedia, CoreVideo, CoreImage, CoreAnimation. Total candidate APIs evaluated: ~80 (grouped from 131 raw lines).

$ curl https://api.openai.com/v1/completions -H "Content-Type: application/json" -H "Authorization: Bearer $API_KEY" -d '{"model": "text-davinci-003", "prompt": "Is this an inclusive code review comment: this is very good code!", "temperature": 0, "max_tokens": 70}'
{
"id": "cmpl-6dKMNKwvoYSF8SLD5Y2HSDakDZgqz",
"object": "text_completion",
"created": 1674831075,
"model": "text-davinci-003",
"choices":
[
{
rolf@ ~/test/bundlestructure $ dotnet new macos
The template "macOS Application" was created successfully.
rolf@ ~/test/bundlestructure $ dotnet build
MSBuild version 17.4.0+18d5aef85 for .NET
Determining projects to restore...
Restored /Users/rolf/test/bundlestructure/bundlestructure.csproj (in 119 ms).
Detected signing identity:
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/Microsoft.Win32.Primitives.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/Microsoft.Win32.Registry.AccessControl.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/Microsoft.Win32.Registry.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/netstandard.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/System.AppContext.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/System.Collections.Concurrent.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/System.Collections.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/System.Collections.NonGeneric.dll
_mac-build//Library/Frameworks/Xamarin.Mac.framework/Versions/git/lib/mono/4.5/Facades/System.Co

Keybase proof

I hereby claim:

  • I am rolfbjarne on github.
  • I am rolfbjarne (https://keybase.io/rolfbjarne) on keybase.
  • I have a public key ASB7VNis2wnoySoHWAdAvJrPhgkKoQbmAqm7EzKePxO9CAo

To claim this, I am signing this object:

diff --git a/Make.config b/Make.config
index 57462c6..ba5f835 100644
--- a/Make.config
+++ b/Make.config
@@ -79,6 +79,7 @@ TVOS_SDK_VERSION=10.0
MIN_IOS_SDK_VERSION=6.0
MIN_OSX_SDK_VERSION=10.7
MIN_WATCHOS_SDK_VERSION=2.0
+MIN_WATCH_OS_VERSION=1.0
MIN_TVOS_SDK_VERSION=9.0
diff --git a/tools/mtouch/Target.cs b/tools/mtouch/Target.cs
index cf522ba..af75c72 100644
--- a/tools/mtouch/Target.cs
+++ b/tools/mtouch/Target.cs
@@ -377,34 +377,8 @@ namespace Xamarin.Bundler
GetCustomAttributeReferences (assembly, assemblies, exceptions);
GetCustomAttributeReferences (main, assemblies, exceptions);
if (main.HasTypes) {
- foreach (var t in main.Types) {
- GetTypeReferences (t, assemblies, exceptions);
diff --git a/mono/mini/mini-llvm.c b/mono/mini/mini-llvm.c
index b83c823..ab39f17 100644
--- a/mono/mini/mini-llvm.c
+++ b/mono/mini/mini-llvm.c
@@ -5810,8 +5810,19 @@ process_bb (EmitContext *ctx, MonoBasicBlock *bb)
const char *name = (const char*)ins->inst_p0;
LLVMValueRef var;
- if (!ctx->module->objc_selector_to_var)
+ if (!ctx->module->objc_selector_to_var) {
diff --git a/mcs/build/profiles/monotouch_runtime.make b/mcs/build/profiles/monotouch_runtime.make
index 1603d12..4fb49a0 100644
--- a/mcs/build/profiles/monotouch_runtime.make
+++ b/mcs/build/profiles/monotouch_runtime.make
@@ -41,3 +41,5 @@ MOBILE_STATIC = yes
MOBILE_PROFILE = yes
PROFILE_DISABLE_BTLS=1
+
+MCS_FLAGS = $(MONOTOUCH_MCS_FLAGS)