﻿using System;

namespace Staxel.Trace {
    public struct TraceScope : IDisposable {
        public TraceKey Key;

        public TraceScope(TraceKey key) {
            Key = key;
            TraceRecorder.Enter(Key);
        }

        public void Dispose() {
            TraceRecorder.Leave(Key);
        }
    }
}

﻿using System;
using System.Diagnostics;
using System.Runtime;
using System.Runtime.CompilerServices;

namespace Staxel.Trace {
    public struct TraceScope : IDisposable {
        public TraceKey Key;

        [TargetedPatchingOptOut("")]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public TraceScope(TraceKey key) {
            Key = key;
            TraceRecorder.Enter(Key);
        }

        [Conditional("TRACE")]
        [TargetedPatchingOptOut("")]
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Dispose() {
            TraceRecorder.Leave(Key);
        }
    }
}

Patch out the Tracescope for as far as possible when applicable.
Patch out the Tracescope for as far as possible when applicable.
