Page 1 of 1

7.2.1 CreateBusinessLogic NullReferenceException

PostPosted: Tue Sep 22, 2020 12:32 pm
by neil.interactit
Hey guys,

I have an external application, implemented in an external EXE, referencing JiwaApplication,JiwaODBC,JiwaSales.

I am upgrading it from 7.175 to 7.2.1 and have run into an issue.

I upgraded:
Code: Select all
   var salesOrder = Manager.Instance.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(null);

To:
Code: Select all
   var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();
   var salesOrder = manager.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(null);

And the CreateBusinessLogic method call now generates a Object reference not set to an instance of an object error.

Once I debugged into the compiled assemblies, the Object reference not set to an instance of an object error occurs on line 57:
Code: Select all
businessLogicType.Setup();

Note that all the other Manager.Instance upgraded code (manager.Logon, manager.LogOff, etc) is all working fine.

I have tried adding an expilict reference to JiwaSalesUI, and also (per viewtopic.php?f=26&t=795) have tried:
Code: Select all
   var manager = new JiwaFinancials.Jiwa.JiwaApplication.Manager();
   var form = manager.FormFactory.CreateForm<JiwaFinancials.Jiwa.JiwaSalesUI.SalesOrder.SalesOrderEntryForm>(); // create a form to work-around DEV-6053
   var salesOrder = manager.BusinessLogicFactory.CreateBusinessLogic<SalesOrder>(form);
   salesOrder.Client = null;

Neither has helped.

Can you advise how to remedy this?

Cheers,
Neil.

Re: 7.2.1 CreateBusinessLogic NullReferenceException  Topic is solved

PostPosted: Tue Sep 22, 2020 1:31 pm
by Scott.Pearce
You need to do a .logon() after creating the manager, but before using the factory.

Re: 7.2.1 CreateBusinessLogic NullReferenceException

PostPosted: Tue Sep 22, 2020 3:54 pm
by neil.interactit
Nailed it! Many thanks Scott.