# SolutionServer class

Namespace: [Grasshopper2.Doc](https://developer.rhino3d.com/api/gh2/namespace/grasshopper2.doc.md) · Assembly: [Grasshopper2](https://developer.rhino3d.com/api/gh2/assembly/grasshopper2.md)

```cs
public class SolutionServer
```

This class provides all methods and properties concerning past document solutions and how to start new ones.

## Constructors

- [SolutionServer](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/ctor.md): Create a new Solution instance.

## Fields

- [_triggerViewportUpdatesOnCompletedSolution](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/triggerviewportupdatesoncompletedsolution.md): (static)
- [MaximumHistoryCount](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/maximumhistorycount.md): (static) Gets the maximum number of solution history records that will be kept. This field is constant and set to 10000 or thereabouts.

## Properties

- [EnableSolutions](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/enablesolutions.md): (static) Gets or sets whether solutions are allowed. Setting this will neither abort nor trigger any solutions, that is the responsibility of the caller.
- [State](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/state.md): Gets the state of this server.

## Methods

- [DelayedExpire](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/delayedexpire.md): Call this method if you want the document to expire your object and start a new solution some time in the near future. This method is good for objects which tend to generate frequent expiration waves due to (typically) UI events such as mouse-moves or key-presses. This method does one of three things: If no solution is currently running, it expires the object immediately and starts a new solution. 2. If another solution has only just started a short while ago, it will allow that solution to continue. The object will be expired and a new solution will be started once the current solution completes. 3. If another solution is running and has been running for a while, it will be cancelled. The object will be expired and a new solution will be started immediately.
- [Start](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/start.md): (2 overloads) Start a new document solution. If another solution is currently running on the same document, that solution will be cancelled. This method returns as soon as objects are beginning to solve, ie. when the Phase is set to Running. You should use this overload if this solution runs as part of another solution on a different document. Be sure to share the [Solution.Source](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solution.md) of that containing solution, so that cancellation may be synchronised.
- [StartWait](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/startwait.md): (2 overloads) Start a new solution and solve it on the calling thread. You should never call this function while on the UI thread.
- [Stop](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/stop.md): Attempt to abort the current solution. This happens automatically if a new solution is started. If no solution is currently running, nothing will happen.

## Events

- [EnabledChanged](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/enabledchanged.md): (static) Raised whenever the EnableSolutions property changes. The sender and arguments are always null, given that this is a static event.
- [SolutionAboutToStart](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutionabouttostart.md): The SolutionAboutToStart event is raised before a new solution kicks off. If you want to expire objects prior to a solution, you must do so from within this event.
- [SolutionCancelled](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutioncancelled.md): The SolutionCancelled event is raised when a solution is aborted. This event will always be followed by the SolutionStopped event.
- [SolutionCompleted](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutioncompleted.md): The SolutionCompleted event is raised when a solution completes successfully. This event will always be followed by the SolutionStopped event.
- [SolutionFaulted](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutionfaulted.md): The SolutionException event is raised when a solution is terminated by an unhandled exception. This event will always be followed by the SolutionCancelled and SolutionStopped events.
- [SolutionStarted](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutionstarted.md): The SolutionStarted event is raised whenever a new solution starts.
- [SolutionStopped](https://developer.rhino3d.com/api/gh2/type/grasshopper2.doc.solutionserver/solutionstopped.md): The SolutionStopped event is raised whenever a solution terminates. Whenever there is a SolutionStarted event there will always be a matching solutionStopped event.
