dll not loading- FileLoadException - dll

The problem I am having is that I am getting a System.IO.FileLoadException when trying to load the RWLock.dll on a test box and Windows xp machines.
This is the exception that is thrown when it tries to load the dll on the windows 2003 server machine (most likely 32 bit):
System.IO.FileLoadException: A procedure imported by 'rwlock, Version=1.0.3889.27926, Culture=neutral, PublicKeyToken=null' could not be loaded.
File name: 'rwlock, Version=1.0.3889.27926, Culture=neutral, PublicKeyToken=null' ---> System.Runtime.InteropServices.COMException (0x8007007F): The specified procedure could not be found. (Exception from HRESULT: 0x8007007F)...
However, we have not had any problems trying to run this on a Windows 2007* server machine (64 bit).
Any ideas? Thanks in advance :)
*windows 2008(oops)

The error message is telling you that RWLock.dll tries to import a function that doesn't exist from another DLL. This probably means that RWLock is trying to import an API function that exists on the (I presume you meant instead of "Windows 2007 Server") Windows 2008 Server machine, but not on Windows 2003 or earlier.
You can use Dependency Walker to figure out what it's trying to load and where it's trying to find that missing function, but it won't help make it available on the Windows versions where it doesn't exist.
The other possibility is that RWLock has a dependency on another DLL that it provides, but you're not re-distributing it properly. Dependency Walker can help with this, too.

Related

Unity Di container not working with 64 bit build

I am using Unity for in WCF service to load component.
I am referring below mention article.
https://msdn.microsoft.com/en-us/library/vstudio/hh323725(v=vs.100).aspx
Service is working fine when i build service in visual studio with build option option any CPU.
As one third party component required 64 bit specific build. So i selected 64 bit build option.
I have downloaded Unity code and build for 64 bit but it is also not working.
I am getting below mention exception.
Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Common.Unity' could not be loaded.
As this is not issue of Unity.
It is issue of IISExprees of VS2012 which is support on 32 bit.
Can't get IIS Express 8 beta to run website as 64-bit process
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3254745-allow-for-iis-express-64-bit-to-run-from-visual-st

VB.NET desktop application error : Could not load file or assembly 'log4net, Version = 1.2.10.0 Culture = neutral, PublicKeyToken = 692fbea5521e1304'

I've setup a VB.NET desktop application in a Windows 8.1 pro 64-bit PC. After doing server configurations I'm trying to login to the application. It's when I'm getting the following error message:
Could not load file or assembly 'log4net, Version = 1.2.10.0 Culture = neutral, PublicKeyToken = 692fbea5521e1304'or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
I've installed SAP Crystal Reports 13.0.3 64-bit yet it's still not working.
What is the reason behind this problem?
Check you Application files in Project Settings,find status of log4net dll whether included or not .Make it included in your project as below :
Problem solved.
The problem raised due to the mismatch in version of the log4net.dll file. My solution had log4net version = 1.2.9.0, while it needed the version = 1.2.10.0, hence the exception occured. I replaced the existing log4net.dll file with the one which has appropriate version and the problem was solved.

Loading a DLL in the GAC

currently I have a problem with getting a DLL into the Windows GAC. I tried to follow the steps of creating a DLL and loading it as described in this blog post:
http://blogs.technet.com/b/cloudpfe/archive/2014/02/01/how-to-create-a-custom-authentication-provider-for-active-directory-federation-services-3-0-part-2.aspx
At the point where I try calling the following command:
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7514a164b89fa979")
I get an error which tells me that System.EnterpriseServices could not be found:
Exception calling "Load" with "1" argument(s): "Could not load file or
assembly 'System.EnterpriseServices, Version=4.0.0.0, Culture=neutral,
PublicKeyToken=7514a164b89fa979' or one of its dependencies. The
system cannot find the file specified."
The specified DLL (System.EnterpriseServices) does exist* on the machine.
So now my question is, why can't this method find the DLL and what do I have to do/change to get this command to work?
NOTE: I Tried this on a vanilla Windows Server 2012 R2 with just ADFS parts installed; And I've called the command from the Powershell.
*UPDATE: The System.EnterpriseServices DLL resides in
C:\Windows\Microsoft.NET\assembly\GAC_64\System.EnterpriseServices\v4.0_4.0.0.0__b03f5f7f11d50a3a
and
C:\Windows\WinSxS\amd64_system.enterpriseservices_b03f5f7f11d50a3a_4.0.9600.1638‌​4_none_53a3f9b13fac0ba5\
So it should be available from the GAC.
I think your public Key token is incorrect, you found your own answer with your update :) .
It should be
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
Give this a try.

Where to find the System.management dll

I am trying to build an SQL CLR stored procedure that references an IBM WebSphere MQ dll. I'm having problems doing this on my work machine, so I decided to see if I could just get this to work on my home comp using localhost. I've made progress in getting a different error, however I'm not sure where the system.management dll is located...
Here is a copy of the error message:
Msg 10301, Level 16, State 1, Line 1 Assembly 'amqmdnet' references assembly 'system.management, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: 2(The system cannot find the file specified.)). Please load the referenced assembly into the current database and retry your request.
This is installed in GAC, Check the version of .Net that you have it on your system
You must register this assembly in SQL Server
create assembly [System.Management]
from 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Management.dll'
with permission_set = unsafe

Upgrading App from .NET 3.5 to 4.0, COM fails now

I have an application that I am upgrading from the .NET 3.5 to the .NET 4.0 framework. It uses a COM library which is referenced. It works no problem in 3.5 but after converting to 4.0 I have issues getting the COM to work. The COM is from a 3rd party so we didn't develop it ourselves.
I get the following COM error (generic COM error, not specific to the COM object itself): hr = 0x8007000b
CLR gives me: 'The invocation of the constructor on type 'Skype_Business_Launcher.Main' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
And the C# logs:
=== Pre-bind state information ===
LOG: User = \phillip
LOG: DisplayName = Interop.SKYPE4COMLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Skype Business Launcher, Version=1.0.5.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file:
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///bin/Debug/Interop.SKYPE4COMLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
I removed the pathname for security reasons but I have checked all the path information and it's all correct. Also the COM library file exists where it's pointing to. It's also copied to the OBJ folder within the project as well.
Originally I was getting an error about the COM library not supporting embedded types so I made "Embed Interop Types" false (it was true below) and the error went away but I'm not sure if thats connected to this error or not so I thought I'd mention it just in case.
Again, it works just fine with 3.5.
Thanks,
A shot in the dark: it looks like you are using the x64 version of the framework. Was that already the case with 3.5 ? And is the COM server a DLL or an EXE ?
If the COM server is a DLL, there needs to be a "bitness" match between the DLL and your program.
when you convert your project to 4.0 the IDE can perform a issue to convert COM library into 4.0.
when you convert your project to 4.0 remove com library then Re include it in your project then i thing it should be works.