Bug 36213 - The "Touch" MSBuild task fails with exception if used in a project after importing Xamarin.iOS.CSharp.targets
Summary: The "Touch" MSBuild task fails with exception if used in a project after impo...
Status: RESOLVED DUPLICATE of bug 35961
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: unspecified
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2015-11-24 13:32 UTC by alex
Modified: 2015-11-26 10:37 UTC (History)
4 users (show)

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

Description alex 2015-11-24 13:32:42 UTC
Xamarin.iOS.Common.targets overrides the following MSBuild tasks: Copy, MakeDir, RemoveDir, Delete, Touch.
These new tasks require SessionId parameter to be set. When the build script uses the task without this parameter after importing the Xamarin.iOS.CSharp.targets, then the following exception is thrown:

Error	2	The "Touch" task failed unexpectedly.
System.ArgumentNullException: Value cannot be null.
Parameter name: key
   at System.Collections.Concurrent.ConcurrentDictionary`2.TryGetValue(TKey key, TValue& value)
   at Xamarin.VisualStudio.Build.BuildClients.Get(String sessionId) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\BuildClients.cs:line 28
   at Xamarin.VisualStudio.Build.TaskRunner.Initialize(Task task) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 35
   at Xamarin.VisualStudio.Build.TaskRunner.Run(Task task) in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 64
   at Microsoft.Build.Tasks.Touch.Execute() in C:\Users\builder\data\lanes\2102\f860fe43\source\XamarinVS\src\MSBuild\Xamarin.iOS.Tasks\MsBuildTasks\Touch.cs:line 9
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__20.MoveNext()

Setting the SessionId parameter is not always possible - the task can be invoked by another build tool that is imported after Xamarin (in our case PostSharp).
Comment 2 alex 2015-11-26 10:37:53 UTC

Thanks for the quick reply! The bug is not blocking for us yet, so we can wait for the official release with a bug fix.