Problem with Doc.LayerActivate event

when i add an eventhandler to the document on layer activate to show custom properties from layer in a dockerUi, after some activation of layer,  the event stop to work