You’re being bitten by your use of var here, is my guess.
I’m assuming that Contents is dynamic.
Consider this example:
dynamic d = null;
var s = d.ToString();
s is dynamic not string.
You’ll want to cast the object to object before calling ToString, or cast the result of ToString to a string. The point is that at some point, somewhere, you need a cast to get out of the dynamic cycle.
This is how I’d solve it:
string str = ((object)frame.Contents).ToString();
Debug.WriteLine(str);
or
string str = frame.Contents.ToString() as string;
Debug.WriteLine(str);