cancel
Showing results for 
Search instead for 
Did you mean: 

stopping add-on does not release license

Former Member
0 Kudos

Hello,

I have built an add-on using UI only and I am currently testing it with an add-on identifier of development type.

When stopping this add-on from the add-on manager on business one client, the license used is not released.

Status shown is "Disconnected" and the process gets killed successfully (in task manager). If I restart the add-on, no problem, a new process appears (in task manager) and status switches back to "Connected"

Each time I repeat the operation, the number of available license goes down by one, until I reach 0 and get the system message "Add-on does not have a license".

Do you have any idea?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I haven't been doing this long so I don't know how licenses work internally but...

What if you set your SAPbouiCOM.Application object to null (or nothing in VB) before terminating your process?

Former Member
0 Kudos

Hi Bill,

This is already the case. As I am programming with VB.NET, I even call the garbage collector manually to delete this object from memory.

Here is the code used:

Option Strict On
Imports SAPbouiCOM

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'This is the class for the entity object which manages the termination
'of the add-on
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Public Class ShutdownManager

    Public Sub New()

    End Sub

    Public Sub Close()
        CleanApplication()
        Windows.Forms.Application.Exit()
    End Sub

    Private Sub CleanApplication()
        If Not Module1.oApplication Is Nothing Then
            Dim iGen As Integer = GC.GetGeneration(Module1.oApplication)
            Module1.oApplication = Nothing
            GC.Collect(iGen)
        End If
    End Sub

End Class

I also start a new thread on the Close() function in order to avoid the program to terminate before the UIServer gets notification.

Any idea?

Former Member
0 Kudos

Cyril,

I use something like this instead of GC


System.Runtime.InteropServices.Marshal.ReleaseComObject(Module1.oApplication);
Module1.oApplication = Nothing;

Note that it's set to null after the release. I don't know if that would impact your problem though.

Since your shutdown is in a different class than your application, and it seems to be instantiated rather than static could the problem be related to this? I've always terminated the addon within the class itself. I don't know how to make static classes in VB since I use C# but basically you pass everything as a parameter to the subroutines and never instantiate the class; i.e. there's no "ShutdownManager sm = new ShutdownManager()". Instead you'd do something like

"ShutDownManager.Close(Module1.oApplication)" and there'd be no "New" subroutine. However, I don't know how you'd do this in VB.

At any rate, perhaps the all of the resources for the addon class itself aren't being freed.

I hope I was able to give you some ideas to try.

Good Luck!

Bill

Answers (0)