Bug 12486 - Refactoring a method that can be made static results in an Exception
Summary: Refactoring a method that can be made static results in an Exception
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: C# Binding ()
Version: 4.0.8
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 4.0.9 (from master)
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2013-05-31 10:02 UTC by Dave Thomas
Modified: 2013-06-24 16:18 UTC (History)
1 user (show)

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


Attachments
incorrectly highlighted duplicates after refactoring (114.05 KB, image/png)
2013-05-31 10:02 UTC, Dave Thomas
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 FIXED

Description Dave Thomas 2013-05-31 10:02:33 UTC
Created attachment 4047 [details]
incorrectly highlighted duplicates after refactoring

After refactoring a method that can be made static, pressing undo (CMD Z) results in the following exception:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: must be <= Length, was: 1328
Parameter name: offset
  at Mono.TextEditor.TextDocument.Replace (Int32 offset, Int32 count, System.String value, AnchorMovementType anchorMovementType) [0x00151] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:258 
  at Mono.TextEditor.TextDocument.Replace (Int32 offset, Int32 count, System.String value) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:218 
  at Mono.TextEditor.TextDocument+UndoOperation.Undo (Mono.TextEditor.TextDocument doc) [0x00000] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:573 
  at Mono.TextEditor.TextDocument+AtomicUndoOperation.Undo (Mono.TextEditor.TextDocument doc) [0x00013] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:642 
  at Mono.TextEditor.TextDocument.Undo () [0x0003c] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Document/TextDocument.cs:846 
  at Mono.TextEditor.MiscActions.Undo (Mono.TextEditor.TextEditorData data) [0x00029] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/MiscActions.cs:299 
  at MonoDevelop.SourceEditor.SourceEditorView.Undo () [0x00016] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:1404 
  at MonoDevelop.Ide.Gui.ViewCommandHandlers.OnUndo () [0x0000d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/ViewCommandHandlers.cs:109 
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00054] in /private/tmp/source/bockbuild-crypto-mono/profiles/mono-mac-xamarin/build-root/mono-3.0.10/mcs/class/corlib/System.Reflection/MonoMethod.cs:230 
  --- End of inner exception stack trace ---
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00069] in /private/tmp/source/bockbuild-crypto-mono/profiles/mono-mac-xamarin/build-root/mono-3.0.10/mcs/class/corlib/System.Reflection/MonoMethod.cs:238 
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /private/tmp/source/bockbuild-crypto-mono/profiles/mono-mac-xamarin/build-root/mono-3.0.10/mcs/class/corlib/System.Reflection/MethodBase.cs:114 
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00029] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1965 
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey75.<>m__C8 () [0x0003d] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1053 
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x002ab] in /Users/builder/data/lanes/monodevelop-lion-monodevelop-4.0.8-branch/0a09117d/source/monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1070 

Also, after refactoring if you click on an instance of a repeated word then the results are incorrect
Comment 1 Mike Krüger 2013-05-31 12:55:19 UTC
I removed this code issue -it got contributed but didn't work.
Comment 2 PJ 2013-06-24 16:18:46 UTC
This bug was marked as fixed for Xamarin Studio 4.0.9, which is currently in the beta channel. Try it out!