Skip to content

Commit cf4b3e9

Browse files
authored
trace2: remove inaccurate warning and add UI helper exit calls (#1114)
Remove warning about being unable to set up tracing from Trace2 TryParseSettings method. This method should just check to see whether TRACE2 is enabled - if it is not, it does not need to warn the user, as we only collect traces from those who actively choose to opt in. Additionally, GCM's UI helpers are connected to the TRACE2 system via the Start() call in `ApplicationBase.cs`. Since this call records `Version` and `Start` events, ensure a corresponding `Exit` event is called before the helper process completes.
2 parents ce9f845 + 2476614 commit cf4b3e9

File tree

10 files changed

+11
-7
lines changed

10 files changed

+11
-7
lines changed

src/shared/Atlassian.Bitbucket.UI.Avalonia/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private static void AppMain(object o)
5555
.GetAwaiter()
5656
.GetResult();
5757

58+
context.Trace2.Stop(exitCode);
5859
Environment.Exit(exitCode);
5960
}
6061
}

src/shared/Core/Trace2.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,6 @@ private void TryParseSettings(TextWriter error, IFileSystem fileSystem)
200200
}
201201
}
202202
}
203-
204-
if (_writers.Count == 0)
205-
{
206-
error.WriteLine("warning: unable to set up TRACE2 tracing. No traces will be written.");
207-
}
208203
}
209204

210205
private void WriteVersion(
@@ -314,8 +309,9 @@ public abstract class Trace2Message
314309
[JsonProperty("sid", Order = 2)]
315310
public string Sid { get; set; }
316311

312+
// TODO: Remove this default value when TRACE2 regions are introduced.
317313
[JsonProperty("thread", Order = 3)]
318-
public string Thread { get; set; }
314+
public string Thread { get; set; } = "main";
319315

320316
[JsonProperty("time", Order = 4)]
321317
public DateTimeOffset Time { get; set; }

src/shared/Git-Credential-Manager.UI.Avalonia/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ private static void AppMain(object o)
5555
.GetAwaiter()
5656
.GetResult();
5757

58+
context.Trace2.Stop(exitCode);
5859
Environment.Exit(exitCode);
5960
}
6061
}

src/shared/Git-Credential-Manager/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public static void Main(string[] args)
2929
);
3030
}
3131
}
32-
32+
3333
//
3434
// Git Credential Manager's executable used to be named "git-credential-manager-core" before
3535
// dropping the "-core" suffix. In order to prevent "helper not found" errors for users who

src/shared/GitHub.UI.Avalonia/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ private static void AppMain(object o)
5757
.GetAwaiter()
5858
.GetResult();
5959

60+
context.Trace2.Stop(exitCode);
6061
Environment.Exit(exitCode);
6162
}
6263
}

src/shared/GitLab.UI.Avalonia/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ private static void AppMain(object o)
5454
.GetAwaiter()
5555
.GetResult();
5656

57+
context.Trace2.Stop(exitCode);
5758
Environment.Exit(exitCode);
5859
}
5960
}

src/windows/Atlassian.Bitbucket.UI.Windows/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static async Task Main(string[] args)
2828
.GetAwaiter()
2929
.GetResult();
3030

31+
context.Trace2.Stop(exitCode);
3132
Environment.Exit(exitCode);
3233
}
3334
}

src/windows/Git-Credential-Manager.UI.Windows/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static async Task Main(string[] args)
2828
.GetAwaiter()
2929
.GetResult();
3030

31+
context.Trace2.Stop(exitCode);
3132
Environment.Exit(exitCode);
3233
}
3334
}

src/windows/GitHub.UI.Windows/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public static async Task Main(string[] args)
3030
.GetAwaiter()
3131
.GetResult();
3232

33+
context.Trace2.Stop(exitCode);
3334
Environment.Exit(exitCode);
3435
}
3536
}

src/windows/GitLab.UI.Windows/Program.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ public static async Task Main(string[] args)
2828
.GetAwaiter()
2929
.GetResult();
3030

31+
context.Trace2.Stop(exitCode);
3132
Environment.Exit(exitCode);
3233
}
3334
}

0 commit comments

Comments
 (0)