Bug 1130 - Auto-entering a fully qualified class name causes an ArgumentOutOfRangeException
Summary: Auto-entering a fully qualified class name causes an ArgumentOutOfRangeException
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 2.9.x
Hardware: PC Linux
: Normal normal
Target Milestone: ---
Assignee: Mike Krüger
Depends on:
Reported: 2011-09-29 06:14 UTC by Rob
Modified: 2012-04-20 12:50 UTC (History)
2 users (show)

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

Full message and stacktrace of the bug. (2.99 KB, text/plain)
2011-09-29 06:14 UTC, Rob

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 Rob 2011-09-29 06:14:15 UTC
Created attachment 531 [details]
Full message and stacktrace of the bug.

Auto-adding a using block for an unknown classname, removing it using Ctrl+Z, then auto-inserting the full namespace causes an ArgumentOutOfRangeException.

To recreate:

1) Type the name of a class that is unresolved (e.g. not in the same namespace and not declared with a using block)
2) Press Alt+Enter to auto-resolve the class and choose "using <qualifiedclass>"
3) Press Ctrl+Z to undo the using block
4) Press Alt+Enter again, and this time choose to insert the fully qualified name directly in front of the class declaration

9 times out of 10 for me this results in an exception with the attached stacktrace and the following message:

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentOutOfRangeException: Value has to be >= 0.
Parameter name: sourceIndex

Apologies if this is already resolved, I am still using 2.4 (on Debian).
Comment 1 Mike Krüger 2011-09-29 07:22:21 UTC
At least I can't find it with 2.8.

I've no problem reporting 2.4 bugs (btw. the add namespace thing got changed much since 2.4 :))
Comment 2 Eric Beisecker 2012-04-19 17:53:23 UTC
This bug seems to have come back in the 2.9.x series.


What I'm doing

1) Highlighting type I want to add a namespace for. 
2) Hitting ctrl+option+space to open the Autocomplete menu
3) Selecting the Namespace I want to add.
Comment 3 Mike Krüger 2012-04-20 12:50:29 UTC
Should be fixed.
(btw. the original bug was about another function)