Represents errors that occur when a URI scheme is not registered or is invalid. This exception is thrown by the UriBuilder class when a custom URI scheme is used without being properly registered or is syntactically incorrect according to URI scheme specifications.
Object
Exception
SystemException
UriFormatException
UriSchemeException
[SerializableAttribute]
public class UriSchemeException : UriFormatException
| Name | Description |
|---|---|
| UriSchemeException() | Initializes a new instance of the UriSchemeException class. |
| UriSchemeException(String message) | Initializes a new instance of the UriSchemeException class with a specified error message. |
| UriSchemeException(String message, Exception innerException) | Initializes a new instance of the UriSchemeException class with a specified error message and a reference to the inner exception that is the cause of this exception. |
The UriSchemeException is specifically designed to catch issues related to URI schemes, differentiating them from general URI format errors.
When constructing or parsing URIs, especially those with custom schemes (e.g., myapp://), you might encounter this exception if the scheme is not recognized by the system or violates RFC 3986 standards for URI schemes. This typically happens when:
Uri class expects.To resolve this exception, ensure that the URI scheme you are using is valid and, if it's a custom scheme, that it's properly handled by your application or registered appropriately.
This exception is often caught in try-catch blocks when performing operations that involve URI creation or parsing, such as using the Uri constructor or UriBuilder.
Initializes a new instance of the UriSchemeException class. The message property is set to a system-supplied message that describes the error, such as "Default Message". This message takes the current system's culture into account.
Initializes a new instance of the UriSchemeException class with a specified error message. The message is used to describe the error and can be displayed to the user. This constructor also preserves the stack trace that was captured when the exception was created.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
String |
A String that describes the error. The content of this string is intended to be understood by humans. |
Initializes a new instance of the UriSchemeException class with a specified error message and a reference to the inner exception that is the cause of this exception. An inner exception can be provided to the exception constructor to handle exceptions that are thrown as a result of a previous exception. The InnerException property returns the same value that is passed to the constructor.
Parameters:
| Name | Type | Description |
|---|---|---|
message |
String |
A String that describes the error. The content of this string is intended to be understood by humans. |
innerException |
Exception |
The exception that is the cause of the current exception. If the innerException parameter is not null, the current exception is raised in response to the innerException parameter. Otherwise, the UriSchemeException is raised with a null InnerException. |