Skip to content

Deploying fails with null reference exception #8199

@Youssef1313

Description

@Youssef1313

Android application type

.NET Android (net7.0-android, etc.)

Affected platform version

VS 2022 17.7 Preview 4

Description

Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.CanExecute.AnonymousMethod__13_2(Xamarin.VisualStudio.Android.Setup.IAndroidProjectSetup x) Line 94
	at D:\a\_work\1\s\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs(94)
System.Core.dll!System.Linq.Enumerable.FirstOrDefault<Xamarin.VisualStudio.Android.Setup.IAndroidProjectSetup>(System.Collections.Generic.IEnumerable<Xamarin.VisualStudio.Android.Setup.IAndroidProjectSetup> source, System.Func<Xamarin.VisualStudio.Android.Setup.IAndroidProjectSetup, bool> predicate)
Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.CommandHandlers.DeployCommandHandler.CanExecute(Xamarin.VisualStudio.Android.DeployCommand command) Line 94
	at D:\a\_work\1\s\src\Core\VisualStudio.Android\CommandHandlers\DeployCommandHandler.cs(94)
[Lightweight Function]
Xamarin.VisualStudio.Shell.dll!Xamarin.VisualStudio.Shell.CommandHandlers.DeployProjectAsyncCommandHandler.ExecutePlatformCommandAsync(dynamic command, System.Threading.CancellationToken cancellation) Line 112
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\CommandHandlers\DeployProjectCommandHandler.cs(112)
Xamarin.VisualStudio.Shell.dll!Xamarin.VisualStudio.Shell.CommandHandlers.DeployProjectAsyncCommandHandler.ExecuteAsync(Xamarin.VisualStudio.Contracts.Commands.DeployProjectAsync command, System.Threading.CancellationToken cancellation) Line 79
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\CommandHandlers\DeployProjectCommandHandler.cs(79)
[Resuming Async Method]
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(1070)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Line 977
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(977)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Line 288
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs(288)
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask) Line 810
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(810)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3617
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(3617)
mscorlib.dll!System.Threading.Tasks.Task<System.__Canon>.TrySetResult(System.__Canon result) Line 490
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Future.cs(490)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<Xamarin.VisualStudio.Devices.IDevice>.SetResult(Xamarin.VisualStudio.Devices.IDevice result) Line 603
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(603)
[Completed] Xamarin.VisualStudio.Shell.dll!Xamarin.VisualStudio.Shell.CommandHandlers.DeployProjectAsyncCommandHandler.GetTargetDeviceAsync(Xamarin.VisualStudio.Contracts.Commands.DeployProjectAsync command) Line 134
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\CommandHandlers\DeployProjectCommandHandler.cs(134)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(1070)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Line 977
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(977)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Line 288
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs(288)
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask) Line 810
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(810)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3617
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(3617)
mscorlib.dll!System.Threading.Tasks.Task<bool>.TrySetResult(bool result) Line 490
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Future.cs(490)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.SetResult(bool result) Line 603
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(603)
[Completed] Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.MonoAndroidDeviceManager.AppliesToAsync(Xamarin.VisualStudio.ProjectSystem.IProjectState project) Line 75
	at D:\a\_work\1\s\src\Core\VisualStudio.Android\Devices\MonoAndroidDeviceManager.cs(75)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(1070)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Line 977
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(977)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Line 288
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs(288)
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask) Line 810
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(810)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3617
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(3617)
mscorlib.dll!System.Threading.Tasks.Task<bool>.TrySetResult(bool result) Line 490
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Future.cs(490)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.SetResult(bool result) Line 603
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(603)
[Completed] Xamarin.VisualStudio.Windows.dll!Xamarin.VisualStudio.ProjectSystem.MultiTargetingProjectTracker.AppliesToAsync(string projectCapabilities) Line 97
	at D:\a\_work\1\s\src\Core\VisualStudio\ProjectSystem\MultiTargetingProjectTracker.cs(97)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(1070)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Line 977
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(977)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Line 288
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs(288)
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action action, bool allowInlining, ref System.Threading.Tasks.Task currentTask) Line 810
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(810)
mscorlib.dll!System.Threading.Tasks.Task.FinishContinuations() Line 3617
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Task.cs(3617)
mscorlib.dll!System.Threading.Tasks.Task<bool>.TrySetResult(bool result) Line 490
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\Future.cs(490)
mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.SetResult(bool result) Line 603
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(603)
[Completed] Xamarin.VisualStudio.Android.dll!Xamarin.VisualStudio.Android.ProjectSystem.AndroidAppProjectTracker.AppliesToAsync(string projectCapabilities) Line 279
	at D:\a\_work\1\s\src\Core\VisualStudio.Android\ProjectSystem\AndroidProjectTracker.cs(279)
mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 980
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(980)
mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx) Line 928
	at f:\dd\ndp\clr\src\BCL\system\threading\executioncontext.cs(928)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.MoveNextRunner.Run() Line 1070
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(1070)
mscorlib.dll!System.Runtime.CompilerServices.AsyncMethodBuilderCore.OutputAsyncCausalityEvents.AnonymousMethod__0() Line 977
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs(977)
mscorlib.dll!System.Runtime.CompilerServices.TaskAwaiter.OutputWaitEtwEvents.AnonymousMethod__0() Line 288
	at f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\TaskAwaiter.cs(288)
