Open sameertotey opened 6 years ago
@sameertotey Do you have a solution in mind?
Having same issue with Microsoft.Azure.EventHubs v2.1.0.
The ideal solution would be for Xamarin .NET Standard solutions to be able to reference Microsoft.Azure.EventHubs and build in release mode.
Hi, what is the solution for this? Or is there a workaround? I'm trying to use the Microsoft.Azure.EventHubs 2.1 nuget in a .Netstandard 2.0 project used by Uwp and iOS apps. I'm afraid I won't be able to use this nuget, which is a major drawback. @nemakam ?
Also experiencing this issue with Xamarin Forms, works fine with the Android build though.
UPDATE: I resolved it by setting the 'Linker behavior' option in the iOS project settings to 'Link All'
Changing to "Link All" got the project to build for me, but then would fail when calling await queueClient.SendAsync(msg);
with the message "the lazily-initialize type does not have a public parameter-less constructor". I printed out the stack trace of the message and found the issue steming from the Microsoft.Azure.Amqp namespace.
To resolve this for me I had to add the following argument in the mtouch.
--linkskip=Microsoft.Azure.Amqp
I am having this issue with Xamarin.IOS. I am referencing Microsoft.Azure.ServiceBus v. 3.1.1 from a class library that is .Net Standard 2.0. The Xamarin.IOS project then references the class library. Xamarin.ios is set to Dont Link
I get the following build error Severity Code Description Project File Line Suppression State Error Could not link assemblies. Reason: Error while processing references of 'NextIDClientiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' NID.Client.iOS
Mono.Linker.LoadException: Error while processing references of 'NextIDClientiOS, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'NID.Client.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'NID.Client.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c'
14> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in 1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x000e0] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:80 14> --- 14> --- inner exception 14> Mono.Linker.LoadException: Error while processing references of 'NID.Client.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Linker.LoadException: Error while processing references of 'NID.Client.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' 14> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <cf7a158ef20945e2bfed3d139c691ed5>:0 14> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 14> --- End of inner exception stack trace --- 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220 14> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- End of inner exception stack trace --- 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- End of inner exception stack trace --- 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- 14> --- inner exception 14> Mono.Linker.LoadException: Error while processing references of 'NID.Client.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' 14> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <cf7a158ef20945e2bfed3d139c691ed5>:0 14> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 14> --- End of inner exception stack trace --- 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220 14> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- End of inner exception stack trace --- 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00056] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:56 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- 14> --- inner exception 14> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' ---> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' 14> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <cf7a158ef20945e2bfed3d139c691ed5>:0 14> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00046] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:220 14> at Mono.Linker.LinkContext.ResolveReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00024] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:254 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x0002c] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:52 14> at Mono.Linker.Steps.LoadReferencesStep.ProcessReferences (Mono.Cecil.AssemblyDefinition assembly) [0x00049] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker.Steps/LoadReferencesStep.cs:54 14> --- 14> --- inner exception 14> Mono.Cecil.AssemblyResolutionException: Failed to resolve assembly: 'Microsoft.Azure.ServiceBus, Version=3.1.1.0, Culture=neutral, PublicKeyToken=7e34167dcc6d6d8c' 14> at Mono.Cecil.BaseAssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00105] in <cf7a158ef20945e2bfed3d139c691ed5>:0 14> at Mono.Linker.AssemblyResolver.Resolve (Mono.Cecil.AssemblyNameReference name, Mono.Cecil.ReaderParameters parameters) [0x00071] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/AssemblyResolver.cs:80 14> at Mono.Linker.LinkContext.Resolve (Mono.Cecil.IMetadataScope scope) [0x00009] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/external/mono/external/linker/linker/Linker/LinkContext.cs:210 14> --- 14> at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List
1[Mono.Cecil.AssemblyDefinition]& assemblies) [0x003ad] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Tuning.cs:122
14> at Xamarin.Bundler.Target.LinkAssemblies (System.Collections.Generic.List1[Mono.Cecil.AssemblyDefinition]& assemblies, System.String output_dir, System.Collections.Generic.IEnumerable
1[T] sharedCodeTargets) [0x00256] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:517
14> at Xamarin.Bundler.Target.ManagedLink () [0x00720] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:664
14> at Xamarin.Bundler.Target.ProcessAssemblies () [0x000c2] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Target.cs:868
14> at Xamarin.Bundler.Application.ProcessAssemblies () [0x0002f] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:1411
14> at Xamarin.Bundler.Application.BuildManaged () [0x00001] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:839
14> at Xamarin.Bundler.Application+<>c.1[T].ForEach (System.Action
1[T] action) [0x00024] in <71f4e3d7d65e42b0a699d02e59766d3c>:0
14> at Xamarin.Bundler.Application.BuildAll () [0x00050] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/Application.cs:787
14> at Xamarin.Bundler.Driver.Main2 (System.String[] args) [0x00423] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:1402
14> at Xamarin.Bundler.Driver.Main (System.String[] args) [0x00015] in /Users/builder/jenkins/workspace/xamarin-macios/xamarin-macios/tools/mtouch/mtouch.cs:934
I'm running into this problem as well, after referencing the EventHub .NET standard library in a Xamarin app. However, the suggested workaround does not work, as it actually disables the plugins that are linked in the project. Has anyone found a solution/workaround to this?
Half a year later - and the issue still has not been resolved.. Just got it too when upgrading EventHubs nuget for Xamarin.Forms solution to v 2.2.1
Microsoft.Azure.EventHubs also has a dependency on Microsoft.Azure.Services.AppAuthentication, and so I'm having this issue using EventHub .NET standard library as well. Here is my example project: https://github.com/tele-bird/eventhub-poc
Using the TaskyPortable project as a baseline, I'm able to reproduce this problem:
I found that the issue was caused by two bad reference paths that were added to my iOS projects:
I found through experimentation (editing the csproj by hand) that the Xamarin.iOS10 folder was wrong. It should use the netstandard1.3 folder instead. And now the linker is successful. Here are the new paths that I use:
Actual Behavior
Expected Behavior
Versions