Skip to content

Latest 5.0.2 gives .net standard 2.1 not compatable with NETFrameworks & Mono.Linker.MarkException using 4.1.4 #80

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

Closed
LeoJHarris opened this issue Mar 31, 2020 · 9 comments
Assignees
Labels
Android Android only issue Configuration Issue Configuration Issue

Comments

@LeoJHarris
Copy link

LeoJHarris commented Mar 31, 2020

Issue below occuring in Release mode on android when building project:

Upgrading to latest on this library is causing issues with my UITest project which uses NETFramework 4.6.1 .

netstandard 2.1 is not compatable with any .NETFramework: https://docs.microsoft.com/en-us/dotnet/standard/net-standard

Error is below failing my build:

 sampleApp targets 'netstandard2.1'. It cannot be referenced by a project that targets '.NETFramework,Version=v4.6.1'

Im guessing latest version on this plugin prevents referencing projects with NETFramework

I tried a work around by dropping down to version 4.1.4 but I issues (see below) which I think is the linker stripping out some classes maybe? I dont want to set linking to none but if this is a linker issue any ideas how to fix this? Again guessing I need a line to the proguard.cfg to keep some classes?

Mono.Linker.MarkException: Error processing method: 'System.Void SampleApp.Droid.Resource::UpdateIdValues()' in assembly: 'SampleApp.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Int32 Plugin.LocalNotification.Resource/Attribute::coordinatorLayoutStyle

Full exception:

Severity	Code	Description	Project	File	Line	Suppression State
Error		Mono.Linker.MarkException: Error processing method: 'System.Void SampleApp.Droid.Resource::UpdateIdValues()' in assembly: 'SampleApp.Android.dll' ---> Mono.Cecil.ResolutionException: Failed to resolve System.Int32 Plugin.LocalNotification.Resource/Attribute::coordinatorLayoutStyle
   at Mono.Linker.Steps.MarkStep.HandleUnresolvedField(FieldReference reference)
   at Mono.Linker.Steps.MarkStep.MarkField(FieldReference reference)
   at Mono.Linker.Steps.MarkStep.MarkInstruction(Instruction instruction)
   at Mono.Linker.Steps.MarkStep.MarkMethodBody(MethodBody body)
   at Mono.Linker.Steps.MarkStep.ProcessMethod(MethodDefinition method)
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   --- End of inner exception stack trace ---
   at Mono.Linker.Steps.MarkStep.ProcessQueue()
   at Mono.Linker.Steps.MarkStep.ProcessPrimaryQueue()
   at Mono.Linker.Steps.MarkStep.Process()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.ProcessStep(LinkContext context, IStep step)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, ILogger logger, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.RunTask()
   at Xamarin.Android.Tasks.AndroidTask.Execute()	SampleApp.Android	C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets	1942	
@LeoJHarris LeoJHarris added the bug Something isn't working label Mar 31, 2020
@LeoJHarris LeoJHarris changed the title .net standard 2.1 not compatable with NETFrameworks Latest 5.0.2 gives .net standard 2.1 not compatable with NETFrameworks & Mono.Linker.MarkException using 4.1.4 Mar 31, 2020
@thudugala
Copy link
Owner

@LeoJHarris Can you please attach a sample project

@LeoJHarris
Copy link
Author

LeoJHarris commented Mar 31, 2020

@thudugala Yes I can get try get a sample, setting the linker to none works for the project to get it to succees the build. Any immediate ideas to get it working with linker enabled to SDK assemblies only? Ill skip linking your libary in the skip linking assemblied that will be the best work around I can think of at this stage.

Although I'm pretty sure adding a certain line to the proguard.cfg will fix the issue, Ill investigate around that first since it might be an easy fix otherwise.

@thudugala
Copy link
Owner

also look into #72

@LeoJHarris
Copy link
Author

LeoJHarris commented Mar 31, 2020

@thudugala is there a reason for using .net standard 2.1? Can it not be using 2.0 in latest? Going forward it will have issues with referencing unit testing projects using .NETFramework.

@thudugala
Copy link
Owner

Version 5 and above is targeting Android 10 (this cannot be changed because of android dependency).
Can you please verify that changing to .net standard 2.0 will help you ? I think .NET Framework does not support Android 10.

@LeoJHarris
Copy link
Author

Ill send a sample project as i am unable to get the build working unfortunately. Ill try get something this week.

@thudugala thudugala added Android Android only issue Configuration Issue Configuration Issue and removed bug Something isn't working labels Apr 1, 2020
@LeoJHarris
Copy link
Author

LeoJHarris commented Apr 2, 2020

@thudugala I migrated my Unit testing project to .net core so I could use latest version of your package and no issue now.

@LeoJHarris
Copy link
Author

Can you please verify that changing to .net standard 2.0 will help you ? I think .NET Framework does not support Android 10.

If your just unit testing a .net standard project i.e. the shared code then it shouldnt matter about the android 10 support with .NET Framework?

@thudugala
Copy link
Owner

I think Android 10 is only a issue for UITest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Android Android only issue Configuration Issue Configuration Issue
Projects
None yet
Development

No branches or pull requests

2 participants