v10.10.2024.0701 使用IJsonHost改进Json序列化
大石头 编写于 2024-07-01 08:36:34 大石头 提交于 2024-07-01 08:48:33
X
using System.Collections.Concurrent;

namespace System.Threading.Tasks;

internal class TaskExceptionSlot
{
	public volatile AggregateException Exception;

	public volatile bool Observed;

	public ConcurrentQueue<AggregateException> ChildExceptions;

	private Task parent;

	public TaskExceptionSlot(Task parent)
	{
		this.parent = parent;
	}

	~TaskExceptionSlot()
	{
		if (Exception != null && (!Observed && !TaskScheduler.FireUnobservedEvent(parent, Exception).Observed))
		{
			parent = null;
			throw Exception;
		}
	}
}