StrataFrame Forum

StackOverflowException from BusinessLayerLinkManager

http://forum.strataframe.net/Topic7147.aspx

By Chan - 2/23/2007

Hi,

I have code to create BusinessLayerLinkManager (BLLM) and configure it programmatically. I hit error StackOverflow if I run my code more than once even though I have called BLLM.Displose(). Below is partial of the program call stack.

Any ideas?

System.StackOverflowException was unhandled

> MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True, Boolean IsSharedTable = False) Line 2034 + 0x16 bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True) Line 2008 + 0x14 bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}) Line 2004 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Clear() Line 5812 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.FillTable2() Line 2158 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.HandleTableLinkCurrentDataTableRefilled() Line 1106 + 0xa bytes Basic
  [External Code]
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.raise_CurrentDataTableRefilled() Line 824 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.OnCurrentDataTableRefilled() Line 835 + 0xa bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True, Boolean IsSharedTable = False) Line 2064 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True) Line 2008 + 0x14 bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}) Line 2004 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Clear() Line 5812 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.FillTableLink(Boolean CheckTable1 = False, Boolean CheckTable2 = True) Line 2216 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.HandleTable2CurrentDataTableRefilled() Line 919 + 0x12 bytes Basic
  [External Code]
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.raise_CurrentDataTableRefilled() Line 824 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.OnCurrentDataTableRefilled() Line 835 + 0xa bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True, Boolean IsSharedTable = False) Line 2064 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}, Boolean AcceptChanges = True) Line 2008 + 0x14 bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.ChangeCurrentDataTable(System.Data.DataTable NewTable = {System.Data.DataTable}) Line 2004 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayer.Clear() Line 5812 + 0xb bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.FillTable2() Line 2158 + 0xe bytes Basic
  MicroFour StrataFrame Business.dll!MicroFour.StrataFrame.Business.BusinessLayerLinkManager.HandleTableLinkCurrentDataTableRefilled() Line 1106 + 0xa bytes Basic
By StrataFrame Team - 2/26/2007

I'm not able to reproduce this... can I have your code snippet where you create the BusinessLayerLinkManager programmatically?
By Chan - 2/26/2007

Hi,

Here it is

_BusinessLayerLinkManager = new BusinessLayerLinkManager();
SetupPurchaseInvoiceAndTransferLink();

_PurchaseInvoicesBO.FillByPrimaryKey(PurchaseInvoiceID);

_BusinessLayerLinkManager.Dispose();

public void SetupPurchaseInvoiceAndTransferLink()
{
_BusinessLayerLinkManager.Table1 = _PurchaseInvoicesBO;
_BusinessLayerLinkManager.Table2 = _TransfersBO;
_BusinessLayerLinkManager.TableLink = _PInvoiceTransferBO;
_BusinessLayerLinkManager.PrimaryKeyOnTable1 = _PurchaseInvoicesBO.PrimaryKeyFields;
_BusinessLayerLinkManager.PrimaryKeyOnTable2 = _TransfersBO.PrimaryKeyFields;
_BusinessLayerLinkManager.ForeignKeyToTable1 = _PurchaseInvoicesBO.PrimaryKeyFields;
_BusinessLayerLinkManager.ForeignKeyToTable2 = _TransfersBO.PrimaryKeyFields;
_BusinessLayerLinkManager.FillLinkOnTable1Fill = true;
_BusinessLayerLinkManager.FillLinkOnTable2Fill = true;
_BusinessLayerLinkManager.FilterLinkOnTable1Filter = LinkManagerFilterTypeOptions.MatchCurrentRow;
_BusinessLayerLinkManager.FilterLinkOnTable2Filter = LinkManagerFilterTypeOptions.MatchCurrentRow;
}

By StrataFrame Team - 2/27/2007

When I modify and run your sample, I do not get into an infinite loop (causing the StackOverflowException).  There is a flag in the FillTable2() method that prevents the method from being called recursively.  I noticed that your stack trace has debugging symbols, did you build the source code?  If you did, then can you put a break point in the BusinessLayerLinkManager.vb file within the HandleTableLinkCurrentDataTableRefilled() method and test the _IsInTable2Fill value... that flag should prevent the FillTable2() from being called.