Tuesday, August 26, 2014

SSMS 2008 and System.Transactions.dll 2.0.0.0

Recently my machine got some hang and I had to restart my machine by "pressing down power button for long time and start again". As usual the chkdsk popup came and run complete disk scan. After the check disk scan, I was able to login and reached till desktop. But from that time onwards I started facing some strange issues. One of issue is mentioned below.

I opened SSMS 2008 R2 (SQL Server Management Studio) and tried connecting to an SQL Server instance.It resulted in the below error message

"Could not load file or assembly 'System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one of its dependencies. The module was expected to contain an assembly manifest. (System.Data)"

What is the relation between SSMS and this dll. I know this dll is used for .Net to achieve transactions in our applications. May be this is used by SSMS to execute our queries. But why its needed when we are connecting to database? No idea. 

Attempt 1 - Re-register System.Transactions.dll into GAC

Googled and found couple of links and everywhere it is telling that the dll is not registered in the GAC. Normally this dll will be registered in to the GAC but some operations like installation of other software might have unregistered it. Below are the main paths we can see this particular dll. But unfortunately in my case I don't have that dll in place or the dll size is 0 KB.
  • C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll - File size 0 KB
  • C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin - I dont have VS 2005 Installed
  • C:\Windows\Microsoft.NET\Framework64\v2.0.50727 - The file is present. But SSMS.exe is a 32bit process.
  • C:\Program Files (x86)\Microsoft Visual Studio 9.0\SDK\v3.5\Bin - This folder is empty
  • C:\Program Files (x86)\Microsoft Visual Studio 10.0\SDK\v3.5\Bin - Folder empty
  • C:\Program Files (x86)\Microsoft Visual Studio 11.0\SDK\v3.5\Bin - Folder empty

Attempt 2 - Reinstall .Net framework from control panel

This turns out that my .Net 2.0 installation is corrupted. What is the easiest way? Go to control panel -> Programs and features -> Turn windows features turn on or off and uninstall and install the .Net framework. But in my machine I was not even able to get the "windows features on off" grid. Even I don't think, I can do it as .Net 2.0 is part of Windows 7 OS.

Attempt 3 - Repair .Net using tool

Downloaded the Microsoft.Net Framework Repair Tool and run it. I tried the same and no chance. Still the file size is 0KB.

Attempt 4 - Install .Net framework using msi

Then downloaded the.Net 2.0 installer and tried installing it. But it says "The product is already installed as part of the operating system"

Attempt 5 - Uninstall from installer cache

One link from Microsoft KB says we need to goto the installer folder located at <OS Drive>:\Windows\Installer and find the msi package by its comment "Microsoft .NET Framework 2.0 RTL x86 enu" and right click to repair. But I was not able to see the entry with the .Net 2.0 comment.

Attempt 6 - Reinstall using command

Anther link says we can directly run the installer using the msiexe command as follows

msiexec /fpecmsu {C09FB3CD-3D0C-3F2D-899A-6A1D67F2073F} REINSTALL=ALL /l*v %temp%\netfx20sp2_repair_log.txt /qn

After waiting for some time I could see the netfx20sp2_repair_log.txt in the temp folder with and entry as below

MSI (s) (7C:30) [01:16:50:534]: Running installation inside multi-package transaction {C09FB3CD-3D0C-3F2D-899A-6A1D67F2073F}

But still the issue is not resolved.

Attempt 7 - using sfc.exe

Since the .Net 2.0 is part of Windows OS, there is another way to verify the installation. Its using sfc command. Full command is as follows which we can give in command window which is running in admin mode.

sfc.exe /scannow

Result

"Windows Resource Protection found corrupt files but was unable to fix some of th
em.
Details are included in the CBS.Log windir\Logs\CBS\CBS.log. ...."

There are issues which were not resolved and simply pointing to a log file which is around 3 MB text.

What is there in the log

Just searched through the CBS.log for System.Transaction.dll and found the entry very easily.

2014-08-26 01:33:57, Info                  CSI    00000389 Hashes for file member \SystemRoot\WinSxS\x86_system.transactions_b77a5c561934e089_6.1.7601.18410_none_e7e76cdf2530f04d\System.Transactions.dll do not match actual file [l:46{23}]"System.Transactions.dll" :
  Found: {l:20 b:2jmj7l5rSw0yVb/vlWAYkK/YBwk=} Expected: {l:20 b:hs4esk9VeIeBIBB9tDCOqo2DioA=}
  Found: {l:32 b:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=} Expected: {l:32 b:hZSyvIr53ZRpAoP4vZD8O+tE48T6dPGXmr6Eo8MKkWU=}
