Bug 4221 - Problem with templates in C# that are only comments
Summary: Problem with templates in C# that are only comments
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.8.2
Hardware: PC Windows
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-04-04 05:11 UTC by Noam
Modified: 2012-04-04 08:05 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 FIXED

Description Noam 2012-04-04 05:11:31 UTC
C# Code Templates won't accept a template that is made uniquely by empty lines or comments. I upgraded to MD 2.8.2 with Unity 3.5, and MD now returns a "text editor extension chain" error when trying to insert them (while they were accepted in the previous version, which was 2.4.x).

I have a template that basically is the following:
/***************
*
***************/

And when I try to insert it in the document I get an error as follows:


System.InvalidOperationException: Sequence contains no elements

   at System.Linq.Enumerable.First[TSource](IEnumerable`1 source)

   at MonoDevelop.CSharp.HelperMethods.ParseSnippet(CSharpParser parser, TextEditorData data) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\CSharpBinding\MonoDevelop.CSharp.Resolver\HelperMethods.cs:line 87

   at MonoDevelop.CSharp.Formatting.CSharpFormatter.OnTheFlyFormat(PolicyContainer policyParent, IEnumerable`1 mimeTypeChain, TextEditorData data, Int32 startOffset, Int32 endOffset) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\CSharpBinding\MonoDevelop.CSharp.Formatting\CSharpFormatter.cs:line 132

   at MonoDevelop.Ide.CodeFormatting.CodeFormatter.OnTheFlyFormat(PolicyContainer policyParent, TextEditorData data, Int32 startOffset, Int32 endOffset) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeFormatting\CodeFormatter.cs:line 113

   at MonoDevelop.Ide.CodeTemplates.CodeTemplate.FillVariables(TemplateContext context) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeTemplates\CodeTemplate.cs:line 293

   at MonoDevelop.Ide.CodeTemplates.CodeTemplate.InsertTemplateContents(Document document) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeTemplates\CodeTemplate.cs:line 433

   at MonoDevelop.SourceEditor.ExtensibleTextEditor.InsertTemplate(CodeTemplate template, Document document) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor\ExtensibleTextEditor.cs:line 672

   at MonoDevelop.SourceEditor.SourceEditorView.InsertTemplate(CodeTemplate template, Document doc) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor\SourceEditorView.cs:line 1891

   at MonoDevelop.Ide.CodeTemplates.CodeTemplate.Insert(Document document) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeTemplates\CodeTemplate.cs:line 386

   at MonoDevelop.Ide.CodeTemplates.CodeTemplateCompletionData.InsertCompletionText(CompletionListWindow window, KeyActions& ka, Key closeChar, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeTemplates\CodeTemplateCompletionData.cs:line 57

   at MonoDevelop.Ide.CodeCompletion.CompletionListWindow.CompleteWord(KeyActions& ka, Key closeChar, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeCompletion\CompletionListWindow.cs:line 383

   at MonoDevelop.Ide.CodeCompletion.CompletionListWindow.PreProcessKeyEvent(Key key, Char keyChar, ModifierType modifier, KeyActions& ka) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeCompletion\CompletionListWindow.cs:line 158

   at MonoDevelop.Ide.CodeCompletion.CompletionWindowManager.PreProcessKeyEvent(Key key, Char keyChar, ModifierType modifier, KeyActions& ka) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.CodeCompletion\CompletionWindowManager.cs:line 138

   at MonoDevelop.Ide.Gui.Content.CompletionTextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\CompletionTextEditorExtension.cs:line 77

   at MonoDevelop.CSharp.Completion.CSharpTextEditorCompletion.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\CSharpBinding\MonoDevelop.CSharp.Completion\CSharpTextEditorCompletion.cs:line 178

   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\TextEditorExtension.cs:line 115

   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\TextEditorExtension.cs:line 115

   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\TextEditorExtension.cs:line 115

   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\TextEditorExtension.cs:line 115

   at MonoDevelop.Ide.Gui.Content.TextEditorExtension.KeyPress(Key key, Char keyChar, ModifierType modifier) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\core\MonoDevelop.Ide\MonoDevelop.Ide.Gui.Content\TextEditorExtension.cs:line 115

   at MonoDevelop.SourceEditor.ExtensibleTextEditor.ExtensionKeyPress(Key key, UInt32 ch, ModifierType state) in c:\BuildAgent\work\6b3beae2de4b9011\monodevelop\main\src\addins\MonoDevelop.SourceEditor2\MonoDevelop.SourceEditor\ExtensibleTextEditor.cs:line 257
Comment 1 Mike Krüger 2012-04-04 08:05:41 UTC
Already fixed in master.