OpenOrder Object reference not set to an instance of an obje

Discussions related to custom development with Select.
Post Reply
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

OpenOrder Object reference not set to an instance of an obje

Post by cbentley »

I am able to open hundreds of orders monthly and perform updates. Recently, I have a problem opening a some orders. When the OpenOrder method is called, I get an exception from within the API "Object Reference not set to an instance of an object". The below code is how I open orders. And below that is the stack trace of the exception. I use API version 4.0. Hopefully this has not been posted somewhere already - I did not see it.

Thank you, Chris.

SPSelectService svc = new SPSelectService();
SelectServer ss = null;
IOrderStore os = null;
IOrder order = null;
try
{
System.Net.NetworkCredential creds = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["SPSAccount"], ConfigurationManager.AppSettings["SPSPassword"], ConfigurationManager.AppSettings["SPSDomain"]);
svc.Connect(creds);
ss = svc.SelectServer;
os = ss.GetService<IOrderStore>();
IOrderInfo oi = os.Orders.Where(t => t.Number == OrderNumber).FirstOrDefault();
if (oi != null)
{
SPSelectService SPService = new SPSelectService();\
order = os.OpenOrder(oi); <<< EXCEPTION HERE


at OriginationChargeDetailCharge.<CTX>0A47.<ValueImpl>25240(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at OriginationChargeDetailCharge.<CTX>0A47.<Value>25240(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFPercentChargeCalculation.get_Percent()
at OriginationChargeDetailCharge.<CTX>0A46.<ValueImpl>25146(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at OriginationChargeDetailCharge.<CTX>0A46.<Value>25146(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFPercentChargeCalculation.get_Amount()
at CDFDetailCharge.<ValueImpl>BuyerPaidAtClosing(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>BuyerPaidAtClosing(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_BuyerPaidAtClosing()
at CDFDetailCharge.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_Amount()
at CDFCharge.<ValueImpl>Source(ICDFChargeSource& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFCharge.<Value>Source(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.<ValueImpl>Charges()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>Charges(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at OriginationChargeDetailLine.get_Charges()
at CDFDetailLine.<ValueImpl>SellerPaidAtClosing(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailLine.<Value>SellerPaidAtClosing(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailLine.get_SellerPaidAtClosing()
at CDFSellerProceeds.<CTX>00DB.<PID>Func00DC(CDFDetailLine l)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Enumerable.Sum(IEnumerable`1 source)
at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector)
at CDFSellerProceeds.<ValueImpl>SendToAmount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFSellerProceeds.<Value>SendToAmount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFSellerProceeds.get_SendToAmount()
at CDFSellerProceeds.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFSellerProceeds.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFSellerProceeds.<ValueImpl>SendCharge(Boolean& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFSellerProceeds.<Value>SendCharge(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFSellerProceeds.get_SendCharge()
at CDFLine.<CTX>01E7.<PID>Func01E8(ICDFChargeSource p)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at SoftPro.ClientModel.Collections.CollectionExtensions.MergeWith[T](IList`1 list, IEnumerable`1 other)
at CDFLine.<ValueImpl>AllSourcesForMe()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>AllSourcesForMe(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_AllSourcesForMe()
at CDFLine.<ValueImpl>PendingSources()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>PendingSources(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_PendingSources()
at CDFCharge.<ValueImpl>Source(ICDFChargeSource& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFCharge.<Value>Source(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.<ValueImpl>CostPaidMethod(CostPaidMethod& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>CostPaidMethod(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_CostPaidMethod()
at CDFDetailCharge.<ValueImpl>BuyerPaidAtClosing(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>BuyerPaidAtClosing(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_BuyerPaidAtClosing()
at CDFDetailCharge.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_Amount()
at PrepaidDetailCharge.<ValueImpl>SendCharge(Boolean& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at PrepaidDetailCharge.<Value>SendCharge(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at PrepaidDetailCharge.get_SendCharge()
at CDFLine.<CTX>01E7.<PID>Func01E8(ICDFChargeSource p)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at SoftPro.ClientModel.Collections.CollectionExtensions.MergeWith[T](IList`1 list, IEnumerable`1 other)
at CDFLine.<ValueImpl>AllSourcesForMe()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>AllSourcesForMe(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_AllSourcesForMe()
at CDFLine.<ValueImpl>PendingSources()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>PendingSources(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_PendingSources()
at CDFCharge.<ValueImpl>Source(ICDFChargeSource& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFCharge.<Value>Source(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.<ValueImpl>CostPaidMethod(CostPaidMethod& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>CostPaidMethod(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_CostPaidMethod()
at CDFDetailCharge.<ValueImpl>BuyerPaidAtClosing(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>BuyerPaidAtClosing(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_BuyerPaidAtClosing()
at CDFDetailCharge.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_Amount()
at PrepaidDetailCharge.<ValueImpl>SendCharge(Boolean& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at PrepaidDetailCharge.<Value>SendCharge(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at PrepaidDetailCharge.get_SendCharge()
at CDFLine.<CTX>01E7.<PID>Func01E8(ICDFChargeSource p)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at SoftPro.ClientModel.Collections.CollectionExtensions.MergeWith[T](IList`1 list, IEnumerable`1 other)
at CDFLine.<ValueImpl>AllSourcesForMe()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>AllSourcesForMe(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_AllSourcesForMe()
at CDFLine.<ValueImpl>PendingSources()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDFLine.<Value>PendingSources(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFLine.get_PendingSources()
at CDFCharge.<ValueImpl>Source(ICDFChargeSource& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFCharge.<Value>Source(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.<ValueImpl>CostPaidMethod(CostPaidMethod& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>CostPaidMethod(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_CostPaidMethod()
at CDFDetailCharge.<ValueImpl>BuyerPaidAtClosing(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>BuyerPaidAtClosing(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_BuyerPaidAtClosing()
at CDFDetailCharge.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at CDFDetailCharge.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at CDFDetailCharge.get_Amount()
at PrepaidDetailCharge.<ValueImpl>SendCharge(Boolean& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at PrepaidDetailCharge.<Value>SendCharge(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at PrepaidDetailCharge.get_SendCharge()
at CDF.<CTX>00CB.<PID>Func00CC(ICDFChargeSource p)
at System.Linq.Enumerable.WhereEnumerableIterator`1.MoveNext()
at CDF.<ValueImpl>Lines()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at CDF.<Value>Lines(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at DueFromBuyerSummarySection.<ValueImpl>Lines()
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule(IField field, Rule rule)
at DueFromBuyerSummarySection.<Value>Lines(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at DueFromBuyerSummarySection.<ValueImpl>Total(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at DueFromBuyerSummarySection.<Value>Total(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.Field`1.get_Value()
at DueFromBuyerSummarySection.get_Total()
at BuyerCashToCloseSummaryCharge.<ValueImpl>Amount(Decimal& )
at SoftPro.EntityModel.Reflection.RuleHelper.RunValueRule[T](IField`1 field, Rule`1 rule)
at BuyerCashToCloseSummaryCharge.<Value>Amount(Object )
at SoftPro.EntityModel.RuleInstance.Run()
at SoftPro.EntityModel.EntityExecutionContext.RunRules()
at SoftPro.EntityModel.EntityExecutionContext.Dispose(Boolean completed)
at SoftPro.EntityModel.EntityExecutionContext.Scope.Dispose()
at SoftPro.EntityModel.EntityRuntime.Deserialize(Stream stream, Boolean readOnly)
at SoftPro.EntityModel.EntityRuntime.Load(Stream stream, SerializationFormat format, Boolean readOnly)
at SoftPro.OrderTracking.Client.Orders.OrderStoreProvider.Load(MemoryStream memory, OrderEditMode mode)
at SoftPro.OrderTracking.Client.Orders.OrderStore.OpenOrder(OrderIdentifier id, OrderEditMode mode)
at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.OpenOrder(IOrderInfo orderInfo, OrderEditMode mode)
at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.OpenOrder(IOrderInfo orderInfo, Boolean readOnly)
at SoftPro.OrderTracking.Client.Orders.OrderStore.SoftPro.OrderTracking.Client.Orders.IOrderStore.OpenOrder(IOrderInfo orderInfo)
at ACLAW.SoftProWindowsService.TitleOrderJob.UpdateSPSOrderTitleOrdered(String OrderNumber, String ConfCode, String UserFullName, StringBuilder Debug) in c:\cbentley\Projects\SoftProSelect\ACLAW.SoftProWindowsService\TitleOrderJob.cs:line 181
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: OpenOrder Object reference not set to an instance of an

Post by BobRichards »

I'm afraid I need a little more information. Does this fail often? What is the function of "SPSelectService" and why do you need it the second time since you authenticated to Select on the first instance?
Bob Richards, Senior Software Developer, SoftPro
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Re: OpenOrder Object reference not set to an instance of an

Post by cbentley »

Hi Bob,
SPSelectService is a utility class with convenience functions. You are right, I don't need it a second time. The second instance can be replaced with the first.

This problem started 12/10/15. Since 12/10/15, this section of code has opened and updated 1133 orders and failed on 25. This has been in use since early 2015 without modification, save our upgrade to 4.0 earlier in 2015. If I attempt to reprocess any of these 25 orders, I will get the same error at the OpenOrder method. It seems to be dependent on some data or attribute of the order.

Thank you for your assistance.
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: OpenOrder Object reference not set to an instance of an

Post by BobRichards »

Does it happen if you manually open the failing orders and perform the same operations? (Assuming you can perform the same operations, of course.)
Bob Richards, Senior Software Developer, SoftPro
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Re: OpenOrder Object reference not set to an instance of an

Post by cbentley »

I can open the order in the SPS client with no problem.
John Morris
Posts: 411
Joined: Thu Sep 11, 2008 11:35 am
Location: Raleigh, NC, USA
Contact:

Re: OpenOrder Object reference not set to an instance of an

Post by John Morris »

Are you using the same profile in the GUI as you are in the API code?
John Morris
Sr. Software Architect
SoftPro
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Re: OpenOrder Object reference not set to an instance of an

Post by cbentley »

Yes, same credentials.
cbentley
Posts: 13
Joined: Tue Nov 11, 2014 3:08 pm

Re: OpenOrder Object reference not set to an instance of an

Post by cbentley »

Is there anything I can try or information I can provide that may help? I continue to see these errors a few times per week. Thanks.
BobRichards
Posts: 1377
Joined: Wed Jan 15, 2014 3:50 pm
Location: Raleigh, NC
Contact:

Re: OpenOrder Object reference not set to an instance of an

Post by BobRichards »

Unfortunately it is hard to help much since you are using your SPSelectService class. I am curious why you authenticate with one instance of this class and then process the order with another instance of this class that has not authenticated. This could be the reason for the unexpected behavior. Even so, why do you need the second instance?
Bob Richards, Senior Software Developer, SoftPro
ckootg
Posts: 122
Joined: Fri Jan 06, 2012 6:10 pm

Re: OpenOrder Object reference not set to an instance of an

Post by ckootg »

Hi Chris,

I believe you are running into the same problem we did. viewtopic.php?f=6&t=863

If so, it is fixed in version 4.0.4.4 (4.0.30302.1074)
Post Reply