mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-19 17:23:55 -05:00
Fix invalid dacpac version crashing sqltoolsservice (#789)
* fix invalid dacpac version crashing sqltoolsservice
This commit is contained in:
@@ -22,7 +22,7 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx.Contracts
|
||||
/// <summary>
|
||||
/// Gets or sets the version of the DAC application
|
||||
/// </summary>
|
||||
public Version ApplicationVersion { get; set; }
|
||||
public string ApplicationVersion { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -10,6 +10,7 @@ using Microsoft.SqlTools.Utility;
|
||||
using System;
|
||||
using System.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
{
|
||||
@@ -28,7 +29,19 @@ namespace Microsoft.SqlTools.ServiceLayer.DacFx
|
||||
|
||||
public override void Execute()
|
||||
{
|
||||
this.DacServices.Extract(this.Parameters.PackageFilePath, this.Parameters.DatabaseName, this.Parameters.ApplicationName, this.Parameters.ApplicationVersion, null, null, null, this.CancellationToken);
|
||||
Version version = ParseVersion(this.Parameters.ApplicationVersion);
|
||||
this.DacServices.Extract(this.Parameters.PackageFilePath, this.Parameters.DatabaseName, this.Parameters.ApplicationName, version, null, null, null, this.CancellationToken);
|
||||
}
|
||||
|
||||
public static Version ParseVersion(string incomingVersion)
|
||||
{
|
||||
Version parsedVersion;
|
||||
if (!Version.TryParse(incomingVersion, out parsedVersion))
|
||||
{
|
||||
throw new ArgumentException(string.Format(SR.ExtractInvalidVersion, incomingVersion));
|
||||
}
|
||||
|
||||
return parsedVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2869,6 +2869,14 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
}
|
||||
}
|
||||
|
||||
public static string ExtractInvalidVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
return Keys.GetString(Keys.ExtractInvalidVersion);
|
||||
}
|
||||
}
|
||||
|
||||
public static string ConnectionServiceListDbErrorNotConnected(string uri)
|
||||
{
|
||||
return Keys.GetString(Keys.ConnectionServiceListDbErrorNotConnected, uri);
|
||||
@@ -4182,6 +4190,9 @@ namespace Microsoft.SqlTools.ServiceLayer
|
||||
public const string Error_ExistingDirectoryName = "Error_ExistingDirectoryName";
|
||||
|
||||
|
||||
public const string ExtractInvalidVersion = "ExtractInvalidVersion";
|
||||
|
||||
|
||||
private Keys()
|
||||
{ }
|
||||
|
||||
|
||||
@@ -1687,4 +1687,8 @@
|
||||
<value>For directory {0} a file with name {1} already exist</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
<data name="ExtractInvalidVersion" xml:space="preserve">
|
||||
<value>Invalid version '{0}' passed. Version must be in the format x.x.x.x where x is a number.</value>
|
||||
<comment></comment>
|
||||
</data>
|
||||
</root>
|
||||
|
||||
@@ -782,4 +782,8 @@ JobServerIsNotAvailable = Job server is not available
|
||||
|
||||
NeverBackedUp = Never
|
||||
Error_InvalidDirectoryName = Path {0} is not a valid directory
|
||||
Error_ExistingDirectoryName = For directory {0} a file with name {1} already exist
|
||||
Error_ExistingDirectoryName = For directory {0} a file with name {1} already exist
|
||||
|
||||
############################################################################
|
||||
# DacFx
|
||||
ExtractInvalidVersion = Invalid version '{0}' passed. Version must be in the format x.x.x.x where x is a number.
|
||||
@@ -1956,6 +1956,11 @@
|
||||
<target state="new">Batch parser wrapper execution: {0} found... at line {1}: {2} Description: {3}</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
<trans-unit id="ExtractInvalidVersion">
|
||||
<source>Invalid version '{0}' passed. Version must be in the format x.x.x.x where x is a number.</source>
|
||||
<target state="new">Invalid version '{0}' passed. Version must be in the format x.x.x.x where x is a number.</target>
|
||||
<note></note>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
Reference in New Issue
Block a user