---
title: "InstanceStartAttribute class"
canonical: https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/InstanceStartAttribute
---

# InstanceStartAttribute class

Marks the method that runs in each instance before its first request, in an application written without ASP.NET.

```csharp
[AttributeUsage(AttributeTargets.Method)]
public sealed class InstanceStartAttribute : Attribute
```

## Public Members

| name                                                                                                                   | description              |
| ---------------------------------------------------------------------------------------------------------------------- | ------------------------ |
| [InstanceStartAttribute](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/InstanceStartAttribute/-ctor)() | The default constructor. |

## Remarks

Every instance starts as a copy of the same template, so anything created before the template was saved is identical in all of them. Use this method for state that must differ between instances, such as a random identifier or a random generator you seed yourself.

The method is static, returns `Task` and takes no parameters. It can have any name, and an application has at most one. An exception fails the request the instance was started for.

An application with a `Program.cs` subscribes to [`Starting`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Instance/Starting) instead; there the attribute is a build error. [`Instance`](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk/Isoplane/Instance) lists what Isoplane already reseeds for you, and [The application lifecycle](https://isoplane.dev/docs/concepts/application-lifecycle) explains templates and instances in full.

## Examples

```csharp
private static Guid instance;

[InstanceStart]
public static Task StartAsync()
{
    instance = Guid.NewGuid();
    return Task.CompletedTask;
}
```

## See Also

- namespace [Isoplane](https://isoplane.dev/docs/reference/sdk/Isoplane.Sdk)
