mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-26 01:25:42 -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user