IronPython script to export a visualization to PDF results in the below InvalidOperationException error,
System.InvalidOperationException: Invalid operation 'BeginAggregatedTransaction' to the command history when in state 'Executing'.
at Spotfire.Dxp.Framework.Commands.CommandHistory.BeginAggregatedTransaction(String displayName, Boolean transient, DocumentNode rootNode)
at Spotfire.Dxp.Framework.Commands.CommandHistory.BeginTransientTransaction(DocumentNode rootNode)
at Spotfire.Dxp.Application.Document.Export(PdfExportSettings2 settings)
at _stub_$265##265(Closure , CallSite , CodeContext , Object , Object , String )
at Microsoft.Scripting.Actions.MatchCaller.Call4[T0,T1,T2,T3,TRet](Func`6 target, CallSite site, Object[] args)
at Microsoft.Scripting.Actions.CallSite`1.UpdateAndExecute(Object[] args)
at Microsoft.Scripting.Actions.UpdateDelegates.Update4[T,T0,T1,T2,T3,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3)
at $261##261(Closure , Scope , LanguageContext )
at Spotfire.Dxp.Application.ScriptSupport.IronPythonScriptEngine.ExecuteForDebugging(String scriptCode, Dictionary`2 scope, Stream outputStream)
at Spotfire.Dxp.Application.Scripting.ScriptManager.<>c__DisplayClass14.b__f()
at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor, Boolean visible, Boolean sticky, Guid stickyGuid)
at Spotfire.Dxp.Framework.Commands.CommandHistory.Transaction(String displayName, Executor executor)
at Spotfire.Dxp.Framework.DocumentModel.DocumentNode.Transaction(String displayName, Executor executor)
at Spotfire.Dxp.Application.Scripting.ScriptManager.ExecuteScriptForDebugging(String scriptCode, Dictionary`2 scriptArguments, String& output)
at Spotfire.Dxp.Forms.Framework.Scripting.ScriptEditDialog.RunButton_Click(Object sender, EventArgs e)
The cause of the above error is because all Iron Python scripts are executed in transaction, which means that any code that starts a progress or aggregated transaction will fail.