Skip to content

Conversation

@jonpryor
Copy link
Contributor

Commit 4d2362d broke the xamarin-android linker, as assemblies
which should have been linked were no longer being linked.

The apparent cause is that before commit 4d2362d, the "default"
action would be AssemblyAction.Link. Starting with 4d2362d, the
default action was instead AssemblyAction.Skip, as
LinkContext._userAction would be zero-initialized during
construction, and AssemblyAction.Skip is the default (0) enum value.

Set AssemblyAction._userAction in the constructor to
AssemblyAction.Link, so that pre-4d2362d8 linker behavior is
retained. This should allow the Xamarin.Android linker to work without
further changes.

Commit 4d2362d [broke the xamarin-android linker][0], as assemblies
which should have been linked were no longer being linked.

[0]: dotnet/android#1112 (comment)

The apparent cause is that before commit 4d2362d, the "default"
action would be `AssemblyAction.Link`. Starting with 4d2362d, the
default action was instead `AssemblyAction.Skip`, as
`LinkContext._userAction` would be zero-initialized during
construction, and `AssemblyAction.Skip` is the default (0) enum value.

Set `AssemblyAction._userAction` in the constructor to
`AssemblyAction.Link`, so that pre-4d2362d8 linker behavior is
retained. This should allow the Xamarin.Android linker to work without
further changes.
@marek-safar
Copy link
Contributor

marek-safar commented Dec 16, 2017

This value is correctly initialized by GetDefaultContext but as XA hooks into internals, it needs to mimic the change. The correct way to do it is to update https://github.com/xamarin/xamarin-android/blob/master/src/Xamarin.Android.Build.Tasks/Linker/MonoDroid.Tuner/Linker.cs#L48 to set UserAction to the expected value.

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.

2 participants