C++ Failure on MSVCR80.dll using Microsoft.SqlServer.Management

0

I am trying to run test on my server but it fails due to some C++ error coming from MSVCR80.dll. On my machine it runs smoothly but on the server, I do not find a way to make it work.

Here is the error I have when running my tests (sorry it is in italian but it could be easily understood, I guess, everybody speaks italian, no?) :

 Class Initialization method Test.Quartz.GestioneQuartzTest.MyClassInitialize threw exception. System.Reflection.TargetInvocationException:  System.Reflection.TargetInvocationException: Eccezione generata dalla destinazione di una chiamata.
 --->  System.TypeInitializationException: L'inizializzatore di tipo di '<Module>' ha generato un'eccezione.
 --->  <CrtImplementationDetails>.ModuleLoadException: The C++ module failed to load during appdomain initialization.
 --->  System.DllNotFoundException: Impossibile caricare la DLL 'MSVCR80.dll': Routine di inizializzazione della libreria di collegamento dinamico (DLL) non riuscita. (Eccezione da HRESULT: 0x8007045A)..

and the stack Trace :

_encode_pointer(Void* )
_initatexit_app_domain()
LanguageSupport.InitializePerAppDomain(LanguageSupport* )
LanguageSupport._Initialize(LanguageSupport* )
LanguageSupport.Initialize(LanguageSupport* )
ThrowModuleLoadException(String errorMessage, Exception innerException)
ThrowModuleLoadException(String , Exception )
LanguageSupport.Initialize(LanguageSupport* )
cctor()
Microsoft.SqlServer.Management.Common.ExecuteBatch.GetStatements(String sqlCommand)
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
System.Type.InvokeMember(String name, BindingFlags invokeAttr, Binder binder, Object target, Object[] args, CultureInfo culture)
Microsoft.SqlServer.Management.Common.ServerConnection.GetStatements(String query, ExecutionTypes executionType, Int32& statementsToReverse)
Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand, ExecutionTypes executionType)
Microsoft.SqlServer.Management.Common.ServerConnection.ExecuteNonQuery(String sqlCommand)
Test.DataBaseHelper.ExecuteScriptFile(String RessourceName) in C:\CoreTest\TestHelper\DataBaseHelper.cs: line 35
Test.Quartz.GestioneQuartzTest.MyClassInitialize(TestContext testContext) in C:\CoreTest\Quartz\GestioneQuartzTest.cs: line 62

I have tried downloading the dll MSVCR80 and putting it on windows/system32 but it did not help. HAve someone already experienced this problem before?

Thx for any help.

[EDIT]

When debugging one test, the error happens there (2nd line) :

  Microsoft.SqlServer.Management.Smo.Server server = new Microsoft.SqlServer.Management.Smo.Server(svrConnection);
 return server.ConnectionContext.ExecuteNonQuery(scriptText);

The Script text contains the code I use to create or Drop my tables to perform my test in a similar environment as the production.

[/EDIT]

c#
c++
sql-server
asked on Stack Overflow Sep 20, 2010 by Arthis • edited Sep 20, 2010 by Arthis

1 Answer

0

Instead of just downloading a single DLL (possibly missing other dependencies), have you tried downloading and installing the Microsoft Visual C++ 2005 SP1 Redistributable?

Edit, as for running your solution in Visual Studio: Well, the error location was pretty much already obvious, given the stack trace. Since this is an error loading a native DLL, I was talking more about running WinDBG, which in this case might provide better information about what gets loaded and why it is failing. Judging from the exception code and way of failing (probably during DllMain, i.e. LoadLibrary) I'd guess it's a missing dependency. Either WinDbg or DependencyWalker can help you out in this case, but with DependencyWalker, you'd have to know where to look, i.e. what module to analyze.

answered on Stack Overflow Sep 20, 2010 by Jim Brissom • edited Sep 20, 2010 by Jim Brissom

User contributions licensed under CC BY-SA 3.0