Bug 59212 - System.NullReferenceException at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.ExecuteDeploy
Summary: System.NullReferenceException at Xamarin.VisualStudio.Android.CommandHandlers...
Status: NEW
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: Xamarin.Forms ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-09-04 13:27 UTC by John Hardman
Modified: 2018-03-12 18:31 UTC (History)
9 users (show)

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

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 for Bug 59212 on Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.
Related Links:
Status:
NEW

Description John Hardman 2017-09-04 13:27:08 UTC
When building & deploying from Visual Studio, the deploy often does not happen until I re-start Visual Studio and try again. This costs a lot of time over the course of a day, let alone a project.

It happens regardless of target platform. It is happening on Visual Studio 2017, but also happened on Visual Studio 2015.

I have just had it happen on Android, so here is the final bit of information from the log. Any idea what might be causing this - is there a workaround until a fix can be pushed out?


Xamarin.VisualStudio.ProgressReport|Error|0|System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.ExecuteDeploy(Project project, IMonoAndroidDevice device, IAndroidProjectProperties projectProperties, IProgressReport progress, Boolean runInProc, CancellationToken cancellationToken) in C:\d\lanes\4985\306f76ac\source\xamarinvs\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs:line 150
   at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.Execute(DeployCommand command, IProgressReport progress, CancellationToken cancellationToken) in C:\d\lanes\4985\306f76ac\source\xamarinvs\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs:line 116
   at Xamarin.VisualStudio.Commands.CommandHandlerBase`2.Execute(TCommand command, CancellationToken cancellationToken) in C:\d\lanes\4985\306f76ac\source\xamarinvs\src\Core\VisualStudio\Commands\CommandHandlerBase.cs:line 131
Comment 1 Prashant [MSFT] 2017-09-05 05:24:12 UTC
Thanks so much for taking the time to submit this report!  Please attach the following to help us reproduce this issue:
-Detailed reproduction steps
-Version information (Help → About Microsoft Visual Studio → Copy Info)
-Logs (Help → Xamarin → Zip Logs (last 7 days))
-Optional: project to reproduce your issue
Comment 2 John Hardman 2017-09-05 09:06:56 UTC
Here's the Visual Studio About info

Microsoft Visual Studio Community 2017  (2)
Version 15.3.0
VisualStudio.15.Release/15.3.0+26730.3
Microsoft .NET Framework
Version 4.7.02046

Installed Version: Community

Visual Basic 2017   00369-60000-00001-AA477
Microsoft Visual Basic 2017

Visual C# 2017   00369-60000-00001-AA477
Microsoft Visual C# 2017

Visual C++ 2017   00369-60000-00001-AA477
Microsoft Visual C++ 2017

Visual F# 4.1   00369-60000-00001-AA477
Microsoft Visual F# 4.1

Application Insights Tools for Visual Studio Package   8.8.00712.1
Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2017   15.0.30726.0
ASP.NET and Web Tools 2017

ASP.NET Core Razor Language Services   1.0
Provides languages services for ASP.NET Core Razor.

ASP.NET Template Engine 2017   15.0.30726.0
ASP.NET Template Engine 2017

ASP.NET Web Frameworks and Tools 2017   5.2.50601.0
For additional information, visit https://www.asp.net/

Azure App Service Tools v3.0.0   15.0.30728.0
Azure App Service Tools v3.0.0

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.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Azure Data Lake Tools for Visual Studio   2.2.9000.1
Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools   1.10
Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

Cookiecutter   3.0.17208.1
Provides tools for finding, instantiating and customizing templates in cookiecutter format.

Fabric.DiagnosticEvents   1.0
Fabric Diagnostic Events

JavaScript Language Service   2.0
JavaScript Language Service

JavaScript Project System   2.0
JavaScript Project System

JavaScript UWP Project System   2.0
JavaScript UWP Project System

JetBrains ReSharper Ultimate 2017.1.3    Build 108.0.20170613.154143
JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2017 JetBrains, Inc.

Merq   1.1.17-rc (cba4571)
Command Bus, Event Stream and Async Manager for Visual Studio extensions.

Microsoft Azure HDInsight Azure Node   2.2.9000.1
HDInsight Node under Azure Node

Microsoft Azure Hive Query Language Service   2.2.9000.1
Language service for Hive query

Microsoft Azure Service Fabric Tools for Visual Studio   1.7
Microsoft Azure Service Fabric Tools for Visual Studio

Microsoft Azure Stream Analytics Language Service   2.2.9000.1
Language service for Azure Stream Analytics

Microsoft Azure Stream Analytics Node   1.0
Azure Stream Analytics Node under Azure Node

Microsoft Azure Tools   2.9
Microsoft Azure Tools for Microsoft Visual Studio 2017 - v2.9.50719.1

Microsoft Continuous Delivery Tools for Visual Studio   0.3
Simplifying the configuration of continuous build integration and continuous build delivery from within the Visual Studio IDE.

Microsoft JVM Debugger   1.0
Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

Microsoft MI-Based Debugger   1.0
Provides support for connecting Visual Studio to MI compatible debuggers

Microsoft Visual C++ Wizards   1.0
Microsoft Visual C++ Wizards

Microsoft Visual Studio VC Package   1.0
Microsoft Visual Studio VC Package

Mono Debugging for Visual Studio   4.6.8-pre (ec7034f)
Support for debugging Mono processes with Visual Studio.

Node.js Tools   1.0.0.0
Adds support for developing and debugging Node.js apps in Visual Studio

NuGet Package Manager   4.3.0
NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

Office Developer Tools for Visual Studio 2017 ENU   15.0.26712
Microsoft Office Developer Tools for Visual Studio 2017 ENU

Python   3.0.17208.1
Provides IntelliSense, projects, templates, debugging, interactive windows, and other support for Python developers.

Python - Django support   3.0.17208.1
Provides templates and integration for the Django web framework.

Python - IronPython support   3.0.17208.1
Provides templates and integration for IronPython-based projects.

Python - Profiling support   3.0.17208.1
Profiling support for Python projects.

R Tools for Visual Studio   1.1.30623.0940
Provides project system, R Interactive window, plotting, and more for the R programming language.

SQL Server Data Tools   15.1.61707.200
Microsoft SQL Server Data Tools

ToolWindowHostedEditor   1.0
Hosting json editor into a tool window

TypeScript   2.3.4.0
TypeScript tools for Visual Studio

Visual C++ for Cross Platform Mobile Development (Android)   15.0.26724.01
Visual C++ for Cross Platform Mobile Development (Android)

Visual C++ for Linux Development   1.0.7
Visual C++ for Linux Development

Visual Studio Code Debug Adapter Host Package   1.0
Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

Visual Studio Tools for Apache Cordova   15.120.6728.1
Visual Studio Tools for Apache Cordova

Visual Studio tools for CMake   1.0
Visual Studio tools for CMake

Visual Studio Tools for Unity   3.3.0.0
Visual Studio Tools for Unity

Visual Studio Tools for Universal Windows Apps   15.0.26730.00
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.

VSColorOutput   2.5.1
Color output for build and debug windows - http://mike-ward.net/vscoloroutput

WebJobs Tools v1.0.0   15.0.30812.0
WebJobs Tools v1.0.0

Workflow Manager Tools 1.0   1.0
This package contains the necessary Visual Studio integration components for Workflow Manager.

Xamarin   4.6.0.295 (306f76a)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

Xamarin.Android SDK   7.4.0.19 (0cd0214)
Xamarin.Android Reference Assemblies and MSBuild support.

Xamarin.iOS and Xamarin.Mac SDK   10.12.0.14 (bf350ba)
Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
Comment 3 John Hardman 2017-09-05 09:10:17 UTC
Am getting the following message when I try to attach Zip logs privately:

"Sorry, but you are not allowed to (un)mark comments or attachments as private."

Please let me have email address to send them to.
Comment 4 Jose Gallardo 2017-09-06 18:26:15 UTC
Hi John,

Can you please try to reproduce this issue with Preview bits?
https://www.visualstudio.com/vs/preview/

You don't need to uninstall the stable version, it can be used side by side.

Thanks
Comment 5 John Hardman 2017-09-20 18:45:54 UTC
Hi Jose,

Is there a change in VS Preview that is expected to fix this problem? I'd like to see what the release note says before spending precious time doing another VS install.

I'm also nervous about the side-by-side running - I've had VS installations interfere with each other previously.
Comment 6 Pierce Boggan [MSFT] 2017-10-20 20:31:40 UTC
@John Hardman - Yes, we made some changes around how Android deployments are handled.

You should now be able to get Visual Studio 2017 version 15.4 in a stable environment, as of October 10th, 2017. If you could give it a try there and see if you can reproduce in your environment, that would be amazing. :)

It might also be useful to get Xamarin logs (Help -> Xamarin -> Zip Logs) and some more information about the deployment emulator/device if you can still reproduce. You can send those to piboggan at microsoft dot com if needed.

Thanks,
Pierce Boggan
Comment 7 John Hardman 2017-12-06 18:26:12 UTC
@Pierce Boggan - Apologies for delay in responding. Yes, it still happened with 15.4 . I am just waiting for 15.5 to install to check that.
Comment 8 John Hardman 2017-12-12 09:35:02 UTC
@Pierce Boggan - Still happens on 15.5 . Will capture logs the next time it occurs
Comment 9 John Hardman 2017-12-12 19:56:28 UTC
@Pierce Boggan - Checked the logs on 15.5 . Nothing useful there. Actually, very little there. Do I need to do anything to increase verbosity in the Xamarin logs?
Comment 10 Jimmy [MSFT] 2017-12-20 22:33:40 UTC
Hey John, under Tools > Options > Xamarin > Android Settings set the Xamarin diagnostic log verbosity to "diagnostic". That should output more info in the Xamarin diagnostic window for deployments.
Comment 11 John Hardman 2018-03-08 11:19:48 UTC
Still happening. The only significant thing in the log is:

Xamarin.VisualStudio.ProgressReport|Error|0|System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.ExecuteDeploy(Project project, IMonoAndroidDevice device, IAndroidProjectProperties projectProperties, IProgressReport progress, Boolean runInProc, CancellationToken cancellationToken, Boolean launchRequired, Boolean launchSuccess, TimeSpan launchTimeElapsed) in C:\d\lanes\5409\4a1f0eaf\source\xamarinvs\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs:line 194
   at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.Execute(DeployCommand command, IProgressReport progress, CancellationToken cancellationToken) in C:\d\lanes\5409\4a1f0eaf\source\xamarinvs\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs:line 118
   at Xamarin.VisualStudio.Commands.CommandHandlerBase`2.Execute(TCommand command, CancellationToken cancellationToken) in C:\d\lanes\5409\4a1f0eaf\source\xamarinvs\src\Core\VisualStudio\Commands\CommandHandlerBase.cs:line 128
