in

The ORM Foundation

Get the facts!

"index was out of range" error when deleting fact / value / entity type with sample population

Last post Mon, Sep 23 2013 7:25 by Ken Evans. 5 replies.
Page 1 of 1 (6 items)
Sort Posts: Previous Next
  • Mon, Aug 26 2013 2:58

    • koneill
    • Top 25 Contributor
      Male
    • Joined on Fri, Feb 17 2012
    • The Netherlands
    • Posts 38

    "index was out of range" error when deleting fact / value / entity type with sample population

     Hi,

     Im getting the following error in Norma when I try do delete one or more fact types / value / entity types when they contain a sample population:

     "index was out of range: must be non-negative and less than the size of the collection. Parameter name: index"

     Work around is quite easy: delete the sample populations and then delete the desired types.

     Working with: NORMA may 29 release, VS2012

     Regards,

    Karl

  • Mon, Aug 26 2013 21:25 In reply to

    Re: "index was out of range" error when deleting fact / value / entity type with sample population

    Hi Karl,

    I actually hit this with another scenario (renaming an object type with a population), and there are probably other ways to hit it as well when there is a sample population.

    The bug was a typo introduced in build 1515 (just before the last public release) that read the count off one collection and tried to iterate another. See http://sourceforge.net/p/orm/code/1520/ if you're curious.

    Obviously, this will be fixed in the next public drop. If it is causing someone too much pain in the mean time please let me know.

    -Matt

  • Tue, Aug 27 2013 6:29 In reply to

    Re: "index was out of range" error when deleting fact / value / entity type with sample population

    Matt, I get this error quite often in larger models, just selecting and dragging groups of things around, and even without any sample population data. Today I even got a full-fledged crash. It's never been repeatable enough to feel I had something to report, but there's definitely problems.
  • Tue, Aug 27 2013 10:28 In reply to

    Re: "index was out of range" error when deleting fact / value / entity type with sample population

    Hi Clifford,

    Glad to hear that the full-fledged crash is an unusual event, although I would obviously like to make that an extremely rare occurrence.

    'index out of range' is an extremely common error, and can theoretically happen any time a list or array is accessed via an index, which means that there are likely tens of thousands of potential sources for this exception in the code. These issues generally manifest themselves fairly quickly: this one was a typo/incomplete copy-paste edit that was introduced shortly before the drop and not caught, but was found and fixed quickly thereafter. Unfortunately, it happened before a release.

    There is no way to get this specific error without sample population in the fact type, so you are likely seeing something entirely different if you're seeing this without sample population.

    There are three classes of errors in NORMA:

    1. Errors that happen during a model change. Each item that shows up on the undo list is a single model change. These all happen under a transacted object model, and the model will return to the exact state as before the change, then report the error. This type of bug (which I've found to be the most common, and includes this one) are the easiest to track because they can be immediately reproduced by replicating the change.
    2. Errors that happen during playback of atom changes in a single model change. These happen during the initial change, undo, and redo and always occur after the model change has been committed. The general source of these errors is one of the tool windows. Note that years ago I added additional framework components to NORMA so that one error during events in one rogue tool window could not bring down the system. The result is that you get an error dialog after the transaction playback is complete, but the system does not crash.
    3. Errors that happen during rendering of the diagram or one of the tool window states. These are generally the bugs that will lead to a crash, and are the hardest to reproduce because they can take the system down.

    If you get a reproducible failure that does not crash the system, then you can easily attach a debugger and get a call stack. NORMA installs the .pdb files, so the call stack is generally readable. To do this (this looks long, but takes about 15 seconds the second time you do it. This should also be familiar for those who are developers as well as modelers). It is hard to verify these instructions on a machine with a development version of NORMA installed, so it would be nice if someone could check them out for me. I'll add these to the readme once they are verified.

    1. Open a second instance of Visual Studio.
    2. Choose the 'Attach to Process' command on the Tools menu (usually Ctrl-Alt-P).
    3. Attach to the 'devenv.exe' instance that is hosting the NORMA designer. You can speed up the attach by only debugging managed code (a setting in the dialog).
    4. Try to reproduce the bug. You may stop in the debugger at the point the error is thrown. If you don't, do the following:
      • Using the dialog from Tools/Options menu, choose the 'Debugger' category and uncheck the 'Just My Code' option, then choose OK to commit your options.
      • Open the Exceptions dialog from the Debug menu (usually Ctrl-Alt-E) and check the 'Thrown' column for the 'Common Language Runtime' category, then commit the dialog.
      • You should now stop somewhere in the code when you reproduce the bug.
    5. You may be prompted for a source location when the debugger stops. You can either ignore this, or pull the source code onto your machine from sourceforge. This is easiest if you have SVN and/or TortoiseSVN installed. Make sure you get the right changeset (look at the readme.htm file installed with NORMA in the Documentation directory). If you click the 'Code' page from orm.sf.net you'll see instructions on how to get a read-only copy. This can take two or three minutes. This step is optional. Obviously, it is really nice to have an exact line in the code, and this is easy if you already have SVN on your machine, but I can almost always spot the problem from the callstack (next step).
    6. Once the debugger is stopped, use the Debug/Windows/Call Stack menu to see the call stack.
      • If you see [External Code] in the list (this won't happen if 'Just my Code' is off), then right click in the dialog and choose 'Show External Code'
      • You can also make sure that all of the options at the bottom of the context menu are checked (Show Module Names through Show Byte Offsets) to get the most information.
    7. With focus in the call stack tool window, Select All and Copy to get the callstack (Ctrl-A/Ctrl-C, or use the items on the context menu).
    8. Get me the call stack.

    Please note that not all exceptions that are thrown during are actual problems. In general, I try to minimize the number of thrown exceptions during normal processing cases, but that is not true for all of the VS components used by NORMA. Generally, if you attach a debugger after the .orm file is loaded then you will see very few 'false negative' exceptions, but you may see a ton during system startup and file load.

    NORMA is a good-sized code base, with well over half a million lines of active code at this point (haven't counted in years, this is a low-ball number). Unfortunately, there is very little I can do with a general report (I occasionally have problems, I saw this error). If you're using the tool, please take the 5 minutes if you see a problem to get a call stack and/or reproduce the scenario. The bottom line is that I can't fix issue I don't know about and can't reproduce.

    -Matt

  • Mon, Sep 23 2013 7:20 In reply to

    • wearego
    • Top 200 Contributor
    • Joined on Thu, Feb 3 2011
    • Posts 2

    Re: "index was out of range" error when deleting fact / value / entity type with sample population

    I got this error after editing a constraint such that the sample population would not comply with the model any more. Some reproduction info (VS2008 2013-05 CTP): Person is a parent of Person (uniqueness is only on first role, changing it to span both roles) Edit Constraint Role boxes show: | 1 | | Click second role Role boxes show: | 1 | 2 | Double-click second role to commit. Index out of range exception. Parameter name: index Call stack: > mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException(System.ExceptionArgument argument, System.ExceptionResource resource) + 0x41 bytes mscorlib.dll!System.ThrowHelper.ThrowArgumentOutOfRangeException() + 0x10 bytes mscorlib.dll!System.Collections.Generic.List.this[int].get(int index = 0) + 0x2b bytes mscorlib.dll!System.Collections.ObjectModel.ReadOnlyCollection.this[int].get(int index) + 0x36 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.Role.GetErrorCollection.MoveNext() + 0x56a bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.FactType.GetErrorCollection.MoveNext() + 0x68b bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.FactType.RegenerateErrorText() + 0xa8 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.FactType.ProcessValidateFactNameForObjectificationAdded(ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification link = {ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification}) + 0x70 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.FactType.ValidateFactTypeNameForObjectificationAddedRule(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e = {Microsoft.VisualStudio.Modeling.ElementAddedEventArgs}) + 0x37 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.FactType.ValidateFactTypeNameForObjectificationAddedRuleClass.ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e = {Microsoft.VisualStudio.Modeling.ElementAddedEventArgs}) + 0x49 bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.AddRuleNotification.FireRule() + 0x5e bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.RuleManager.FireAddRule(Microsoft.VisualStudio.Modeling.Transaction txn = {Microsoft.VisualStudio.Modeling.Transaction}, Microsoft.VisualStudio.Modeling.ElementAddedEventArgs eventArgs = {Microsoft.VisualStudio.Modeling.ElementAddedEventArgs}) + 0xe1 bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.RuleManager.ElementAdded(Microsoft.VisualStudio.Modeling.Transaction txn, Microsoft.VisualStudio.Modeling.AddElementLinkCommand addLinkCmd) + 0x49 bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.AddElementLinkCommand.NotifyRule() + 0x4b bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Transaction.AddCommand(Microsoft.VisualStudio.Modeling.ModelCommand command) + 0x1ee bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.ElementLink.ElementLink(Microsoft.VisualStudio.Modeling.Partition partition, Microsoft.VisualStudio.Modeling.RoleAssignment[ roleAssignments, Microsoft.VisualStudio.Modeling.PropertyAssignment[ propertyAssignments = {Microsoft.VisualStudio.Modeling.PropertyAssignment[1]}) + 0x2f0 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification.Objectification(Microsoft.VisualStudio.Modeling.Store store = {ORMSolutions.ORMArchitect.Core.Shell.ORMDesignerDocData.ORMStore}, Microsoft.VisualStudio.Modeling.RoleAssignment[ roleAssignments = {Microsoft.VisualStudio.Modeling.RoleAssignment[2]}, Microsoft.VisualStudio.Modeling.PropertyAssignment[ propertyAssignments = {Microsoft.VisualStudio.Modeling.PropertyAssignment[1]}) + 0x5d bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification.CreateObjectificationForFactTypeInternal(ORMSolutions.ORMArchitect.Core.ObjectModel.FactType factType = FactType (Name = "PersonIsAParentOfPerson"), bool isImplied = true, ORMSolutions.ORMArchitect.Framework.INotifyElementAdded notifyAdded = null) + 0x838 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification.ProcessFactTypeForImpliedObjectification(ORMSolutions.ORMArchitect.Core.ObjectModel.FactType factType = FactType (Name = "PersonIsAParentOfPerson"), bool throwOnFailure = false) + 0xe7 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ObjectModel.Objectification.DelayProcessFactTypeForImpliedObjectification(Microsoft.VisualStudio.Modeling.ModelElement {ORMSolutions.ORMArchitect.Core.ObjectModel.FactType} element = FactType (Name = "PersonIsAParentOfPerson")) + 0x2c bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Framework.FrameworkDomainModel.ElementValidator.Validate() + 0x48 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Framework.FrameworkDomainModel.DelayValidateElements(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e = {Microsoft.VisualStudio.Modeling.ElementAddedEventArgs}) + 0x316 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Framework.FrameworkDomainModel.DelayValidateElementsClass.ElementAdded(Microsoft.VisualStudio.Modeling.ElementAddedEventArgs e = {Microsoft.VisualStudio.Modeling.ElementAddedEventArgs}) + 0x49 bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.AddRuleNotification.FireRule() + 0x5e bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Transaction.FireCommitTimeRules(Microsoft.VisualStudio.Modeling.SortedRuleNotificationList rulesToFire = {Microsoft.VisualStudio.Modeling.SortedRuleNotificationList}) + 0x42 bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Transaction.FireCommitTimeElementRules() + 0x5c bytes Microsoft.VisualStudio.Modeling.Sdk.dll!Microsoft.VisualStudio.Modeling.Transaction.Commit() + 0x137 bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.ConnectAction.CreateConnection() + 0x84 bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.ConnectAction.OnClicked(Microsoft.VisualStudio.Modeling.Diagrams.MouseActionEventArgs e) + 0x1b2 bytes ORMSolutions.ORMArchitect.Core.VS2008.dll!ORMSolutions.ORMArchitect.Core.ShapeModel.InternalUniquenessConstraintConnectAction.OnClicked(Microsoft.VisualStudio.Modeling.Diagrams.MouseActionEventArgs e = {Microsoft.VisualStudio.Modeling.Diagrams.MouseActionEventArgs}) + 0xad bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.MouseAction.InvokeStateChangeMethods(Microsoft.VisualStudio.Modeling.Diagrams.MouseActionState oldState = {Microsoft.VisualStudio.Modeling.Diagrams.DragPendingState}, Microsoft.VisualStudio.Modeling.Diagrams.MouseActionState newState = {Microsoft.VisualStudio.Modeling.Diagrams.ClickedState}, Microsoft.VisualStudio.Modeling.Diagrams.DiagramClientView diagramClientView = { [Microsoft.VisualStudio.Modeling.Diagrams.DiagramClientView]}, Microsoft.VisualStudio.Modeling.Diagrams.ActionRequest nextAction) + 0x59d bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.MouseAction.FlushInternalEventQueue() + 0x1e0 bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.MouseAction.MouseUp(Microsoft.VisualStudio.Modeling.Diagrams.DiagramMouseEventArgs mouseArgs) + 0x4b bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.DiagramClientView.OnMouseUp(System.Windows.Forms.MouseEventArgs e = {X = 221 Y = 108 Button = Left}) + 0x70 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WmMouseUp(ref System.Windows.Forms.Message m, System.Windows.Forms.MouseButtons button, int clicks) + 0x28f bytes System.Windows.Forms.dll!System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message m) + 0x885 bytes Microsoft.VisualStudio.Modeling.Sdk.Diagrams.dll!Microsoft.VisualStudio.Modeling.Diagrams.DiagramClientView.WndProc(ref System.Windows.Forms.Message m) + 0x8f bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.OnMessage(ref System.Windows.Forms.Message m) + 0x10 bytes System.Windows.Forms.dll!System.Windows.Forms.Control.ControlNativeWindow.WndProc(ref System.Windows.Forms.Message m) + 0x31 bytes System.Windows.Forms.dll!System.Windows.Forms.NativeWindow.DebuggableCallback(System.IntPtr hWnd, int msg = 514, System.IntPtr wparam, System.IntPtr lparam) + 0x57 bytes
  • Mon, Sep 23 2013 7:25 In reply to

    • Ken Evans
    • Top 10 Contributor
      Male
    • Joined on Sun, Nov 18 2007
    • Stickford, UK
    • Posts 805

    Re: "index was out of range" error when deleting fact / value / entity type with sample population

     Thanks for this. I'll pass it on to Matt for comment.

Page 1 of 1 (6 items)
© 2008-2024 ------- Terms of Service