Skip to content

The register-protocol optimization is not enabled when the interpreter is enabled #21782

@rolfbjarne

Description

@rolfbjarne

See:

https://github.com/xamarin/xamarin-macios/blob/f29834a751b20e2b26f348219f1fc9b6df19ea4b/tools/common/Optimizations.cs#L268

The register-protocol optimization is used to determine whether static interface constructors from the managed-static registrar are trimmed away or not:

https://github.com/xamarin/xamarin-macios/blob/f29834a751b20e2b26f348219f1fc9b6df19ea4b/tools/linker/CoreOptimizeGeneratedCode.cs#L1365-L1377

and this is required to get smaller apps + not reference frameworks unnecessarily (see #21002).

The current workaround is to add this to the csproj:

<PropertyGroup>
	<MtouchExtraArgs>--optimize:register-protocols</MtouchExtraArgs>
</PropertyGroup>

Metadata

Metadata

Assignees

No one assigned

    Labels

    regressionThe issue or pull request is a regression

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions