The error is very easy to duplicate. I’ve included a small code example below (password is xxx'd out). I’ve simplified the code down to the point where all I do is access the order, then try to save it with no changes. In every case, there’s an error added to the ValidationMessages collection that says “object reference not set to an instance of an object”. By the way, the modifications seem to save correctly. Despite the error, if I go into the SoftPro client and look at the order, it seems to have all of the changes that I made.
I’ve verified that I can open the order in the SoftPro client with the same user and make changes and save successfully.
I’ve also included the debug info at the end of this post. Anyone have any ideas??
CODE:
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SoftPro.OrderTracking.Common;
using System.Net;
using SoftPro.Select.Client;
using SoftPro.OrderTracking.Client;
using SoftPro.Select.Common;
namespace SoftProTest
{
class Program
{
static void Main(string[] args)
{
NetworkCredential credentials = new NetworkCredential("admin", "xxxxx", SoftPro.ClientModel.Constants.ServerDomain);
SelectServer sps = new SelectServer("http://WSFRANDSEN1:8080", credentials);
//if we do not force authentication now, it will happen later (in a lazy fashion)
sps.EnsureAuthenticated();
//in order to work with Order Tracking (ie ProForm), you need to obtain the OrderTracking service object
var orderTracking = sps.GetService<OrderTracking>();
OrderQuerySpec spec = new OrderQuerySpec();
spec.BaseOrderNumber = "910-1000029-90";
using (IOrder order = orderTracking.GetOrder(spec, false))
{
if (order != null)
{
try
{
//apply the modifications
//=================================================
//...
//save it
//=================================================
ValidationMessage[] messages;
if (orderTracking.SaveOrder(order, out messages))
{
//some logic here...
}
}
finally
{
//unlock it
//=================================================
if (order != null)
{
orderTracking.CloseOrder(order);
}
}
}
}
}
}
}
Code: Select all
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftProTest.vshost.exe'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Core\3.5.0.0__b77a5c561934e089\System.Core.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml.Linq\3.5.0.0__b77a5c561934e089\System.Xml.Linq.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Data.DataSetExtensions\3.5.0.0__b77a5c561934e089\System.Data.DataSetExtensions.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll'
The thread 'vshost.NotifyLoad' (0x2508) has exited with code 0 (0x0).
The thread 'vshost.LoadReference' (0x2a64) has exited with code 0 (0x0).
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftProTest.exe', Symbols loaded.
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Select.Client.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.OrderTracking.Client.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.OrderTracking.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.ClientModel.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Select.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.IdentityModel\3.0.0.0__b77a5c561934e089\System.IdentityModel.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel\3.0.0.0__b77a5c561934e089\System.ServiceModel.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\SMDiagnostics\3.0.0.0__b77a5c561934e089\SMDiagnostics.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Runtime.Serialization\3.0.0.0__b77a5c561934e089\System.Runtime.Serialization.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.WorkflowServices\3.5.0.0__31bf3856ad364e35\System.WorkflowServices.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.ServiceModel.Web\3.5.0.0__31bf3856ad364e35\System.ServiceModel.Web.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Diagnostics.ServiceModelSink\3.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Diagnostics.ServiceModelSink.dll'
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
A first chance exception of type 'System.Configuration.ConfigurationErrorsException' occurred in System.Configuration.dll
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_MSIL\System.IdentityModel.Selectors\3.0.0.0__b77a5c561934e089\System.IdentityModel.Selectors.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.Transactions\2.0.0.0__b77a5c561934e089\System.Transactions.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Windows\assembly\GAC_32\System.EnterpriseServices\2.0.0.0__b03f5f7f11d50a3a\System.EnterpriseServices.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Security.Cache.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Common.Data.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.BusinessObjects.Base.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Administration.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Security.Classes.dll'
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'egq6t18e'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.BusinessRules.Base.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.BusinessRules.Core.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Common.Classes.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.BusinessObjects.Core.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Security.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.SPAdminManagers.Data.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.ProForm.Classes.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Documents.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.DocEngine.Common.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.SPAdminManagers.Core.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.SPAdminManagers.Base.dll'
A first chance exception of type 'System.IO.FileNotFoundException' occurred in mscorlib.dll
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'jqdu4l-p'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.CalcEngine.Functions.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.CalcEngine.Formulas.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.CalcEngine.ScheduleFunctions.dll'
SoftProTest.vshost.exe Information: 0 : Root reference acquired for Order 910-1000029-90, Purchase, settlement date 7/7/2010, received on 6/7/2010 (5f261ebc-7472-df11-91c8-005056864aea). Updated reference count = 1.
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Security.Data.dll'
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Accounting.Common.dll'
SoftProTest.vshost.exe Information: 0 : Root reference acquired for Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e). Updated reference count = 1.
SoftProTest.vshost.exe Information: 0 : Root reference released for Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e). Updated reference count = 0.
SoftProTest.vshost.exe Information: 0 : Root Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e) released from memory.
SoftProTest.vshost.exe Information: 0 : Root reference acquired for Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e). Updated reference count = 1.
SoftProTest.vshost.exe Information: 0 : Root reference acquired for Order 910-1000029-90, Purchase, settlement date 7/7/2010, received on 6/7/2010 (5f261ebc-7472-df11-91c8-005056864aea). Updated reference count = 2.
'SoftProTest.vshost.exe' (Managed (v2.0.50727)): Loaded 'C:\Users\Dennis\Desktop\SoftProTest\SoftProTest\bin\Debug\SoftPro.Select.Shell.dll'
A first chance exception of type 'System.NullReferenceException' occurred in SoftPro.BusinessObjects.Core.dll
SoftProTest.vshost.exe Information: 0 : Root reference released for Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e). Updated reference count = 0.
SoftProTest.vshost.exe Information: 0 : Root Ledger 910-1000029-90 (2dc61e45-2e73-df11-b17d-001a4ba9f37e) released from memory.
SoftProTest.vshost.exe Information: 0 : Root reference released for Order 910-1000029-90, Purchase, settlement date 7/7/2010, received on 6/7/2010 (5f261ebc-7472-df11-91c8-005056864aea). Updated reference count = 1.
SoftProTest.vshost.exe Error: 0 : System.NullReferenceException: Object reference not set to an instance of an object.
Stack Trace:
at SoftPro.BusinessObjects.Core.Ledger.TellObjectsWeCommitted()
at SoftPro.BusinessObjects.Core.Order.SaveOrderAndLedger(Boolean ignoreWarnings, ArrayList errorsAndWarnings, SqlConnection sqlConn, Engine engine, Ledger ledger)
at SoftPro.BusinessObjects.Core.Order.SaveRoot(Boolean ignoreWarnings)
at SoftPro.OrderTracking.Client.OrderTracking.SaveOrder(IOrder order, ValidationMessage[]& messages)
XML Log:
<ILExceptionData>
<Point module="SoftPro.BusinessObjects.Core.dll" classFull="SoftPro.BusinessObjects.Core.Ledger" methodName="TellObjectsWeCommitted" methodSignature="Void TellObjectsWeCommitted()" methodToken="0x6001431" ILOffset="54" />
<Point module="SoftPro.BusinessObjects.Core.dll" classFull="SoftPro.BusinessObjects.Core.Order" methodName="SaveOrderAndLedger" methodSignature="SoftPro.BusinessObjects.Core.Ledger SaveOrderAndLedger(Boolean, System.Collections.ArrayList, System.Data.SqlClient.SqlConnection, SoftPro.BusinessObjects.Base.Engine, SoftPro.BusinessObjects.Core.Ledger)" methodToken="0x6000fdd" ILOffset="295" />
<Point module="SoftPro.BusinessObjects.Core.dll" classFull="SoftPro.BusinessObjects.Core.Order" methodName="SaveRoot" methodSignature="SoftPro.BusinessObjects.Base.ValidationError[] SaveRoot(Boolean)" methodToken="0x6000fdc" ILOffset="150" />
<Point module="SoftPro.OrderTracking.Client.dll" classFull="SoftPro.OrderTracking.Client.OrderTracking" methodName="SaveOrder" methodSignature="Boolean SaveOrder(SoftPro.OrderTracking.Client.IOrder, SoftPro.Select.Common.ValidationMessage[] ByRef)" methodToken="0x6004052" ILOffset="84" />
</ILExceptionData>