Bug 6030 - Code Completion not displaying Methods/Members of libraries. Receiving System.NullReferenceException
Summary: Code Completion not displaying Methods/Members of libraries. Receiving System...
Status: RESOLVED INVALID
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 3.0.x
Hardware: PC Linux
: High normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-07-07 09:16 UTC by Mike
Modified: 2012-07-09 18:21 UTC (History)
1 user (show)

Tags:
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:
Status:
RESOLVED INVALID

Description Mike 2012-07-07 09:16:44 UTC
I am unable to use code completion with any libraries to include System dlls.

I am using a fresh install of Mono Develop 3.0.2 on OpenSuse 12.1. I have gotten this error on a fresh OpenSuse 11.4 as well. In the stack trace below I created a new Console Application, created a class called MyClass. I attempted to get code completion working with it's members by using ctrl-space and after a few hits received this exception. I was able to get MyClass to come up when defining the variable a, however after the new, it would not come up and eventually crashed.

I receive similar exceptions in the console/log every time code completion is asked to display the members and methods of a library or class.




ERROR [2012-07-07 08:51:56Z]: Unexpected code completion exception.
FileName: /home/XXXX/Dev/consoletest/consoletest/Main.cs
Position: line=11 col=19
Line text: 			MyClass a = new 
System.NullReferenceException: Object reference not set to an instance of an object
  at System.Threading.CancellationToken.ThrowIfCancellationRequested () [0x00000] in /usr/src/packages/BUILD/mono-2.10.2/mcs/class/corlib/System.Threading/CancellationToken.cs:77 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Resolve (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00038] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:224 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ResolveType (ICSharpCode.NRefactory.CSharp.AstType type) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:240 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitVariableDeclarationStatement (ICSharpCode.NRefactory.CSharp.VariableDeclarationStatement variableDeclarationStatement) [0x000a2] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:2659 
  at ICSharpCode.NRefactory.CSharp.VariableDeclarationStatement.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/Statements/VariableDeclarationStatement.cs:76 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ScanChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000c] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:277 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitBlockStatement (ICSharpCode.NRefactory.CSharp.BlockStatement blockStatement) [0x00011] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:2584 
  at ICSharpCode.NRefactory.CSharp.BlockStatement.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/Statements/BlockStatement.cs:134 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ScanChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000c] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:277 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.VisitMethodMember (ICSharpCode.NRefactory.CSharp.EntityDeclaration member) [0x00024] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:726 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitMethodDeclaration (ICSharpCode.NRefactory.CSharp.MethodDeclaration methodDeclaration) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:739 
  at ICSharpCode.NRefactory.CSharp.MethodDeclaration.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/MethodDeclaration.cs:85 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ScanChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000c] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:277 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.VisitTypeOrDelegate (ICSharpCode.NRefactory.CSharp.AstNode typeDeclaration, System.String name, Int32 typeParameterCount) [0x000d8] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:568 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:582 
  at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs:112 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ScanChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000c] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:277 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitNamespaceDeclaration (ICSharpCode.NRefactory.CSharp.NamespaceDeclaration namespaceDeclaration) [0x00044] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:534 
  at ICSharpCode.NRefactory.CSharp.NamespaceDeclaration.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs:123 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ScanChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x0000c] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:277 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ICSharpCode.NRefactory.CSharp.IAstVisitor<ICSharpCode.NRefactory.Semantics.ResolveResult>.VisitCompilationUnit (ICSharpCode.NRefactory.CSharp.CompilationUnit unit) [0x0003e] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:520 
  at ICSharpCode.NRefactory.CSharp.CompilationUnit.AcceptVisitor[ResolveResult] (IAstVisitor`1 visitor) [0x00000] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Ast/CompilationUnit.cs:117 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.Scan (ICSharpCode.NRefactory.CSharp.AstNode node) [0x000ca] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:183 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor+<GetResolveResult>c__AnonStorey7B.<>m__18C () [0x0001f] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:435 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.ResetContext (ICSharpCode.NRefactory.CSharp.Resolver.CSharpResolver storedContext, System.Action action) [0x0002a] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:138 
  at ICSharpCode.NRefactory.CSharp.Resolver.ResolveVisitor.GetResolveResult (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00047] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/ResolveVisitor.cs:430 
  at ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver.Resolve (ICSharpCode.NRefactory.CSharp.AstNode node, CancellationToken cancellationToken) [0x00045] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Resolver/CSharpAstResolver.cs:151 
  at ICSharpCode.NRefactory.CSharp.Refactoring.CreateFieldAction.GetValidTypes (ICSharpCode.NRefactory.CSharp.Resolver.CSharpAstResolver resolver, ICSharpCode.NRefactory.CSharp.Expression expr) [0x001ad] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Refactoring/CodeActions/CreateFieldAction.cs:196 
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.HandleKeywordCompletion (Int32 wordStart, System.String word) [0x0056e] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:1621 
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.MagicKeyCompletion (Char completionChar, Boolean controlSpace) [0x007b8] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:575 
  at ICSharpCode.NRefactory.CSharp.Completion.CSharpCompletionEngine.GetCompletionData (Int32 offset, Boolean controlSpace) [0x00032] in /usr/src/packages/BUILD/monodevelop-3.0.2/contrib/ICSharpCode.NRefactory.CSharp/Completion/CSharpCompletionEngine.cs:110 
  at MonoDevelop.CSharp.Completion.CSharpCompletionTextEditorExtension.InternalHandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, Char completionChar, Boolean ctrlSpace, System.Int32& triggerWordLength) [0x000bb] in /usr/src/packages/BUILD/monodevelop-3.0.2/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs:229 
  at MonoDevelop.CSharp.Completion.CSharpCompletionTextEditorExtension.HandleCodeCompletion (MonoDevelop.Ide.CodeCompletion.CodeCompletionContext completionContext, Char completionChar, System.Int32& triggerWordLength) [0x00078] in /usr/src/packages/BUILD/monodevelop-3.0.2/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpCompletionTextEditorExtension.cs:191
Comment 1 Mike Krüger 2012-07-09 05:36:02 UTC
I think your mono version is too old. 

default (CancellationToken) did throw a null reference exception in an older mono version - I'm not sure when it was fixed, but that caused this error in nrefactory.
Comment 2 Mike 2012-07-09 18:21:28 UTC
After alot of frustration, compiling and what not I figured out the secret to getting monodevelop to work. Don't try to put mono on myself, just let monodevelop do it...

Thanks. I tried 2.11.2 and it didn't work, however, the 2.10.6 which came with monodevelop RPM worked nicely.