I have seen this issue in VS 2013 Pro and 2015 Pro with both Elements 8.1 and 8.2 (latest beta). I’ll be typing along in VS and while rearranging braces or parentheses (the auto placement of these seems to be broken, but that’s another issue) when an error dialog pops up saying that “An exception has been encountered” and to check the ActivityLog.xml for details. Following is the last element in that log.
<entry>
<record>912</record>
<time>2015/09/21 23:12:56.029</time>
<type>Error</type>
<source>Editor or Editor Extension</source>
<description>System.ArgumentOutOfRangeException: startIndex cannot be larger than length of string.
Parameter name: startIndex
 at System.String.Substring(Int32 startIndex, Int32 length)
 at System.String.Substring(Int32 startIndex)
 at RemObjects.Oxygene.Code.BaseParser.A(Int32 , Int32 , String , String )
 at RemObjects.Oxygene.Code.Compiler.CodeCompletionCompiler.UpdateFileUpdate(BaseParser aParser, Int32 aOffset, Int32 aCount, String aData, String aCompletedText, Boolean aDoUpdateEvent)
 at RemObjects.Oxygene.Code.Compiler.Compiler.UpdateFileUpdate(String , Int32 , Int32 , String , String )
 at RemObjects.Oxygene.VisualStudio.Editor.OxygeneClassifier.fBuffer_Changed(Object sender, TextContentChangedEventArgs e)
 at Microsoft.VisualStudio.Text.Utilities.GuardedOperations.RaiseEvent[TArgs](Object sender, EventHandler`1 eventHandlers, TArgs args)</description>
</entry>
oke that is curious. Any idea what you are doing when it does fail? (i’ve yet to see this behavior so it must be something I am not doing that you are)
I haven’t been able to reproduce it on demand yet. It seems like it’s related to whatever plugin puts red squigely lines under code that has an error. I believe it happens when I get the error lines to appear on the closing braces of a class. I hover over the error to see what it says and then when I go to type more, I get the exception message box and CC/auto-format/auto-indent no longer work. I pasted the exception that is thrown in the first message in this thread if that helps.
It is in a shared project and in RemObjects C#. It seems to be important that the file is shared and that the File Switcher Display is displaying. I have the file shared between a .Net and Java project.
I’ve finally found a way to reproduce it:
Create a shared project in RO C#.
Create a .Net and Java library project that references the shared project.
In the shared project create a class called Optional.
Make sure the File Switcher is active.
Type in the code as shown in the attached image.
After typing in the constructor, you should see a red squigly highlight as shown in the image.
Hover the mouse over the error squigley to see what the error is as shown in the image.
Go to type some more in the editor and an exception is thrown. Now CC/Auto-indent/etc. will not work.