//
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
-using System.Collections.ObjectModel;
+using System.Collections.Generic;
using System.Diagnostics;
using System.Diagnostics.Tracing;
using System.Runtime.ExceptionServices;
// If the task faulted, throw its first exception,
// even if it contained more than one.
case TaskStatus.Faulted:
- ReadOnlyCollection<ExceptionDispatchInfo> edis = task.GetExceptionDispatchInfos();
+ List<ExceptionDispatchInfo> edis = task.GetExceptionDispatchInfos();
if (edis.Count > 0)
{
edis[0].Throw();
}
/// <summary>Gets the exception dispatch infos once the task has faulted.</summary>
- internal ReadOnlyCollection<ExceptionDispatchInfo> GetExceptionDispatchInfos()
+ internal List<ExceptionDispatchInfo> GetExceptionDispatchInfos()
{
Debug.Assert(IsFaulted && ExceptionRecorded, "Must only be used when the task has faulted with exceptions.");
return m_contingentProperties!.m_exceptionsHolder!.GetExceptionDispatchInfos();
break;
case TaskStatus.Faulted:
- ReadOnlyCollection<ExceptionDispatchInfo> edis = task.GetExceptionDispatchInfos();
+ List<ExceptionDispatchInfo> edis = task.GetExceptionDispatchInfos();
ExceptionDispatchInfo oceEdi;
if (lookForOce && edis.Count > 0 &&
(oceEdi = edis[0]) != null &&
}
/// <summary>
- /// Wraps the exception dispatch infos into a new read-only collection. By calling this method,
- /// the holder assumes exceptions to have been "observed", such that the finalization
+ /// The holder assumes exceptions to have been "observed", such that the finalization
/// check will be subsequently skipped.
/// </summary>
- internal ReadOnlyCollection<ExceptionDispatchInfo> GetExceptionDispatchInfos()
+ internal List<ExceptionDispatchInfo> GetExceptionDispatchInfos()
{
List<ExceptionDispatchInfo>? exceptions = m_faultExceptions;
Debug.Assert(exceptions != null, "Expected an initialized list.");
Debug.Assert(exceptions.Count > 0, "Expected at least one exception.");
MarkAsHandled(false);
- return new ReadOnlyCollection<ExceptionDispatchInfo>(exceptions);
+ return exceptions;
}
/// <summary>