Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix cref tags on generated VB's SyntaxFactory #62578

Merged
merged 1 commit into from
Jul 21, 2022
Merged

Conversation

jcouv
Copy link
Member

@jcouv jcouv commented Jul 12, 2022

@jcouv jcouv self-assigned this Jul 12, 2022
@jcouv jcouv requested a review from a team as a code owner July 12, 2022 21:31
@@ -617,7 +617,7 @@ Public MustInherit Class WriteUtils
text = XmlEscape(text)
Else
' Ensure the text does not require escaping.
Dim filtered = text.Replace("<cref ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")
Dim filtered = text.Replace("<see ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be "<see cref=", ""?

tbh, i'm not really sure what is going on here...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic in XmlEscape on next line only looks for &, < and >. It doesn't look for = or ".
So I think this is correct.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like the result of this transformation is only used for a debug assert. e.g., if user says "don't escape the text", then verify in an ad-hoc manner that the text didn't require escaping.

Basically, since "cref" itself doesn't need to be escaped, we don't need to check for it and replace here.

@@ -617,7 +617,7 @@ Public MustInherit Class WriteUtils
text = XmlEscape(text)
Else
' Ensure the text does not require escaping.
Dim filtered = text.Replace("<cref ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")
Dim filtered = text.Replace("<see ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Dim filtered = text.Replace("<see ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")
Dim filtered = text.Replace("<see cref ", "").Replace("/>", "").Replace("&amp;", "").Replace("&lt;", "").Replace("&gt;", "")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jcouv - I agree with Cyrus. I think this line needs to be adjusted as shown.

@jcouv
Copy link
Member Author

jcouv commented Jul 19, 2022

@dotnet/roslyn-compiler for review (small change affecting xml docs in some of our code generators)

@jcouv jcouv merged commit 3fe6824 into dotnet:main Jul 21, 2022
@jcouv jcouv deleted the fix-cref branch July 21, 2022 04:29
@ghost ghost added this to the Next milestone Jul 21, 2022
333fred added a commit to 333fred/roslyn that referenced this pull request Jul 21, 2022
* upstream/main: (53 commits)
  Remove 'mangleName' parameter in PENamedTypeSymbolNonGeneric (dotnet#62813)
  Produce errors for 'partial file record' (dotnet#62686)
  [EnC] Allow renaming methods, properties, events etc. (dotnet#62364)
  Update AbstractFileHeaderDiagnosticAnalyzer.cs
  Rename file
  Make static
  Move tests
  Refactor
  Support ref field assignment in object initializers (dotnet#62584)
  Fix cref tags on generated VB's SyntaxFactory (dotnet#62578)
  Simplify
  Simplify
  Simplify
  Simplify
  Simplify
  Simplify
  Simplify
  Simplify
  Move helper methods
  Remove serialization
  ...
@allisonchou allisonchou modified the milestones: Next, 17.4 P1 Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants