Skip to content

Commit d38a8d1

Browse files
watfordgnfmairaw
authored andcommitted
Add missing exception to Uri.IdnHost (#2658)
Uri.IdnHost throws InvalidOperationException if the URI is not absolute. This is because it internally forwards to `DnsSafeHost` which throws. This is true for .NET Core 3+ (at least) and .NET Framework 4.8 (Reference Source). Sources: https://github.com/dotnet/corefx/blob/master/src/System.Private.Uri/src/System/Uri.cs#L1219-L1233 https://referencesource.microsoft.com/#System/net/System/URI.cs,988f6bd791dbb0dc,references
1 parent ead68ff commit d38a8d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

xml/System/Uri.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,7 @@ If you used an escaped string to construct this instance (for example, `"http://
24572457
24582458
]]></format>
24592459
</remarks>
2460+
<exception cref="T:System.InvalidOperationException">This instance represents a relative URI, and this property is valid only for absolute URIs.</exception>
24602461
</Docs>
24612462
</Member>
24622463
<Member MemberName="IsAbsoluteUri">
@@ -4901,4 +4902,4 @@ If you used an escaped string to construct this instance (for example, `"http://
49014902
</Docs>
49024903
</Member>
49034904
</Members>
4904-
</Type>
4905+
</Type>

0 commit comments

Comments
 (0)