File tree Expand file tree Collapse file tree 3 files changed +37
-1
lines changed
Workspaces.Common/CSharp/Refactorings Expand file tree Collapse file tree 3 files changed +37
-1
lines changed Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
17
17
- Fix analyzer [ RCS0056] ( https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0056 ) ([ PR] ( https://github.com/dotnet/roslynator/pull/1521 ) )
18
18
- Fix analyzer [ RCS1181] ( https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1181 ) ([ PR] ( https://github.com/dotnet/roslynator/pull/1526 ) )
19
19
- Fix analyzer [ RCS0005] ( https://josefpihrt.github.io/docs/roslynator/analyzers/RCS0005 ) ([ PR] ( https://github.com/dotnet/roslynator/pull/1533 ) )
20
+ - Fix analyzer [ RCS1181] ( https://josefpihrt.github.io/docs/roslynator/analyzers/RCS1181 ) ([ PR] ( https://github.com/dotnet/roslynator/pull/1534 ) )
20
21
21
22
## [ 4.12.5] - 2024-09-13
22
23
Original file line number Diff line number Diff line change @@ -196,6 +196,37 @@ void M()
196
196
" ) ;
197
197
}
198
198
199
+ [ Fact , Trait ( Traits . Analyzer , DiagnosticIdentifiers . ConvertCommentToDocumentationComment ) ]
200
+ public async Task Test_CommentContainsXmlSpecialChars ( )
201
+ {
202
+ await VerifyDiagnosticAndFixAsync ( """
203
+ namespace N
204
+ {
205
+ /// <summary>
206
+ /// x
207
+ /// </summary>
208
+ class C
209
+ {
210
+ int P { get; set; } [|// Must be >= 0 & <= 5.|]
211
+ }
212
+ }
213
+ """ , """
214
+ namespace N
215
+ {
216
+ /// <summary>
217
+ /// x
218
+ /// </summary>
219
+ class C
220
+ {
221
+ /// <summary>
222
+ /// Must be >= 0 & <= 5.
223
+ /// </summary>
224
+ int P { get; set; }
225
+ }
226
+ }
227
+ """ ) ;
228
+ }
229
+
199
230
[ Fact , Trait ( Traits . Analyzer , DiagnosticIdentifiers . ConvertCommentToDocumentationComment ) ]
200
231
public async Task TestNoDiagnostic_DocumentationComment ( )
201
232
{
Original file line number Diff line number Diff line change 3
3
using System . Collections . Immutable ;
4
4
using System . Diagnostics ;
5
5
using System . Linq ;
6
+ using System . Net ;
6
7
using System . Text . RegularExpressions ;
7
8
using System . Threading ;
8
9
using System . Threading . Tasks ;
@@ -61,7 +62,10 @@ public static Task<Document> RefactorAsync(
61
62
62
63
Debug . Assert ( trailingTrivia . Contains ( trivia ) ) ;
63
64
64
- comments = ImmutableArray . Create ( _leadingSlashesRegex . Replace ( trivia . ToString ( ) , "" ) ) ;
65
+ string commentText = _leadingSlashesRegex . Replace ( trivia . ToString ( ) , "" ) ;
66
+ commentText = WebUtility . HtmlEncode ( commentText ) ;
67
+
68
+ comments = ImmutableArray . Create ( commentText ) ;
65
69
66
70
SyntaxToken newToken = token . WithTrailingTrivia ( trailingTrivia . Skip ( trailingTrivia . IndexOf ( trivia ) + 1 ) ) ;
67
71
You can’t perform that action at this time.
0 commit comments