none
StackOverflowException on linq to SQL datacontext SubmitChanges RRS feed

  • Question


  • On calling the datacontext's SubmitChanges() method I get a StackOverflowException

    in looking at the data being saved I see no issues.

    is there any way to step into il code for the  SubmitChanges() method ?

    Sunday, May 10, 2009 1:49 PM

Answers

  • I was setting the the foriegn entity properties not the foriegn key fields, looks the same .. and even works when the entity being saved has no parent entity. however in this case it was a child table and suddenly the pattern I used no longer worked.

    • Marked as answer by johntgold Sunday, May 10, 2009 4:34 PM
    Sunday, May 10, 2009 4:34 PM

All replies

  • the one object being saved serializes fine:

    <ItemUOMConversion z:Id="1" z:Type="LinqLayer.ItemUOMConversion" z:Assembly="App_Code.vrfx0qpp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null" xmlns="http://schemas.datacontract.org/2004/07/LinqLayer" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:z="http://schemas.microsoft.com/2003/10/Serialization/"><ItemUOMConversionID>-1</ItemUOMConversionID><ItemUOMConversionGUID>46841a4b-5a5b-4093-87f9-79721b87773a</ItemUOMConversionGUID><ItemID>1</ItemID><UOMCode z:Id="2">TR</UOMCode><Qty>11</Qty><RecordStatus>65</RecordStatus><CreatedBy>14</CreatedBy><CreatedDate>2009-05-10T11:12:44.0283-04:00</CreatedDate><LastModifiedBy i:nil="true"/><LastModifiedDate i:nil="true"/><Version i:nil="true" xmlns:a="http://schemas.datacontract.org/2004/07/System.Data.Linq"/></ItemUOMConversion>



    the change set looks fine:


    -  DA.db.GetChangeSet() {Inserts: 1, Deletes: 0, Updates: 0} System.Data.Linq.ChangeSet
    +  Deletes Count = 0 System.Collections.Generic.IList<object> {System.Collections.ObjectModel.ReadOnlyCollection<object>}
    -  Inserts Count = 1 System.Collections.Generic.IList<object> {System.Collections.ObjectModel.ReadOnlyCollection<object>}
    -  [0] {LinqLayer.ItemUOMConversion} object {LinqLayer.ItemUOMConversion}
      _CreatedBy 14 int
    +  _CreatedDate {5/10/2009 11:12:44 AM} System.DateTime
    +  _Item {System.Data.Linq.EntityRef<LinqLayer.Item>} System.Data.Linq.EntityRef<LinqLayer.Item>
      _ItemID 1 int
    +  _ItemUOMConversionGUID {46841a4b-5a5b-4093-87f9-79721b87773a} System.Guid
      _ItemUOMConversionID -1 int
      _LastModifiedBy null int?
      _LastModifiedDate null System.DateTime?
      _Qty 11 int
      _RecordStatus 65 'A' char
    +  _UOM {System.Data.Linq.EntityRef<LinqLayer.UOM>} System.Data.Linq.EntityRef<LinqLayer.UOM>
      _UOMCode "TR" string
      _Version null System.Data.Linq.Binary
      CreatedBy 14 int
    +  CreatedDate {5/10/2009 11:12:44 AM} System.DateTime
      Identity -1 int
    +  Item {LinqLayer.Item} LinqLayer.Item
      ItemID 1 int
    +  ItemUOMConversionGUID {46841a4b-5a5b-4093-87f9-79721b87773a} System.Guid
      ItemUOMConversionID -1 int
      LastModifiedBy null int?
      LastModifiedDate null System.DateTime?
      PrimaryKey -1 object {int}
      PropertyChanged null System.ComponentModel.PropertyChangedEventHandler
    +  PropertyChanging {Method = {Void OnPropertyChanging(System.Object, System.ComponentModel.PropertyChangingEventArgs)}} System.ComponentModel.PropertyChangingEventHandler
      Qty 11 int
      RecordStatus 65 'A' char
    +  RowGuid {46841a4b-5a5b-4093-87f9-79721b87773a} System.Guid
    +  UOM {LinqLayer.UOM} LinqLayer.UOM
      UOMCode "TR" string
      Version null System.Data.Linq.Binary
    +  Static members  
    +  Raw View  
    +  Updates Count = 0 System.Collections.Generic.IList<object> {System.Collections.ObjectModel.ReadOnlyCollection<object>}
    +  Non-Public members  
    Sunday, May 10, 2009 3:17 PM
  • Take a look at the associations to/from the table involved and ensure they're pointing in the right direction.
    Kristofer - Huagati Systems Co., Ltd. - www.huagati.com - Cool tools for Linq-to-SQL and Entity Framework: www.huagati.com/dbmltools
    Sunday, May 10, 2009 3:22 PM
    Answerer
  • look fine, both are forien key relationships to primary keys on other tables.
    Sunday, May 10, 2009 3:41 PM
  • Can you send me the solution and the schema of the database you're trying it against so I can help find out what the problem is? If that's not possible, what about a smaller solution designed specifically to reproduce the exception? You can send it to me at davidewi --AT-- microsoft --DOT--- com
    Sunday, May 10, 2009 4:28 PM
    Answerer
  • I was setting the the foriegn entity properties not the foriegn key fields, looks the same .. and even works when the entity being saved has no parent entity. however in this case it was a child table and suddenly the pattern I used no longer worked.

    • Marked as answer by johntgold Sunday, May 10, 2009 4:34 PM
    Sunday, May 10, 2009 4:34 PM
  • I'm glad you figured out a workaround, but I'd still appreciate if you can send me something that can reproduce the problem so we can determine if it is a legitimate bug.

    Thanks,
    David
    Sunday, May 10, 2009 5:02 PM
    Answerer