mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-02-16 10:58:30 -05:00
Fixed Azure Pipeline build warnings (#1254)
* Fixed Azure Pipeline build warnings * Removed variable declaration in SmoScriptableOperationWithFullDbAccess catch block.
This commit is contained in:
@@ -11,8 +11,6 @@ using System.Resources;
|
|||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlServer.Management.Diagnostics;
|
|
||||||
using System.Globalization;
|
|
||||||
using Microsoft.Data.SqlClient;
|
using Microsoft.Data.SqlClient;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -362,7 +360,7 @@ WHERE do.database_id = @DbID
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -574,7 +572,7 @@ WHERE do.database_id = @DbID
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,11 +9,8 @@ using Microsoft.SqlTools.ServiceLayer.Admin.Contracts;
|
|||||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
namespace Microsoft.SqlTools.ServiceLayer.Admin
|
||||||
@@ -168,8 +165,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Admin
|
|||||||
|
|
||||||
private static string GetBackupDate(DateTime backupDate)
|
private static string GetBackupDate(DateTime backupDate)
|
||||||
{
|
{
|
||||||
if (backupDate == null
|
if (backupDate < minBackupDate)
|
||||||
|| backupDate < minBackupDate)
|
|
||||||
{
|
{
|
||||||
return SR.NeverBackedUp;
|
return SR.NeverBackedUp;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,10 +6,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
|
||||||
using Microsoft.SqlServer.Management.Common;
|
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
|
||||||
using Microsoft.SqlServer.Management.Smo.Agent;
|
using Microsoft.SqlServer.Management.Smo.Agent;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.Agent.Contracts;
|
||||||
|
|
||||||
@@ -52,9 +48,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
Category = job.Category,
|
Category = job.Category,
|
||||||
CategoryId = job.CategoryID,
|
CategoryId = job.CategoryID,
|
||||||
CategoryType = job.CategoryType,
|
CategoryType = job.CategoryType,
|
||||||
LastRun = job.LastRun != null ? job.LastRun.ToString() : string.Empty,
|
LastRun = job.LastRun.ToString(),
|
||||||
NextRun = job.NextRun != null ? job.NextRun.ToString() : string.Empty,
|
NextRun = job.NextRun.ToString(),
|
||||||
JobId = job.JobID != null ? job.JobID.ToString() : null,
|
JobId = job.JobID.ToString(),
|
||||||
OperatorToEmail = job.OperatorToEmail,
|
OperatorToEmail = job.OperatorToEmail,
|
||||||
OperatorToPage = job.OperatorToPage,
|
OperatorToPage = job.OperatorToPage,
|
||||||
StartStepId = job.StartStepID,
|
StartStepId = job.StartStepID,
|
||||||
@@ -82,9 +78,9 @@ namespace Microsoft.SqlTools.ServiceLayer.Agent
|
|||||||
Category = job.Category,
|
Category = job.Category,
|
||||||
CategoryId = job.CategoryID,
|
CategoryId = job.CategoryID,
|
||||||
CategoryType = job.CategoryType,
|
CategoryType = job.CategoryType,
|
||||||
LastRun = job.LastRun != null ? job.LastRun.ToString() : string.Empty,
|
LastRun = job.LastRun.ToString(),
|
||||||
NextRun = job.NextRun != null ? job.NextRun.ToString() : string.Empty,
|
NextRun = job.NextRun.ToString(),
|
||||||
JobId = job.JobID != null ? job.JobID.ToString() : null,
|
JobId = job.JobID.ToString(),
|
||||||
OperatorToEmail = job.OperatorToEmail,
|
OperatorToEmail = job.OperatorToEmail,
|
||||||
OperatorToPage = job.OperatorToPage,
|
OperatorToPage = job.OperatorToPage,
|
||||||
StartStepId = job.StartStepID,
|
StartStepId = job.StartStepID,
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ namespace Microsoft.SqlTools.ServiceLayer.AzureFunctions
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Write(TraceEventType.Information, $"Failed to add sql binding. Error: {ex.Message}");
|
Logger.Write(TraceEventType.Information, $"Failed to add sql binding. Error: {ex.Message}");
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace Microsoft.SqlTools.ServiceLayer.AzureFunctions
|
|||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Write(TraceEventType.Information, $"Failed to get Azure functions. Error: {ex.Message}");
|
Logger.Write(TraceEventType.Information, $"Failed to get Azure functions. Error: {ex.Message}");
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ using Microsoft.Data.SqlClient;
|
|||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Admin;
|
|
||||||
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Management;
|
using Microsoft.SqlTools.ServiceLayer.Management;
|
||||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||||
@@ -453,10 +452,6 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery
|
|||||||
result = constDeviceTypeMediaSet;
|
result = constDeviceTypeMediaSet;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
throw ex;
|
|
||||||
}
|
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
this.serverConnection.SqlExecutionModes = executionMode;
|
this.serverConnection.SqlExecutionModes = executionMode;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ using Microsoft.SqlServer.Management.Common;
|
|||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
using Microsoft.SqlTools.ServiceLayer.DisasterRecovery.Contracts;
|
||||||
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
using Microsoft.SqlTools.ServiceLayer.TaskServices;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Utility;
|
|
||||||
using Microsoft.SqlTools.Utility;
|
using Microsoft.SqlTools.Utility;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
@@ -318,7 +317,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DisasterRecovery.RestoreOperation
|
|||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
Logger.Write(TraceEventType.Information, $"Failed to execute restore task. error: {ex.Message}");
|
Logger.Write(TraceEventType.Information, $"Failed to execute restore task. error: {ex.Message}");
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,21 +5,15 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
|
||||||
using System.Security;
|
using System.Security;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
|
||||||
using Microsoft.SqlServer.Management.Common;
|
using Microsoft.SqlServer.Management.Common;
|
||||||
using Microsoft.SqlServer.Management.Diagnostics;
|
|
||||||
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
using Microsoft.SqlServer.Management.Sdk.Sfc;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlTools.ServiceLayer.Connection;
|
using Microsoft.SqlTools.ServiceLayer.Connection;
|
||||||
using Assembly = System.Reflection.Assembly;
|
|
||||||
|
|
||||||
namespace Microsoft.SqlTools.ServiceLayer.Management
|
namespace Microsoft.SqlTools.ServiceLayer.Management
|
||||||
{
|
{
|
||||||
@@ -773,22 +767,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Management
|
|||||||
if (site != null)
|
if (site != null)
|
||||||
{
|
{
|
||||||
// see if service provider supports INodeInformation interface from the object explorer
|
// see if service provider supports INodeInformation interface from the object explorer
|
||||||
try
|
// NOTE: we're trying to forcefully set connection information on the data container.
|
||||||
|
// If this code doesn't execute, then dc.Init call below will result in CDataContainer
|
||||||
|
// initializing its ConnectionInfo member with a new object contructed off the parameters
|
||||||
|
// in the XML doc [server name, user name etc]
|
||||||
|
IManagedConnection managedConnection = site.GetService(typeof(IManagedConnection)) as IManagedConnection;
|
||||||
|
if (managedConnection != null)
|
||||||
{
|
{
|
||||||
// NOTE: we're trying to forcefully set connection information on the data container.
|
this.SetManagedConnection(managedConnection);
|
||||||
// If this code doesn't execute, then dc.Init call below will result in CDataContainer
|
|
||||||
// initializing its ConnectionInfo member with a new object contructed off the parameters
|
|
||||||
// in the XML doc [server name, user name etc]
|
|
||||||
IManagedConnection managedConnection = site.GetService(typeof(IManagedConnection)) as IManagedConnection;
|
|
||||||
if (managedConnection != null)
|
|
||||||
{
|
|
||||||
this.SetManagedConnection(managedConnection);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
// keep the exception flowing
|
|
||||||
throw ex;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ using System.Collections.Generic;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using Microsoft.SqlServer.Management.Smo;
|
using Microsoft.SqlServer.Management.Smo;
|
||||||
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
using Microsoft.SqlTools.ServiceLayer.ObjectExplorer.Nodes;
|
||||||
@@ -40,11 +39,9 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
string error = string.Format(CultureInfo.InvariantCulture, "Failed expanding oe children. parent:{0} error:{1} inner:{2} stacktrace:{3}",
|
string error = string.Format(CultureInfo.InvariantCulture, "Failed expanding oe children. parent:{0} error:{1} inner:{2} stacktrace:{3}",
|
||||||
parent != null ? parent.GetNodePath() : "", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
|
parent != null ? parent.GetNodePath() : "", ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
|
||||||
Logger.Write(TraceEventType.Error, error);
|
Logger.Write(TraceEventType.Error, error);
|
||||||
throw ex;
|
throw;
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return allChildren;
|
return allChildren;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,7 +142,7 @@ namespace Microsoft.SqlTools.ServiceLayer.ObjectExplorer.SmoModel
|
|||||||
string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}",
|
string error = string.Format(CultureInfo.InvariantCulture, "Failed getting smo objects. parent:{0} querier: {1} error:{2} inner:{3} stacktrace:{4}",
|
||||||
parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
|
parent != null ? parent.GetNodePath() : "", querier.GetType(), ex.Message, ex.InnerException != null ? ex.InnerException.Message : "", ex.StackTrace);
|
||||||
Logger.Write(TraceEventType.Error, error);
|
Logger.Write(TraceEventType.Error, error);
|
||||||
throw ex;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -65,13 +65,9 @@ namespace Microsoft.SqlTools.ServiceLayer.TaskServices
|
|||||||
hasAccessToDb = GainAccessToDatabase();
|
hasAccessToDb = GainAccessToDatabase();
|
||||||
base.Execute(mode);
|
base.Execute(mode);
|
||||||
}
|
}
|
||||||
catch (DatabaseFullAccessException databaseFullAccessException)
|
catch (DatabaseFullAccessException)
|
||||||
{
|
{
|
||||||
Logger.Write(TraceEventType.Warning, $"Failed to gain access to database. server|database:{ServerName}|{DatabaseName}");
|
Logger.Write(TraceEventType.Warning, $"Failed to gain access to database. server|database:{ServerName}|{DatabaseName}");
|
||||||
throw databaseFullAccessException;
|
|
||||||
}
|
|
||||||
catch
|
|
||||||
{
|
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|||||||
Reference in New Issue
Block a user