You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Assembly load error in Android app referencing another project referencing a DLL assembly #10154
If a MAUI Android project has a reference to a .NET Standard project in the same solution; and the .NET Standard project has a reference to a .NET Standard assembly, calling a code that eventually calls a code in the assembly fails to load the assembly.
Steps to Reproduce
Create a new MAUI solution and project.
Add a .NET Standard project to the solution.
Add a .NET Standard assembly reference to this project created in Step 2.
Add a method to the .NET Standard project (created in Step 2) that calls something in the referenced (in Step 3) assembly.
Add a project reference to the MAUI app that was created in Step 1 that references to the project created in Step 2.
Call the method that was created in step 4.
i.e. The reference chain: MAUI csproj --> .NET Std. csproj --> .NET Std. DLL
Link to public reproduction project repository
https://github.com/ist-22/10154-repro
app has a project reference to lib1
lib1 has an assembly reference to lib2 (so lib2 needs to be compiled first)
Version with bug
6.0.400
Last version that worked well
Unknown/Other
Affected platforms
Android
Affected platform versions
Android 11
Did you find any workaround?
Add the .NET Standard assembly reference also to the MAUI app project.
In the repository uncomment lines 14..18 in app/app.csproj -- this adds an assembly reference to lib2 in app
Are you sure this is a MAUI (The UI Framework) issue, or an issue with whatever device you're trying to target? Did you try doing this with a dotnet new android app?
I don't think it's a device/target issue (if this implies architecture) since adding a reference to the assembly in the top MAUI app can act as a workaround.
However, you are right about the MAUI/UI framework question and pointing to the Android project. Yes the issue happens in a project created with dotnet new android, too; so I guess it's not MAUI specific and maybe more related to Xamarin.Android?
Activity
drasticactions commentedon Sep 16, 2022
Are you sure this is a MAUI (The UI Framework) issue, or an issue with whatever device you're trying to target? Did you try doing this with a
dotnet new androidapp?ist-22 commentedon Sep 16, 2022
I don't think it's a device/target issue (if this implies architecture) since adding a reference to the assembly in the top MAUI app can act as a workaround.
However, you are right about the MAUI/UI framework question and pointing to the Android project. Yes the issue happens in a project created with
dotnet new android, too; so I guess it's not MAUI specific and maybe more related to Xamarin.Android?jonpryor commentedon Sep 26, 2022
Could you please attach a project that exhibits this scenario?
ist-22 commentedon Sep 29, 2022
@jonpryor -- Updated the issue description with the repo link
25 remaining items
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)`
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (#7642
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (do…
Revert "[Xamarin.Android.Build.Tasks] fix cases of missing `@(Referen…
Revert "[Xamarin.Android.Build.Tasks] fix cases of missing `@(Referen…
jonathanpeppers commentedon Jan 22, 2023
The first attempt to fix this in xamarin/xamarin-android/main didn't work out. (It caused a different issue) Reopening to look into this further.
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)`
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)`
[Xamarin.Android.Build.Tasks] fix cases of missing `@(Reference)` (#7947