"Error in text editor extension chain." when trying to edit new UnityScript file

I’m currently working through the Penelope tutorial, and every time I make a new UnityScript file (either through Unity or MonoDevelop) and then try editing said file an error box pops up with the message, “Error in text editor extension chain.”

The “details” box shows this:

System.NullReferenceException: Object reference not set to an instance of an object
at Boo.MonoDevelop.Util.Completion.BooCompletionTextEditorExtension.IsInsideComment (System.String line, Int32 offset) [0x00000] in :0
at UnityScript.MonoDevelop.Completion.UnityScriptEditorCompletion.HandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext context, Char completionChar, System.Int32& triggerWordLength) [0x00000] in :0
at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x000da] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs:128
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115
at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress (Key key, UInt32 ch, ModifierType state) [0x00000] in /BuildAgent/work/976433a72acbefb1/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:257

After clicking OK, I can continue typing but autocomplete/code completion/intellisense/whatever you want to call it doesn’t work at all. I’ve been able to get around this by completely restarting both Unity and MonoDevelop after creating the new file, but that has stopped working. A system restart didn’t fix it.

As far as I can tell this only happens with new files, because I can select a file that I created earlier and edit it with no problems.

I’m using a 2009 Macbook Pro running Mountain Lion (10.8) with 8Gb of RAM.

EDIT: The error comes up again any time I type an open parenthesis. Example: If I type “function Update(,” the instant I type the ( the error window comes up again.

Well, there’s clearly something wrong with your MonoDevelop. The code completion seems to be damaged in some way. The best advice i could give is reinstalling MonoDevelop and / or Unity

I know this is an old thread, but I have the same problem and reinstalling unity and monodevelop doesn’t seem to resolve it.

This problem came up after I installed Microsoft’s plugin “Visual Studio Tools” and even as I uinstalled Visual Studio AND unity/monodevelop alike, the problem still persists after I install unity back.

=/

Here is how I got this problem to go away.

  1. In the Add-in Manager, under “Language Bindings” I disabled Boo.
  2. Closed Unity and Monodevelop
  3. Delete the projects entire /Library folder (It will be regenerated next launch). [I am not sure if you can just delete /Library/ScriptAssemblies, but I wanted to nuke this problem from orbit so I went with the entire directory.]
  4. Delete all the .sln and .csproj files related to the project (these will also be regenerated)
  5. Open the project back up in unity (It will reimport and restablish the /Library folder)
  6. Assets > Sync Monodevelop Project

This fixed the Boo auto-completion problem for me.