ClearEnvironmentPriorToAnalysis must be called from a GUI thread as it calls TaskStores ClearByOwner method which must be called from a GUI thread.