Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[illink] Mono.Android.Export.dll is linked away when an [Export] attribute is used #5265

Closed
pjcollins opened this issue Nov 5, 2020 · 1 comment · Fixed by #5286
Closed
Assignees
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: Linker Issues when linking assemblies.
Milestone

Comments

@pjcollins
Copy link
Member

Steps to Reproduce

  1. Building a simple One .NET project in Release configuration fails with the following code snippet inserted:
[Export]
public void MyButton_OnClick ()
{
}

Log File

Xamarin.Android.Common.targets(1391,3): error XA4210: Please add a reference to Mono.Android.Export.dll when using ExportAttribute or ExportFieldAttribute. 

Binary log:
msbuild.zip

@pjcollins pjcollins added Area: App+Library Build Issues when building Library projects or Application projects. Area: Linker Issues when linking assemblies. labels Nov 5, 2020
@pjcollins pjcollins added this to the One .NET milestone Nov 5, 2020
@jonathanpeppers
Copy link
Member

jonathanpeppers commented Nov 5, 2020

Just a thought, @jonpryor could the ExportAttribute move to be inside Mono.Android.Export.dll in .NET 6? We could also put a type forwarder in Mono.Android.dll.

A hello world app in .NET 6 will have a @(Reference) for Mono.Android and Mono.Android.Export by default, as basically every assembly gets referenced.

radekdoulik added a commit to radekdoulik/xamarin-android that referenced this issue Nov 11, 2020
... when Export or ExportField attributes are used.

Should fix: dotnet#5265

The dynamic dependency code is taken from dotnet/runtime repo. Once we
switch to VS 16.8, we can use net5.0 TFM and start using these
attributes from NET5.
jonpryor pushed a commit that referenced this issue Nov 16, 2020
A new version of Mono.Android-Tests has been added to run against the
.NET 6 SDK:

   * `tests/Mono.Android-Tests/Runtime-Microsoft.Android.Sdk/Mono.Android.NET-Tests.csproj`

To support this, new .NET `.csproj` files have been added alongside
all of the existing legacy Xamarin.Android unit test library projects.
These projects target `net5.0-android` and build against our
.NET 6 SDK (6f761ea):

  * `src/Mono.Android/Test/Java.Interop-Tests/Java.Interop-Tests.NET.csproj`
  * `src/Mono.Android/Test/Mono.Android-Test.Library/Mono.Android-Test.Library.NET.csproj`
  * `src/Xamarin.Android.NUnitLite/Xamarin.Android.NUnitLite.NET.csproj`
  * `tests/TestRunner.Core/TestRunner.Core.NET.csproj`
  * `tests/TestRunner.NUnit/TestRunner.NUnit.NET.csproj`

The `_CreateAar` target was being skipped for the new
`Java.Interop-Tests.NET` project, as it had no inputs.  As a result,
the `Mono.Android-Test-classes.jar` file required by these tests was
not being included in the application project.  To fix this, I've added
`@(AndroidJavaLibrary)` to `@(_CreateAarInputs)` so that these items
will also be considered as inputs for this target/task.

All tests which have been ignored are tied back to one of the following issues:

  * Mono.Data.Sqlite is not supported.
  * Secondary AppDomains are not supported.
  * Missing crypto/networking support in dotnet/runtime.
  * dotnet/runtime#35836
  * dotnet/runtime#44358
  * #5265
  * #5275
radekdoulik added a commit to radekdoulik/xamarin-android that referenced this issue Nov 23, 2020
... when Export or ExportField attributes are used.

Should fix: dotnet#5265

The dynamic dependency code is taken from dotnet/runtime repo. Once we
switch to VS 16.8, we can use net5.0 TFM and start using these
attributes from NET5.
grendello pushed a commit that referenced this issue Nov 24, 2020
* [illink] Preserve DynamicCallbackCodeGenerator

... when Export or ExportField attributes are used.

Should fix: #5265

The dynamic dependency code is taken from dotnet/runtime repo. Once we
switch to VS 16.8, we can use net5.0 TFM and start using these
attributes from NET5.

* Update Xamarin.Android.NamingCustomAttributes.projitems

Do not include the attributes on net5.0
@ghost ghost locked as resolved and limited conversation to collaborators Jun 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Area: App+Library Build Issues when building Library projects or Application projects. Area: Linker Issues when linking assemblies.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants