Closed thefirstfloor closed 4 years ago
I think maybe what is happening is Session.instance.End();
is being called multiple times, so it is trying to save results whilst it is already saving. I'll see if I can replicate and can deploy a check for this that throws a more helpful error.
Cannot replicate this even when End
is called multiple times. Are there no other errors that occur before this?
Nope. ... Queuing save of file: C:\Users\Jeroen\Documents\XXX\Demo\DemoID\S000\trackers\righthand_controller_movement_T002.csv Joining File Saver Thread Managing action (few times) Finished worker thread Message before the error are: Ended session. Queuing save of file: C:\Users\Jeroen\Documents\MPI SNT\Demo\DemoID\S000\trial_results.csv
End After Last Trial
should definitely work when calling trial.End()
(starting the next trial will not automatically end the current one).
I am puzzled as to how it allows Queuing save of file: C:\Users\Jeroen\Documents\MPI SNT\Demo\DemoID\S000\trial_results.csv
when the session has already ended.
You can see here, the results get saved BEFORE the session ends.
I have not tested with Android, do you know if you switch platform to Windows this error goes away? Any other info you have would be useful. I assume the examples run OK?
If you are willing to host your project on github or elsewhere (perhaps privately if necessary) and invite me I can take a look at the code.
I am not able to share it online at this point I'm afraid, but: After analysing the flow of the method calls and seeing your remark about trial.end(), I tried to set up the flow a bit different.
My assumption/logic was that BeginNextTrialSafe() or even BeginNextTrial(), will end the current one running, it also shows in the inspector that the system indeed goes to the next trial in the block. So that is a bit misleading.
Instead of calling BeginNextTrialSafe() after my statemachine knows it's the end of the trial, now it does Session.instance.CurrentTrial.End(); I hooked up a method to the UXF OnTrialEnd event that calls the BeginNextTrialSafe(). Also the automatic ending of the session works fine now.
Thanks for diving into it.
Indeed that is misleading, I will try to implement something to address this.
UXF 2.05 Unity 2020.1.12f1 Android project but running in Link PC mode in editor Data handling: File saver enabled
Three active Position trackers in scene. Error happens when calling Session.instance.End();
Console: _InvalidOperationException: Cant add action to FileIOManager, is currently quitting. Action: UXF.FileSaver+<>c__DisplayClass12_0.b_0
UXF.FileSaver.ManageInWorker (System.Action action) (at Assets/UXF/Scripts/DataHandling/FileSaver.cs:82)
UXF.FileSaver.HandleDataTable (UXF.UXFDataTable table, System.String experiment, System.String ppid, System.Int32 sessionNum, System.String dataName, UXF.UXFDataType dataType, System.Int32 optionalTrialNum) (at Assets/UXF/Scripts/DataHandling/FileSaver.cs:148)
UXF.Session.SaveDataTable (UXF.UXFDataTable table, System.String dataName, UXF.UXFDataType dataType) (at Assets/UXF/Scripts/Session.cs:538)
UXF.Session.SaveResults () (at Assets/UXF/Scripts/Session.cs:692)
UXF.Session.End () (at Assets/UXF/Scripts/Session.cs:620)