Bug 9003 - Template with */ at the end of a line throws InvalidOperationException
Summary: Template with */ at the end of a line throws InvalidOperationException
Status: RESOLVED NOT_REPRODUCIBLE
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: Trunk
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-12-17 18:36 UTC by Nate Chatellier
Modified: 2013-01-02 04:08 UTC (History)
3 users (show)

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


Attachments
Bugged template example file (526 bytes, text/xml)
2012-12-17 18:36 UTC, Nate Chatellier
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 NOT_REPRODUCIBLE

Description Nate Chatellier 2012-12-17 18:36:43 UTC
Created attachment 3104 [details]
Bugged template example file

1) Create a new Code Template through the standard dialog


2) Input the following template (or use the attached file):
/* ---------------------------------------------------------------------------------------- */
$selected$$end$


3) Attempt to insert the template, and the following error is thrown:

System.InvalidOperationException: The source sequence is empty
  at System.Linq.Enumerable.First[Statement] (IEnumerable`1 source) [0x00000] in <filename unknown>:0 
  at MonoDevelop.CSharp.HelperMethods.ParseSnippet (ICSharpCode.NRefactory.CSharp.CSharpParser parser, Mono.TextEditor.TextEditorData data) [0x00064] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Resolver/HelperMethods.cs:87 
  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.Ide.CodeTemplates.CodeTemplate.FillVariables (MonoDevelop.Ide.CodeTemplates.TemplateContext context) [0x004a6] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs:293 
  at MonoDevelop.Ide.CodeTemplates.CodeTemplate.InsertTemplateContents (MonoDevelop.Ide.Gui.Document document) [0x00183] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs:433 
  at MonoDevelop.SourceEditor.ExtensibleTextEditor.InsertTemplate (MonoDevelop.Ide.CodeTemplates.CodeTemplate template, MonoDevelop.Ide.Gui.Document document) [0x0000c] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:672 
  at MonoDevelop.SourceEditor.SourceEditorView.InsertTemplate (MonoDevelop.Ide.CodeTemplates.CodeTemplate template, MonoDevelop.Ide.Gui.Document doc) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:1891 
  at MonoDevelop.Ide.CodeTemplates.CodeTemplate.Insert (MonoDevelop.Ide.Gui.Document document) [0x0000d] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs:386 
  at MonoDevelop.Ide.CodeTemplates.CodeTemplateCompletionData.InsertCompletionText (MonoDevelop.Ide.CodeCompletion.CompletionListWindow window, MonoDevelop.Ide.CodeCompletion.KeyActions& ka, Key closeChar, Char keyChar, ModifierType modifier) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplateCompletionData.cs:57 
  at MonoDevelop.Ide.CodeCompletion.CompletionListWindow.CompleteWord (MonoDevelop.Ide.CodeCompletion.KeyActions& ka, Key closeChar, Char keyChar, ModifierType modifier) [0x00039] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs:383 
  at MonoDevelop.Ide.CodeCompletion.CompletionListWindow.PreProcessKeyEvent (Key key, Char keyChar, ModifierType modifier, MonoDevelop.Ide.CodeCompletion.KeyActions& ka) [0x00074] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionListWindow.cs:158 
  at MonoDevelop.Ide.CodeCompletion.CompletionWindowManager.PreProcessKeyEvent (Key key, Char keyChar, ModifierType modifier, MonoDevelop.Ide.CodeCompletion.KeyActions& ka) [0x0000f] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeCompletion/CompletionWindowManager.cs:138 
  at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x0000d] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/CompletionTextEditorExtension.cs:77 
  at MonoDevelop.CSharp.Completion.CSharpTextEditorCompletion.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/CSharpBinding/MonoDevelop.CSharp.Completion/CSharpTextEditorCompletion.cs:178 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress (Key key, Char keyChar, ModifierType modifier) [0x00013] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Content/TextEditorExtension.cs:115 
  at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress (Key key, UInt32 ch, ModifierType state) [0x00000] in /BuildAgent/work/6c28873fe3729864/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:257
Comment 1 Nate Chatellier 2012-12-17 18:51:20 UTC
Note that if you put a [space] character between the * and the / at the end of the line, the error goes away. It also goes away if you type some text after the / character.
Comment 2 Mike Krüger 2013-01-02 04:08:06 UTC
Which version are you using ?
This code doesn't even exist anymore.