Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 33 additions & 3 deletions dotnet/targets/Xamarin.Shared.Sdk.targets
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
<ProjectCapability Include="MacCatalystBinding" Condition="'$(_ProjectType)' == 'MacCatalystBindingProject'" />
<ProjectCapability Include="MacCatalystClassLibrary" Condition="'$(_ProjectType)' == 'MacCatalystClassLibrary'" />

<ProjectCapability Condition="'$(_KeepLaunchProfiles)' != 'true'" Remove="LaunchProfiles" />
<ProjectCapability Condition="'$(_KeepLaunchProfiles)' != 'true' And '$(_PlatformName)' != 'macOS'" Remove="LaunchProfiles" />
</ItemGroup>

<!-- Default item includes (globs and implicit references) -->
Expand Down Expand Up @@ -541,7 +541,10 @@
<!-- Validate the linker mode -->
<Error Text="Invalid link mode: '$(_LinkMode)'. Valid link modes are: 'None', 'SdkOnly' and 'Full'" Condition="'$(_LinkMode)' != 'None' And '$(_LinkMode)' != 'SdkOnly' And '$(_LinkMode)' != 'Full' And '$(_LinkMode)' != 'TrimMode'" />

<Error Text="The only valid registrar when using NativeAOT is 'managed-static' (current value: '$(Registrar)'). Please either delete the 'Registrar' property, or change it to be 'managed-static'." Condition="'$(_UseNativeAot)' == 'true' And '$(Registrar)' != '' And '$(Registrar)' != 'managed-static'" />
<Error
Text="The only valid registrars when using NativeAOT are 'managed-static' or 'trimmable-static' (current value: '$(Registrar)'). Please either delete the 'Registrar' property, or change it to be 'managed-static' or 'trimmable-static'."
Condition="'$(_UseNativeAot)' == 'true' And '$(Registrar)' != '' And '$(Registrar)' != 'managed-static' And '$(Registrar)' != 'trimmable-static'"
/>

<Warning Text="All assemblies must be processed by the linker when using NativeAOT. Please don't set neither the '$(_LinkModeProperty)' nor the 'TrimMode' property, so that the build can default to linking all assemblies." Condition="'$(_UseNativeAot)' == 'true' And '$(_LinkMode)' != 'Full'" />

Expand Down Expand Up @@ -584,6 +587,10 @@
<_IsManagedStaticRegistrarFeature Condition="'$(Registrar)' == 'managed-static'">true</_IsManagedStaticRegistrarFeature>
<_IsManagedStaticRegistrarFeature Condition="'$(Registrar)' != 'managed-static'">false</_IsManagedStaticRegistrarFeature>

<!-- Set managed static registrar value -->
<_IsTrimmableStaticRegistrarFeature Condition="'$(Registrar)' == 'trimmable-static'">true</_IsTrimmableStaticRegistrarFeature>
<_IsTrimmableStaticRegistrarFeature Condition="'$(Registrar)' != 'trimmable-static'">false</_IsTrimmableStaticRegistrarFeature>

<!-- Set NativeAOT value -->
<_IsNativeAOTFeature Condition="'$(_XamarinRuntime)' == 'NativeAOT'">true</_IsNativeAOTFeature>
<_IsNativeAOTFeature Condition="'$(_XamarinRuntime)' != 'NativeAOT'">false</_IsNativeAOTFeature>
Expand Down Expand Up @@ -643,6 +650,8 @@
SkipMarkingNSObjectsInUserAssemblies=$(_SkipMarkingNSObjectsInUserAssemblies)
TargetArchitectures=$(TargetArchitectures)
TargetFramework=$(_ComputedTargetFrameworkMoniker)
TypeMapAssemblyName=$(_TypeMapAssemblyName)
TypeMapOutputDirectory=$(_TypeMapOutputDirectory)
UseLlvm=$(MtouchUseLlvm)
Verbosity=$(_BundlerVerbosity)
Warn=$(_BundlerWarn)
Expand Down Expand Up @@ -725,6 +734,7 @@
<RuntimeHostConfigurationOption Include="ObjCRUntime.AggressiveAttributeTrimmingOnlyWithStaticRegistrar" value="true" Trim="true" Condition="'$(MobileAggressiveAttributeTrimming)' == 'true' And ('$(Registrar)' == 'static' Or '$(Registrar)' == 'managed-static')" />
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

