Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 11edd9b

Browse files
carlossanlopmairaw
andauthored
Specify XmlException LineNumber and LinePosition are zero-based (dotnet#3636)
* Specify XmlException LineNumber and LinePosition are zero-based * suggestion by krwq * suggestions by mairaw Co-Authored-By: Maira Wenzel <[email protected]> * suggestions by mairaw Co-Authored-By: Maira Wenzel <[email protected]> * remove example, mention exception message * Space * suggestions by mairaw Co-Authored-By: Maira Wenzel <[email protected]>
1 parent ee94535 commit 11edd9b

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

xml/System.Xml/XmlException.xml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -347,9 +347,22 @@ The `XmlException` is a generic XML-related error that is thrown if problems occ
347347
<ReturnType>System.Int32</ReturnType>
348348
</ReturnValue>
349349
<Docs>
350-
<summary>Gets the line number indicating where the error occurred.</summary>
350+
<summary>Gets the line number indicating where the error occurred. Line numbers start at 1.</summary>
351351
<value>The line number indicating where the error occurred.</value>
352-
<remarks>To be added.</remarks>
352+
<remarks>
353+
<format type="text/markdown"><![CDATA[
354+
355+
## Remarks
356+
357+
Attempting to load the string `"<<foo>\r\nbar</foo>"` as XML throws an `XmlException` with the following message:
358+
359+
`System.Xml.XmlException: 'Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 1, position 2.'`
360+
361+
Showing that line number is 1-based (the error is found in the first line).
362+
363+
364+
]]></format>
365+
</remarks>
353366
</Docs>
354367
</Member>
355368
<Member MemberName="LinePosition">
@@ -389,9 +402,21 @@ The `XmlException` is a generic XML-related error that is thrown if problems occ
389402
<ReturnType>System.Int32</ReturnType>
390403
</ReturnValue>
391404
<Docs>
392-
<summary>Gets the line position indicating where the error occurred.</summary>
405+
<summary>Gets the line position indicating where the error occurred. Line position starts at 1.</summary>
393406
<value>The line position indicating where the error occurred.</value>
394-
<remarks>To be added.</remarks>
407+
<remarks>
408+
<format type="text/markdown"><![CDATA[
409+
410+
## Remarks
411+
412+
Attempting to load the string `"<<foo>\r\nbar</foo>"` as XML throws an `XmlException` with the following message:
413+
414+
`System.Xml.XmlException: 'Name cannot begin with the '<' character, hexadecimal value 0x3C. Line 1, position 2.'`
415+
416+
Showing that line position is 1-based (the error is found in the second character).
417+
418+
]]></format>
419+
</remarks>
395420
</Docs>
396421
</Member>
397422
<Member MemberName="Message">

0 commit comments

Comments
 (0)