GithubHelp home page GithubHelp logo

microsoft / sqltoolsservice Goto Github PK

View Code? Open in Web Editor NEW
438.0 60.0 146.0 298.19 MB

SQL Tools API service that provides SQL Server data management capabilities.

License: Other

C# 86.92% Batchfile 0.02% Smalltalk 0.03% PowerShell 0.08% Shell 0.04% TSQL 12.91% Jupyter Notebook 0.01%

sqltoolsservice's Introduction

Build Status Build Status

Microsoft SQL Tools Service

The SQL Tools Service is an application that provides core functionality for various SQL Server tools. These features include the following:

  • Connection management
  • Language Service support using VS Code protocol
  • Query execution and resultset management

SQL Tools Service API Documentation

Please see the SQL Tools Service API documentation at https://microsoft.github.io/sqltoolssdk/.

Setup, Building and Testing the codebase

Please see the SQL Tools Service wiki documentation at https://github.com/Microsoft/sqltoolsservice/wiki

Contribution Guidelines

We welcome many kinds of community contributions to this project! Whether it's a feature implementation, bug fix, or a good idea, please create an issue so that we can discuss it. It is not necessary to create an issue before sending a pull request but it may speed up the process if we can discuss your idea before you start implementing it.

Because this project exposes a couple different public APIs, we must be very mindful of any potential breaking changes. Some contributions may not be accepted if they risk introducing breaking changes or if they don't match the goals of the project. The core maintainer team has the right of final approval over any contribution to this project. However, we are very happy to hear community feedback on any decision so that we can ensure we are solving the right problems in the right way.

