-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: add trace2 to config/env documentation
Add Trace2 config/env var options to GCM's configuration/environment documentation to improve discoverability.
- Loading branch information
1 parent
d6a4cf3
commit f6d82a8
Showing
6 changed files
with
399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
src/shared/Atlassian.Bitbucket.UI.Avalonia/Program_BACKUP_61045.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Threading; | ||
using Atlassian.Bitbucket.UI.Commands; | ||
using Atlassian.Bitbucket.UI.Controls; | ||
using Avalonia; | ||
using GitCredentialManager; | ||
using GitCredentialManager.UI; | ||
|
||
namespace Atlassian.Bitbucket.UI | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// If we have no arguments then just start the app with the test window. | ||
if (args.Length == 0) | ||
{ | ||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); | ||
return; | ||
} | ||
|
||
// Create the dispatcher on the main thread. This is required | ||
// for some platform UI services such as macOS that mandates | ||
// all controls are created/accessed on the initial thread | ||
// created by the process (the process entry thread). | ||
Dispatcher.Initialize(); | ||
|
||
// Run AppMain in a new thread and keep the main thread free | ||
// to process the dispatcher's job queue. | ||
var appMain = new Thread(AppMain) {Name = nameof(AppMain)}; | ||
appMain.Start(args); | ||
|
||
// Process the dispatcher job queue (aka: message pump, run-loop, etc...) | ||
// We must ensure to run this on the same thread that it was created on | ||
// (the main thread) so we cannot use any async/await calls between | ||
// Dispatcher.Create and Run. | ||
Dispatcher.MainThread.Run(); | ||
|
||
// Execution should never reach here as AppMain terminates the process on completion. | ||
throw new InvalidOperationException("Main dispatcher job queue shutdown unexpectedly"); | ||
} | ||
|
||
private static void AppMain(object o) | ||
{ | ||
string[] args = (string[]) o; | ||
|
||
// Set the session id (sid) for the helper process, to be | ||
// used when TRACE2 tracing is enabled. | ||
ProcessManager.CreateSid(); | ||
using (var context = new CommandContext()) | ||
using (var app = new HelperApplication(context)) | ||
{ | ||
// Initialize TRACE2 system | ||
context.Trace2.Initialize(DateTimeOffset.UtcNow); | ||
|
||
// Write the start and version events | ||
context.Trace2.Start(context.ApplicationPath, args); | ||
|
||
app.RegisterCommand(new CredentialsCommandImpl(context)); | ||
|
||
int exitCode = app.RunAsync(args) | ||
.ConfigureAwait(false) | ||
.GetAwaiter() | ||
.GetResult(); | ||
|
||
context.Trace2.Stop(exitCode); | ||
Environment.Exit(exitCode); | ||
} | ||
} | ||
|
||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure(() => new AvaloniaApp(() => new TesterWindow())) | ||
.UsePlatformDetect() | ||
.LogToTrace(); | ||
} | ||
} |
77 changes: 77 additions & 0 deletions
77
src/shared/Atlassian.Bitbucket.UI.Avalonia/Program_BASE_61045.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Threading; | ||
using Atlassian.Bitbucket.UI.Commands; | ||
using Atlassian.Bitbucket.UI.Controls; | ||
using Avalonia; | ||
using GitCredentialManager; | ||
using GitCredentialManager.UI; | ||
|
||
namespace Atlassian.Bitbucket.UI | ||
{ | ||
public static class Program | ||
{ | ||
public static void Main(string[] args) | ||
{ | ||
// If we have no arguments then just start the app with the test window. | ||
if (args.Length == 0) | ||
{ | ||
BuildAvaloniaApp().StartWithClassicDesktopLifetime(args); | ||
return; | ||
} | ||
|
||
// Create the dispatcher on the main thread. This is required | ||
// for some platform UI services such as macOS that mandates | ||
// all controls are created/accessed on the initial thread | ||
// created by the process (the process entry thread). | ||
Dispatcher.Initialize(); | ||
|
||
// Run AppMain in a new thread and keep the main thread free | ||
// to process the dispatcher's job queue. | ||
var appMain = new Thread(AppMain) {Name = nameof(AppMain)}; | ||
appMain.Start(args); | ||
|
||
// Process the dispatcher job queue (aka: message pump, run-loop, etc...) | ||
// We must ensure to run this on the same thread that it was created on | ||
// (the main thread) so we cannot use any async/await calls between | ||
// Dispatcher.Create and Run. | ||
Dispatcher.MainThread.Run(); | ||
|
||
// Execution should never reach here as AppMain terminates the process on completion. | ||
throw new InvalidOperationException("Main dispatcher job queue shutdown unexpectedly"); | ||
} | ||
|
||
private static void AppMain(object o) | ||
{ | ||
string[] args = (string[]) o; | ||
|
||
// Set the session id (sid) for the helper process, to be | ||
// used when TRACE2 tracing is enabled. | ||
SidManager.CreateSid(); | ||
using (var context = new CommandContext()) | ||
using (var app = new HelperApplication(context)) | ||
{ | ||
// Initialize TRACE2 system | ||
context.Trace2.Initialize(DateTimeOffset.UtcNow); | ||
|
||
// Write the start and version events | ||
context.Trace2.Start(context.ApplicationPath, args); | ||
|
||
app.RegisterCommand(new CredentialsCommandImpl(context)); | ||
|
||
int exitCode = app.RunAsync(args) | ||
.ConfigureAwait(false) | ||
.GetAwaiter() | ||
.GetResult(); | ||
|
||
context.Trace2.Stop(exitCode); | ||
Environment.Exit(exitCode); | ||
} | ||
} | ||
|
||
public static AppBuilder BuildAvaloniaApp() | ||
=> AppBuilder.Configure(() => new AvaloniaApp(() => new TesterWindow())) | ||
.UsePlatformDetect() | ||
.LogToTrace(); | ||
} | ||
} |
Empty file.
Oops, something went wrong.