MonoDevelop can't find List or Dictionary

I’m using Unity 2017.1.0f3 and MonoDevelop 5.9.6 and I recently updated the scripting runtime version from default (3.5) to 4.6.

Since then when I try to use a List or a Dictionary it doesn’t recognize them and mark them as error with the following message: “The name ‘List/Dictionary’ does not exist in current context”.

I can use other classes of the same namespace, like SortedDictionary without any problem, and the script works fine even using List or Dictionary but it’s annoying because it seems wrong and I can’t use autocomplete.

What could be the problem?

using System.Collections.Generic;

@bigmisterb
I have that line at the beginning of the script, as I said it works fine in Unity and I can use other classes of the same namespace.

I have the same issue, nothing to do with the next space, it is almost like if monodevelop is compatible with 4.6

This is happening to me too at the moment. I have been googling for several minutes without finding a solution. What is this, 2015?

test bed seems to support dictionary…

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test : MonoBehaviour {
	// Update is called once per frame
	void Update () {
		var d = new Dictionary<string, string> (){
			{ "test1", "Something here" },
			{ "test2", "Something there" }
		};
	}
}

MonoDevelop probably didn’t get the memo that you updated the runtime version, and got confused.

Stop using MonoDevelop, it’s garbage. If that’s not an option, close Unity/MD, delete your .sln and .csproj files, open Unity, and then open scripts. That should fix things.

1 Like

This. get VS Code, install the Unity and C# plugins as well as icon plugins, core sdk etc. Enjoy life with proper debugging, support and no more **** crashes. also you can copy and paste all the time into it, none of the horrible monodevelop bugs. Also its a fraction of the size and opens 4x faster.