Page 1 of 1

Warn On Exit V7.02

PostPosted: Fri Mar 15, 2019 1:49 pm
by 2can2
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

Re: Warn On Exit V7.02

PostPosted: Fri Mar 15, 2019 4:33 pm
by Mike.Sheen
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.

Re: Warn On Exit V7.02

PostPosted: Fri Mar 15, 2019 5:13 pm
by 2can2
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.

Re: Warn On Exit V7.02

PostPosted: Tue Jun 11, 2019 2:07 pm
by 2can2
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.

Re: Warn On Exit V7.02

PostPosted: Tue Jun 11, 2019 4:49 pm
by pricerc
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

Re: Warn On Exit V7.02

PostPosted: Wed Jun 12, 2019 2:57 pm
by Mike.Sheen
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

Re: Warn On Exit V7.02  Topic is solved

PostPosted: Wed Jun 12, 2019 3:44 pm
by pricerc
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.