Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
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
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.
Customer have created a library solution HPE.Xamarin.Forms.Utils (Attached) using Xamarin.Forms.Dependency to execute native code using a shared project. This solution on compiling generates a nuget package HPE.Xamarin.Forms.Utils.1.0.14.nupkg(Attached).
The nuget package is consumed in XamarinTestApp (Attached) which is a Xamarin Forms Application. When XamarinTestApp us executed for UWP the native code is executed correctly (Screen Attached) , However for Android on Android it always crashes, (Screen Attached) with error System.MissingMethodException: Default constructor not found for type HPE.Xamarin.Forms.Utils.ILocalDevice.
As code follows the documentation https://developer.xamarin.com/guides/xamarin-forms/dependency-service/introduction/ and appears everything is in place including the default constructor. (LocalDevice.cs in library project).
public class LocalDevice : Java.Lang.Object, ILocalDevice
public class LocalDevice : ILocalDevice
and also registering it manually via
public LocalDevice() // Necessary for Xamarin DependencyService to work
Install https://marketplace.visualstudio.com/items?itemName=NuProjTeam.NuGetPackageProject <https://marketplace.visualstudio.com/items?itemName=NuProjTeam.NuGetPackageProject before opening the library project.
Created attachment 18633 [details]
Library Solution (HPE.Xamarin.Forms.Utils)
Created attachment 18634 [details]
Sample App for Repro
Created attachment 18635 [details]
Screenshot - UWP (Success)
Created attachment 18636 [details]
Screenshot - Android (Failure)
Created attachment 18637 [details]
Generated nuget package
Please provide version info for the environment where the issue was observed as part of the standard information on bug reports. For this particular bug, please include at a minimum the Xamarin.Android version (or XamarinVS version) as well as the Xamarin.Forms version. See also [1, 2].
Additionally, please clearly list the steps to replicate the problem, preferably using a numbered list. As also linked on , please see the "Description" section on  for a rough template of the recommended content and format for the bug Description.
Visual Studio Info
Microsoft Visual Studio Enterprise 2015
Version 14.0.25421.03 Update 3
Microsoft .NET Framework
Installed Version: Enterprise
Architecture and Modeling Tools 00322-90200-21579-AA533
Microsoft Architecture and Modeling Tools
UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.
Visual Basic 2015 00322-90200-21579-AA533
Microsoft Visual Basic 2015
Visual C# 2015 00322-90200-21579-AA533
Microsoft Visual C# 2015
Visual C++ 2015 00322-90200-21579-AA533
Microsoft Visual C++ 2015
Windows Phone SDK 8.0 - ENU 00322-90200-21579-AA533
Windows Phone SDK 8.0 - ENU
Application Insights Tools for Visual Studio Package 7.12.01115.4
Application Insights Tools for Visual Studio
ASP.NET and Web Tools 2015 (RC1 Update 1) 14.1.20203.0
ASP.NET and Web Tools 2015 (RC1 Update 1)
ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0
For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563
ASP.NET Web Frameworks and Tools 2013 5.2.40314.0
For additional information, visit http://www.asp.net/
Azure App Service Tools v2.9 14.0.20316.0
Azure App Service Tools v2.9
Azure Data Lake Node 1.0
This package contains the Data Lake integration nodes for Server Explorer.
Azure Data Lake Tools for Visual Studio 2.0.6000.0
Microsoft Azure Data Lake Tools for Visual Studio
Command Bus, Event Stream and Async Manager Merq
Provides ICommandBus, IEventStream and IAsyncManager MEF services for loosely coupled Visual Studio extension components communication and integration.
Common Azure Tools 1.8
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
A Visual Studio Extension that brings the GitHub Flow into Visual Studio.
Creates Xamarin Android Binding projects from a gradle file.
Microsoft Azure HDInsight HQL Service 2.0.6000.0
Language service for Hive query
Microsoft Azure HDInsight Tools for Visual Studio 2.0.6000.0
An integrated development environment for HDInsight application development.
Microsoft Azure Mobile Services Tools 1.4
Microsoft Azure Mobile Services Tools
Microsoft Azure Tools 2.9
Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.40323.3
NuGet Package Manager 3.4.4
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.
NuGet Package Project System
PreEmptive Analytics Visualizer 1.2
Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.
SQL Server Data Tools 14.0.60519.0
Microsoft SQL Server Data Tools
Hosting json editor into a tool window
TypeScript tools for Visual Studio
Visual Studio Tools for Apache Cordova Update 10
Visual Studio Tools for Apache Cordova
Visual Studio Tools for Universal Windows Apps 14.0.25420.01
The Visual Studio Tools for Universal Windows apps allow you to build a single universal app experience that can reach every device running Windows 10: phone, tablet, PC, and more. It includes the Microsoft Windows 10 Software Development Kit.
Xamarin 188.8.131.52 (47830f6)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.
Xamarin Inspector Support 0.8.0.0 (dc081aa)
Adds support for inspecting Xamarin and WPF apps.
Xamarin.Android 184.108.40.206 (ce955cc)
Visual Studio extension to enable development for Xamarin.Android.
Xamarin.iOS 10.2.1.5 (44931ae)
Visual Studio extension to enable development for Xamarin.iOS.
Steps to replicate
1. Download the attached nuget package file on the local drive.
2. Open XamarinTestApp in Visual Studio 2015
3. Using Tools -> Nuget Package Manager -> Package Manager Settings -> Package Source : Add a new source by Naming it and browsing the nuget package file in Step 1
4. Build the Solution.
5. Set UWP as startup -> Run -> It Runs fine (Screen Attached)
6. Set Android as startup -> Run -> It fails (Screen Attached)
(In reply to Brendan Zagaeski from comment #7)
> Additionally, please clearly list the steps to replicate the problem,
> preferably using a numbered list. As also linked on , please see the
> "Description" section on  for a rough template of the recommended content
> and format for the bug Description.
>  https://bugzilla.xamarin.com/page.cgi?id=bug-writing.html
## Confirmation status: invalid test case
1. In the attached app test case from Comment 2, the "XamarinTestApp.Droid" project does not include a reference to the platform-specific Xamarin.Android assembly from the NuGet package:
2. Removing and re-adding the NuGet package "HPE.Xamarin.Forms.Utils" successfully added the reference to "HPE.Xamarin.Forms.Utils.Droid.dll" into the "XamarinTestApp.Droid" project.
3. Rebuilding and redeploying the project fixed the error message from Comment 4.
In short, the error message was accurate and pointed to the cause of the problem.
If adding the NuGet package to the Xamarin.Android package consistently fails to add the Android-specific package as a reference in some Visual Studio environment, that would be a behavior of the NuGet Package Manager extension. It could indicate that the NuGet package is not conforming to all of the conventions that other NuGet packages for Xamarin.Android use.