Ways to Contribute

  • File a bug or feature request as an issue
  • Comment on existing issues to give your feedback on how they should be fixed/implemented
  • Contribute a bug fix or feature implementation by submitting a pull request
  • Review the pull requests that others submit to ensure they follow [established guidelines] (#pull-request-guidelines)

Code Contribution Guidelines

Here's a high level list of guidelines to follow to ensure your code contribution is accepted:

  • Follow established guidelines for coding style and design

  • Follow established guidelines for commit hygiene

  • Write unit tests to validate new features and bug fixes

  • Ensure that the 'Release' build and unit tests pass locally

  • Respond to all review feedback and final commit cleanup

Practice Good Commit Hygiene

First of all, make sure you are practicing good commit hygiene so that your commits provide a good history of the changes you are making. To be more specific:

  • Write good commit messages

    Commit messages should be clearly written so that a person can look at the commit log and understand how and why a given change was made. Here is a great model commit message taken from a blog post by Tim Pope:

    Capitalized, short (50 chars or less) summary
    
    More detailed explanatory text, if necessary.  Wrap it to about 72
    characters or so.  In some contexts, the first line is treated as the
    subject of an email and the rest of the text as the body.  The blank
    line separating the summary from the body is critical (unless you omit
    the body entirely); tools like rebase can get confused if you run the
    two together.
    
    Write your commit message in the imperative: "Fix bug" and not "Fixed bug"
    or "Fixes bug."  This convention matches up with commit messages generated
    by commands like git merge and git revert.
    
    Further paragraphs come after blank lines.
    
    - Bullet points are okay, too
    
    - Typically a hyphen or asterisk is used for the bullet, followed by a
      single space, with blank lines in between, but conventions vary here
    
    - Use a hanging indent
    

    A change that fixes a known bug with an issue filed should use the proper syntax so that the issue is automatically closed once your change is merged. Here's an example of what such a commit message should look like:

    Fix #3: Catch NullReferenceException from DoThing
    
    This change adds a try/catch block to catch a NullReferenceException that
    gets thrown by DoThing [...]
    
  • Squash your commits

    If you are introducing a new feature but have implemented it over multiple commits, please squash those commits into a single commit that contains all the changes in one place. This especially applies to any "oops" commits where a file is forgotten or a typo is being fixed. Following this approach makes it a lot easier to pull those changes to other branches or roll back the change if necessary.

  • Keep individual commits for larger changes

    You can certainly maintain individual commits for different phases of a big change. For example, if you want to reorganize some files before adding new functionality, have your first commit contain all of the file move changes and then the following commit can have all of the feature additions. We highly recommend this approach so that larger commits don't turn into a jumbled mess.

Add Unit Tests for New Code

If you're adding a new feature to the project, please make sure to include adequate nUnit tests with your change.

We do both component-level and scenario-level testing depending on what code is being tested. We don't expect contributors to test every possible edge case. Testing mainline scenarios and the most common failure scenarios is often good enough.

We are very happy to accept unit test contributions for any feature areas that are more error-prone than others. Also, if you find that a feature fails for you in a specific case, please feel free to file an issue that includes a unit test which reproduces the problem. This will allow us to quickly implement a fix that resolves the problem.

Build 'Release' Before Submitting

Before you send out your pull request, make sure that you have run a Release configuration build of the project and that all new and existing tests are passing. The Release configuration build ensures that all public API interfaces have been documented correctly otherwise it throws an error. We have turned on this check so that our project will always have good generated documentation.

Follow the Pull Request Process

  • Create a new branch from which to submit your Pull Request

    Commits directly to main are not allowed - instead you will create a new branch and then submit a PR to merge changes from that branch into main.

    See About branches for more information about branching and how to create a new branch.

  • Create your pull request

    Use the typical process to send a pull request from your fork of the project. In your pull request message, please give a high-level summary of the changes that you have made so that reviewers understand the intent of the changes. You should receive initial comments within a day or two, but please feel free to ping if things are taking longer than expected.

  • The build and unit tests must run green

    Run all unit tests to ensure all tests are passing and are not negatively impacted by your change.

  • Respond to code review feedback

    If the reviewers ask you to make changes, make them as a new commit to your branch and push them so that they are made available for a final review pass. Do not rebase the fixes just yet so that the commit hash changes don't upset GitHub's pull request UI.

  • If necessary, do a final rebase

    Once your final changes have been accepted, we may ask you to do a final rebase to have your commits so that they follow our commit guidelines. If specific guidance is given, please follow it when rebasing your commits. Once you do your final push we will merge your changes!

sqltoolsservice's People

Contributors

aasimkhan30 avatar alanrenmsft avatar barbaravaldez avatar benjin avatar benrr101 avatar caohai avatar charles-gagnon avatar cheenamalhotra avatar coquagli avatar corivera avatar csigs avatar cssuh avatar dependabot[bot] avatar erpett avatar gupta1 avatar hyoshis avatar justinmdotnet avatar kburtram avatar kevcunnane avatar kisantia avatar lewis-sanchez avatar llali avatar mattirv avatar mitchellsternke avatar nofield avatar sharonravindran avatar shueybubbles avatar smartguest avatar ssreerama avatar udeeshagautam avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sqltoolsservice's Issues

Where can I find Microsoft.SqlServer.XEvent.Linq.QueryableXEventData?

Looks like Microsoft.SqlServer.XEvent.Linq.dll has been removed. It was found in previous versions, including microsoft.sqlserver.sqlmanagementobjects.150.18040.0-preview

Either way, I'm looking for QueryableXEventData which is awesome and useful. When I try to load the DLL from old versions including microsoft.sqlserver.sqlmanagementobjects.150.18040.0-preview, I get

Add-Type : Could not load file or assembly 'Microsoft.SqlServer.Xe.Core.dll' or one of its dependencies. The specified module could not be found.

How can I get this class back? I'm using this version of SMO

image

Thanks much,
Chrissy

v1.0.0-alpha.38 - .Net Core 2.0 build - SMO discrepancies

I understand that this is a work in progress. So, I just want to point out a discrepancies I found when building data object when executing T-SQL queries with SMO .ExecuteWithResults() method.

I'm comparing using the Windows SQL Server SMO vs the '1.0.0-alpha.38 - .Net Core 2.0 build'. In Windows SMO, I can use the columns in the result dataset. But, in the '.NET Core 2.0 Build', it excluding the columns and instead giving the data in the .ItemArray property (which is looking like a Python list).

This could be a major breaking change for people that have invested time building SMO scripts.

See image below.
smo_discrepancies_2017-06-19_13-05-31

Sql Parser is not parsing the OVER clause

It appears that the Sql Parser is not parsing the OVER clause.

For example with an expression like LAG(o.[col1]) OVER(ORDER BY o.[col2], the OVER clause is tokenized but is not even part of the AST.

This is causing issues for us as we can't validate the OVER clause with our visitor (since the over clause is not in the AST, it is not visited).

I'm guessing this means that formatting and auto-completion won't work either inside the over clause (although I couldn't test this).

Any samples to provide basic autocompletion / error reporting?

Hi,
I would like to allow users of my web app to write custom sql query in their browser.
The query occur against a few well known tables and should be readonly (no update/delete/create).

Ideally, the queries should be validated and I came across this project.
It's quite overwhelming though and I don't know where to start to provide basic intellisense and error reporting to the user.

I was thinking that the query being written by the user could be sent to the server (.net) periodically and the GUI could check the results and provide feedback to the users.
Any basic samples out there? Not sure where to even look.
I had a look at https://github.com/Microsoft/vscode-mssql/tree/master/src/languageservice but there doesn't seem to be much there.

sqltoolservice is broken on Ubuntu 17.04

The service as used by vscode-mssql and mssql-scripter is broken on Ubuntu 17.04. This also includes the alpha build that uses .NET Core 2.0 preview as used in the alpha builds of vscode-mssql.

Can't get AccessToken to persist, but only sometimes

I successfully added AccessToken support to dbatools but it seems to only work partially. Here's some code for a repro:

$params = @{
    Type            = 'ManagedIdentity'
    Subtype         = 'AzureSqlDb'
    EnableException = $true
}
$token = New-DbaAzAccessToken @params

$params = @{
    SqlInstance = 'psdbatools.database.windows.net'
    Database    = 'abc'
    AccessToken = $token
}

# This will connect successfully. You can even do $azSqlCn.Databases.Name and get the db names
$azSqlCn = Connect-DbaInstance @params

# This will break
Get-DbatoolsLog | Select -First 1 | Write-DbaDataTable -SqlInstance $azSqlCn -Database abc -Table ThisisErrorLog -AutoCreateTable

The last command should write to the $azSqlCn instance. But instead I get System.Data.SqlClient.SqlException: Login failed for user ''. This unanswered question had similar things and I wondered if it was because it changed the db context or something? Either way, I tried for like a week and could not get it to work - kept getting that Login failed for user ''.

Any advice would be appreciated.

Issues with Microsoft.SqlServer.SqlManagementObjects

Hi,
I apologize if this tracker is the wrong one, but maybe you know how to to contact the owners of the following package, as it is used by your package and both are apparently owned by Microsoft SQL Tools. I tried contacting the owners via Nuget contact information but never received any reply:
https://www.nuget.org/packages/Microsoft.SqlServer.SqlManagementObjects/

  1. The above nuget package targets netfx (4.0) and netcoreapp2.0. Is there any reason why it does not target netstandard2.0? With netcoreapp2.0 I need to multi-target my internal libraries for my products for both netfx, netcoreapp, as I have products sharing the same libraries but targeting different platforms.

  2. The package does not copy the correct native runtime libs for the new PackageReference system and the new sdk style csproject, as the targets file does not properly work . I can provide a repro if necessary

So currently the above mentioned package is kinda broken.

Thanks

handling of hierachyid datatype

we are handling it as byte[] data type and as a result, when using Edit Data for a table with this type of columns in Azure Data Studio, we will get an error indicating cannot convert string to byte[].

this issue is found while editing the OrganizationNode column of HumanResources.Employee table in adventureWorks database.

BTW, SSMS handles this data type properly.

Code analysis feature

Hello,

I think that static code analysis will be a great feature for the extension. Is it possible to make analyzer like eslint using the current SQL parser?

Need to understand How-To properly install 'ServiceLayer' in Linux.

As I finally got Linux SMO piece working in Linux, I failed to mention that it was on Windows 10 Insider (16215) Bash. During my preparation to the South Florida SQLSaturday session, I discover that the behavior between Windows 10 Bash and Ubuntu is different.

I've created the 'sqltoolsservice' folder on my home user location in both Win10 Bash and Ubuntu. Now, in Win10 Bash I haven't add the sqltoolsservice folder to the PATH and I can run my PowerShell SMO script without any error.

smo_01_2017-06-10_21-59-38

Now, in Ubuntu, I have to change folder to sqltoolsservice in order to run my PowerShell SMO script. Also, I added the both path: "/home/maxt/sqltoolsservice: .../refs:$PATH" in the ~/.bashrc with no result.

smo_02_2017-06-10_21-59-38

So, what I'm doing wrong?? Any hint!

Greatly Appreciated,
:)

Use this library to format sql from a .net framework app?

It seems the docs are somewhat lacking.
We'd love to use the sql formatting functionality to format some sql scripts.
Our app is a .net app (full framework, not core), but we can't find any nuget package to pull this library.
Is this possible to do?

TSQLDebugger

TSQL Debugger have been deprecated in SSMS 18.0.
I`m sure that many persons think it is a usefull tool, why don't bring it back in Azure Database Studio?

Support for other SQL servers or allowing extensions to do so?

Since Azure can support other SQL sever types like MySQL or PostgreSQL are there plans to support them or allow extensions for different flavors of SQL/or even NoSQL. I could envision this as a platform for managing data connections similar to how VSCode allows for any language to be used through extensions. Even if Microsoft doesn't support the plugins directly it would be nice to only have one platform to be able to query from.

Fix Baseline Test string compare logic

Currently, the baseline files for BatchParser tests are being compared without any whitespace/newline characters. A better logic to compare baseline files should be implemented.

Using dotnet core linker

Dotnet core has a built in linker that can be used to decrease the overall package size of our application, by passing in the -o linked argument into the publish command.

In my testing it reduced the size of the binaries from 435 files totalling 119 MB to 15 files totalling 4.3 MB. This is quite the savings.

Could not load file or assembly 'Microsoft.SqlServer.ServiceBrokerEnum,

Hi,
I apologize if this tracker is the wrong one, but maybe you can help me with this package
https://www.nuget.org/packages/Microsoft.SqlServer.SqlManagementObjects/

When I try to get the collection of Service Broker queues, i get the the following excpetion. Is there a package I'm missing?

Could not load file or assembly 'Microsoft.SqlServer.ServiceBrokerEnum, Culture=neutral, PublicKeyToken=89845dcd8080cc91'. The system cannot find the file specified.

I'm trying to get a list of the Queues already in Service Broker.

Ubuntu x64 using SMO getting "Property Login was not set." error.

I just install "v1.0.0-alpha.34 - .Net Core 2.0 build" ServiceLayer in Ubuntu 16.04.2 and I'm getting the error:

Exception calling "getSqlEdition" with "1" argument(s): "Property Login was not set."
At line:1 char:1

  • $MySQLobj.getSqlEdition('mtrinidadlt2,1437')
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : PropertyNotSetException
    
    

The following code below works in Window 1o Build 161199 using PowerShell Beta.2

PowerShell Beta requirements:
I have copied all ServiceLayer dll's into the PowerShell Beta folder.

Environment:

OS: Ubuntu 16.04.2

Shell: PS /home/maxt> $PSVersionTable

Name Value


PSVersion 6.0.0-beta
PSEdition Core
BuildVersion 3.0.0.0
CLRVersion
GitCommitId v6.0.0-beta.2
OS Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

.NET Core Version installed: 2.0 Preview 1

Repro steps in PowerShell:

$Source = @"
public class MyMSSql
{
public static string getEdition(string sqlName)
{
string sqlEdition;
Microsoft.SqlServer.Management.Smo.Server sname = new Microsoft.SqlServer.Management.Smo.Server(sqlName);
sqlEdition = sname.Information.Edition;
return sqlEdition;
}
public string getSqlEdition(string sqlName)
{
string sqlEdition;
Microsoft.SqlServer.Management.Smo.Server sname = new Microsoft.SqlServer.Management.Smo.Server(sqlName);
sqlEdition = sname.Information.Edition;
return sqlEdition;
}
}
"@;

$Assem = (
"Microsoft.SqlServer.Management.Sdk.Sfc",
"Microsoft.SqlServer.Smo",
"Microsoft.SqlServer.ConnectionInfo"
);

Add-Type -ReferencedAssemblies $Assem -TypeDefinition $Source

$MySQLobj = New-Object MyMSSql
$MySQLobj.getSqlEdition('mtrinidadlt2,1437')

Expected Results: (See images below)

poshcoresql_01_2017-06-08_9-45-42

poshcoresql_02_2017-06-08_9-45-42

Remove older cluster endpoint query before GA

Some breaking changes in the big data cluster query are coming to move this to a DMV. Our implementation will fall back to existing CTP logic for at least 1 release, but then we should remove the fallback logic for simplicity / maintainability.

Versioning causing issues

The app setup I have

Web App (.net472)
Class Library (.netstandard2.0)

The Web App references Microsoft.SqlServer.SqlManagementObjects and the Class library also references Microsoft.SqlServer.SqlManagementObjects

The problem lies in the versions that get loaded, .net472 references a version 15.0. and the class library a version 15.2.0

When kicking the web app up, we end up with the error:

"Could not load file or assembly 'Microsoft.SqlServer.SqlEnum, Version=15.2.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)":"Microsoft.SqlServer.SqlEnum, Version=15.2.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"} System.Exception {System.IO.FileLoadException

Thoughts?

Profiler.ProfilerServiceTests.TestStartProfilingRequest is flaky

TestStartProfilingRequest has been failing on and off in AppVeyor builds. See https://ci.appveyor.com/project/kburtram/sqltoolsservice/build/1.0.1572 or https://ci.appveyor.com/project/kburtram/sqltoolsservice/build/1.0.1570 for examples.

Stack trace:

Error Message:
 Assert.Equal() Failure
Expected: (null)
Actual:   4d7e4874-682f-406c-a24a-a38311d78b6a
Stack Trace:
   at Microsoft.SqlTools.ServiceLayer.UnitTests.Profiler.ProfilerServiceTests.<TestStartProfilingRequest>d__0.MoveNext() in C:\projects\sqltoolsservice\test\Microsoft.SqlTools.ServiceLayer.UnitTests\Profiler\ProfilerServiceTests.cs:line 64

Sqltoolsservice embedded in .NET framework application

Hello,
I am trying to link to sqltoolsservice libraries directly in .NET 4.7.2 application (WinForms or WPF). It is possible to add reference to sqltoolsservice dll's (as NET Core reference) in WinForms application and compile, but during running I got error - Could not load file System.Runtime 4.2.1.0 or one of its dependencies. How properly should be such embedding done?

Best regards,
JK

Please add messages to asserts and add tracing to product code

I've had some tests fail in the appveyor run as part of a pull request, but there was zero information in the log to identify the issue.
Eg, this assert on not null provides no information on what is null:

Location[] locations = scripter.GetSqlObjectDefinition(objectName, schemaName, objectType);
          if (shouldReturnValidResult)
          {
              Assert.NotNull(locations);
              Cleanup(locations);
          }
          else
          {
              Assert.Null(locations);
          }

Also, GetSqlObjectDefinition has zero tracing. Since the failure doesn't reproduce readily on a dev machine figuring out how to make these tests reliable in the cloud will be difficult without appropriate tracing.

Add more coverage for SQL object names with ' and ]

While testing ADS against a test database with object names like "Table'quote]bracket" I found that the script menu items failed for those objects. I am submitting a fix and a unit test for the scripting component, but we should add broader test coverage for objects with these characters in their names.

"Discover Dependencies Failed" with latest SMO

Not sure if this is the right place to report this issue, but I can't find a repo specifically for SMO.

Using a NetCore 2.1 app, I'm trying to script my database using code like the following:

         private static void ScriptDatabaseTables(string outputPath, Func<(string schemaName, string 
              tableName), bool> shouldIncludeTable, bool includeDependencies)
         {
             using (var dbContext = TestUtilities.GetDbContext())
            {
                  var builder = new SqlConnectionStringBuilder(dbContext.Database.GetDbConnection().ConnectionString)
             {
                 MultipleActiveResultSets = false
             };

            using (var sqlConnection = new SqlConnection(builder.ToString()))
            {
                var sqlServer = new Server(new ServerConnection(sqlConnection));
                var database = sqlServer.Databases["MyDatabase"];

                var scripter = new Scripter(sqlServer);

                scripter.Options.ScriptData = true;
                scripter.Options.ScriptSchema = false;
                scripter.Options.WithDependencies = includeDependencies;


                using (var writer = File.CreateText(outputPath))
                {
                    var tableList = database.Tables.Cast<Table>()
                        .Where(table => !table.IsSystemObject && shouldIncludeTable((table.Schema, table.Name)))
                        .Select(table => table.Urn).ToArray();

                    var scriptLines = scripter.EnumScript(tableList);

                    foreach (var scriptLine in scriptLines)
                    {
                        writer.WriteLine(scriptLine);
                    }
                }
            }
        }
    }

With NuGet package Microsoft.SqlServer.Smo, Version=140.17279.0-xplat, and also with Microsoft.SqlServer.SqlManagementObjects, Version=140.17279 this code fails the error "Discover dependenceis failed". It works with version 140.17199

The innermost exception is

      --ArgumentNullException
      at System.IO.StreamReader..ctor(Stream stream, Encoding encoding, Boolean           detectEncodingFromByteOrderMarks, Int32 bufferSize, Boolean leaveOpen)
         at System.IO.StreamReader..ctor(Stream stream)
         at Microsoft.SqlServer.Management.Smo.SqlEnumDependencies.EnumDependencies(Object ci,           DependencyRequest rd)
         at Microsoft.SqlServer.Management.Sdk.Sfc.Enumerator.EnumDependencies(Object connectionInfo, DependencyRequest dependencyRequest)
         at Microsoft.SqlServer.Management.Smo.ExecutionManager.GetDependencies(DependencyRequest dependencyRequest)
         at Microsoft.SqlServer.Management.Smo.DependencyWalker.DiscoverDependencies(Urn[] urns, Boolean parents)

The code that is failing is in SqlEnumDependencies.EnumDependencies and looks like this:

            string str1 = string.Empty;
            if (this.IsDbCloud)
              str1 = "CloudDependency.sql";
            else if (this.m_targetVersion.Major <= 8)
              str1 = "ShilohDependency.sql";
            else if (this.m_targetVersion.Major == 9)
              str1 = "YukonDependency.sql";
            else if (this.m_targetVersion.Major == 10)
              str1 = "KatmaiDependency.sql";
            else if (this.m_targetVersion.Major >= 11)
              str1 = "SQL11Dependency.sql";
            string str2 = string.Format((IFormatProvider) CultureInfo.InvariantCulture, "declare @find_referencing_objects int\nset @find_referencing_objects = {0}\n", (object) (rd.ParentDependencies ? 0 : 1));
            Assembly assembly = SqlEnumNetCoreExtension.GetAssembly(typeof (SqlTypeConvert));
            StreamReader streamReader = new StreamReader(assembly.GetManifestResourceStream(assembly.GetName().Name + "." + str1));

Looking at the differences between the two versions, I can see that in the most recent versions of the Microsoft.SqlServer.SqlEnum the prefix "Microsoft.SqlServer.SqlEnum" was removed from all the resource names, yet the code calling GetManifestResourceStream still seems to be expecting it to be there.

SQL Tools ServiceLayer - Microsoft.SqlServer.Management.Smo.Server not loading.

Issue

I recently installed to latest PowerShell Beta 3 and now SMO component won't work.
But, it's only "[Microsoft.SqlServer.Management.Smo.Server]".
 
I can use it with PowerShell Beta 2 but not with Beta 3.  
 
There's a newer SQLToolsService-Servicelayer for .Net 2.0 but I get the same error in Beta 3.
So, I think it has to be with PowerShell Beta 3.
 
Beta 3 error:
PS C:\Program Files\PowerShell\6.0.0-beta.3> $SQLSrvObj = new-object Microsoft.SqlServer.Management.Smo.Server($SQLSrvCo
nn);
new-object : Cannot find type [Microsoft.SqlServer.Management.Smo.Server]: verify that the assembly containing this
type is loaded.
At line:1 char:14

  • ... SQLSrvObj = new-object Microsoft.SqlServer.Management.Smo.Server($SQL ...
    +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
        + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand
     
     (See image)
    beta3smo_err_2017-06-23_11-33-30

Confirmed

I have use both .NET 2.0 version of the SMO in the SQLToolsService-Servicelayer version(s):
'v1.0.0-alpha38 - .NET Core 2.0 Build' and 'v1.0.0-alpha.43 - .NET Core 2.0 Build'.

Both of these versions works with PowerShell Core Beta 2 in both Windows and Linux. But, it will not work in Beta 3.

So, something happened with the Microsoft.SqlServer.Management.Smo.Server DLL.

Environment

Windows 10 Build 16215
Linux: Ubuntu 16.04.2

SqlToolsService - ServiceLayer: v6.0.0-alpha43 - .NET 2.0 Core Build

.NET Core: 2.0 Preview 1

PowerShell Core Version - Windows

PS C:\Program Files\PowerShell\6.0.0-beta.3> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      6.0.0-beta
PSEdition                      Core
GitCommitId                    v6.0.0-beta.3
OS                             Microsoft Windows 10.0.16215
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

PowerShell Core Version - Linux (Windows Bash)

PS /home/maxt/sqltoolsservice> $PSVersionTable                                                                                      

Name                           Value                                                                                               
----                           -----                                                                                               
PSVersion                      6.0.0-beta                                                                                          
PSEdition                      Core                                                                                                
GitCommitId                    v6.0.0-beta.3                                                                                       
OS                             Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014                                  
Platform                       Unix                                                                                                
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                             
PSRemotingProtocolVersion      2.3                                                                                                 
SerializationVersion           1.1.0.1                                                                                             
WSManStackVersion              3.0 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.