Bug 4585 - Remove and Sort usings: exception
Summary: Remove and Sort usings: exception
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2012-04-22 09:27 UTC by pinggi
Modified: 2012-04-23 01:59 UTC (History)
1 user (show)

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:

Description pinggi 2012-04-22 09:27:43 UTC
1. I had following code in *.cs file opened in text editor.

namespace Tree
	public class test
		public test()
			if (true) return;

2. I ran 'Remove and Sort usings' action and got this exception:

System.ArgumentException: Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at Mono.TextEditor.GapBuffer.PlaceGap(Int32 newOffset, Int32 minLength)
   at Mono.TextEditor.GapBuffer.Replace(Int32 offset, Int32 count, String text)
   at Mono.TextEditor.Document.Mono.TextEditor.IBuffer.Replace(Int32 offset, Int32 count, String value)
   at Mono.TextEditor.TextEditorData.Replace(Int32 offset, Int32 count, String value)
   at MonoDevelop.Refactoring.TextReplaceChange.PerformChange(IProgressMonitor monitor, RefactorerContext rctx)
   at MonoDevelop.Refactoring.RefactoringService.AcceptChanges(IProgressMonitor monitor, ProjectDom dom, List`1 changes, ITextFileProvider fileProvider)
   at MonoDevelop.Refactoring.RefactoringService.AcceptChanges(IProgressMonitor monitor, ProjectDom dom, List`1 changes)
   at MonoDevelop.Refactoring.RefactoringOperation.Run(RefactoringOptions options)
   at MonoDevelop.Refactoring.RefactorImports.RemoveSortImportsHandler.Run(RefactoringOptions options)
   at MonoDevelop.Refactoring.AbstractRefactoringCommandHandler.Run(Object data)
   at MonoDevelop.Components.Commands.CommandHandler.InternalRun(Object dataItem)
   at MonoDevelop.Components.Commands.CommandManager.DefaultDispatchCommand(ActionCommand cmd, CommandInfo info, Object dataItem, Object target, CommandSource source)
   at MonoDevelop.Components.Commands.CommandManager.DispatchCommand(Object commandId, Object dataItem, Object initialTarget, CommandSource source)
Comment 1 Mike Krüger 2012-04-23 01:59:48 UTC
fixed in master.