The reason this is not working is because you cannot assign variables of different types in expressions (your second step). For example, if you had Locals.X that was a number, and Locals.Y that was a String, you couldn't convert the type of X to Y by assignment. I would expect this step to generate an error since you are doing something that cannot really be done. We will have to look at that problem to determine why that is happening.
However, if you want to make a copy of an object, you can always clone it. I replaced your second step's statement with the following:
ThisContext.Locals.SetPropertyObject("variant2", 0, Locals.variant.Clone("", 0)) and now it works.
Allen P.
NI