Bug 19234 - [iOS] Binding project Syntax highlighting shows that names don't exist in the current context, but compiles with no errors
Summary: [iOS] Binding project Syntax highlighting shows that names don't exist in the...
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 5.0
Hardware: Macintosh Mac OS
: Low enhancement
Target Milestone: master
Assignee: Mike Krüger
Depends on:
Reported: 2014-04-23 02:24 UTC by Timothy Risi
Modified: 2016-01-24 18:53 UTC (History)
6 users (show)

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

Screen shot of highlighted errors. (908.85 KB, image/png)
2014-04-23 02:24 UTC, Timothy Risi

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 19234 on Developer Community or GitHub 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 or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Timothy Risi 2014-04-23 02:24:57 UTC
Created attachment 6635 [details]
Screen shot of highlighted errors.

I'm working on building an iOS binding project to try it out and experience the process.  The syntax highlighting shows a lot of errors of the type "error CS0103: The name <name> does not appear in the current context".  Autocomplete doesn't work for any of the attributes showing errors either.

Building the project succeeds with no errors, and when referencing the resulting dll file I'm able to successfully access and autocomplete all of the methods/properties defined in the ApiDefinitions file.

Xamarin Studio
Version 5.0 (build 725)
Installation UUID: 3d34ed17-120d-4fb8-9987-2ad2015aee3e
	Mono 3.4.0 ((no/585aa54)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 304000201

Apple Developer Tools
Xcode 5.1.1 (5085)
Build 5B1008

Version: 4.12.4 (Business Edition)
Android SDK: /Users/Tim/Library/Developer/Xamarin/android-sdk-mac_x86
	Supported Android versions:
		2.1   (API level 7)
		2.2   (API level 8)
		2.3   (API level 10)
		3.1   (API level 12)
		4.0   (API level 14)
		4.0.3 (API level 15)
		4.3   (API level 18)
		4.4   (API level 19)
Java SDK: /usr
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)

Version: (Business Edition)
Hash: f3cf074
Build date: 2014-04-21 16:24:28-0400

Xamarin.Mac: Not Installed

Build Information
Release ID: 500000725
Git revision: 1c04181c9318b2beb490053d013131ea9ccca2d2
Build date: 2014-04-22 15:37:35-04
Xamarin addins: df1b37d137609c2d5a731772a7a34bd0701860ec

Operating System
Mac OS X 10.9.2
Darwin Macbook.local 13.1.0 Darwin Kernel Version 13.1.0
    Thu Jan 16 19:40:37 PST 2014
    root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64
Comment 1 Sadik Ali 2014-05-02 09:21:11 UTC
I tried to reproduce this issue and I am able to reproduce this issue

Steps to reproduce:
1. Create a iOS Binding project
2. Paste the following code in “ApiDefinition.cs” file
     [BaseType (typeof (NSObject))]
    interface Utilities{
        [Static, Export("echo:")]
        string Echo(string message);

        [Static , Export("test:")]
        string Test(string test);

        [Export ("add:and")]
        int Add(int x, int y);

        [Export ("multiply:and:")]
        int Multiply(int x, int y);
2. Build the  the “iOSBindingProject”
3. Add an “iPhone SingleViewApplication” in the solution.
4. Add the reference of “iOS Binding” project
5. Now I can access the methods of “ApiDefinition.cs” file

I observed that when in “iOSBindingProject  when I hover the curser over the highlighting syntax it shows a errors i.e. “CS0103: The name <name> does not appear in the current context” and also autocomplete doesn't work for any of the attributes showing errors either. I am able to build project successfully.

I have also checked that when I add the “iOSBindingProject” reference to the project I am able to successfully access and autocomplete all of the methods/properties defined in the ApiDefinitions file.

Screencast: http://www.screencast.com/t/4aWSgGIV5ep

Environment Info:

Mac OS X 10.9.2

Xamarin Studio : 5.0 (build 784)

Build Information 
Release ID: 500000784
Git revision: ea367c9e829e7c627ec8927e8832df6a74390d61
Build date: 2014-04-29 09:48:53-04
Xamarin addins: 92dcfc8532a8c6d21783289c176417d7c17bf492
Comment 3 Mikayla Hutchinson [MSFT] 2014-05-02 13:36:50 UTC
This is a consequence of the way binding projects work. They undergo a multi-pass compilation system:

1) cs files with the ObjcBindingApiDefinition and ObjcBindingCoreSource build actions are fed into btouch, which creates the actual binding files in an intermediate folder

2) The actual binding files are combined with the cs files with the Compile build acton to create the real binding assembly.

So the cs files in #1 aren't actually built referencing the assemblies the project references, they're built referencing btouch, and the C# completion engine doesn't understand this.

And the files in #2 are referencing types generated in #1, which are not available until the compile has take place.

This could all be fixed by some special casing but it's definitely nontrivial.
Comment 7 Jason 2016-01-24 18:53:41 UTC
Bump. This is incredibly annoying.