icsharpcode / NRefactory

NRefactory - Refactoring Your C# Code
684 stars 263 forks source link

return attributes are not parsed and rendered correctly. #447

Open AnashOommen opened 10 years ago

AnashOommen commented 10 years ago
  string code = @"

class A {
[return: System.Xml.Serialization.XmlElementAttribute(""rval"")] public void Bar() { } } ";

  CSharpParser parser = new CSharpParser();
  SyntaxTree syntaxTree = parser.Parse(new StringReader(code));
  string code1 = syntaxTree.ToString();

 // At this point, [return: is rendered as [@return: 

  CSharpParser parser1 = new CSharpParser();
  SyntaxTree syntaxTree1 = parser.Parse(new StringReader(code1));
  string code2 = syntaxTree1.ToString();

  // At this point, Bar() will totally miss the [return: attribute.
EgorBo commented 9 years ago

the bug reproduces in the latest 5.5.1 nuget package, however, it seems it's fixed in master.