Reputation: 315
I am having a strange issue with a C# .NET 4.0 dll (running with a stub/test application) working with a Firebird database. The setup seems to be correct but when the Firebird (2.5.2 I think) client/dll/provider needs to throw an exception, I always get the following:
Failure: System.TypeLoadException : Could not load type 'System.Runtime.CompilerServices.ExtensionAttribute' from assembly 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.
So, for instance, if I change my connection string to not point to my DB file, it will give this exception instead of something more relevant. This happens whether or not I debug it from Visual Studio 2010 or whether I go and run the EXE manually.
There's another person working on the same code who doesn't have this problem, so it doesn't seem like it would be code related.
Has anybody seen or heard of anything like this? It's getting frustrating to have to guess what the exception is trying to tell me.
UPDATE: So it seems as though everything is x86, so it doesn't look like it's a bit-ness mismatch. And I've checked and double checked that I had the right version of the provider (e.g. NETProvider-3.0.2-Net40). I'm still getting the TypeLoadException.
For reference, in case it inspires anyone, I'm running Windows XP 32 bit. The other person who gets relevant/real exceptions is on Windows 7 (possibly 64 bit).
Upvotes: 2
Views: 687
Reputation: 109079
The problem is that you are using the .NET 4.5 version of the Firebird .NET provider on a .NET 4 system. Microsoft made .NET 4.5 an in-place update, keeping it version 4.0.0.0, while at the same time moving around things like System.Runtime.CompilerServices.ExtensionAttribute
to mscorlib
to be able to use extension methods in mscorlib
. When the .NET 4.5 compiled version is running on .NET 4 it can't locate the class because it is in a different library than expected.
Bottom line: make sure you install the .NET 4 version (NETProvider-3.0.2.0-NET40.7z
) from http://www.firebirdsql.org/en/net-provider/
This information is also described on this blog.
Upvotes: 2
Reputation: 945
Tried with different firebug providers versions, finally updating .NET to 4.5 on server machine worked for me.
.NET 4.5 download: http://go.microsoft.com/?linkid=9810134
Upvotes: 0
Reputation: 61626
You typically get this error when you have a mismatch in bitness. Make sure both your Firebird driver (and all the dependent DLLs downstream) and your executable are set to the same bitness.
Upvotes: 0