Or something similar lest you risk paying the price for not paying attention.

The XmlSerializer can serialize an object to a stream, any stream. If the stream you are searializing your object to already contains data, and the length of that data is longer than the length of the data you are currently writing (your about-to-be serialized object) you get artifacts.

This is to say that if you open a stream without clearing it in some manner, and then write less data than what was already there…. You get your new data at the begining, and leftovers from what was there before at the end.

So in the case of serializing to a file, the easiest thing to do is use a StreamWriter and provide the path of the file to which you wish to write. The StreamWriter overwrites any existing file for you by default.

As per msdn documentation:
StreamWriter Constructor (String)
The path parameter can be a file name, including a file on a Universal Naming Convention (UNC) share. If the file exists, it is overwritten; otherwise, a new file is created.