Bug 9691 - MonoDevelop-Unity error saving with syntax error
Summary: MonoDevelop-Unity error saving with syntax error
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.8.2
Hardware: Macintosh Mac OS
: Lowest normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-01-21 10:11 UTC by David Erosa
Modified: 2013-01-22 02:34 UTC (History)
1 user (show)

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


Attachments
Error dialog (166.60 KB, image/png)
2013-01-21 10:11 UTC, David Erosa
Details


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 FIXED

Description David Erosa 2013-01-21 10:11:04 UTC
Created attachment 3252 [details]
Error dialog

I'm using MonoDevelop-Unity version 2.8.2 included with Unity 4.0.0f7 under OSX 10.8.2
I think this is not a duplicate of bug #4651, as MonoDevelop-Unity keeps on working, not crashing.

Description of Problem:
While adding a string array, I misplaced a ']' at the end of the array, resulting in the following line:

string []d = {"Animations", "Materials", "Fonts", "Models", "Music", "Prefabs", "Scenes", "Scripts", "Sounds"]};

Prior noticing the error, I tried to save the file and got an error dialog (Error while executing command: Save) and the following trace:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.ArrayInitializer arrayInitializer) [0x00051] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:2956 
  at Mono.CSharp.ArrayInitializer.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/expression.cs:6010 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.BlockVariableDeclaration blockVariableDeclaration) [0x00089] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:1251 
  at Mono.CSharp.BlockVariableDeclaration.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/statement.cs:1554 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.AddBlockChildren (ICSharpCode.NRefactory.CSharp.BlockStatement result, Mono.CSharp.Block blockStatement, System.Int32& curLocal) [0x00064] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:1610 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.Block blockStatement) [0x0006e] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:1625 
  at Mono.CSharp.Block.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/statement.cs:2279 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.Method m) [0x00153] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:926 
  at Mono.CSharp.Method.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/method.cs:1143 
  at Mono.CSharp.StructuralVisitor.VisitTypeContainer (Mono.CSharp.TypeContainer tc) [0x00019] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/visit.cs:40 
  at Mono.CSharp.StructuralVisitor.Visit (Mono.CSharp.Class c) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/visit.cs:86 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.Class c) [0x001c7] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:422 
  at Mono.CSharp.Class.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/class.cs:2516 
  at Mono.CSharp.StructuralVisitor.VisitNamespaceBody (Mono.CSharp.Namespace nspace) [0x00024] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/visit.cs:59 
  at ICSharpCode.NRefactory.CSharp.CSharpParser+ConversionVisitor.Visit (Mono.CSharp.Namespace nspace) [0x0007b] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:297 
  at Mono.CSharp.UsingsBag+Namespace.Accept (Mono.CSharp.StructuralVisitor visitor) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/mcs/location.cs:782 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (Mono.CSharp.CompilerCompilationUnit top, Int32 line) [0x0001a] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3411 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (System.IO.Stream stream, Int32 line) [0x00038] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3443 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.Parse (System.IO.TextReader reader, Int32 line) [0x0004c] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3392 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.ParseTypeMembers (System.IO.TextReader reader, Int32 lineModifier) [0x0001b] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3452 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.ParseStatements (System.IO.TextReader reader, Int32 lineModifier) [0x0001b] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3464 
  at ICSharpCode.NRefactory.CSharp.CSharpParser.ParseExpression (System.IO.TextReader reader) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/contrib/ICSharpCode.NRefactory/CSharp/Parser/CSharpParser.cs:3483 
  at MonoDevelop.CSharp.HelperMethods.ParseSnippet (ICSharpCode.NRefactory.CSharp.CSharpParser parser, Mono.TextEditor.TextEditorData data) [0x0000c] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/HelperMethods.cs:79 
  at MonoDevelop.CSharp.Formatting.CSharpFormatter.OnTheFlyFormat (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, Mono.TextEditor.TextEditorData data, Int32 startOffset, Int32 endOffset) [0x0001c] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs:132 
  at MonoDevelop.Ide.CodeFormatting.CodeFormatter.OnTheFlyFormat (MonoDevelop.Projects.Policies.PolicyContainer policyParent, Mono.TextEditor.TextEditorData data, Int32 startOffset, Int32 endOffset) [0x00028] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs:113 
  at MonoDevelop.SourceEditor.SourceEditorView.Save (System.String fileName, System.String encoding) [0x0011f] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:391 
  at MonoDevelop.SourceEditor.SourceEditorView.Save (System.String fileName) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:359 
  at MonoDevelop.Ide.Gui.Document.Save () [0x00128] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs:275 
  at MonoDevelop.Ide.Gui.ViewCommandHandlers.OnSaveFile () [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs:71 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00000] in <filename unknown>:0 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in <filename unknown>:0 
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00029] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1386 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey42.<>m__56 () [0x0003d] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:597 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:614 

Steps to reproduce the problem:
1. Create a new file using MonoDevelop-Unity included with Unity 4.0.0f7
2. Create (or edit) a c# file with the following content:

public class MakeFolders
{ 
	static void CreateFolders ()
	{
		string []d = {]};

	}
}

3. Try to save the file.


Actual Results:
MonoDevelop-Unity fails to save the file, showing the dialog attached with the report.

Expected Results:
The file is correctly saved.

How often does this happen? 
Every time a file with that syntactic error is saved.

Additional Information:
Comment 1 Mike Krüger 2013-01-22 02:34:26 UTC
2.8.2 is over 3 years old code - unity should  upgrade to a newer version.

/closing