Bug 52529 - Xamarin.Build.Download.targets: error : Object reference not set to an instance of an object.
Summary: Xamarin.Build.Download.targets: error : Object reference not set to an instan...
Status: RESOLVED FIXED
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: N/A
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bill Holmes
URL:
Depends on:
Blocks:
 
Reported: 2017-02-15 16:26 UTC by Jerome Laban
Modified: 2017-05-23 21:11 UTC (History)
3 users (show)

Tags:
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 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.

Related Links:
Status:
RESOLVED FIXED

Description Jerome Laban 2017-02-15 16:26:09 UTC
When building projects that depend on the xamarin.build.download package, using VS2017 (only, no VS2015 installed) latest (26206), an exception is raised, making the compilation fail early.

 1>C:\Users\jerome.laban\.nuget\packages\xamarin.build.download\0.2.2\build\Xamarin.Build.Download.targets(25,3): error : Object reference not set to an instance of an object.

Updating to a later version does not fix the issue.

It seems to be related to the lookup of the 7Zip binary.

Here's the stack trace:

>	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.Get7ZipPath()	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.Build7ZipExtractionArgs(string file, string contentDir)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.CreateExtractionArgs(string file, string contentDir, Xamarin.Build.Download.XamarinDownloadArchives.ArchiveKind kind)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.<ExtractArchive>c__async1.MoveNext()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.Start<Xamarin.Build.Download.XamarinDownloadArchives.<ExtractArchive>c__async1>(ref Xamarin.Build.Download.XamarinDownloadArchives.<ExtractArchive>c__async1 stateMachine)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.ExtractArchive(string url, string file, string contentDir, string flagFile, Xamarin.Build.Download.XamarinDownloadArchives.ArchiveKind kind, System.Threading.CancellationToken token)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.<MakeSureLibraryIsInPlace>c__async0.MoveNext()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder<bool>.Start<Xamarin.Build.Download.XamarinDownloadArchives.<MakeSureLibraryIsInPlace>c__async0>(ref Xamarin.Build.Download.XamarinDownloadArchives.<MakeSureLibraryIsInPlace>c__async0 stateMachine)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.MakeSureLibraryIsInPlace(string destinationDir, string url, Xamarin.Build.Download.XamarinDownloadArchives.ArchiveKind kind, string cacheFile, string sha1, System.Threading.CancellationToken token)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.MoveNext()	Unknown
 	mscorlib.dll!System.Runtime.CompilerServices.AsyncTaskMethodBuilder.Start<Xamarin.Build.Download.XamarinDownloadArchives.(ref Xamarin.Build.Download.XamarinDownloadArchives.<Execute>c__AnonStorey8.<Execute>c__async7 stateMachine)	Unknown
 	Xamarin.Build.Download.dll!Xamarin.Build.Download.XamarinDownloadArchives.<>m__0()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task<System.Threading.Tasks.Task>.InnerInvoke()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.Execute()	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecutionContextCallback(object obj)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, object state, bool preserveSyncCtx)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteWithThreadLocal(ref System.Threading.Tasks.Task currentTaskSlot)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.ExecuteEntry(bool bPreventDoubleExecution)	Unknown
 	mscorlib.dll!System.Threading.Tasks.Task.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()	Unknown
 	mscorlib.dll!System.Threading.ThreadPoolWorkQueue.Dispatch()	Unknown
 	mscorlib.dll!System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()	Unknown
Comment 1 Jerome Laban 2017-02-15 18:15:36 UTC
Worked around by :

- Adding HKLM\Software\WOW64Node\Xamarin\VisualStudio node
- A "Path" String in HKCU\Software\Xamarin\VisualStudio\SomeRandomName.

I put the file in a folder like this "C:\temp\Xamarin\4.3.0.598\7-Zip\7x.exe" where "C:\Temp" is the path string, and "4.3.0.598" is the installed Xamarin version.
Comment 2 Bill Holmes 2017-05-23 21:11:27 UTC
The latest version of Xamarin Build Download should have the fix for this.

https://www.nuget.org/packages/Xamarin.Build.Download/0.4.5