• V20: 3CX Re-engineered. Get V20 for increased security, better call management, a new admin console and Windows softphone. Learn More.

Plugin disposal

Status
Not open for further replies.

Steve G.

Joined
Aug 16, 2018
Messages
10
Reaction score
0
Hi,

I'm trying to cleanup when the main 3cx Windows Phone is exited.
I found the Attribute [CRMPluginDispose] and made the Plugin implementing IDisposable, but I have Trouble to get the Plugin notified when the main app closes.

How is main app notifying its Plugins about a shutdown?

Best regards

Steve
 
Hello @Steve G.

You don't need to implement IDisposable. You just add the attribute [CRMPluginDispose] to the method you want to be called on dispose.

Kind regards.
 
  • Like
Reactions: VoIPTools
Hi @edossantos,

i tried that and it did not succeed. Also a breakpoint at this method does not halt, nor the log entry is written.

Code:
        [CRMPluginDispose]
        public void Dispose()
        {
            ToLog("Disposing Plugin");
        }

Plugin class signature:

Code:
 [CRMPluginLoader]
 public class W3cxPlugin : AbsCallNotifier{

        [CRMPluginInitializer]
        public static void Loader(IMyPhoneCallHandler callHandler){..}
}

Any idea what is missing?

Best regards,

Steve
 
Hello Steve,

That should work...

Is the Dispose method inside the class W3cxPlugin?

Also, you can try using a finalizer for the class:
Code:
~W3cxPlugin()
{
}

However, the finalizer might not be invoked at all by the .NET framework in some cases...

Kind regards.
 
Hello @Steve G.

You don't need to implement IDisposable. You just add the attribute [CRMPluginDispose] to the method you want to be called on dispose.

Kind regards.
Hello Steve,

That should work...

Is the Dispose method inside the class W3cxPlugin?

Also, you can try using a finalizer for the class:
Code:
~W3cxPlugin()
{
}

However, the finalizer might not be invoked at all by the .NET framework in some cases...

Kind regards.

yes it is inside but still it does not work.

However using the finalizer as suggested works fine.
We keep track on the Framework version and will retest this on Version change, so consider this solved.

Thank you'!
 
Status
Not open for further replies.

Getting Started - Admin

Latest Posts

Forum statistics

Threads
141,631
Messages
748,959
Members
144,746
Latest member
gamingpro2131
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.