Hello,
I think you will have to modify the code which generates the the second assignment statement as shown below.
InitExpression = new CodeBinaryOperatorExpression(new CodeVariableReferenceExpression("root"), CodeBinaryOperatorType.Add, new CodePrimitiveExpression(resource.Value));
Regards,