Removed use of tf.Status static instance#975
Removed use of tf.Status static instance#975Oceania2018 merged 1 commit intoSciSharp:masterfrom Superpiffer:master
Conversation
In multithreading .NET 4.8 applications, sometimes in Session finalizer the method c_api.TF_DeleteSession find f.Status static instance already disposed for some reason. No problem for .NET 6 application or with a single thread.
|
@Superpiffer Do you think it will work if I change to below if (tf.Status == null || tf.Status.Handle.IsInvalid)
{
c_api.TF_DeleteSession(handle, c_api.TF_NewStatus());
}
else
{
c_api.TF_DeleteSession(handle, tf.Status.Handle);
} |
I think so, maybe that's ok as a "last resort" in my use case, also preserving the previous behaviour. I can test it on monday. |
|
@Oceania2018 I tried and I have the same problem: |
|
Is there any code like |
No, I cannot use Also I made a new PR with a possible solution: #978 |


In multithreading .NET 4.8 applications, sometimes in Session finalizer the method c_api.TF_DeleteSession find f.Status static instance already disposed for some reason. No problem for .NET 6 application or with a single thread. (#912)