WinForms utility application issue  Topic is solved

Discussions relating to Jiwa 7 plugin development, and the Jiwa 7 API.

WinForms utility application issue

Postby neil.interactit » Mon Feb 25, 2019 1:35 pm

Hi guys,

I have an external WinForms utility application that grabs work dockets from another system and creates invoices in Jiwa. The app references required Jiwa DLLs and then any Jiwa interaction within the app is via your business logic (eg. var debtor = new JiwaFinancials.Jiwa.JiwaApplication.Entities.Debtor.Debtor(); debtor.ReadRecord(debtorId); etc). This is working well.

The client wants some changes. Even though the compiled exe continued to work when they upgraded to v175 , I am now unable to debug in the development environment.

I am getting:
Code: Select all
System.NullReferenceException
  HResult=0x80004003
  Message=Object reference not set to an instance of an object.
  Source=JiwaApplication
  StackTrace:
   at JiwaFinancials.Jiwa.JiwaApplication.Manager.HandleApplicationManagerPluginExceptions()
   at JiwaFinancials.Jiwa.JiwaApplication.Manager.Logon(String ServerName, String DatabaseName, AuthenticationModes AuthenticationMode, String JiwaUserName, String JiwaPassword)
   at JobManager.JiwaService.GetJiwaUser() in C:\Users\neil\OneDrive\Documents\Projects\JobManagerOnly\JobManager\JiwaService.cs:line 73


Which is caused by the line:
Code: Select all
Manager.Instance.Logon(Properties.Settings.Default.Servername, Properties.Settings.Default.Database, database.AuthenticationModes.JiwaAuthentication, Properties.Settings.Default.Username, password);


I have confirmed all the passed parameters are not null, and neither is Manager.Instance, which appears in debug as:
Code: Select all
Manager.Instance
{JiwaFinancials.Jiwa.JiwaApplication.Manager}
    AppStylistRuntime: {Infragistics.Win.AppStyling.Runtime.AppStylistRuntime}
    ApplicationStylePath: ""
    ApplicationStyleProperties: {JiwaFinancials.Jiwa.JiwaApplication.Controls.StyleProperties}
    BusinessLogicCollection: {JiwaFinancials.Jiwa.JiwaApplication.BusinessLogic.BusinessLogicCollection}
    BusinessLogicFactory: {JiwaFinancials.Jiwa.JiwaApplication.BusinessLogicFactory}
    CommandLineArgs: null
    CompileDebugSymbols: true
    ConnectionProfile: {JiwaFinancials.Jiwa.JiwaApplication.ConnectionManager.ConnectionProfile}
    CrystalReportsProviderName: "SQLNCLI11"
    CurrentLogicalWarehouse: {Letitia Street / Hobart}
    CurrentLongRunningTask: null
    Database: {JiwaFinancials.Jiwa.JiwaODBC.database}
    DialogFactory: {JiwaFinancials.Jiwa.JiwaApplication.DialogFactory}
    FormFactory: {JiwaFinancials.Jiwa.JiwaApplication.FormFactory}
    Forms: {JiwaFinancials.Jiwa.JiwaApplication.Forms.FormCollection}
    GeneralLedgerConfiguration: {JiwaFinancials.Jiwa.JiwaApplication.GeneralLedger.Configuration}
    JLib: {JiwaFinancials.Jiwa.JiwaLib.StdFunctions}
    LicenceSQLConnection: {System.Data.SqlClient.SqlConnection}
    LicenceSQLTransaction: {System.Data.SqlClient.SqlTransaction}
    LocalCurrency: {JiwaFinancials.Jiwa.JiwaApplication.Entities.ForeignExchange.Currency}
    LongRunningTasks: {JiwaFinancials.Jiwa.JiwaApplication.LongRunningTasks}
    MDIParentForm: null
    Menu: {JiwaFinancials.Jiwa.JiwaApplication.Menu.Menu}
    PhysicalWarehouseCollection: Count = 1
    PluginCollection: {JiwaFinancials.Jiwa.JiwaApplication.Plugin.PluginCollection}
    PluginFolder: "C:\\ProgramData\\\\JobManager\\1.0.0\\neil\\_localdb_MSSQLLocalDB\\InteractIT_V7\\Plugins\\admin"
    RecentItemCollection: {JiwaFinancials.Jiwa.JiwaApplication.RecentlyViewed.RecentItemCollection}
    ReportsFolder: "C:\\ProgramData\\\\JobManager\\1.0.0\\neil\\_localdb_MSSQLLocalDB\\InteractIT_V7\\Reports"
    Search: {JiwaFinancials.Jiwa.JiwaApplication.JiwaSearch.clsSearch}
    Staff: {JiwaFinancials.Jiwa.JiwaApplication.JiwaStaff.clsStaff}
    SysDateTime: {25/02/2019 11:35:55 AM}
    SysLongDate: " ddd dd mmm yyyy hh:nn am/pm"
    SysShortDateCentury: "dd/MM/yyyy"
    TaxRates: {JiwaFinancials.Jiwa.JiwaApplication.JiwaTaxSystemRates.TaxRates}
    UsedLicences: Count = 1


