Error opening orders created before SPS version upgrade. Could not load file or assembly 'SoftPro.EntityModel' ...
Posted: Wed Jan 24, 2024 9:17 am
We are receiving errors in our production environment when trying to open (via the SDK) SPS orders created before our 5/16/2021 SoftPro Select version upgrade.
Current version is 4.3.60210.119 (4.3.41)
Previous version was 4.3.60108.11 (4.3.10.1) - before 5/16/2021
We can successfully open & post payments to orders created after this 5/16/2021 date. We use the current version of the SPS SDK - 4.3.60210.119 - to post the payments to SPS.
The error we are receiving for the older orders is:
errorMessage="Could not load file or assembly 'SoftPro.EntityModel' or one of its dependencies. The system cannot find the file specified.
These orders are successfully located in the orderStore.Orders list
Please see code snippet below.
Current version is 4.3.60210.119 (4.3.41)
Previous version was 4.3.60108.11 (4.3.10.1) - before 5/16/2021
We can successfully open & post payments to orders created after this 5/16/2021 date. We use the current version of the SPS SDK - 4.3.60210.119 - to post the payments to SPS.
The error we are receiving for the older orders is:
errorMessage="Could not load file or assembly 'SoftPro.EntityModel' or one of its dependencies. The system cannot find the file specified.
These orders are successfully located in the orderStore.Orders list
- orderInfo = orderStore.Orders.Where(t => t.Number == spsOrderNumber).FirstOrDefault();
- orderStore.OpenOrder(orderInfo)
Please see code snippet below.
Code: Select all
/// <summary>
/// Given an connected SelectServer instance, open the given SPS Order
/// </summary>
/// <param name="spsOrderNumber">identifies the SPS Order</param>
/// <param name="selectServer">the connection to the active Select Server. The caller is responsible for disposing this when done with it.</param>
/// <returns></returns>
public IOrder OpenSpsOrder(string spsOrderNumber, SelectServer selectServer )
{
IOrderStore orderStore = null;
IOrderInfo orderInfo;
IOrder order = null;
// Locate the desired SPS Order....
try
{
orderStore = selectServer.GetService<IOrderStore>();
Logger.Debug($"Searching for SPS Order: {spsOrderNumber}");
orderInfo = orderStore.Orders.Where(t => t.Number == spsOrderNumber).FirstOrDefault();
if (orderInfo == null)
{
Logger.Info($"Order not found: {spsOrderNumber}");
throw new KeyNotFoundException($"Order not found: {spsOrderNumber}"); // aka NotFoundException
}
Logger.Debug($"Order Found: {spsOrderNumber}");
// Ok, the order has been located. Let's open it and return it to the caller
order = orderStore.OpenOrder(orderInfo);
Logger.Debug("Order opened...");
return order;
}
catch (Exception)
{
if (order != null)
{
try
{
Logger.Debug($"Exception encountered. Attempting to close open Order.");
orderStore?.CloseOrder(order);
Logger.Debug($"Order closed. Clean up complete.");
order.Dispose();
}
catch (Exception ex2)
{
Logger.Warn($"While cleaning up from the aforementioned Error, an attempt to close the Order failed: {ex2.Message}. {(ex2.InnerException == null ? "" : ex2.InnerException.Message)}", ex2);
}
}
throw; // we've cleaned up resources. Now let the caller know something went wrong.
}
}