2014-08-26 01:33:57, Info                  CSI    0000038a [SR] Cannot repair member file [l:46{23}]"System.Transactions.dll" of System.Transactions, Version = 6.1.7601.18410, pA = PROCESSOR_ARCHITECTURE_INTEL (0), Culture neutral, VersionScope neutral, PublicKeyToken = {l:8 b:b77a5c561934e089}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-08-26 01:33:58, Info                  CSI    0000038b Hashes for file member \SystemRoot\WinSxS\x86_system.transactions_b77a5c561934e089_6.1.7601.18410_none_e7e76cdf2530f04d\System.Transactions.dll do not match actual file [l:46{23}]"System.Transactions.dll" :
  Found: {l:20 b:2jmj7l5rSw0yVb/vlWAYkK/YBwk=} Expected: {l:20 b:hs4esk9VeIeBIBB9tDCOqo2DioA=}
  Found: {l:32 b:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=} Expected: {l:32 b:hZSyvIr53ZRpAoP4vZD8O+tE48T6dPGXmr6Eo8MKkWU=}
2014-08-26 01:33:58, Info                  CSI    0000038c [SR] Cannot repair member file [l:46{23}]"System.Transactions.dll" of System.Transactions, Version = 6.1.7601.18410, pA = PROCESSOR_ARCHITECTURE_INTEL (0), Culture neutral, VersionScope neutral, PublicKeyToken = {l:8 b:b77a5c561934e089}, Type neutral, TypeName neutral, PublicKey neutral in the store, hash mismatch
2014-08-26 01:33:58, Info                  CSI    0000038d [SR] This component was referenced by [l:156{78}]"Package_3_for_KB2931356~31bf3856ad364e35~amd64~~6.1.1.0.2931356-78_neutral_GDR"
2014-08-26 01:33:58, Info                  CSI    0000038e Hashes for file member \??\C:\windows\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll do not match actual file [l:46{23}]"System.Transactions.dll" :
  Found: {l:20 b:2jmj7l5rSw0yVb/vlWAYkK/YBwk=} Expected: {l:20 b:hs4esk9VeIeBIBB9tDCOqo2DioA=}
  Found: {l:32 b:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=} Expected: {l:32 b:hZSyvIr53ZRpAoP4vZD8O+tE48T6dPGXmr6Eo8MKkWU=}
2014-08-26 01:33:58, Info                  CSI    0000038f Hashes for file member \SystemRoot\WinSxS\x86_system.transactions_b77a5c561934e089_6.1.7601.18410_none_e7e76cdf2530f04d\System.Transactions.dll do not match actual file [l:46{23}]"System.Transactions.dll" :
  Found: {l:20 b:2jmj7l5rSw0yVb/vlWAYkK/YBwk=} Expected: {l:20 b:hs4esk9VeIeBIBB9tDCOqo2DioA=}
  Found: {l:32 b:47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU=} Expected: {l:32 b:hZSyvIr53ZRpAoP4vZD8O+tE48T6dPGXmr6Eo8MKkWU=}
2014-08-26 01:33:58, Info                  CSI    00000390 [SR] Could not reproject corrupted file [ml:520{260},l:98{49}]"\??\C:\windows\Microsoft.NET\Framework\v2.0.50727"\[l:46{23}]"System.Transactions.dll"; source file in store is also corrupted
2014-08-26 01:33:59, Info                  CSI    00000391 Repair results created:

It says source file store is also corrupted. Even I checked sfc.exe documentation .It says the same cannot be repaired.

Attempt 8 - Remove .Net 2.0 using third party tool

There is something called .Net framework cleanup tool which can be used to remove .Net framework version. But in the documentation it says, it cannot remove .Net 2.0 from Windows 7.

Attempt 9 - Use SQL Server 2012 and connect to SQL 2008 R2 instance

Now its time to step back and think. My actual problem is to connect to SQL Server instance. Why don't I try using SQL 2012 SSMS. Installed SQL Server 2012 and tried to connect to SQL 2008 instance. The connection succeeded. I was able to expand the databases node. But when I try to do any operation such as  opening the query window or restore database backup I gets new error as follows.

Could not load file or assembly 'Microsoft.NetEnterpriseServers.ExceptionMessageBox, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The module was expected to contain an assembly manifest. (Microsoft.SqlServer.Management.RelationalEngineTasks)

Entering into more issues

What's left

  1. Copy the dll from another machine which is having same .Net version and paste into my folder and register into GAC
  2. Reinstall .Net framework 2.0 manually by following the below link
  3. Format and re-install everything / re-image my machine as everyone in my company uses same OS image.
Planning to go with option 3 is option 1 doesn't work.

Update 1

I tried option 1 and it started working. Followed the steps mentioned in a link to replace the System.Transactions.dll as its protected by Trusted Installer

1 comment:

MJB said...

Great! Thanks this solved the issue for me. My System.Transactions DLL was 0KB too and I was getting the same error.

One thing to clarify, there are now with .NET 4.0 two GACS and different versions of the gacutil.exe tool install into different GACS. I used the tool located in: C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin

I copied the System.Transactions 256kb DLL I found on the web over the 0KB located in:
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll" using the Trusted Installer method.

Then I ran gacutil -IF "C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Transactions.dll"

The "F" forces the reinstall.

I rebooted, then restarted both Visual 2010 & 2013 I have on my machine. Then started SSMS and connected to SQL server as normal using management studio.