gitsql / SQL-Server-Edition

SQL Server Edition
8 stars 2 forks source link

Bug after selecting DB #31

Open m3techitopsadmin opened 3 years ago

m3techitopsadmin commented 3 years ago

Hi getting this error when selecting DB for gitSQL first time setup after successful test connection with DB: See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.SqlServer.Smo, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified.
File name: 'Microsoft.SqlServer.Smo, Version=14.100.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91'
   at gitSQL.scripter.getObjects(String instanceName, String svrName, Boolean loginSecure, String sqlServerLogin, String password, String dbName, Boolean freeMode, Boolean SequencesEnabled)
   at gitSQL.frmMain.cbxProject_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.WmReflectCommand(Message& m)
   at System.Windows.Forms.ComboBox.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

WRN: Assembly binding logging is turned OFF.
To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
Note: There is some performance penalty associated with assembly bind failure logging.
To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].

************** Loaded Assemblies **************
mscorlib
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/Windows/Microsoft.NET/Framework64/v4.0.30319/mscorlib.dll
----------------------------------------
gitSQL
    Assembly Version: 1.4.6.0
    Win32 Version: 1.4.6.0
    CodeBase: file:///C:/Program%20Files%20(x86)/gitSQL/gitSQL.exe
----------------------------------------
System.Windows.Forms
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4300.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
Newtonsoft.Json
    Assembly Version: 10.0.0.0
    Win32 Version: 10.0.2.20802
    CodeBase: file:///C:/Program%20Files%20(x86)/gitSQL/Newtonsoft.Json.DLL
----------------------------------------
System.Configuration
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4190.0 built by: NET48REL1LAST_B
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Configuration/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
----------------------------------------
System.Core
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4341.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Xml
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Xml/v4.0_4.0.0.0__b77a5c561934e089/System.Xml.dll
----------------------------------------
System.Management
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Management/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Management.dll
----------------------------------------
System.Runtime.Serialization
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Serialization/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Serialization.dll
----------------------------------------
SMDiagnostics
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/SMDiagnostics/v4.0_4.0.0.0__b77a5c561934e089/SMDiagnostics.dll
----------------------------------------
System.ServiceModel.Internals
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4250.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_MSIL/System.ServiceModel.Internals/v4.0_4.0.0.0__31bf3856ad364e35/System.ServiceModel.Internals.dll
----------------------------------------
System.Data
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4270.0 built by: NET48REL1LAST_C
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Data/v4.0_4.0.0.0__b77a5c561934e089/System.Data.dll
----------------------------------------
System.Transactions
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.Transactions/v4.0_4.0.0.0__b77a5c561934e089/System.Transactions.dll
----------------------------------------
System.EnterpriseServices
    Assembly Version: 4.0.0.0
    Win32 Version: 4.8.4084.0 built by: NET48REL1
    CodeBase: file:///C:/WINDOWS/Microsoft.Net/assembly/GAC_64/System.EnterpriseServices/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.EnterpriseServices.dll
----------------------------------------

************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.

For example:

<configuration>
    <system.windows.forms jitDebugging="true" />
</configuration>

When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
mariascott commented 3 years ago

Hi @m3techitopsadmin

Sorry to hear this happened.

gitSQL SQL Server edition relies on the Server Management Objects (SMO) library to be installed on the computer running gitSQL.

The Microsoft SQL Server installation steps have an option to install SMO.

Would you try installing the additional package to see if that works for you?

m3techitopsadmin commented 3 years ago

Please see this: https://docs.microsoft.com/en-us/sql/relational-databases/server-management-objects-smo/installing-smo?view=sql-server-ver15 From SSMS 2017 onwards this is supposed to be part of the application that uses it as a dependency. I tried to find an older installation online but no luck

gprieck commented 2 years ago

I am having the same issue. I have been running gitSQL on a Windows 10 Professional computer machine for several years. That computer had Microsoft SQL Server Management Studio 2017 which uses the the 14.0 versions of the SMO.

I unlinked our license and moved it to a new computer running Windows 10 Enterprise I installed SSMS 2018 Same error when I pick the database I installed SSMS 2017, thinking that might help since it installs the 14.0 versions of the SMO Same error when I pick the database