Comment 12 FieldstrikeMobile 2018-03-08 16:01:48 UTC
Just installed V15.6 and this error started happening for the first time ever.

Xamarin.VisualStudio.ProjectFixerRunner|Information|0|Project loaded: ''
Xamarin.VisualStudio.ProgressReport|Error|0|System.NullReferenceException: Object reference not set to an instance of an object.
   at Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.ExecuteDeploy(Project project, IMonoAndroidDevice device, IAndroidProjectProperties projectProperties, IProgressReport progress, Boolean runInProc, CancellationToken cancellationToken, Boolean launchRequired, Boolean launchSuccess, TimeSpan launchTimeElapsed) in E:\A\_work\61\s\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs:line 195
Comment 13 FieldstrikeMobile 2018-03-08 16:03:29 UTC
I have a Xamarin android project using .Net Standard 1.4 libs.

I'm pretty sure that 15.6 Visual studio has decided to ignore .Net Standard 1.4 libs as it has also decided to remove them as build dependencies on my Android project even tho my android project references them
Comment 14 FieldstrikeMobile 2018-03-12 14:28:59 UTC
some extra info that may be useful. This only happens on my Nexus 9, which I know has a different architecture to the usual devices, (x64 I think?) I just remember having problems with processor architecture in the past with this device
Comment 15 Pierce Boggan [MSFT] 2018-03-12 18:31:54 UTC
Hi all,

Could you please attach your Xamarin IDE logs? You can grab this by going to Help > Xamarin > Zip Logs.

Additionally, if you could grab your Visual Studio version information by going to Help > About Microsoft Visual Studio > Copy Info, that would be super helpful.

Thanks everyone!

-Pierce Boggan