Warn On Exit V7.02  Topic is solved

Discussions relating to plugin development, and the Jiwa API.

Warn On Exit V7.02

Postby 2can2 » Fri Mar 15, 2019 1:49 pm

Hi, I have used a plugin created by Jiwa for V175 to 'Warn on Exit' and created a NEW VB Plugin in V7.02 SR2 and imported the plugin. It errors on Login with 'Object Reference not set to an instance of an object'
In Plugin maintenance it compiles with no errors. I also tried creating a New VB plugin an then copied the custom code into the new Plugin but still get the same error on Login?
Any help would be appreciated. Cheers
Attachments
Plugin KC Warn on Exit V702.xml
(30.8 KiB) Downloaded 64 times
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: Warn On Exit V7.02

Postby Mike.Sheen » Fri Mar 15, 2019 4:33 pm

Hi Doug,

There is a line of code in there:
Code: Select all
AddHandler JiwaApplication.Manager.Instance.MDIParentForm.Load, addressOf MainForm_Load


Which should be replaced with:
Code: Select all
AddHandler Plugin.Manager.MDIParentForm.Load, addressOf MainForm_Load


We talked about the changes in this article - How to convert plugins or code to be compatible with 7.00.177.00 or later.

We then brought back the change which broke the plugins in DEV-5878 - but this itself got broken again until DEV-7096 which was in 7.2 SR2.

In summary: Either install 7.2 SR2 or modify the plugin as outlined above.
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Warn On Exit V7.02

Postby 2can2 » Fri Mar 15, 2019 5:13 pm

Thanks for the quick reply and link that explains the issue. I had tried looking for the document re conversion as I had seen it before but didn't find it.
Thanks again.
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: Warn On Exit V7.02

Postby 2can2 » Tue Jun 11, 2019 2:07 pm

Hi, I am now using the Jiwa Plugin Scheduler on V7.02 SR5 and it won't start if the plugin 'Warn on Exit' is enabled. Same issue as previously trying to open Jiwa, error in Event viewer = 'Object Reference not set to an instance of an object'. I changed line 55 as per previous post which worked for the Jiwa login BUT now the issue occurs trying to start the Scheduler.
How do I get around this one? Thanks.
2can2
Frequent Contributor
Frequent Contributor
 
Posts: 171
Joined: Tue Feb 26, 2008 10:24 am
Topics Solved: 25

Re: Warn On Exit V7.02

Postby pricerc » Tue Jun 11, 2019 4:49 pm

2can2 wrote:Hi, I am now using the Jiwa Plugin Scheduler on V7.02 SR5 and it won't start if the plugin 'Warn on Exit' is enabled. Same issue as previously trying to open Jiwa, error in Event viewer = 'Object Reference not set to an instance of an object'. I changed line 55 as per previous post which worked for the Jiwa login BUT now the issue occurs trying to start the Scheduler.
How do I get around this one? Thanks.


If you're only getting a problem with the scheduler, then as a workaround, you can just wrap it in a try/catch bock that ignores the error.

e.g.
Code: Select all
   Public Sub MainForm_Load(ByVal eventSender As Object, ByVal eventArgs As System.EventArgs)
      Try
         AddHandler Plugin.Manager.MDIParentForm.Load, addressOf MainForm_Load
      Catch ex As Exception
         Debug.Print(ex.Message)
      End Try
   End Sub
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20

Re: Warn On Exit V7.02

Postby Mike.Sheen » Wed Jun 12, 2019 2:57 pm

pricerc wrote:If you're only getting a problem with the scheduler, then as a workaround, you can just wrap it in a try/catch bock that ignores the error.


Why not just check if MDIParentForm is null / Nothing before trying to add the handler? In context outside of Jiwa.exe, the MDIParentForm property of the Manager class will be null as this is the host MDI Parent form of the application.

Code: Select all
Public Sub Setup(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaApplicationManagerPlugin.Setup
   If Plugin.Manager.MDIParentForm IsNot Nothing Then
      AddHandler Plugin.Manager.MDIParentForm.Load, addressOf MainForm_Load
   End If
End Sub
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: 2444
Joined: Tue Feb 12, 2008 11:12 am
Location: Perth, Republic of Western Australia
Topics Solved: 756

Re: Warn On Exit V7.02  Topic is solved

Postby pricerc » Wed Jun 12, 2019 3:44 pm

Mike.Sheen wrote:
pricerc wrote:If you're only getting a problem with the scheduler, then as a workaround, you can just wrap it in a try/catch bock that ignores the error.


Why not just check if MDIParentForm is null / Nothing before trying to add the handler? In context outside of Jiwa.exe, the MDIParentForm property of the Manager class will be null as this is the host MDI Parent form of the application.

Code: Select all
Public Sub Setup(ByVal Plugin As JiwaApplication.Plugin.Plugin) Implements JiwaApplication.IJiwaApplicationManagerPlugin.Setup
   If Plugin.Manager.MDIParentForm IsNot Nothing Then
      AddHandler Plugin.Manager.MDIParentForm.Load, addressOf MainForm_Load
   End If
End Sub



Or that. Technically a better option, since exception handling is expensive.
/Ryan

ERP Consultant,
Advanced ERP Limited, NZ
https://aerp.co.nz
User avatar
pricerc
Senpai
Senpai
 
Posts: 504
Joined: Mon Aug 10, 2009 12:22 pm
Location: Auckland, NZ
Topics Solved: 20


Return to Technical and or Programming

Who is online

Users browsing this forum: No registered users and 6 guests

cron