Closed ghuntley closed 6 years ago
=== Visual Studio Enterprise 2017 for Mac ===
Version 7.4.2 (build 12)
Installation UUID: a32bd9d1-8328-4615-8629-3d85d971cc40
Runtime:
Mono 5.8.1.0 (2017-10/6bf3922f3fd) (64-bit)
GTK+ 2.24.23 (Raleigh theme)
Package version: 508010000
=== NuGet ===
Version: 4.3.1.4445
=== .NET Core ===
Runtime: /usr/local/share/dotnet/dotnet
Runtime Version: 2.0.5
SDK: /usr/local/share/dotnet/sdk/2.1.4/Sdks
SDK Version: 2.1.4
MSBuild SDKs: /Library/Frameworks/Mono.framework/Versions/5.8.1/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Profiler ===
Version: 1.6.1
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler
=== Apple Developer Tools ===
Xcode 9.3 (14154)
Build 9E145
=== Xamarin.Mac ===
Version: 4.2.1.28 (Visual Studio Enterprise)
=== Xamarin.iOS ===
Version: 11.9.1.24 (Visual Studio Enterprise)
Hash: f62de472
Branch: xcode9.3
Build date: 2018-03-29 19:30:53-0400
=== Xamarin.Android ===
Version: 8.2.0.16 (Visual Studio Enterprise)
Android SDK: /Users/ghuntley/Library/Developer/Xamarin/android-sdk-macosx
Supported Android versions:
4.4 (API level 19)
5.0 (API level 21)
5.1 (API level 22)
6.0 (API level 23)
7.0 (API level 24)
7.1 (API level 25)
8.0 (API level 26)
8.1 (API level 27)
SDK Tools Version: 25.2.5
SDK Platform Tools Version: 27.0.1
SDK Build Tools Version: 27.0.3
Java SDK: /usr
java version "1.8.0_101"
Java(TM) SE Runtime Environment (build 1.8.0_101-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode)
Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL
=== Xamarin Inspector ===
Version: 1.4.0
Hash: b3f92f9
Branch: master
Build date: Fri, 19 Jan 2018 22:00:34 GMT
Client compatibility: 1
=== Build Information ===
Release ID: 704020012
Git revision: 0d8e3f0a4d683771f17959739956fa09c7ba21e3
Build date: 2018-03-30 10:45:17-04
Xamarin addins: 958839ea56ab1e331caf7c92b6ad50fb9e6ee9d2
Build lane: monodevelop-lion-d15-6
=== Operating System ===
Mac OS X 10.13.4
Darwin 17.5.0 Darwin Kernel Version 17.5.0
Mon Mar 5 22:24:32 PST 2018
root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64
=== Enabled user installed addins ===
MFractor 3.04.15
Internet of Things (IoT) development (Preview) 7.1
The workaround is to not install the package into Xamarin.Android directly and ignore defaults supplied by the file -> new project wizard.
Microsoft.Azure.EventHubs
into netstandard20 projectIT WORKS. Kinda annoyed tho - 40mins wasted. I can see newbies wasting days/weeks on this tho or giving up on xamarin altogether.
Ultimate end goal is to do this https://docs.microsoft.com/en-us/azure/event-hubs/event-hubs-dotnet-standard-getstarted-send
Repro test case at issue1532.zip
@ghuntley I think the issue1532.zip
file is missing the Droid
and iOS
directories.
I'll try to repro with a new project in the meantime, it looks pretty simple to setup.
I could repro with Visual Studio 2017 15.6.6 on Windows:
I am also getting the same results with xamarin-android/master.
Microsoft.Azure.EventHubs.dll
indeed has a reference to Microsoft.Azure.Services.AppAuthentication.dll
:
It appears that installing https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication/1.1.0-preview
fixes the issue. I believe there is an issue with this NuGet package where it should actually have a dependency on this other package, here is the nuspec (no dependency):
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Microsoft.Azure.EventHubs</id>
<version>2.0.0</version>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<licenseUrl>https://raw.githubusercontent.com/Azure/azure-event-hubs-dotnet/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Azure/azure-event-hubs-dotnet</projectUrl>
<iconUrl>https://raw.githubusercontent.com/Azure/azure-event-hubs-dotnet/master/event-hubs.png</iconUrl>
<description>This is the next generation Azure Event Hubs .NET Standard client library. For more information about Event Hubs, see https://azure.microsoft.com/en-us/services/event-hubs/</description>
<releaseNotes>https://github.com/Azure/azure-event-hubs-dotnet/releases</releaseNotes>
<tags>Azure Event Hubs EventHubs .NET AMQP IoT</tags>
<dependencies>
<group targetFramework=".NETFramework4.6.1">
<dependency id="Microsoft.Azure.Amqp" version="2.2.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.1" exclude="Build,Analyzers" />
<dependency id="System.Diagnostics.DiagnosticSource" version="4.4.1" exclude="Build,Analyzers" />
<dependency id="System.IdentityModel.Tokens.Jwt" version="5.2.1" exclude="Build,Analyzers" />
<dependency id="System.Net.Http" version="4.3.3" exclude="Build,Analyzers" />
<dependency id="System.Reflection.TypeExtensions" version="4.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework="UAP10.0">
<dependency id="Microsoft.Azure.Amqp" version="2.2.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.1" exclude="Build,Analyzers" />
<dependency id="Microsoft.NETCore.UniversalWindowsPlatform" version="5.2.3" exclude="Build,Analyzers" />
<dependency id="System.Diagnostics.DiagnosticSource" version="4.4.1" exclude="Build,Analyzers" />
<dependency id="System.IdentityModel.Tokens.Jwt" version="5.2.1" exclude="Build,Analyzers" />
<dependency id="System.Net.Http" version="4.3.3" exclude="Build,Analyzers" />
<dependency id="System.Reflection.TypeExtensions" version="4.4.0" exclude="Build,Analyzers" />
</group>
<group targetFramework=".NETStandard2.0">
<dependency id="Microsoft.Azure.Amqp" version="2.2.0" exclude="Build,Analyzers" />
<dependency id="Microsoft.IdentityModel.Clients.ActiveDirectory" version="3.19.1" exclude="Build,Analyzers" />
<dependency id="System.Diagnostics.DiagnosticSource" version="4.4.1" exclude="Build,Analyzers" />
<dependency id="System.IdentityModel.Tokens.Jwt" version="5.2.1" exclude="Build,Analyzers" />
<dependency id="System.Net.Http" version="4.3.3" exclude="Build,Analyzers" />
<dependency id="System.Reflection.TypeExtensions" version="4.4.0" exclude="Build,Analyzers" />
<dependency id="System.Runtime.Serialization.Primitives" version="4.3.0" exclude="Build,Analyzers" />
</group>
</dependencies>
</metadata>
</package>
Maybe they just took out the dependency so they could ship 🚢 to stable, as the dependency is still in preview?
That being said, it is the <ResolveAssemblies />
MSBuild task from Xamarin.Android failing if an assembly can't be found. It is very likely you would still get a runtime exception in a case like this if we let the build go on and the app was deployed and launched.
It is a bit weird something different is happening on Android vs iOS, so let me discuss with my team and we can see what needs to be done here. @ghuntley let me know if you see Microsoft.Azure.Services.AppAuthentication.dll
somewhere and I missed it.
The iOS team do not have <ResolveAssemblies />
in their build system. They make use of the msbuild variable @(ReferenceCopyLocalPaths)
to figure out what assemblies need to be shipped. The down side of this is it does not always pick up ALL the required assemblies.
The <ResolveAssemblies />
task will pick up all the required dependencies regardless of if they are referenced by the main app or not. It does this by using Cecil to load the dll's and then walk its dependencies. In this case the Nuget for Microsoft.Azure.Services.AppAuthentication.dll
was not installed but it appears Microsoft.Azure.EventHubs.dll
has it as a reference. Which is why <ResolveAssemblies />
is complaining. This will explain why iOS behaves differently.
Maybe if we improved the error message it would help? The existing message makes it sound like it's a missing assembly in Xamarin.Android:
Could not load assembly XYZ. Perhaps it doesn't exist in the Mono for Android profile?
This message makes sense if the assembly name started with System.*
. But for other assemblies maybe it should say something like:
Could not load assembly 'Microsoft.Azure.Services.AppAuthentication'. It was referenced by assembly 'Microsoft.Azure.EventHubs', but was not found.
Or maybe that is a better message, in general?
I'm all for better error messages :) We have a helper to check if something is a Framework Assembly I think, so it that fails we can provide a newer error message.
Could not load assembly 'Microsoft.Azure.Services.AppAuthentication'. It was referenced by assembly 'Microsoft.Azure.EventHubs', but was not found.
Are you missing a reference or nuget package?
On 11 April 2018 at 14:22, Jonathan Peppers notifications@github.com wrote:
Maybe if we improved the error message it would help? The existing message makes it sound like it's a missing assembly in Xamarin.Android:
Could not load assembly XYZ. Perhaps it doesn't exist in the Mono for Android profile?
This message makes sense if the assembly name started with System.*. But for other assemblies maybe it should say something like:
Could not load assembly 'Microsoft.Azure.Services.AppAuthentication'. It was referenced by assembly 'Microsoft.Azure.EventHubs', but was not found.
Or maybe that is a better message, in general?
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/xamarin/xamarin-android/issues/1532#issuecomment-380449788, or mute the thread https://github.com/notifications/unsubscribe-auth/AAxeeaziaGVJpPOpwirK-EsKe1U4LMAmks5tngOigaJpZM4TNk6a .
Thanks for looking at this so quickly Jonathan Peppers. Here's the exact solution that includes the iOS and Android applications.
Typically I use netstandard20
style project structure. When this issue was created I was doing a quick proof of concept infront of a client and accepted the defaults shipped by the Xamarin toolchain - shared projects.
edit: problem is reproducing with netstandard20
library as well. Agreed that this is an upstream issue with the package. I'm sorry for any confusion. Either way sending in a couple PR's to improve the developer experience/error messages is highly valuable.
Confirming that manually installing https://www.nuget.org/packages/Microsoft.Azure.Services.AppAuthentication/1.1.0-preview into the Android project resolves the compilation issue. This isn't needed on iOS.
I added new Page. After Then I got the same error. In Xaml file I added next line
xmlns:local="clr-namespace:PageNavigation;assembly:PageNavigation" The error is gone
Visual Studio for Mac 7.4.2
Bootstrap a new application using File -> New -> Xamarin.Forms application -> iOS & Android application using defaults (which creates shared project architecture)
iOS App
Compiles and works fine.
Android
Does not compile, left with 💣