# Sandbox.ThreadSafe.AssertIsMainThread

```csharp
static void AssertIsMainThread(string memberName = )
```

Throws an exception if not called from the main thread.
Useful for enforcing thread safety on main-thread-only APIs.

### Parameters

- `memberName` (`string`), default ``: Automatically filled with the calling method name

### Exceptions

- `System.Exception`: Thrown if not on the main thread

Declared in [Sandbox.ThreadSafe](/api/Sandbox.ThreadSafe).
Assembly: `Sandbox.System`.
