Programmatically get a diff between two versions of a file in TFS
Solved. The problem was the reader. After I changed the last two lines to
var diff = Encoding.UTF8.GetString(stream.ToArray());
I got some diff at last.
I know you accepted your answer, and this was asked in 2012, but I recently had to do the same thing, but much prefer using a StreamReader
vs .ToArray()
The answer is that you have to reset the MemoryStream
before you start reading from it.
add this
stream.Position = 0;
right after you flush the writer