1

The article guides Azure WorkerRole OnStop handling; https://azure.microsoft.com/en-us/blog/the-right-way-to-handle-azure-onstop-events/

In above link, it does not call base.OnStop(); at the last line. But other code examples [1], [2], [3] have base call at the very last line.

Should I have to put this code?

Community
  • 1
  • 1
Youngjae
  • 24,352
  • 18
  • 113
  • 198
  • It's not in the documentation on [MSDN](https://msdn.microsoft.com/en-us/library/microsoft.windowsazure.serviceruntime.roleentrypoint.onstop.aspx) either. Did you try it and did it work? – Mark C. Aug 03 '16 at 02:41
  • @MarkC. // I didn't try without `base` statement yet. – Youngjae Aug 03 '16 at 02:47

1 Answers1

0

The base class is abstract

public abstract class RoleEntryPoint

and the OnStop method is a virtual member

public virtual void OnStop()

I think the OnStop member does nothing, in the same way that the virtual method OnStop have no body definition in the ServiceBase class used to create Windows Services

Why call base.OnStop() when Windows Service is stopped?

Also to mention that if they create that member as abstract they will force you to implement it in the derived class, even if you have nothing to include there.

So my 2 cent's will be that is not necessary to call base.OnStop(), just if you want to add extra code for the OnStop event.

Community
  • 1
  • 1
MrVoid
  • 709
  • 5
  • 19