Bug 45837 - Cannot build/compile Bindings Library project.
Summary: Cannot build/compile Bindings Library project.
Alias: None
Product: Visual Studio Extensions
Classification: Xamarin
Component: iOS ()
Version: 4.2.0 (C8)
Hardware: PC Windows
: --- normal
Target Milestone: 15.3
Assignee: Bugzilla
Depends on:
Reported: 2016-10-24 14:36 UTC by Maciej Puchalski
Modified: 2017-07-12 07:24 UTC (History)
8 users (show)

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

Solution with bug presentation and build log. (28.25 KB, application/x-zip-compressed)
2016-10-24 14:36 UTC, Maciej Puchalski

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 Maciej Puchalski 2016-10-24 14:36:47 UTC
Created attachment 18192 [details]
Solution with bug presentation and build log.

Steps to reproduce:
1. Create Bindings Library Project (add -> new project -> iOS -> Bindings Library (iOS) )
2. Try to build it.
3. Error list will be as follows:
Severity	Code	Description	Project	File	Line	Suppression State
Warning	IDE0006	Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled.	NativeLibrary1		1	Active

Severity	Code	Description	Project	File	Line	Suppression State
Warning		The "PrepareNativeReferences" 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.TaskRunner.Initialize(Task task) in c:\Users\builder\data\lanes\3822\3b7df6f5\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 38
   at Xamarin.VisualStudio.Build.TaskRunner.Run(Task task) in c:\Users\builder\data\lanes\3822\3b7df6f5\source\xamarinvs\src\MSBuild\Xamarin.VisualStudio.Build\TaskRunner.cs:line 56
   at Xamarin.iOS.Tasks.PrepareNativeReferences.Execute() in c:\Users\builder\data\lanes\3822\3b7df6f5\source\xamarinvs\src\MSBuild\Xamarin.iOS.Tasks\Tasks\PrepareNativeReferences.cs:line 18
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
   at Microsoft.Build.BackEnd.TaskBuilder.<ExecuteInstantiatedTask>d__26.MoveNext()	NativeLibrary1			

4. Result: If I refer this project in other project, for ex. Xamarin.iOS app, the dll will be refer-able, but Visual Studio will prompt, that referred classes/namespaces aren't there. The attached solution has 
NativeLibrary1.Class1 dd;
line in 21th line of AppDelegate.cs in App1 project to show that behaviour.

I am attaching a build log (plus the solution with library in question) obtained via https://github.com/dotnet/roslyn/wiki/Diagnosing-Project-System-Build-Errors , in other words, .designtime.log log from %TEMP%.

Exact same issue (the PrepareNativeReferences warning) happened while building other Bindings Library, which I cannot share here. This library worked in Xamarin Studio on MAC.
Comment 1 Vincent Dondain [MSFT] 2016-10-24 14:48:48 UTC

I cannot reproduce your issue with Xamarin Studio and the following versions of the products (stable): https://gist.github.com/VincentDondain/d68eac02c356fdd24cf89c3648da9431

I tried to download your test case and it builds fine, new projects build fine.

I believe this is likely a Visual Studio issue.

@maciej could you please give us the versions of the products you're using?
Comment 2 Maciej Puchalski 2016-10-25 06:31:14 UTC

My "Xamarin for Visual Studio" is 4.2.703 (with auto update ON), while Xamarion.iOS is These are from VS -> Tools -> Extensions and Updates.
The .NET Framework used by visual studio is 4.6.01586, while Visual Studio itself is 14.0.25431.01 Update 3, Community 2015. Both .NET Framework and Visual Studio version info is from VS -> Help -> About Visual Studio. 

Xamarin.iOS library (referenced via both projects, as seen in the example) has Version and Runtime Version v4.0.30319. 

if You need any more information, please let me know.

Thanks in advance!
Comment 3 Thomas Stalzer 2016-11-14 14:52:55 UTC

This also happens on my machine.

MS Visual Studio Community 2015 14.0.25431.01
Xamarin (3e1ef9e)
Xamarin.iOS (44931ae)

Comment 4 Emanuel 2017-06-08 13:59:47 UTC
Hi All,
I couldn't reproduce this issue with our latest stable bits (15.2.2) and the attached sample. Since there were several fixes related to the 'PrepareNativeReferences' task I'll mark this bug as Resolved Fixed.

Feel free to reopen this bug if you're still hitting this issue, and please attach a detailed build output and a sample solution if possible.