---
title: InvalidResponseException
summary: API reference for InvalidResponseException.
status: draft
owner: <owner>
last_reviewed: 2026-07-23
library: SAIF.Framework.DNS
reference_type: package
---

# InvalidResponseException

`InvalidResponseException` is thrown when a DNS server delivers a reply that cannot be parsed as expected — specifically, when an embedded `Question` in the reply cannot be decoded.

## Purpose
- Signal to the caller that a DNS reply was received but could not be parsed into a valid `Response`.

## Context
- Namespace: `SAIF.Framework.DNS`
- Assembly/package: `SAIF.BOF.Framework.DNS`
- Base type: `SystemException`

## Public members
| Member | Signature | Purpose |
| --- | --- | --- |
| InvalidResponseException() | `public InvalidResponseException()` | Default constructor with no message or inner exception. |
| InvalidResponseException(Exception) | `public InvalidResponseException(Exception innerException)` | Constructs the exception wrapping an inner exception, with no message. |
| InvalidResponseException(string, Exception) | `public InvalidResponseException(string message, Exception innerException)` | Constructs the exception with a message and an inner exception. |

## Behavioral notes
- The class is marked `[Serializable]` and includes a `protected` deserialization constructor (`SerializationInfo`, `StreamingContext`) for binary serialization support.
- Thrown by the `Response` constructor when parsing an embedded `Question` fails, wrapping the original exception as the inner exception; enforces [BR-007](../../business-rules.md#br-007-malformed-embedded-questions-abort-response-construction).

## Sources
- SAIF.Framework.DNS\InvalidResponseException.cs
