I had a mistake, defined in a type "parent" as a Node and in initialization parameter "parent" as TreeNode (my class)
When asigning them : TN.parent = parent I got error in release mode but not in debug. It worked like this in debug but not in release.