ILSpy icon indicating copy to clipboard operation
ILSpy copied to clipboard

XML comment contents XMLified in error

Open tamlin-mike opened this issue 5 years ago • 4 comments

Repro

/// <summary>foo > 1</summary>
class C { } // compile with -doc:blahblah

Decompiles to

// C
/// <summary>foo &gt; 1</summary>
internal class C
{
}

Expected: &gt; remaining > (i.e. as-is from the generated XML file contents).

tamlin-mike avatar Dec 24 '19 22:12 tamlin-mike

I am not sure, whether this is an error or just a request for "visual improvement"... The generated XML looks fine to me.

siegfriedpammer avatar Dec 28 '19 17:12 siegfriedpammer

I consider it an error, since it does not reproduce (display) the comment as expected. Whether or not the bug is only in the interactive visualization I didn't research.

tamlin-mike avatar Dec 29 '19 02:12 tamlin-mike

The XML file indeed contains the '>' unescaped. I think this is due to us reading the whole XML file using XmlTextReader and caching/indexing all the entries. XmlTextReader seems to automatically escape all characters that are used as XML tokens. No idea, whether there is a switch to turn this off.

siegfriedpammer avatar Dec 29 '19 08:12 siegfriedpammer

We may be able to fix this by switching to https://github.com/KirillOsenkov/XmlParser instead of using XmlTextReader.

siegfriedpammer avatar Mar 12 '21 20:03 siegfriedpammer