Bug 4050 - Unexpected code completion exception
Summary: Unexpected code completion exception
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-03-22 20:38 UTC by Csaba Halász
Modified: 2012-03-23 04:31 UTC (History)
1 user (show)

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

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 or GitHub 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 Csaba Halász 2012-03-22 20:38:57 UTC
using System;
namespace Test
	class TestClass
		public void Foo(object[] data)
			Console.WriteLine(data.Clone() as o<caret>);

Pressing ctrl+space for completion of o to object[] results in a null reference exception:

ERROR [2012-03-23 01:33:03Z]: Unexpected code completion exception.
FileName: /tmp/CompletionTest/Test.cs
Position: line=8 col=38
Line text:                      Console.WriteLine(data.Clone() as o);
System.NullReferenceException: Object reference not set to an instance of an object
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.HandleKeywordCompletion (Int32 wordStart, System.String word) [0x0022d] in monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:1264
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.MagicKeyCompletion (Char completionChar, Boolean controlSpace) [0x00ac0] in monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:561
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.GetCompletionData (Int32 offset, Boolean controlSpace) [0x00032] in monodevelop/main/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:112
  at MonoDevelop.CSharp.Completion.CSharpCompletionTextEditorExtension.InternalHandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, Char completionChar, Boolean ctrlSpace, System.Int32& triggerWordLength) [0x00108] in monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs:238
  at MonoDevelop.CSharp.Completion.CSharpCompletionTextEditorExtension.HandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, Char completionChar, System.Int32& triggerWordLength) [0x00078] in monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs:200
Comment 1 Mike Krüger 2012-03-23 04:31:47 UTC
Fixed that one.
(btw. was already covered by a unit test)