internal static void FinishScope(Scope scope, IExceptionAggregator exceptionAggregator)
        {
            var coverageSession = Ci.Coverage.CoverageReporter.Handler.EndSession();

            if (coverageSession is not null)
            {
                scope.Span.SetTag("test.coverage", Datadog.Trace.Vendors.Newtonsoft.Json.JsonConvert.SerializeObject(coverageSession));
            }

            Exception exception = exceptionAggregator.ToException();

            if (exception != null)
            {
                if (exception.GetType().Name == "SkipException")
                {
                    scope.Span.SetTag(TestTags.Status, TestTags.StatusSkip);
                    scope.Span.SetTag(TestTags.SkipReason, exception.Message);
                }
                else
                {
                    scope.Span.SetException(exception);
                    scope.Span.SetTag(TestTags.Status, TestTags.StatusFail);
                }
            }
            else
            {
                scope.Span.SetTag(TestTags.Status, TestTags.StatusPass);
            }

            scope.Dispose();
        }
        internal static void FinishScope(Scope scope, IExceptionAggregator exceptionAggregator)
        {
            Exception exception = exceptionAggregator.ToException();

            if (exception != null)
            {
                if (exception.GetType().Name == "SkipException")
                {
                    scope.Span.SetTag(TestTags.Status, TestTags.StatusSkip);
                    scope.Span.SetTag(TestTags.SkipReason, exception.Message);
                }
                else
                {
                    scope.Span.SetException(exception);
                    scope.Span.SetTag(TestTags.Status, TestTags.StatusFail);
                }
            }
            else
            {
                scope.Span.SetTag(TestTags.Status, TestTags.StatusPass);
            }

            scope.Dispose();
        }