diff --git a/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs b/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs
index 39fb5620..1914f454 100644
--- a/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs
+++ b/src/Microsoft.SqlTools.Hosting/Utility/CommandOptions.cs
@@ -22,6 +22,8 @@ namespace Microsoft.SqlTools.Hosting.Utility
///
/// Construct and parse command line options from the arguments array
///
+ /// The args to parse
+ /// Name of the service to display
public CommandOptions(string[] args, string serviceName)
{
ServiceName = serviceName;
@@ -89,7 +91,7 @@ namespace Microsoft.SqlTools.Hosting.Utility
///
/// Whether the program should exit immediately. Set to true when the usage is printed.
///
- public bool ShouldExit { get; private set; }
+ public bool ShouldExit { get; protected set; }
///
/// The locale our we should instantiate this service in
diff --git a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs
index 671f127b..263d97aa 100644
--- a/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs
+++ b/src/Microsoft.SqlTools.Hosting/Utility/Logger.cs
@@ -70,14 +70,14 @@ namespace Microsoft.SqlTools.Utility
///
public static void Flush()
{
- TraceSource.Flush();
+ TraceSource?.Flush();
Trace.Flush();
}
public static void Close()
{
Flush();
- TraceSource.Close();
+ TraceSource?.Close();
Trace.Close();
Listener = null; // Since we have closed the listener, set listener to null.
}
@@ -86,8 +86,11 @@ namespace Microsoft.SqlTools.Utility
get => tracingLevel;
set
{
- // configures the source level filter. This alone is not enough for tracing that is done via "Trace" class instead of "TraceSource" object
- TraceSource.Switch = new SourceSwitch(TraceSource.Name, value.ToString());
+ if(TraceSource != null)
+ {
+ // configures the source level filter. This alone is not enough for tracing that is done via "Trace" class instead of "TraceSource" object
+ TraceSource.Switch = new SourceSwitch(TraceSource.Name, value.ToString());
+ }
// configure the listener level filter
tracingLevel = value;
Listener.Filter = new EventTypeFilter(tracingLevel);
@@ -216,8 +219,8 @@ namespace Microsoft.SqlTools.Utility
TraceOutputOptions = TraceOptions.DateTime | TraceOptions.ProcessId | TraceOptions.ThreadId,
Filter = new EventTypeFilter(TracingLevel),
};
- TraceSource.Listeners.Clear();
- TraceSource.Listeners.Add(Listener);
+ TraceSource?.Listeners.Clear();
+ TraceSource?.Listeners.Add(Listener);
Trace.Listeners.Clear();
Trace.Listeners.Add(Listener);
}
diff --git a/src/Microsoft.SqlTools.ServiceLayer/Utility/ServiceLayerCommandOptions.cs b/src/Microsoft.SqlTools.ServiceLayer/Utility/ServiceLayerCommandOptions.cs
index 5298b4cb..3d52a18b 100644
--- a/src/Microsoft.SqlTools.ServiceLayer/Utility/ServiceLayerCommandOptions.cs
+++ b/src/Microsoft.SqlTools.ServiceLayer/Utility/ServiceLayerCommandOptions.cs
@@ -2,7 +2,9 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
+using System;
using System.Globalization;
+using System.Linq;
using Microsoft.SqlTools.Hosting.Utility;
namespace Microsoft.SqlTools.ServiceLayer.Utility
@@ -11,8 +13,36 @@ namespace Microsoft.SqlTools.ServiceLayer.Utility
{
internal const string ServiceLayerServiceName = "MicrosoftSqlToolsServiceLayer.exe";
- public ServiceLayerCommandOptions(string[] args) : base(args, ServiceLayerServiceName)
+ private static readonly string[] serviceLayerCommandArgs = { "-d", "--developers" };
+
+ /**
+ * List of contributors to this project, used as part of the onboarding process.
+ */
+ private readonly string[] contributors = new string[] {
+ // Put your Github username here!
+ "Charles-Gagnon"
+ };
+
+ public ServiceLayerCommandOptions(string[] args) : base(args.Where(arg => !serviceLayerCommandArgs.Contains(arg)).ToArray(), ServiceLayerServiceName)
{
+ for (int i = 0; i < args.Length; ++i)
+ {
+ string arg = args[i].ToLowerInvariant();
+
+ switch (arg)
+ {
+ case "-d":
+ case "--developers":
+ Console.WriteLine();
+ Console.WriteLine("**********************************************************************************");
+ Console.WriteLine("These are some of the developers who have contributed to this project - thank you!");
+ Console.WriteLine("**********************************************************************************");
+ Console.WriteLine();
+ Console.WriteLine(string.Join(Environment.NewLine, contributors.Select(contributor => $"\t{contributor}")));
+ this.ShouldExit = true;
+ break;
+ }
+ }
}
public override void SetLocale(string locale)