ObjCRuntime.AggressiveAttributeTrimmingOnlyWithStaticRegistrar is conditioned on Registrar being static or managed-static, but the new trimmable-static registrar is also a static registrar mode. If this feature gate is intended to apply to all static registrar modes, please include trimmable-static in the condition as well so behavior stays consistent.

Suggested change
<RuntimeHostConfigurationOption Include="ObjCRUntime.AggressiveAttributeTrimmingOnlyWithStaticRegistrar" value="true" Trim="true" Condition="'$(MobileAggressiveAttributeTrimming)' == 'true' And ('$(Registrar)' == 'static' Or '$(Registrar)' == 'managed-static')" />
<RuntimeHostConfigurationOption Include="ObjCRUntime.AggressiveAttributeTrimmingOnlyWithStaticRegistrar" value="true" Trim="true" Condition="'$(MobileAggressiveAttributeTrimming)' == 'true' And ('$(Registrar)' == 'static' Or '$(Registrar)' == 'managed-static' Or '$(Registrar)' == 'trimmable-static')" />

Copilot uses AI. Check for mistakes.
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.Arch.IsSimulator" Value="$(_IsSimulatorFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsManagedStaticRegistrar" Value="$(_IsManagedStaticRegistrarFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" Value="$(_IsTrimmableStaticRegistrarFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsNativeAOT" Value="$(_IsNativeAOTFeature)" Trim="true" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsCoreCLR" Value="true" Trim="true" Condition="'$(UseMonoRuntime)' != 'true'" />
<RuntimeHostConfigurationOption Include="ObjCRuntime.Runtime.IsCoreCLR" Value="false" Trim="true" Condition="'$(UseMonoRuntime)' == 'true'" />
Expand Down Expand Up @@ -758,7 +768,8 @@
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="MonoTouch.Tuner.RegistrarRemovalTrackingStep" />
<!-- TODO: these steps should probably run after mark. -->
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Condition="'$(_AreAnyAssembliesTrimmed)' == 'true'" Type="Xamarin.Linker.Steps.PreMarkDispatcher" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.Linker.ManagedRegistrarStep" Condition="'$(Registrar)' == 'managed-static'" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.Linker.ManagedRegistrarStep" Condition="'$(Registrar)' == 'managed-static' Or '$(Registrar)' == 'trimmable-static'" />
<_TrimmerCustomSteps Include="$(_AdditionalTaskAssembly)" BeforeStep="MarkStep" Type="Xamarin.Linker.TrimmableRegistrarStep" Condition="'$(Registrar)' == 'trimmable-static'" />

<!--
IMarkHandlers which run during Mark
Expand Down Expand Up @@ -1107,6 +1118,17 @@
<_FrameworkToPublish Include="@(_AllLinkerItems)" Condition="'%(_AllLinkerItems.SourceFile)' == '_FrameworkToPublish.items'" />
<_DynamicLibraryToPublish Include="@(_AllLinkerItems)" Condition="'%(_AllLinkerItems.SourceFile)' == '_DynamicLibraryToPublish.items'" />
</ItemGroup>

<ItemGroup Condition="'$(Registrar)' == 'trimmable-static'">
<_TypeMapAssemblies Include="$(_TypeMapOutputDirectory)/*.dll" />
<ResolvedFileToPublish Include="@(_TypeMapAssemblies)">
<PublishFolderType>Assembly</PublishFolderType>
<CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
<RelativePath>$(_AssemblyPublishDir)%(Filename)%(Extension)</RelativePath>
<OriginalRelativePath>%(Filename)%(Extension)</OriginalRelativePath>
</ResolvedFileToPublish>
<FileWrites Include="@(_TypeMapAssemblies)" />
</ItemGroup>
</Target>

<!-- Native code -->
Expand Down Expand Up @@ -1260,6 +1282,14 @@
<_RuntimeConfigurationFile>runtimeconfig.bin</_RuntimeConfigurationFile>
</PropertyGroup>

<PropertyGroup Condition="'$(Registrar)' == 'trimmable-static'">
<_TypeMapAssemblyName Condition="'$(_TypeMapAssemblyName)' == ''">_Microsoft.$(_PlatformName).TypeMaps</_TypeMapAssemblyName>
<_TypeMapOutputDirectory Condition="'$(_TypeMapOutputDirectory)' == ''">$(DeviceSpecificIntermediateOutputPath)typemap\</_TypeMapOutputDirectory>
</PropertyGroup>
<ItemGroup Condition="'$(Registrar)' == 'trimmable-static'">
<RuntimeHostConfigurationOption Include="System.Runtime.InteropServices.TypeMappingEntryAssembly" Value="$(_TypeMapAssemblyName)" Link="true" />
Copy link

Copilot AI Apr 3, 2026

Choose a reason for hiding this comment

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

All other RuntimeHostConfigurationOption items use the metadata Trim="true", but this new item uses Link="true", which is inconsistent and may mean the option isn't handled as intended by the build logic. Please verify the expected metadata and use the same convention (likely Trim="true") so the option is reliably written to the runtimeconfig.

Suggested change
<RuntimeHostConfigurationOption Include="System.Runtime.InteropServices.TypeMappingEntryAssembly" Value="$(_TypeMapAssemblyName)" Link="true" />
<RuntimeHostConfigurationOption Include="System.Runtime.InteropServices.TypeMappingEntryAssembly" Value="$(_TypeMapAssemblyName)" Trim="true" />

Copilot uses AI. Check for mistakes.
</ItemGroup>

<!-- Not sure about how to handle nested app extensions here, but if it ever becomes a problem we can look into it (I believe only watch extensions can have embedded extensions at this point, and we don't support watchOS on .NET anyways) -->
<ItemGroup Condition="'$(IsAppExtension)' == 'true'">
<_CustomLinkFlags Include="-rpath" />
Expand Down
2 changes: 1 addition & 1 deletion runtime/Delegates.cs.t4
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ namespace ObjCRuntime {
Write ("\t\t\tif (IsCoreCLR) {\n\t");
}
if (d.SkipManagedStaticRegistrar) {
Write ("\t\t\tif (!Runtime.IsManagedStaticRegistrar) {\n\t");
Write ("\t\t\tif (!Runtime.IsManagedStaticRegistrar && !Runtime.IsTrimmableStaticRegistrar) {\n\t");
}
#>
options->Delegates-><#= d.SimpleEntryPoint #> = (IntPtr) (void *) <#= d.UnmanagedDelegateCast #> &<#= d.SimpleEntryPoint #>;
Expand Down
3 changes: 2 additions & 1 deletion runtime/delegates.t4
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,8 @@
new XDelegate ("void *", "IntPtr", "xamarin_lookup_unmanaged_function",
"const char *", "IntPtr", "assembly",
"const char *", "IntPtr", "symbol",
"int32_t", "int", "id"
"int32_t", "int", "id",
"const char *", "IntPtr", "objcClassName"
) {
WrappedManagedFunction = "LookupUnmanagedFunction",
},
Expand Down
16 changes: 13 additions & 3 deletions runtime/runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
enum InitializationFlags : int {
InitializationFlagsIsPartialStaticRegistrar = 0x01,
InitializationFlagsIsManagedStaticRegistrar = 0x02,
/* unused = 0x04,*/
InitializationFlagsIsTrimmableStaticRegistrar = 0x04,
/* unused = 0x08,*/
InitializationFlagsIsSimulator = 0x10,
InitializationFlagsIsCoreCLR = 0x20,
Expand Down Expand Up @@ -2553,7 +2553,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
}

void
xamarin_registrar_dlsym (void **function_pointer, const char *assembly, const char *symbol, int32_t id)
xamarin_registrar_dlsym (void **function_pointer, const char *assembly, const char *symbol, int32_t id, const char* objcClassName)
{
if (*function_pointer != NULL)
return;
Expand All @@ -2563,7 +2563,7 @@ -(struct NSObjectData*) xamarinGetNSObjectData;
return;

GCHandle exception_gchandle = INVALID_GCHANDLE;
*function_pointer = xamarin_lookup_unmanaged_function (assembly, symbol, id, &exception_gchandle);
*function_pointer = xamarin_lookup_unmanaged_function (assembly, symbol, id, objcClassName, &exception_gchandle);
if (*function_pointer != NULL)
return;

Expand Down Expand Up @@ -3053,6 +3053,16 @@ -(struct NSObjectData*) xamarinGetNSObjectData
}
}

void
xamarin_set_is_trimmable_static_registrar (bool value)
{
if (value) {
options.flags = (InitializationFlags) (options.flags | InitializationFlagsIsTrimmableStaticRegistrar);
} else {
options.flags = (InitializationFlags) (options.flags & ~InitializationFlagsIsTrimmableStaticRegistrar);
}
}

bool
xamarin_is_managed_exception_marshaling_disabled ()
{
Expand Down
3 changes: 2 additions & 1 deletion runtime/xamarin/runtime.h
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ void xamarin_check_objc_type (id obj, Class expected_class, SEL sel, id self,
#endif

void xamarin_set_is_managed_static_registrar (bool value);
void xamarin_set_is_trimmable_static_registrar (bool value);

void xamarin_process_nsexception (NSException *exc);
void xamarin_process_nsexception_using_mode (NSException *ns_exception, bool throwManagedAsDefault, GCHandle *output_exception);
Expand Down Expand Up @@ -308,7 +309,7 @@ bool xamarin_is_user_type (Class cls);
* symbol: the symbol to look up. Can be NULL to save space (this value isn't used except in error messages).
* id: a numerical id for faster lookup (than doing string comparisons on the symbol name).
*/
void xamarin_registrar_dlsym (void **function_pointer, const char *assembly, const char *symbol, int32_t id);
void xamarin_registrar_dlsym (void **function_pointer, const char *assembly, const char *symbol, int32_t id, const char* objcClassName);

/*
* Wrapper GCHandle functions that takes pointer sized handles instead of ints,
Expand Down
5 changes: 4 additions & 1 deletion scripts/rsp-to-csproj/rsp-to-csproj.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,10 @@ void ProcessFile (string file)
sb.AppendLine ($" </PropertyGroup>");
sb.AppendLine ($" <ItemGroup>");
foreach (var item in items) {
sb.AppendLine ($" <{item.Name} Include=\"{item.Include}\" />");
string link = "";
if (item.Include.StartsWith (workingDirectory))
link = $" Link=\"{item.Include [(workingDirectory.Length + 1)..]}\"";
sb.AppendLine ($" <{item.Name} Include=\"{item.Include}\"{link} />");
}
sb.AppendLine ($" </ItemGroup>");
sb.AppendLine ($"</Project>");
Expand Down
4 changes: 4 additions & 0 deletions src/Foundation/NSObject2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,10 @@ public void Dispose ()
[UnconditionalSuppressMessage ("", "IL2072", Justification = "The APIs this method tries to access are marked by other means, so this is linker-safe.")]
internal static IntPtr CreateNSObject (IntPtr type_gchandle, IntPtr handle, Flags flags)
{
// This method should never be called when using the trimmable static registrar, so assert that never happens by throwing an exception in that case.
if (Runtime.IsTrimmableStaticRegistrar)
throw new System.Diagnostics.UnreachableException ();

// Note that the code in this method doesn't necessarily work with NativeAOT, so assert that never happens by throwing an exception if using the managed static registrar (which is required for NativeAOT)
if (Runtime.IsManagedStaticRegistrar) {
throw new System.Diagnostics.UnreachableException ();
Expand Down
2 changes: 2 additions & 0 deletions src/ILLink.Substitutions.MacCatalyst.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="false" value="false" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseNSUrlSessionHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseNSUrlSessionHandler" featurevalue="false" value="false" />
Expand Down
2 changes: 2 additions & 0 deletions src/ILLink.Substitutions.iOS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<method signature="System.Int32 GetRuntimeArch()" body="stub" feature="ObjCRuntime.Runtime.Arch.IsSimulator" featurevalue="true" value="1" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="false" value="false" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseNSUrlSessionHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseNSUrlSessionHandler" featurevalue="false" value="false" />
Expand Down
2 changes: 2 additions & 0 deletions src/ILLink.Substitutions.macOS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
<method signature="System.Boolean get_IsNativeAOT()" body="stub" feature="ObjCRuntime.Runtime.IsNativeAOT" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="false" value="false" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseNSUrlSessionHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseNSUrlSessionHandler" featurevalue="false" value="false" />
Expand Down
2 changes: 2 additions & 0 deletions src/ILLink.Substitutions.tvOS.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<method signature="System.Int32 GetRuntimeArch()" body="stub" feature="ObjCRuntime.Runtime.Arch.IsSimulator" featurevalue="true" value="1" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsManagedStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsManagedStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="false" value="false" />
<method signature="System.Boolean get_IsTrimmableStaticRegistrar()" body="stub" feature="ObjCRuntime.Runtime.IsTrimmableStaticRegistrar" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="false" value="false" />
<method signature="System.Boolean get_UseCFNetworkHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseCFNetworkHandler" featurevalue="true" value="true" />
<method signature="System.Boolean get_UseNSUrlSessionHandler()" body="stub" feature="System.Net.Http.NativeHandler.UseNSUrlSessionHandler" featurevalue="false" value="false" />
Expand Down
8 changes: 8 additions & 0 deletions src/ObjCRuntime/Blocks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -511,6 +511,10 @@ public static bool IsManagedBlock (IntPtr block)
[UnconditionalSuppressMessage ("", "IL2072", Justification = "The APIs this method tries to access are marked by other means, so this is linker-safe.")]
static Type? GetDelegateProxyType (MethodInfo minfo, uint token_ref, out MethodInfo? baseMethod)
{
// This method should never be called when using the trimmable static registrar, so assert that never happens by throwing an exception in that case.
if (Runtime.IsTrimmableStaticRegistrar)
throw new System.Diagnostics.UnreachableException ();

// Note that the code in this method doesn't necessarily work with NativeAOT, so assert that never happens by throwing an exception if using the managed static registrar (which is required for NativeAOT)
if (Runtime.IsManagedStaticRegistrar)
throw new System.Diagnostics.UnreachableException ();
Expand Down Expand Up @@ -610,6 +614,10 @@ static IntPtr CreateBlockForDelegate (Delegate @delegate, Delegate delegateProxy
[UnconditionalSuppressMessage ("", "IL2075", Justification = "The APIs this method tries to access are marked by other means, so this is linker-safe.")]
internal static IntPtr GetBlockForDelegate (MethodInfo minfo, object? @delegate, uint token_ref, string? signature)
{
// This method should never be called when using the trimmable static registrar, so assert that never happens by throwing an exception in that case.
if (Runtime.IsTrimmableStaticRegistrar)
throw new System.Diagnostics.UnreachableException ();

// Note that the code in this method doesn't necessarily work with NativeAOT, so assert that never happens by throwing an exception if using the managed static registrar (which is required for NativeAOT)
if (Runtime.IsManagedStaticRegistrar)
throw new System.Diagnostics.UnreachableException ();
Expand Down
Loading
Loading