mscorlib.dll!System.Threading.Tasks.AwaitTaskContinuation.ExecuteWorkItemHelper() Line 681
	at f:\dd\ndp\clr\src\BCL\system\threading\Tasks\TaskContinuation.cs(681)
mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch() Line 820
	at f:\dd\ndp\clr\src\BCL\system\threading\threadpool.cs(820)
[Async Call Stack]
[Async] Xamarin.VisualStudio.Shell.dll!Xamarin.VisualStudio.Shell.XamarinCommandBus.ExecuteAsync<bool>(Merq.IAsyncCommand<bool> command, System.Threading.CancellationToken cancellation) Line 125
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\XamarinCommandBus.cs(125)
[Async] Xamarin.VisualStudio.Shell.dll!Microsoft.VisualStudio.ProjectSystem.Mobile.MobilePlatformDeployProvider.DeployAsync(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Threading.CancellationToken cancellationToken, System.IO.TextWriter outputPaneWriter) Line 68
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\CommonProjectSystem\Multiplatform\Platforms\Mobile\MobilePlatformDeployProvider.cs(68)
[Async] Xamarin.VisualStudio.Shell.dll!Xamarin.VisualStudio.ProjectSystem.DeployProvider.DeployAsync(System.Threading.CancellationToken cancellationToken, System.IO.TextWriter outputPaneWriter) Line 93
	at D:\a\_work\1\s\src\Core\VisualStudio.Shell\CommonProjectSystem\Debug\DeployProvider.cs(93)
[Async] [Awaited by multiple tasks/threads]

Output

20:36:25:897	Build started...
20:36:27:727	1>------ Build started: Project: Uno.netcoremobile, Configuration: Debug Any CPU ------
20:36:28:132	2>------ Build started: Project: Uno.UI.netcoremobile, Configuration: Debug Any CPU ------
20:36:29:111	3>------ Build started: Project: SamplesApp.netcoremobile, Configuration: Debug Any CPU ------
20:36:30:677	3>C:\Users\PC\Desktop\uno\src\SamplesApp\SamplesApp.netcoremobile\Android\AndroidManifest.xml : warning XA4216: AndroidManifest.xml //uses-sdk/@android:minSdkVersion '16' is less than API-19, this configuration is not supported.
20:36:30:677	3>C:\Users\PC\Desktop\uno\src\SamplesApp\SamplesApp.netcoremobile\Android\AndroidManifest.xml : warning XA4211: AndroidManifest.xml //uses-sdk/@android:targetSdkVersion '30' is less than $(TargetFrameworkVersion) ''. Using API-33 for ACW compilation.
20:36:36:678	3>SamplesApp.netcoremobile -> C:\Users\PC\Desktop\uno\src\SamplesApp\SamplesApp.netcoremobile\bin\Debug\net7.0-android\SamplesApp.dll
20:36:39:986	3>C:\Users\PC\Desktop\uno\src\SourceGenerators\Uno.UI.Tasks\Content\Uno.UI.Tasks.targets(53,3): warning : The Uno.UI.Tasks build task is running under devenv.exe you will have to restart Visual Studio to rebuild it.
20:36:40:076	3>Done building project "SamplesApp.netcoremobile.csproj".
20:36:40:294	3>obj\Debug\net7.0-android\android\AndroidManifest.xml : warning XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-33\optional\androidx.window.extensions.jar
20:36:40:294	3>obj\Debug\net7.0-android\android\AndroidManifest.xml : warning XA4218: Unable to find //manifest/application/uses-library at path: C:\Program Files (x86)\Android\android-sdk\platforms\android-33\optional\androidx.window.sidecar.jar
20:36:41:698	3>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Aapt2.targets(212,3): warning APT2000: warn: removing resource uno.platform.unosampleapp:string/Given_ResourceMap_When_MainMap without required default value.
20:36:41:698	3>C:\Program Files\dotnet\packs\Microsoft.Android.Sdk.Windows\33.0.68\tools\Xamarin.Android.Aapt2.targets(212,3): warning APT2000: warn: removing resource uno.platform.unosampleapp:string/Prefix_Given_ResourceLoader_When_PrefixedNamedLoader without required default value.
20:36:41:967	3>Done building project "SamplesApp.netcoremobile.csproj".
20:36:42:037	4>------ Deploy started: Project: SamplesApp.netcoremobile, Configuration: Debug Any CPU ------
20:43:58:301	4>Object reference not set to an instance of an object.
20:43:58:639	========== Build: 3 succeeded, 0 failed, 20 up-to-date, 0 skipped ==========
20:43:58:639	========== Build started at 8:35 PM and took 08:04.055 minutes ==========
20:43:58:639	========== Deploy: 0 succeeded, 1 failed, 0 skipped ==========
20:43:58:639	========== Deploy started at 8:35 PM and took 08:04.055 minutes ==========

Steps to Reproduce

None available. Doesn't seem consistent.

Did you find any workaround?

No response

Relevant log output

No response

Metadata

Metadata

Assignees

Labels

needs-triageIssues that need to be assigned.vs-syncFor internal use only; creates a VSTS "mirror" issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions