Bug 14300 - Exception when creating iOS project
Summary: Exception when creating iOS project
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: unspecified
Hardware: PC Mac OS
: High blocker
Target Milestone: master
Assignee: Marius Ungureanu
URL:
Depends on:
Blocks:
 
Reported: 2013-08-28 15:59 UTC by Jérémie Laval
Modified: 2014-01-17 07:41 UTC (History)
7 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 Jérémie Laval 2013-08-28 15:59:50 UTC
http://screencast.com/t/M1YJLM10


System.ArgumentOutOfRangeException: Should be >= 0
Parameter name: removedChars
  at ICSharpCode.NRefactory.CSharp.FormattingChanges.AddChange (Int32 offset, Int32 removedChars, System.String insertedText) [0x000a7] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingChanges.cs:133 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.AddChange (Int32 offset, Int32 removedChars, System.String insertedText) [0x0000a] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:70 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.EnsureBlankLinesBefore (ICSharpCode.NRefactory.CSharp.AstNode node, Int32 blankLines) [0x000e7] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:218 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor+<VisitSyntaxTree>c__AnonStorey7F.<>m__1BD (ICSharpCode.NRefactory.CSharp.AstNode child) [0x0003a] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:65 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitChildrenToFormat (ICSharpCode.NRefactory.CSharp.AstNode parent, System.Action`1 callback) [0x00114] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor.cs:110 
  at ICSharpCode.NRefactory.CSharp.FormattingVisitor.VisitSyntaxTree (ICSharpCode.NRefactory.CSharp.SyntaxTree unit) [0x00023] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/FormattingVisitor_Global.cs:63 
  at ICSharpCode.NRefactory.CSharp.SyntaxTree.AcceptVisitor (IAstVisitor visitor) [0x00003] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/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) [0x00036] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/external/nrefactory/ICSharpCode.NRefactory.CSharp/Formatter/CSharpFormatter.cs:140 
  at MonoDevelop.CSharp.Formatting.CSharpFormatter.FormatText (MonoDevelop.CSharp.Formatting.CSharpFormattingPolicy policy, MonoDevelop.Ide.Gui.Content.TextStylePolicy textPolicy, System.String mimeType, System.String input, Int32 startOffset, Int32 endOffset) [0x00115] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs:121 
  at MonoDevelop.CSharp.Formatting.CSharpFormatter.FormatText (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, System.String input, Int32 startOffset, Int32 endOffset) [0x0001f] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Formatting/CSharpFormatter.cs:149 
  at MonoDevelop.Ide.CodeFormatting.AbstractCodeFormatter.FormatText (MonoDevelop.Projects.Policies.PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, System.String input) [0x0001e] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/ICodeFormatter.cs:53 
  at MonoDevelop.Ide.CodeFormatting.CodeFormatter.FormatText (MonoDevelop.Projects.Policies.PolicyContainer policyParent, System.String input) [0x0001b] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeFormatting/CodeFormatter.cs:50 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.CreateFileContent (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String fileName, System.String identifier) [0x00063] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:270 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.SaveFile (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String baseDirectory, System.String entryName) [0x0006b] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:204 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddFileToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x0000a] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:113 
  at MonoDevelop.Ide.Templates.SingleFileDescriptionTemplate.AddToProject (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.Project project, System.String language, System.String directory, System.String name) [0x00009] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/SingleFileDescriptionTemplate.cs:108 
  at MonoDevelop.Ide.Templates.ProjectDescriptor.InitializeItem (MonoDevelop.Projects.SolutionItem policyParent, MonoDevelop.Projects.ProjectCreateInformation projectCreateInformation, System.String defaultLanguage, MonoDevelop.Projects.SolutionEntityItem item) [0x00224] in /Users/builder/data/lanes/monodevelop-lion-master/acdd9843/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/ProjectDescriptor.cs:162
Comment 1 Alan McGovern 2013-08-28 22:59:30 UTC
When you fix this bug can you clean up/merge this branch as a regression test to ensure we can always create projects.

An additional specific regression test for the formatter bug would always be amazing. You can use the test contained in my branch to figure out exactly which files are causing the issue by simply running the test in Xamarin Studio with 'halt on all thrown exceptions' enabled.

https://github.com/mono/monodevelop/compare/test_project_creation
Comment 2 Alan McGovern 2013-08-28 23:21:03 UTC
Please only merge this test into master if this bug is fixed after bug #14308 is fixed in order to keep the tree green.
Comment 3 Alan McGovern 2013-08-28 23:41:45 UTC
Ignore bug #14308. It is unrelated to this after all.
Comment 4 Mike Krüger 2013-08-29 01:28:48 UTC
fixed
Comment 5 Jérémie Laval 2013-08-29 12:13:05 UTC
No test = not fixed
Comment 6 Mike Krüger 2013-08-29 12:55:04 UTC
I tested that - thanks

I just add tests where they belong to
Comment 7 Jérémie Laval 2013-08-29 12:59:42 UTC
Nop, you added test for a formatter bug (which is lovely) but you didn't test the real fix to that bug which is commit 3f0760554e5b003f57eba7dd46cab24a9ef62f46

A test based on comment 1 is what's needed.
Comment 8 Mike Krüger 2013-08-29 13:02:41 UTC
that's not really the 'real' fix - the real fix is always the cause - not hiding error messages.

That we need tests for project create/compile is a different story.
Comment 9 Jérémie Laval 2013-08-29 13:04:29 UTC
That bug must stay open until Alan's test is included.
Comment 10 Lluis Sanchez 2013-09-03 04:39:40 UTC
Marius, can you add new tests for creating a project from a template? we have new api for that in ProjectOperations.
Comment 11 Marius Ungureanu 2013-09-03 04:54:00 UTC
Hey. Yea, I'll handle this.
Comment 12 Mike Krüger 2013-09-03 05:54:44 UTC
We should test all project templates we deliver.
Comment 13 Marius Ungureanu 2013-09-03 06:10:25 UTC
Apparently, Alan added a test case for this.

It's on test_project_creation branch. Commit https://github.com/mono/monodevelop/commit/466fc7f42b87fd48754ca7d8ef15e19357352e09
Comment 14 Marius Ungureanu 2013-09-03 08:49:24 UTC
Switched assignee to Alan as he's the owner of the branch with the fix.
Comment 15 Jérémie Laval 2013-09-03 09:15:00 UTC
As per comment #1 the branch is just a proof of concept. If you can productize it that would be fantastic.
Comment 16 Marius Ungureanu 2013-09-03 09:24:33 UTC
The problem is that I don't have access to proprietary code for proprietary templates.
Comment 17 Jérémie Laval 2013-09-03 09:26:35 UTC
You can write a generic test that iterates over all the templates currently available. That will automatically pick up the other templates in CI.
Comment 19 Atin 2014-01-17 07:41:52 UTC
Today, we have checked this issue with:

XS 4.2.3(build 127)
MT 7.0.6.167
ML 10.8.5

We are successfully able to create iOS template, without any Exception. Hence marking this as Verified.