Skip to main content
Dispose result objects

Dispose objects at the end of the scope

Ossi Galkin avatar
Written by Ossi Galkin
Updated over a year ago

Available from version 5.6.


Sometimes it is useful or even necessary to dispose result objects to release resources used by them. This option is available in the advanced settings in Code elements, Code statements and Tasks:

This affects on the object returned by the Code element/statemens or Task. For example, in the following Code statement an instance of System.IO.StreamWriter is returned and if the Dispose at the end of the scope option is turned on the Dispose() -method for the System.IO.StreamWriter instance is called at the end of the current scope. The current scope being the Scope element, Foreach element or While element for the Code element/statement or Task, or the parent scope of the Process. In the loop scopes the dispose will be done once at the end of each iteration.

This option does nothing if the result object does not implement the IDisposable interface, for more information see this article.

Note that the IAsyncDisposable.DisposeAsync is not supported.

Did this answer your question?