I am having the exact same issue where Autodesk.Revit.Exceptions.InvalidOperationException: 'This Element cannot have type assigned.' gets thrown.
How did you manage to solve this ?