---
title: "Debug Assertions - s&box library"
description: "This library adds Assert functions which are only checked in debug mode (that is, in the editor).\nThis lets you create reliable code which has no performance impact once the game is released.\nThis is because C# has an attribute which can actually remove code if DEBUG isn't defined. It completely disappears.\n\nFor a taste about defensive programming, please watch the ~9 minutes after this timestamp in this video: https://youtu.be/oitYvDe4nps?t=210\nEmphasis on the part at 8:40.\n\nThe issue which inspired this project: https://github.com/Facepunch/sbox-public/issues/291\nThe source code is available at https://gitgud.io/nixx/sbox-debug-assertions\n\nNote: The assertions sit in the Quality.Diagnostics namespace, in case s&box ever add their own."
canonical: "https://sbox.watch/libraries/quality/debugassertions/"
generated_at: "2026-07-22T23:08:23.184Z"
---

# Debug Assertions

No summary provided.

- Type: library
- Ident: quality.debugassertions
- Creator: quality
- Canonical: https://sbox.watch/libraries/quality/debugassertions/
- Markdown: https://sbox.watch/libraries/quality/debugassertions.md
- sbox.game: https://sbox.game/quality/debugassertions/
- Generated: 2026-07-22T23:08:23.184Z

## Stats

- 24h momentum: +0
- Terry score: --
- Favorites: 0
- Upvotes: 0
- Downvotes: 0
- Updated: Feb 10, 2026
- Created: Jan 26, 2026
- Size: 10.8 KB
- Files: 5
- Tags: 

## Description

This library adds Assert functions which are only checked in debug mode (that is, in the editor).
This lets you create reliable code which has no performance impact once the game is released.
This is because C\# has an attribute which can actually remove code if DEBUG isn't defined. It completely disappears.

For a taste about defensive programming, please watch the ~9 minutes after this timestamp in this video: https://youtu.be/oitYvDe4nps?t=210
Emphasis on the part at 8:40.

The issue which inspired this project: https://github.com/Facepunch/sbox-public/issues/291
The source code is available at https://gitgud.io/nixx/sbox-debug-assertions

Note: The assertions sit in the Quality.Diagnostics namespace, in case s&box ever add their own.



## More by quality

| Package | Ident | Players | Favorites | Upvotes | Score | Markdown |
| --- | --- | --- | --- | --- | --- | --- |
| Simple Anti-Tamper | quality.simpleantitamper | 0 | 2 | 5 | 65% | https://sbox.watch/libraries/quality/simpleantitamper.md |
| Changelog Helper | quality.changeloghelper | 0 | 0 | 0 | -- | https://sbox.watch/libraries/quality/changeloghelper.md |
