Bug 42011 - Code Template Failing
Summary: Code Template Failing
Status: VERIFIED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor (show other bugs)
Version: 6.0.0 (C7)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Mike Krüger
URL:
: 42018 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-06-20 19:11 UTC by James Waltz
Modified: 2016-10-20 02:32 UTC (History)
4 users (show)

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


Attachments

Description James Waltz 2016-06-20 19:11:42 UTC
After updating to Xamarin Studio 6.0, several of my code templates have stopped working. I have tried deleting and re-creating them, but they still do not work.

Example:
Shortcut - cmd
Group - C#
Template Text -

public ICommand $name$Command {
	private set;
	get;
}

private void Execute$name$Command()
{
}

When I type "cmd" and hit tab twice, the template text is dropped into the text editor with "$name$" replaced with "notset". The cursor is placed after this text but no text is highlighted. I am unable to type my own entry to replace the "$name$" token.

The following exception is logged in the IDE log:

Error while executing action System.Action`1[Mono.TextEditor.TextEditorData] :System.ArgumentOutOfRangeException: endOffset < startOffset
Parameter name: endOffset
  at MonoDevelop.Core.Text.TextSegment.FromBounds (Int32 startOffset, Int32 endOffset) [0x00017] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Core/MonoDevelop.Core.Text/ISegment.cs:217 
  at MonoDevelop.Ide.CodeTemplates.CodeTemplate.InsertTemplateContents (MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext context) [0x001d8] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.CodeTemplates/CodeTemplate.cs:458 
  at MonoDevelop.SourceEditor.ExtensibleTextEditor.InsertTemplate (MonoDevelop.Ide.CodeTemplates.CodeTemplate template, MonoDevelop.Ide.Editor.TextEditor editor, MonoDevelop.Ide.Editor.DocumentContext context) [0x00007] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:584 
  at MonoDevelop.SourceEditor.ExtensibleTextEditor.DoInsertTemplate () [0x00044] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/ExtensibleTextEditor.cs:573 
  at MonoDevelop.SourceEditor.TabAction.Action (Mono.TextEditor.TextEditorData data) [0x00000] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/EditActions.cs:43 
  at Mono.TextEditor.EditMode.RunAction (System.Action`1 action) [0x00006] in /Users/builder/data/lanes/3342/694a75f0/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/EditMode.cs:208
Comment 1 Mike Krüger 2016-06-21 07:01:57 UTC
*** Bug 42018 has been marked as a duplicate of this bug. ***
Comment 2 xamarin-release-manager 2016-06-21 07:04:27 UTC
Fixed in version 6.1.0.4978 (master)

Author: Mike Kr??ger
Commit: 5841774f1c72be33b9279af560d403d0553c8ec5 (mono/monodevelop)
Comment 3 xamarin-release-manager 2016-06-21 07:48:44 UTC
Fixed in version 6.0.2.28 (cycle7)

Author: Lluis Sanchez
Commit: 7999835a823c1e94acdd8a84c23f6a7b9b5733ce (mono/monodevelop)
Comment 4 Sunil Kumar 2016-06-27 19:01:57 UTC
I have checked this issue with latest master XamarinStudio-6.1.0.5058_8c955ef9100378f8d2a5d7a83031c93aa43dec35.dmg and cycle7 XamarinStudio-6.0.2.36.dmg and observed that now this issue works fine. Now text is displaying highlighted and user is able to type own entry to replace the "$name$" token. Here is the screencast for the same: http://www.screencast.com/t/H8SrF5uzNzY

Hence I am closing this issue.

Environment info:
Latest master XamarinStudio-6.1.0.5058_8c955ef9100378f8d2a5d7a83031c93aa43dec35.dmg

Cycle 7: XamarinStudio-6.0.2.36.dmg
Commit : 014d200a9d9d38bca6f0c58764b7c1396f10f417.

Note You need to log in before you can comment on or make changes to this bug.