Bug 54928 - Link Assemblies Task Failed with error XA2006
Summary: Link Assemblies Task Failed with error XA2006
Status: RESOLVED NORESPONSE
Alias: None
Product: Android
Classification: Xamarin
Component: General (show other bugs)
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2017-04-10 11:08 UTC by sandeep.rayat
Modified: 2017-10-04 16:26 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Android Version (12.04 KB, image/png)
2017-04-10 11:08 UTC, sandeep.rayat
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED NORESPONSE

Description sandeep.rayat 2017-04-10 11:08:44 UTC
Created attachment 21388 [details]
Android Version

Android Version

Severity	Code	Description	Project	File	Line	Suppression State
Error		The "LinkAssemblies" task failed unexpectedly.
Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA2006: Could not resolve reference to 'System.Configuration.ConfigurationException' (defined in assembly 'System.Configuration, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') with scope 'System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'. When the scope is different from the defining assembly, it usually means that the type is forwarded. ---> Mono.Cecil.ResolutionException: Failed to resolve System.Configuration.ConfigurationException
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.MarkType(TypeReference reference)
   at MonoDroid.Tuner.MonoDroidMarkStep.MarkType(TypeReference reference)
   at Mono.Linker.Steps.MarkStep.InitializeType(TypeDefinition type)
   at Mono.Linker.Steps.MarkStep.InitializeAssembly(AssemblyDefinition assembly)
   at Mono.Linker.Steps.MarkStep.Initialize()
   at Mono.Linker.Steps.MarkStep.Process(LinkContext context)
   at MonoDroid.Tuner.MonoDroidMarkStep.Process(LinkContext context)
   at Mono.Linker.Pipeline.Process(LinkContext context)
   at MonoDroid.Tuner.Linker.Process(LinkerOptions options, LinkContext& context)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   --- End of inner exception stack trace ---
   at Java.Interop.Tools.Diagnostics.Diagnostic.Error(Int32 code, Exception innerException, String message, Object[] args)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute(DirectoryAssemblyResolver res)
   at Xamarin.Android.Tasks.LinkAssemblies.Execute()
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	TeaTotal.Droid			





Getting this error in Release build only. Seems to build find in debug mode but seems to be a linker problem? 

I have updated the android versions(see attachment) so doesn't seem to be that. 

Any ideas?





03-28 09:22:13.445 F/monodroid-assembly( 2966): Could not load assembly 'System.Configuration' during startup registration.
03-28 09:22:13.445 F/monodroid-assembly( 2966): This might be due to an invalid debug installation.
03-28 09:22:13.445 F/monodroid-assembly( 2966): A common cause is to 'adb install' the app directly instead of doing from the IDE.
Comment 1 Jon Douglas [MSFT] 2017-06-19 19:17:05 UTC
Non-engineering team preliminary quick review

## Specific to one particular project, development computer, or target mobile device?

Specific to Mono Linker behavior with non-available assemblies in a Debug vs. Release configuration

## Includes steps to reproduce the problem and a description of the actual vs. expected behavior?

No steps are included nor a reproduction. We will need a minimal project that demonstrates this issue.

## Considers the relevant log files for the part(s) of the process where something goes wrong (IDE editing, MSBuild building, deploying, launching, attaching the debugger, an in-app error, or something else) and has them attached?
(See https://developer.xamarin.com/guides/cross-platform/troubleshooting/questions/version-logs/ for general reference.)

Yes, provides enough logging of the linker error in question.

## Misc Notes

System.Configuration is not an available assembly in Xamarin.Android:

https://developer.xamarin.com/guides/cross-platform/advanced/available-assemblies/

Thus this assembly is being pulled in by something else and the linker cannot find any reference to this assembly as it's not available.

https://github.com/xamarin/java.interop/blob/a1d3ecc8ba6e67b96ae1c633194b0e78c2ac5c23/src/Java.Interop.Tools.Diagnostics/Java.Interop.Tools.Diagnostics/XamarinAndroidException.cs#L8

ConfigurationException on the other hand is found in System.Configuration

## Next Steps

We will need a minimal reproduction. We want to see where the reference to the System.Configuration assembly is coming from. This is typically not a supported assembly in Xamarin.Android.
Comment 2 Jon Douglas [MSFT] 2017-10-04 16:26:27 UTC
Because we have not received a reply to our request for more information we are closing this issue. If you are still encountering this issue, please reopen the ticket with the requested information. Thanks!