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.

Latest Posts

Forum statistics

Threads
112,323
Messages
591,896
Members
165,474
Latest member
costionofrei