I recall a similar issue with a previous Jiwa upgrade, and I'm thinking the fix is possibly unrelated to the obvious debug indication - maybe a framework version issue? - but I can't get a handle on it.

Can you assist?

Cheers,
Neil
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: WinForms utility application issue  Topic is solved

Postby SBarnes » Mon Feb 25, 2019 4:15 pm

Do you have ALL jiwa dlls in the directory with the executable I have seen it fail at login due to a plugin that needed other Jiwa DLLs that were not related to the functionality I was using and as soon as I put all the DLLs in directory the problem went away?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: WinForms utility application issue

Postby neil.interactit » Tue Feb 26, 2019 8:43 am

That's done it! Thanks!

For others and future reference ... the project references 4 Jiwa DLLs ... JiwaApplication, JiwaODBC, JiwaSales and JiwaServiceManager ... and if I delete the bin/obj directories and rerun, I can see 89 Jiwa DLLs created in the bin folder ... so it looked like it was getting all "child" DLLs it needed. However, manually copying the other 207 DLLs into the bin folder did the trick.

Thanks again.
neil.interactit
Kohai
Kohai
 
Posts: 232
Joined: Wed Dec 03, 2014 2:36 pm
Topics Solved: 6

Re: WinForms utility application issue

Postby Mike.Sheen » Tue Feb 26, 2019 9:51 am

Also note that if you don't want to have a copy of the assemblies in your application folder - if Jiwa is installed already you can just add a handler for AppDomain.CurrentDomain.AssemblyResolve and in there direct .NET to go load the Jiwa assembly from a specific folder location.

This is discussed over in this forum thread: Late Binding or its Equivalent.
Mike Sheen
Chief Software Engineer
Jiwa Financials

If I do answer your question to your satisfaction, please mark it as the post solving the topic so others with the same issue can readily identify the solution
User avatar
Mike.Sheen
Overflow Error
Overflow Error
 
Posts: 2583
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 807

Re: WinForms utility application issue

Postby SBarnes » Tue Feb 26, 2019 9:54 am

Hi Mike,

Is there a reason why the DLLs are not registered in GAC?
Regards
Stuart Barnes
SBarnes
Shihan
Shihan
 
Posts: 1696
Joined: Fri Aug 15, 2008 3:27 pm
Topics Solved: 191

Re: WinForms utility application issue

Postby Scott.Pearce » Thu Feb 28, 2019 11:02 am

General MS guidelines state not to install anything into the GAC if you don't really need to. Keeping things local also makes the deployment much simpler.

https://docs.microsoft.com/en-us/dotnet ... nd-the-gac
Scott Pearce
Senior Analyst/Programmer
Jiwa Financials
User avatar
Scott.Pearce
Senpai
Senpai
 
Posts: 765
Joined: Tue Feb 12, 2008 11:27 am
Location: New South Wales, Australia
Topics Solved: 230


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 2 guests