Bug 4322 - NullReferenceException in indent/unindent selection if nothing is selected
Summary: NullReferenceException in indent/unindent selection if nothing is selected
Status: RESOLVED FIXED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: Trunk
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2012-04-06 20:50 UTC by Csaba Halász
Modified: 2012-04-07 13:39 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 Csaba Halász 2012-04-06 20:50:58 UTC
Trying to (un)indent the current line without any text selected causes a dialog box to pop up saying an exception occurred:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object
  at Mono.TextEditor.MiscActions.RemoveIndentSelection (Mono.TextEditor.TextEditorData data) [0x00011] in monodevelop/main/src/core/Mono.Texteditor/Mono.TextEditor/Actions/MiscActions.cs:83
  at MonoDevelop.SourceEditor.SourceEditorView.UnIndentSelection () [0x00000] in monodevelop/main/src/addins/MonoDevelop.SourceEditor2/MonoDevelop.SourceEditor/SourceEditorView.cs:2108
  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) [0x000d5] in mono-2.10.8.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:226
  --- 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) [0x000eb] in mono-2.10.8.1/mcs/class/corlib/System.Reflection/MonoMethod.cs:234
  at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in mono-2.10.8.1/mcs/class/corlib/System.Reflection/MethodBase.cs:96
  at MonoDevelop.Components.Commands.CommandHandlerInfo.Run (System.Object cmdTarget, MonoDevelop.Components.Commands.Command cmd) [0x00029] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1901
  at MonoDevelop.Components.Commands.CommandManager+<DispatchCommand>c__AnonStorey49.<>m__58 () [0x0003d] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1038
  at MonoDevelop.Components.Commands.CommandManager.DispatchCommand (System.Object commandId, System.Object dataItem, System.Object initialTarget, CommandSource source) [0x0029e] in monodevelop/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.Commands/CommandManager.cs:1055

Note that this exception is *not* logged to the console, and also this isn't the normal "send error report" dialog (it only has an OK button). If even a single character is selected, the commands work as expected. Git revision is 93fa2ebf.
Comment 1 Mike Krüger 2012-04-07 03:32:26 UTC
fixed.
Comment 2 Csaba Halász 2012-04-07 10:18:42 UTC
Problem still there in git rev 565778a2, same stack trace.
Comment 3 Mike Krüger 2012-04-07 13:39:05 UTC
fixed - fixed shift-tab, but the source editor view called the wrong method :(