protected void FlagAsSent(Exception exception)
{
if (exception != null && exception.Data != null)
{
try
{
Type[] genericTypes = exception.Data.GetType().GetTypeInfo().GenericTypeArguments;
if (genericTypes.Length == 0 || genericTypes[0].IsAssignableFrom(typeof(string)))
{
exception.Data[SentKey] = true;
}
}
catch (Exception ex)
{
Debug.WriteLine(String.Format("Failed to flag exception as sent: {0}", ex.Message));
}
}
}