Tried adding a config file with a binding redirect in the same folder as the exe gitSQL.exe.config <?xml version="1.0" encoding="utf-8"?>

That did not help either. I tried both versions I found on the drive 14.0.17289.0 14.0.17041.0

There are packages on nuget. I have tried installing the latest 14 version 140.17283.0, but have not been able to get the package to install. https://www.nuget.org/packages/Microsoft.SqlServer.SqlManagementObjects

mariascott commented 2 years ago

@m3techitopsadmin & @gprieck

We're sorry to hear this issue has manifest. We will build a like for like environment based upon @gprieck's write up and aim to reproduce the issue.

Once we catch the error on our side we'll be sure to find a fix.

Stay tuned for a follow up in due course.

gprieck commented 2 years ago

@m3techitopsadmin & @mariascott

I have some updates on trying to get this working.
I installed Visual Studio 2017 because the machine that I previously had gitSQL running on also had Visual Studio 2017 installed. That did not fix the problem

Per your previous suggestion to m3techitopsadmin "The Microsoft SQL Server installation steps have an option to install SMO", I downloaded the SQL Server 2016 ISO and installed just the "Client Tools SDK". That did not fix the problem.

Looking at the file versions numbers installed with all of these products, none of them were 14.100, so I tried to find that version on nuget. The closest I could come was "Unofficial.Sql.Server.Management.Objects" which listed version 14.100.0.1. I added that to a C# class library project, then copied the dlls it put in the bin folder to the same folder where gitSQL.exe was located. That worked.

The file version was 14.0.17199.0. I went to the official package site "Microsoft.SqlServer.SqlManagementObjects" and installed 140.17199.0. The dlls copied to the bin folder were exactly the same as the ones from the Unofficial site.

This still isn't an ideal solution.

gprieck commented 2 years ago

Is this fixed in the new release?

mariascott commented 2 years ago

@gprieck - We are still working on debugging this issue.

ksabers commented 2 years ago

I am experiencing the same issue with a fresh installation of SQL Server 2019 Developer Edition.

ksabers commented 2 years ago

@mariascott Do you have any news on this blocking bug, please?

ksabers commented 2 years ago

@gprieck - We are still working on debugging this issue.

@mariascott Hi! Could you please update us about the resolution of this bug? It is blocking and does not allow importing data. Thanks!

mariascott commented 2 years ago

Which version of SQL Server are you both connecting to?

Running the following command in SSMS should give the answer:

SELECT @@version

gprieck commented 2 years ago

@mariascott Microsoft SQL Server 2016 (SP1-CU15-GDR) (KB4505221) - 13.0.4604.0 (X64) Jun 15 2019 07:56:34 Copyright (c) Microsoft Corporation Standard Edition (64-bit) on Windows Server 2016 Datacenter 10.0 (Build 14393: ) (Hypervisor)

ksabers commented 2 years ago

SELECT @@Version

Microsoft SQL Server 2019 (RTM) - 15.0.2000.5 (X64) Sep 24 2019 13:48:23 Copyright (C) 2019 Microsoft Corporation Developer Edition (64-bit) on Windows 10 Enterprise 10.0 (Build 19043: )

Installation is fresh on a new Windows 10 machine (only Visual Studio, VS Code and SQL Server installed).

ksabers commented 2 years ago

@mariascott Any news? This bug has been here from almost one year now and it totally blocks the use of the application.

mariascott commented 2 years ago

@ksabers - We've been unsuccessful at reproducing the issue.

We believe there is a genuine issue here with gitSQL not being able to figure out which SMO dlls to use - but until we reproduce the issue we're quite stuck ourselves.

Our recommendation would be to re-install SQL Server (full edition) on the same computer that is running gitSQL - If that doesn't fix the issue then please take a look at the following article https://docs.microsoft.com/en-us/sql/relational-databases/server-management-objects-smo/installing-smo?view=sql-server-ver15

As I say, the root cause is gitSQL can't find the SMO library which it needs as a pre-requisite to connect to SQL Server.