From 335e9fb38cda7750087cf155ebd6b1896ccd3b12 Mon Sep 17 00:00:00 2001 From: ranasaria <41588310+ranasaria@users.noreply.github.com> Date: Tue, 25 Sep 2018 17:26:22 -0700 Subject: [PATCH] Logging for ga (#698) Adding a robustness change to call close on logger before process exit. Also adding a designer.cs file needed by a script csproj that got missed out in previous checkin due to .gitignore entry. --- src/Microsoft.SqlTools.Credentials/Program.cs | 4 + .../Program.cs | 6 +- .../Program.cs | 4 + .../Properties/Resources.Designer.cs | 189 ++++++++++++++++++ 4 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 test/ScriptGenerator/Properties/Resources.Designer.cs diff --git a/src/Microsoft.SqlTools.Credentials/Program.cs b/src/Microsoft.SqlTools.Credentials/Program.cs index 0301a8cf..2a72f3bf 100644 --- a/src/Microsoft.SqlTools.Credentials/Program.cs +++ b/src/Microsoft.SqlTools.Credentials/Program.cs @@ -62,6 +62,10 @@ namespace Microsoft.SqlTools.Credentials Logger.WriteWithCallstack(TraceEventType.Critical, $"An unhandled exception occurred: {e}"); Environment.Exit(1); } + finally + { + Logger.Close(); + } } } } diff --git a/src/Microsoft.SqlTools.ResourceProvider/Program.cs b/src/Microsoft.SqlTools.ResourceProvider/Program.cs index cde1d33f..d0ab5f05 100644 --- a/src/Microsoft.SqlTools.ResourceProvider/Program.cs +++ b/src/Microsoft.SqlTools.ResourceProvider/Program.cs @@ -61,7 +61,11 @@ namespace Microsoft.SqlTools.ResourceProvider catch (Exception e) { Logger.WriteWithCallstack(TraceEventType.Critical, $"An unhandled exception occurred: {e}"); - Environment.Exit(1); + Environment.Exit(1); + } + finally + { + Logger.Close(); } } } diff --git a/src/Microsoft.SqlTools.ServiceLayer/Program.cs b/src/Microsoft.SqlTools.ServiceLayer/Program.cs index 7a2e6070..a6adb8a8 100644 --- a/src/Microsoft.SqlTools.ServiceLayer/Program.cs +++ b/src/Microsoft.SqlTools.ServiceLayer/Program.cs @@ -58,6 +58,10 @@ namespace Microsoft.SqlTools.ServiceLayer Logger.WriteWithCallstack(TraceEventType.Critical, $"An unhandled exception occurred: {e}"); Environment.Exit(1); } + finally + { + Logger.Close(); + } } } } diff --git a/test/ScriptGenerator/Properties/Resources.Designer.cs b/test/ScriptGenerator/Properties/Resources.Designer.cs new file mode 100644 index 00000000..b39eda2f --- /dev/null +++ b/test/ScriptGenerator/Properties/Resources.Designer.cs @@ -0,0 +1,189 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace ScriptGenerator.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ScriptGenerator.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to USE [master] + ///GO + ////****** Object: Database [AdventureWorks] Script Date: 9/6/2018 12:11:50 PM ******/ + ///CREATE DATABASE [AdventureWorks] + /// CONTAINMENT = NONE + /// ON PRIMARY + ///( NAME = N'AdventureWorks_Data', FILENAME = N'D:\sql\14.0.1000.169\sqlservr\data\AdventureWorks_Data.mdf' , SIZE = 174080KB , MAXSIZE = UNLIMITED, FILEGROWTH = 16384KB ) + /// LOG ON + ///( NAME = N'AdventureWorks_Log', FILENAME = N'D:\sql\14.0.1000.169\sqlservr\data\AdventureWorks_Log.ldf' , SIZE = 18432KB , MAXSIZE = 2048GB , FILEGROWTH = [rest of string was truncated]";. + /// + internal static string AdventureWorks { + get { + return ResourceManager.GetString("AdventureWorks", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to USE [AdventureWorks] + ///GO + ///SET ANSI_NULLS OFF + ///GO + ///SET QUOTED_IDENTIFIER OFF + ///GO + /// + ///CREATE PROCEDURE [dbo].[AllocatePageInMixedExtent] + /// @dbName [dbo].[SinglePartNameType], + /// @p [dbo].[Partition], + /// @pg [dbo].[PageId] + ///WITH EXECUTE AS CALLER + ///AS + ///EXTERNAL NAME [AMAPI].[SqlTest.Api.OnDiskStructures.Corruptions].[AllocatePageInMixedExtent] + ///GO + ////****** Object: StoredProcedure [dbo].[AllocatePageInUniformExtent] Script Date: 9/6/2018 12:11:53 PM ******/ + ///SET ANSI_NULLS OFF + ///GO + ///SET QUOTED_IDENTIFIER OFF + ///GO [rest of string was truncated]";. + /// + internal static string AdventureWorksStoredProceduresCreate { + get { + return ResourceManager.GetString("AdventureWorksStoredProceduresCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to USE [AdventureWorks] + ///GO + ////****** Object: Table [Sales].[Customer] Script Date: 9/6/2018 12:11:50 PM ******/ + ///SET ANSI_NULLS ON + ///GO + ///SET QUOTED_IDENTIFIER ON + ///GO + ///CREATE TABLE [Sales].[Customer]( + /// [CustomerID] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL, + /// [TerritoryID] [int] NULL, + /// [AccountNumber] AS (isnull('AW'+[dbo].[ufnLeadingZeros]([CustomerID]),'')), + /// [CustomerType] [nchar](1) NOT NULL, + /// [rowguid] [uniqueidentifier] ROWGUIDCOL NOT NULL, + /// [ModifiedDate] [datetime] NOT NULL, + /// CONSTRAIN [rest of string was truncated]";. + /// + internal static string AdventureWorksTablesCreate { + get { + return ResourceManager.GetString("AdventureWorksTablesCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to USE [AdventureWorks] + ///GO + /// + ///SET ANSI_NULLS ON + ///GO + ///SET QUOTED_IDENTIFIER ON + ///GO + /// + /// + /// + ///CREATE VIEW [Person].[vAdditionalContactInfo] + ///AS + ///SELECT + /// [ContactID] + /// ,[FirstName] + /// ,[MiddleName] + /// ,[LastName] + /// ,[ContactInfo].ref.value(N'declare namespace ci="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactInfo"; + /// declare namespace act="http://schemas.microsoft.com/sqlserver/2004/07/adventure-works/ContactTypes"; + /// (act:telephoneNumber)[1]/act:number', 'n [rest of string was truncated]";. + /// + internal static string AdventureWorksViewsCreate { + get { + return ResourceManager.GetString("AdventureWorksViewsCreate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to USE [master] + ///GO + ///Exec sp_configure 'show advanced option', '1'; RECONFIGURE; + ///go + ///EXEC sp_configure 'clr strict security', 0; RECONFIGURE; + ///go + ///. + /// + internal static string TurnOffClrStrictSecurityMode { + get { + return ResourceManager.GetString("TurnOffClrStrictSecurityMode", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to USE [master] + ///GO + /// + ///EXEC sp_configure 'clr strict security', 1; RECONFIGURE; + ///go + ///Exec sp_configure 'show advanced option', '0'; RECONFIGURE; + ///go. + /// + internal static string TurnOnClrStrictSecurityMode { + get { + return ResourceManager.GetString("TurnOnClrStrictSecurityMode", resourceCulture); + } + } + } +}