Don't DataRow instances have references to other objects? For example, the RowError property is a string; the Table property references the owning the DataTable. There are likely private fields and/or properties that are also references.
Isn't there a way to debug into the InsertRow method and see exactly what's going on? At 03:28 PM 6/20/2006, Shawn Wildermuth wrote >None of the culprits I was expecting to see are in the stack trace : ( > >I would open an incident with MS on this as looks like a bug to me. If it >were a data problem it should return a different sort of error (e.g. "Unable >to enable constraints"). > >Wish I had better news... The only thing that could be throwing that is if >a this pointer were null which is very very nasty. > >Thanks, > >Shawn Wildermuth >http://adoguy.com >C# MVP, MCSD.NET, Author and Speaker > >-----Original Message----- >From: Discussion of advanced .NET topics. >[mailto:[EMAIL PROTECTED] On Behalf Of Franklin Gray >Sent: Tuesday, June 20, 2006 3:17 PM >To: [email protected] >Subject: Re: [ADVANCED-DOTNET] Bug with adding datarow to table > >Sorry it took so long. It is hard to get my tester (my boss) to give me >stuff. I'm sure you know what I mean :) > >Once again...the datatable is a valid object and so in the datarow. This is >the actual code. Datatable declared without events but it does have views >of it that are bound to grids (two views, each to a grid.). > > > Public Function CreateNewDetailRec(ByVal CSId As Double, ByVal IS_ISO As >Boolean) As DataRow > Dim NR As DataRow > NR = Me.DataDetail.NewRow > NR("CONTROL_SEQ_ID") = CSId > NR("ISOL_OR_NORM") = Math.Abs(CType(Not IS_ISO, Int16)) > NR("CONTROL_SEQ_STEP") = Me.DataDetail.Rows.Count + 1 > > Me.DataDetail.Rows.Add(NR) 'this line errors > > Return NR > End Function > > >System.NullReferenceException: Object reference not set to an instance of an >object. > at System.Data.DataTable.InsertRow(DataRow row, Int32 proposedID, Int32 >pos) > at System.Data.DataTable.AddRow(DataRow row, Int32 proposedID) > at System.Data.DataRowCollection.Add(DataRow row) > at MiddleTier.ControlSeq.CreateNewDetailRec(Double CSId, Boolean >IS_ISO) in C:\Data\Evergreen\Code\MiddleTier\ControlSeq.vb:line 275 > at RELIEVE.CSEditorUserControl.AddNewIsolStep() in >C:\Data\Evergreen\Code\RELIEVE\CSEditorUserControl.vb:line 4303 > > > > > > >Message from Shawn Wildermuth ><[EMAIL PROTECTED]>@DISCUSS.DEVELOP.COM received on 06/19/2006 >05:34 PM > >06/19/2006 05:34 PM > > > >Shawn Wildermuth <[EMAIL PROTECTED]>@DISCUSS.DEVELOP.COM > >Please respond to "Discussion of advanced .NET topics." ><[email protected]> >Sent by "Discussion of advanced .NET topics." ><[email protected]> > > > > To: [email protected] > cc: > Subject: Re: [ADVANCED-DOTNET] Bug with adding datarow to >table > >Can you post a stacktrace (including the framework's stack)? That might >give us a clue. It might be that you need to stop some databinding activity >during the add or something...or you have an errant DataView somewhere... > > > >Thanks, > >Shawn Wildermuth >http://adoguy.com >C# MVP, MCSD.NET, Author and Speaker > > > > >-----Original Message----- >From: Discussion of advanced .NET topics. >[mailto:[EMAIL PROTECTED] On Behalf Of Franklin Gray >Sent: Monday, June 19, 2006 2:53 PM >To: [email protected] >Subject: [ADVANCED-DOTNET] Bug with adding datarow to table > >This is a very strange bug. The line (Table.rows.add(NR)) to add a >datarow >to a datatable throws an objective reference error, BUT...all object's >values can be viewed in the quickview window. To add to this, this error >only happens on 2 of 4 developement machines when we execute the exact >same >steps. All machines seem to have the same framework, same code, same 3rd >party assemblies. > >Any ideas? J. Merrill / Analytical Software Corp =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com
