# OpcException Members

> Reference: The exception that is thrown when an OPC operation has failed.

<dl class="api-definition">
<dt>Type</dt>
<dd><a href="./">OpcException</a></dd>
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Inherits members from [Exception](https://learn.microsoft.com/dotnet/api/system.exception).

## Constructors

### OpcException

<span class="api-meta">15 overloads</span>

| Overload | Description |
|---|---|
| [OpcException()](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-noparams) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with default properties. |
| [OpcException(OpcContext)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with default properties and the `context` specified. |
| [OpcException(string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-system-string) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `message` specified. |
| [OpcException(OpcContext, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-system-string)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context` and `message` specified. |
| [OpcException(OpcStatusCode)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opcstatuscode) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `code`. |
| [OpcException(OpcContext, OpcStatusCode)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-opc-uafx-opcstatuscode)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `context` and `code`. |
| [OpcException(OpcStatusCode, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opcstatuscode-system-string) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `code` and `message` specified. |
| [OpcException(OpcContext, OpcStatusCode, string)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-opc-uafx-opcstatuscode-system-string)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context`, `code` and `message` specified. |
| [OpcException(OpcStatusCode, string, Exception)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opcstatuscode-system-string-system-exception) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `code`, `message` and `inner` exception specified. |
| [OpcException(OpcContext, OpcStatusCode, string, Exception)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-opc-uafx-opcstatuscode-system-string-system-exception)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context`, `code`, `message` and `inner` specified. |
| [OpcException(OpcStatusCode, Exception)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opcstatuscode-system-exception) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `code` and `inner` exception. |
| [OpcException(OpcContext, OpcStatusCode, Exception)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-opc-uafx-opcstatuscode-system-exception)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `context`, `code` and `inner` exception. |
| [OpcException(OpcResult)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opcresult) | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class using the `result` information specified. |
| [OpcException(OpcContext, OpcResult)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-opc-uafx-opccontext-opc-uafx-opcresult)<span class="api-meta">since v2.11</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class using the `context` and `result` information specified. |
| [OpcException(SerializationInfo, StreamingContext)](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#opcexception-system-runtime-serialization-serializationinfo-system-runtime-serialization-streamingcontext)<span class="api-meta">protected</span> | Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with serialized data. |

#### OpcException()

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with default properties.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New()
```

</div>

#### OpcException(OpcContext)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with default properties and the `context` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(context As OpcContext)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |

#### OpcException(string)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `message` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(string message)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(message As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |

#### OpcException(OpcContext, string)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context` and `message` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context, string message)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(context As OpcContext, message As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |

#### OpcException(OpcStatusCode)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `code`.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcStatusCode code)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(code As OpcStatusCode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) upon its value the according [Message](https://learn.microsoft.com/dotnet/api/system.exception.message) is used for the new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class. |

#### OpcException(OpcContext, OpcStatusCode)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `context` and `code`.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context, OpcStatusCode code)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(context As OpcContext, code As OpcStatusCode)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) upon its value the according [Message](https://learn.microsoft.com/dotnet/api/system.exception.message) is used for the new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class. |

#### OpcException(OpcStatusCode, string)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `code` and `message` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcStatusCode code, string message)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(code As OpcStatusCode, message As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) which is described by the `message`. |
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |

#### OpcException(OpcContext, OpcStatusCode, string)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context`, `code` and `message` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context, OpcStatusCode code, string message)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(context As OpcContext, code As OpcStatusCode, message As String)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) which is described by the `message`. |
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |

#### OpcException(OpcStatusCode, string, Exception)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `code`, `message` and `inner` exception specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcStatusCode code, string message, Exception inner)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(code As OpcStatusCode, message As String, inner As Exception)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) which is described by the `message`. |
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |
| `inner` | [Exception](https://learn.microsoft.com/dotnet/api/system.exception) | The exception that is the cause of the current exception. If the inner parameter is not null (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. |

#### OpcException(OpcContext, OpcStatusCode, string, Exception)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the `context`, `code`, `message` and `inner` specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(
    OpcContext context,
    OpcStatusCode code,
    string message,
    Exception inner)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(
    context As OpcContext,
    code As OpcStatusCode,
    message As String,
    inner As Exception)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) which is described by the `message`. |
| `message` | [String](https://learn.microsoft.com/dotnet/api/system.string) | The [Message](https://learn.microsoft.com/dotnet/api/system.exception.message). |
| `inner` | [Exception](https://learn.microsoft.com/dotnet/api/system.exception) | The exception that is the cause of the current exception. If the inner parameter is not null (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. |

#### OpcException(OpcStatusCode, Exception)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `code` and `inner` exception.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcStatusCode code, Exception inner)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(code As OpcStatusCode, inner As Exception)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) upon its value the according [Message](https://learn.microsoft.com/dotnet/api/system.exception.message) is used for the new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class. |
| `inner` | [Exception](https://learn.microsoft.com/dotnet/api/system.exception) | The exception that is the cause of the current exception. If the inner parameter is not null (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. |

#### OpcException(OpcContext, OpcStatusCode, Exception)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with the specified `context`, `code` and `inner` exception.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context, OpcStatusCode code, Exception inner)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public Sub New(context As OpcContext, code As OpcStatusCode, inner As Exception)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `code` | [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) | The [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) upon its value the according [Message](https://learn.microsoft.com/dotnet/api/system.exception.message) is used for the new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class. |
| `inner` | [Exception](https://learn.microsoft.com/dotnet/api/system.exception) | The exception that is the cause of the current exception. If the inner parameter is not null (Nothing in Visual Basic), the current exception is raised in a catch block that handles the inner exception. |

#### OpcException(OpcResult)

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class using the `result` information specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcResult result)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(result As OpcResult)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `result` | [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) | The [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) from that the exception information is to be retrieved. |

#### OpcException(OpcContext, OpcResult)

<span class="api-meta">since v2.11</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class using the `context` and `result` information specified.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcException(OpcContext context, OpcResult result)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Sub New(context As OpcContext, result As OpcResult)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `context` | [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) | The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the new [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated. |
| `result` | [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) | The [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) from that the exception information is to be retrieved. |

#### OpcException(SerializationInfo, StreamingContext)

<span class="api-meta">protected</span>

Initializes a new instance of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) class with serialized data.

<div class="api-signature" data-lang="csharp">

```csharp
protected OpcException(SerializationInfo info, StreamingContext context)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Protected Sub New(info As SerializationInfo, context As StreamingContext)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `info` | [SerializationInfo](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationinfo) | The [SerializationInfo](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationinfo) that holds the serialized object data about the exception being thrown. |
| `context` | [StreamingContext](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.streamingcontext) | The [StreamingContext](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.streamingcontext) that contains contextual information about the source or destination. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The info parameter is a null reference (Nothing in Visual Basic). |
| [SerializationException](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationexception) | The class name is a null reference (Nothing in Visual Basic) or [HResult](https://learn.microsoft.com/dotnet/api/system.exception.hresult) is zero (0). |

## Properties

### Code

Gets the according [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) for the [ErrorCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/members#errorcode).

<div class="api-signature" data-lang="csharp">

```csharp
public OpcStatusCode Code { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public ReadOnly Property Code As OpcStatusCode
```

</div>

**Property value**

[OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/)

One of the members defined by the [OpcStatusCode](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcstatuscode/) enumeration.

### Context

<span class="api-meta">since v2.11</span>

Gets the [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was in use while the current [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcContext Context { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Context As OpcContext
```

</div>

**Property value**

[OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/)

An instance of the [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) which was used to store context sensitive data and configuration while the current [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/) was generated.

**Remarks**

The [OpcContext](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/) instance is at least [Empty](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opccontext/members#empty).

### Data

<span class="api-meta">override · since v2.7</span>

Gets a collection of key/value pairs that provide additional user-defined information about the exception.

<div class="api-signature" data-lang="csharp">

```csharp
public override IDictionary Data { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides ReadOnly Property Data As IDictionary
```

</div>

**Property value**

[IDictionary](https://learn.microsoft.com/dotnet/api/system.collections.idictionary)

An object that implements the [IDictionary](https://learn.microsoft.com/dotnet/api/system.collections.idictionary) interface and contains a collection of user-defined key/value pairs. The default is an empty collection.

**Overrides**

[Data](https://learn.microsoft.com/dotnet/api/system.exception.data)

### ErrorCode

Gets the error code of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/).

<div class="api-signature" data-lang="csharp">

```csharp
public uint ErrorCode { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<CLSCompliant(False)>
Public ReadOnly Property ErrorCode As UInteger
```

</div>

**Property value**

[UInt32](https://learn.microsoft.com/dotnet/api/system.uint32)

The error code of the [OpcException](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcexception/).

### HelpLink

<span class="api-meta">override · since v2.7</span>

Gets or sets a link to the help file associated with this exception.

<div class="api-signature" data-lang="csharp">

```csharp
public override string HelpLink { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Property HelpLink As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The Uniform Resource Name (URN) or Uniform Resource Locator (URL).

**Overrides**

[HelpLink](https://learn.microsoft.com/dotnet/api/system.exception.helplink)

### Message

<span class="api-meta">override</span>

Gets a message that describes the current exception.

<div class="api-signature" data-lang="csharp">

```csharp
public override string Message { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides ReadOnly Property Message As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The error message that explains the reason for the exception.

**Overrides**

[Message](https://learn.microsoft.com/dotnet/api/system.exception.message)

### Result

Gets the result information associated with the exception.

<div class="api-signature" data-lang="csharp">

```csharp
public OpcResult Result { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public ReadOnly Property Result As OpcResult
```

</div>

**Property value**

[OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/)

An instance of the [OpcResult](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcresult/) class from that the exception has been initialized.

### Source

<span class="api-meta">override · since v2.7</span>

Gets or sets the name of the application or the object that causes the error.

<div class="api-signature" data-lang="csharp">

```csharp
public override string Source { get; set; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Property Source As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The name of the application or the object that causes the error.

**Overrides**

[Source](https://learn.microsoft.com/dotnet/api/system.exception.source)

### StackTrace

<span class="api-meta">override · since v2.7</span>

Gets a string representation of the immediate frames on the call stack.

<div class="api-signature" data-lang="csharp">

```csharp
public override string StackTrace { get; }
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides ReadOnly Property StackTrace As String
```

</div>

**Property value**

[String](https://learn.microsoft.com/dotnet/api/system.string)

A string that describes the immediate frames of the call stack.

**Overrides**

[StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace)

## Methods

### GetBaseException

<span class="api-meta">override · since v2.8</span>

Returns the System.Exception that is the root cause of one or more subsequent exceptions.

<div class="api-signature" data-lang="csharp">

```csharp
public override Exception GetBaseException()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Function GetBaseException() As Exception
```

</div>

**Returns**

[Exception](https://learn.microsoft.com/dotnet/api/system.exception)

The first exception thrown in a chain of exceptions.

**Overrides**

[GetBaseException()](https://learn.microsoft.com/dotnet/api/system.exception.getbaseexception)

### GetObjectData

<span class="api-meta">override</span>

Sets the [SerializationInfo](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationinfo) with information about the exception.

<div class="api-signature" data-lang="csharp">

```csharp
public override void GetObjectData(
    SerializationInfo info,
    StreamingContext context)
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Sub GetObjectData(
    info As SerializationInfo,
    context As StreamingContext)
```

</div>

**Parameters**

| Name | Type | Description |
|---|---|---|
| `info` | [SerializationInfo](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationinfo) | The [SerializationInfo](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.serializationinfo) that holds the serialized object data about the exception being thrown. |
| `context` | [StreamingContext](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.streamingcontext) | The [StreamingContext](https://learn.microsoft.com/dotnet/api/system.runtime.serialization.streamingcontext) that contains contextual information about the source or destination. |

**Exceptions**

| Exception | Condition |
|---|---|
| [ArgumentNullException](https://learn.microsoft.com/dotnet/api/system.argumentnullexception) | The `info` parameter is a null reference (Nothing in Visual Basic). |

**Overrides**

[GetObjectData(SerializationInfo, StreamingContext)](https://learn.microsoft.com/dotnet/api/system.exception.getobjectdata)

### ToString

<span class="api-meta">override · since v2.8</span>

Creates and returns a string representation of the exception.

<div class="api-signature" data-lang="csharp">

```csharp
public override string ToString()
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
Public Overrides Function ToString() As String
```

</div>

**Returns**

[String](https://learn.microsoft.com/dotnet/api/system.string)

The full name of the type of the exception and its [Message](https://learn.microsoft.com/dotnet/api/system.exception.message), followed by its [StackTrace](https://learn.microsoft.com/dotnet/api/system.exception.stacktrace) on a new line if there is one.

**Overrides**

[ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring)

**Remarks**

Unlike [ToString()](https://learn.microsoft.com/dotnet/api/system.exception.tostring), the string does not contain the inner exceptions.
