none
Linq IndexOutOfRangeException Windows XP Vista .Net 3.5 RRS feed

  • Question

  • In some cases in my application the Dll System.Data.Linq generates an exception when running in Windows XP or Vista, but doesn't in Windows 7. Considering both systems were up to date.

    The exception is:

    System.IndexOutOfRangeException: Index was outside the bounds of the array.
     at System.Data.Linq.IdentityManager.StandardIdentityManager.MultiKeyManager`3.TryCreateKeyFromValues(Object[] values, MultiKey`2& k)
     at System.Data.Linq.IdentityManager.StandardIdentityManager.IdentityCache`2.Find(Object[] keyValues)
     at System.Data.Linq.IdentityManager.StandardIdentityManager.Find(MetaType type, Object[] keyValues)
     at System.Data.Linq.CommonDataServices.GetCachedObject(MetaType type, Object[] keyValues)
     at System.Data.Linq.ChangeProcessor.GetOtherItem(MetaAssociation assoc, Object instance)
     at System.Data.Linq.ChangeProcessor.BuildEdgeMaps()
     at System.Data.Linq.ChangeProcessor.SubmitChanges(ConflictMode failureMode)
     at System.Data.Linq.DataContext.SubmitChanges(ConflictMode failureMode)
     --- End of inner exception stack trace ---
    

    My workaround was to remove the Dll System.Data.Linq(version 3.5.30729.1) and install the one from Windows 7(version 3.5.30729.4926) it seemed to work fine.

    But when installing my software, by setup installation, in a System running Windows XP or Vista I just can't uninstall and reinstall a Dll from GAC(that is related to framework).

    Can anyone give me another workaround for this or a real solution?

    Thanks in advance.

    Thursday, July 21, 2011 1:12 PM

Answers

All replies

  • Hi Igor,

    I think the difference is on XP there was .NET 3.5 installed without SP1 and the other machines has SP1.

    There were a score of bugs with the foreign keys and most of them were fixed in .NET 3.5 SP1 and in .NET 4.0.

    Is it possible to update the .NET framework on those machines?


    Regards, Peter

    //If a post answers your question, please click "Mark As Answer".
    //Also if a post seems to be helpful, please click "Mark as Helpful" on that post.

    Thursday, July 21, 2011 1:44 PM
  • Here you can find another work around, maybe it will work for you:

    http://elegantcode.com/2008/08/25/submitchanges-throws-indexoutofrangeexception/

     

    HTH


    Regards, Peter

    //If a post answers your question, please click "Mark As Answer".
    //Also if a post seems to be helpful, please click "Mark as Helpful" on that post.
    Thursday, July 21, 2011 1:47 PM
  • I have all framework updates installed in XP and Vista. But this Dll in specific(System.Data.Linq) doesn't update at all.

    And my problem is when running an insert query.

    Ayway thanks for trying to help.

     


    Thursday, July 21, 2011 1:52 PM
  • You are right, it seems that the DLLs on Win7 are different.

     

    There is a similar thread about it:

    http://social.msdn.microsoft.com/Forums/en-US/linqtosql/thread/04007c6d-1473-4e27-bb0e-8968073571be/

     

     


    Regards, Peter

    //If a post answers your question, please click "Mark As Answer".
    //Also if a post seems to be helpful, please click "Mark as Helpful" on that post.
    Thursday, July 21, 2011 3:27 PM
  • Thanks it seems to be it. I'll be doing some testing and confirm if it is the answer.

    Again, thank you very much.

    Thursday, July 21, 2011 4:01 PM