I understand that IsFaulted is property that can only be used with Get and what its use is for but I'm having trouble understanding if and when it is ever changed from true to false. Most sites I see online discuss what it is used for and maybe having a check for it but I don't see them ever changing it intentionally or through some kind of work around.
I suppose that you are talking about Task.IsFaulted.
It gets changed to true if there is an unhanded exception during the tasks' execution. Its state depends on the state flags set internally.
You can see from code of IsFaulted that there is no setter:
public bool IsFaulted
{
get
{
// Faulted is "king" -- if that bit is present (regardless of other bits), we are faulted.
return ((m_stateFlags & TASK_STATE_FAULTED) != 0);
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With