Bug 12769 - Error on Format Document
Summary: Error on Format Document
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0.8
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-06-19 14:52 UTC by Neal
Modified: 2014-01-20 08:24 UTC (History)
2 users (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:
VERIFIED FIXED

Description Neal 2013-06-19 14:52:49 UTC
I have a fairly large code document, when attempting to do a code format on it I get an error dialog.  I'm using XamStudio 4.0.9 (beta channel)

System.NullReferenceException: Object reference not set to an instance of an object
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitArrayInitializerExpression (ICSharpCode.NRefactory.CSharp.ArrayInitializerExpression arrayInitializerExpression) [0x00264] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Expressions.cs:526 
  at ICSharpCode.NRefactory.CSharp.ArrayInitializerExpression.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs:108 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitArrayInitializerExpression (ICSharpCode.NRefactory.CSharp.ArrayInitializerExpression arrayInitializerExpression) [0x0006e] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Expressions.cs:489 
  at ICSharpCode.NRefactory.CSharp.ArrayInitializerExpression.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ArrayInitializerExpression.cs:108 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitObjectCreateExpression (ICSharpCode.NRefactory.CSharp.ObjectCreateExpression objectCreateExpression) [0x00097] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Expressions.cs:471 
  at ICSharpCode.NRefactory.CSharp.ObjectCreateExpression.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/ObjectCreateExpression.cs:85 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.<VisitChildren>m__317 (ICSharpCode.NRefactory.CSharp.AstNode n) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:115 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:115 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitAssignmentExpression (ICSharpCode.NRefactory.CSharp.AssignmentExpression assignmentExpression) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs:404 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitAssignmentExpression (ICSharpCode.NRefactory.CSharp.AssignmentExpression assignmentExpression) [0x00017] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Expressions.cs:68 
  at ICSharpCode.NRefactory.CSharp.AssignmentExpression.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/Expressions/AssignmentExpression.cs:91 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.<VisitChildren>m__317 (ICSharpCode.NRefactory.CSharp.AstNode n) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:115 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildren (ICSharpCode.NRefactory.CSharp.AstNode node) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:115 
  at ICSharpCode.NRefactory.CSharp.DepthFirstAstVisitor.VisitExpressionStatement (ICSharpCode.NRefactory.CSharp.ExpressionStatement expressionStatement) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/DepthFirstAstVisitor.cs:249 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitExpressionStatement (ICSharpCode.NRefactory.CSharp.ExpressionStatement expressionStatement) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Statements.cs:36 
  at ICSharpCode.NRefactory.CSharp.ExpressionStatement.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/Statements/ExpressionStatement.cs:45 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.<VisitBlockWithoutFixingBraces>m__31D (ICSharpCode.NRefactory.CSharp.AstNode child) [0x00038] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Statements.cs:53 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitBlockWithoutFixingBraces (ICSharpCode.NRefactory.CSharp.BlockStatement blockStatement, Boolean indent) [0x00012] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Statements.cs:46 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitConstructorDeclaration (ICSharpCode.NRefactory.CSharp.ConstructorDeclaration constructorDeclaration) [0x000ad] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_TypeMembers.cs:396 
  at ICSharpCode.NRefactory.CSharp.ConstructorDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/TypeMembers/ConstructorDeclaration.cs:67 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor+<VisitTypeDeclaration>c__AnonStorey147.<>m__31B (ICSharpCode.NRefactory.CSharp.AstNode child) [0x000bd] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:199 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00157] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:177 
  at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs:107 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor+<VisitTypeDeclaration>c__AnonStorey147.<>m__31B (ICSharpCode.NRefactory.CSharp.AstNode child) [0x000bd] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:199 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitTypeDeclaration (ICSharpCode.NRefactory.CSharp.TypeDeclaration typeDeclaration) [0x00157] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:177 
  at ICSharpCode.NRefactory.CSharp.TypeDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/TypeDeclaration.cs:107 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor+<VisitNamespaceDeclaration>c__AnonStorey146.<>m__31A (ICSharpCode.NRefactory.CSharp.AstNode child) [0x00115] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:110 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitNamespaceDeclaration (ICSharpCode.NRefactory.CSharp.NamespaceDeclaration namespaceDeclaration) [0x0005a] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:82 
  at ICSharpCode.NRefactory.CSharp.NamespaceDeclaration.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/GeneralScope/NamespaceDeclaration.cs:118 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor+<VisitSyntaxTree>c__AnonStorey145.<>m__319 (ICSharpCode.NRefactory.CSharp.AstNode child) [0x0005b] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:56 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00074] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:99 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitSyntaxTree (ICSharpCode.NRefactory.CSharp.SyntaxTree unit) [0x00014] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:49 
  at ICSharpCode.NRefactory.CSharp.SyntaxTree.AcceptVisitor (IAstVisitor visitor) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Ast/SyntaxTree.cs:140 
  at ICSharpCode.NRefactory.CSharp.CSharpFormatter.AnalyzeFormatting (IDocument document, ICSharpCode.NRefactory.CSharp.SyntaxTree syntaxTree, CancellationToken token) [0x00033] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormatter.cs:140 
  at MonoDevelop.CSharp.Formatting.OnTheFlyFormatter.GetFormattingChanges (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, MonoDevelop.Ide.Gui.Document document, System.String input, DomRegion formattingRegion, System.Int32& formatStartOffset, System.Int32& formatLength, Boolean formatLastStatementOnly) [0x000d1] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs:174 
  at MonoDevelop.CSharp.Formatting.OnTheFlyFormatter.Format (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, MonoDevelop.Ide.Gui.Document data, Int32 startOffset, Int32 endOffset, Boolean exact, Boolean formatLastStatementOnly) [0x00206] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs:245 
  at MonoDevelop.CSharp.Formatting.OnTheFlyFormatter.Format (MonoDevelop.Ide.Gui.Document data, Int32 startOffset, Int32 endOffset, Boolean exact) [0x0002c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/OnTheFlyFormatter.cs:65 
  at MonoDevelop.CSharp.Formatting.CSharpFormatter.OnTheFlyFormat (MonoDevelop.Ide.Gui.Document doc, Int32 startOffset, Int32 endOffset) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs:79 
  at MonoDevelop.Ide.CodeFormatting.CodeFormatter.OnTheFlyFormat (MonoDevelop.Ide.Gui.Document doc, Int32 startOffset, Int32 endOffset) [0x00028] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs:102 
  at MonoDevelop.Ide.CodeFormatting.FormatBufferHandler.Run (System.Object tool) [0x0003d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormattingCommands.cs:63 
  at MonoDevelop.Components.Commands.CommandHandler.InternalRun (System.Object dataItem) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandHandler.cs:42 
  at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand (MonoDevelop.Components.Commands.ActionCommand cmd, MonoDevelop.Components.Commands.CommandInfo info, System.Object dataItem, System.Object target, CommandSource source) [0x00076] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1108 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x002de] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.9-branch/8b3c179b/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1075
Comment 1 Mike Krüger 2013-06-20 05:30:00 UTC
Fixed that one - but it'll take a while until it get's released.

(There are some prerequisites that require a stable mono 3 first)
Comment 2 narayanp 2014-01-20 08:24:23 UTC
I have checked this issue with following builds:

All Mac
X.S 4.2.3(build 127)
git- 781819ed590c05a48201be53eb9602b56a4c1fde

I am successfully able to format the document using Format document, Not seeing any exception.