File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed
Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -13,11 +13,15 @@ public class TelemetryTests : IDisposable
1313 private readonly ActivityListener _listener ;
1414 private readonly List < Activity > _recordedActivities = new ( ) ;
1515
16- public TelemetryTests ( )
16+ // Static constructor ensures the AppContext switch is set before any code
17+ // accesses CopilotTelemetry.IsEnabled (which uses lazy evaluation)
18+ static TelemetryTests ( )
1719 {
18- // Enable telemetry for tests
1920 AppContext . SetSwitch ( "GitHub.Copilot.EnableOpenTelemetry" , true ) ;
21+ }
2022
23+ public TelemetryTests ( )
24+ {
2125 // Set up an activity listener to capture spans
2226 _listener = new ActivityListener
2327 {
@@ -32,8 +36,6 @@ public TelemetryTests()
3236 public void Dispose ( )
3337 {
3438 _listener . Dispose ( ) ;
35- // Note: We can't easily reset the AppContext switch, but it won't affect other tests
36- // since IsEnabled is lazily evaluated once
3739 }
3840
3941 [ Fact ]
You can’t perform that action at this time.
0 commit comments