Syntax highlighting and code completion stopped working after update

I recently upgraded to the latest version of Xamarin Studio for Mac OSX (version 5.0, build 878) and since then, code that was previously highlighted correctly and objects that provided code completion stopped working. The code itself still works mostly without any compile or runtime errors which is strange.

Here are a few examples of code highlighting/completion that previously worked and stopped working since updating:

1) Previously I could use Console.WriteLine("example"); to write to the console. Now it will give me a compile error saying "Console" is an ambiguous reference between System.Console and Java.IO.Console. The problem is that when I try to type System.Console, there are no code completion options (screenshot attached as xamarin_completion_1.jpg).


If I ignore the absence of there not being any code completion options and I type System.Console.WriteLine("example"); then it compiles, runs and outputs "example" to the console even though that code is highlighted in red indicating a problem.

2) I have a custom class that contains a list of strings:

public IList phone_listing_ads { get; set; }

In that same class I can use this.phone_listing_ads.Count() to get the total number of items in the list and it works perfectly. It gives code completion suggestions and Count() is one of them. The problem is that in a different class if I try and use this.appConfig.phone_listing_ads.Count() it gives an error saying The member 'System.Collections.ICollection.Count' cannot be used as method or delegate. The problem is that previously it worked perfectly. Even if I try to just enter this.appConfig.phone_listing_ads. there aren't any code completion options.

3) Even though I include...
using System; using System.Collections; using System.Collections.Generic;

...I cannot use eg. IList or List. Even .ToString() indicates a problem even though it still works during runtime. I've attached a screenshot (named xamarin_highlighting_1.jpg) to demonstrate a block of code that previously syntax highlighted/code completed perfectly which now gives a bunch of problems.


It almost feels as if some or other setting or path went missing somewhere after the upgrade and I just don't know what it could be. Any assistance or information would be greatly appreciated! Please let me know if I need to provide any additional examples and/or clarity on any of the above mentioned problems.


  • mhutchmhutch USMember, Xamarin Team Xamurai

    Regarding the completion/highlighting issues, it's strange that System.Console and List<T> aren't showing up. It might be an issue related to updating the code completion databases. Have you tried restarting XS? You could also try removing ~/Library/Caches/XamarinStudio-5.0/DerivedData to force the code completion databases to regenerate from scratch.

    Regarding the compilation issue, are you missing using System.Linq?

    BTW, it's easier to take screenshots on Mac than use a camera :)

  • EtienneStemmetEtienneStemmet ZAMember
    edited June 2014

    I am fully aware of how to do simple things like taking a screenshot. The reason why I took a photo was because the code completion dropdown disappears when you start pressing other keys in order to take a screenshot.

    I've already tried all the obvious troubleshooting steps of restarting XS and my Mac several times etc. without any change. I've also tried including System.Linq like you suggest and it still does not fix any issues. It just causes other issues (screenshot attached).


    I've also tried removing everything in DerivedData like you suggest and still nothing changed. As you can also see from the screenshot there are still all the other errors. I'm going to try completely uninstalling Xamarin and reinstalling (although that shouldn't be the solution to get software working that licenses are paid for).

  • EtienneStemmetEtienneStemmet ZAMember

    If I completely uninstall Xamarin and re-install from scratch the problem still persists.

  • EtienneStemmetEtienneStemmet ZAMember
    edited June 2014

    I have found the problem.

    One of the classes I was no longer able to use was IList. I looked at the IList<T> Interface documentation and it mentions that the namespace is System.Collections.Generic. I am including that namespace in my class, but it was still not working. There it also mentions that the assembly is mscorlib (in mscorlib.dll).

    Going through the options of my PCL and other projects in my workspace I found that under Build -> General there is a checkbox saying Do not reference mscorlib.dll (in the PCL the option is under the C# tab). That checkbox was checked. As soon as I made sure that all my projects and the PCL had that option unchecked the code highlighting, code completion and all included classes suddenly started to work again perfectly as it did before.

    I remember that a solution I read somewhere on the internet regarding some other problem I was experiencing quite a while ago (which I cannot remember what it was now...) suggested checking that box to prevent the project from referencing mscorlib.dll

    On hindsight it seems like that must have been a workaround for an issue which got fixed in one of the new updates to Xamarin.

  • mhutchmhutch USMember, Xamarin Team Xamurai

    Ah, that makes sense, the types that were showing up in completion are from System.dll.

    Generally the only reason you would not reference mscorlib if if you were providing your own implementation for some reason. I'm surprised your project compiled previously.

Sign In or Register to comment.