Problem with firebird data provider 2.5.2

Posts   
 
    
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 30-Nov-2010 10:02:42   

hi.

i'm using llblgen pro 3.0 final and have converted a project from gen pro 2.6. now i use firebird 2.5 and .net provider 2.5.2 my project works fine after i've converted the gen pro project file and build the or mapping. but now i try to refresh the model from a firebird db and get an exception by pressing "Test connection":

Exception type: ConfigurationErrorsException the registered .Net Framework-Data provider cannot be found

so i put the FirebirdSql.Data.FirebirdClient.dll directly in the installation directory from gen pro and set in the LLBLGenPro.exe.config

<!-- Firebird -->
        <add name="Firebird Client Data Provider"
         invariant="FirebirdSql.Data.FirebirdClient"
         description=".Net Framework Data Provider for Firebird"
         type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.5.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"  />

but now this exception arrives

Exception type: FileLoadException The file or assembly "FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" or a dependency is not found.

where can i set the correct provider version???

i'm working on a W7 enterprise 64bit system. gen pro is installed in Program Files (x86).

thank you for help,

shennig

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 30-Nov-2010 10:28:08   

You might need to use an assembly redirect. Please check this thread: http://www.llblgen.com/TinyForum/Messages.aspx?ThreadID=16525

shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 30-Nov-2010 11:46:05   

i've changed the LLBLGenPro.exe.config like this:

<!xml version="1.0"?>
<configuration>
    <configSections>
        ... <startup>
        <!-- .NET 4.0 specific
             ... -->
        <!--<supportedRuntime version="v4.0.30319"/>-->
    </startup>
    <runtime>
        <!-- .NET 4.0 ... -->
        <!--<legacyCasPolicy enabled="true" />-->
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
             <dependentAssembly>
                 <assemblyIdentity name="SD.LLBLGen.Pro.DBDrivers.FirebirdDBDriver" publicKeyToken="ca73b74ba4e3ff27" culture="neutral"/>
                 <bindingRedirect oldVersion="1.0.2003.1-2.5.9.9" newVersion="2.6.0.0"/>
             </dependentAssembly>

             <dependentAssembly>
                    <assemblyIdentity name="FirebirdSql.Data.FirebirdClient" publicKeyToken="3750abcc3150b00c"/>
                    <bindingRedirect oldVersion="2.1.0.0" newVersion="2.5.2.0"/>
              </dependentAssembly>

            <!-- separate assembly paths. These are hints to help fusion when it gets confused. -->
            <probing privatePath="SqlServerUDTAssemblies;Drivers\Oracle;Drivers\SqlServer;Drivers\Firebird; Drivers\OracleODPNET; Drivers\Access;Drivers\DB2;Drivers\OracleMSOracle;Drivers\SybaseAse;Drivers\SybaseAsa;Drivers\MySql;Drivers\PostgreSql; TaskPerformers;ReferencedAssemblies;Plugins;TypeConverters"/>
            
        </assemblyBinding>
    </runtime>

    <!-- Additional DbProviderFactory settings for ADO.NET providers which don't register themselves in the machine.config file. -->
    <!-- Adjust these settings if you want to use a different version of the providers specified below. Leave the 'invariant' names as-is. -->
    <system.data>
        <DbProviderFactories>
            <!-- Firebird -->
            <add name="Firebird Client Data Provider"
             invariant="FirebirdSql.Data.FirebirdClient"
             description=".Net Framework Data Provider for Firebird"
             type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient, Version=2.5.2.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c"  />
            <!-- PostgreSql -->
            <add name="PostgreSql Client Data Provider"
             invariant="Npgsql"
             description=".Net Framework Data Provider for PostgreSql"
             type="Npgsql.NpgsqlFactory, Npgsql, Version=2.0.4.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />
        </DbProviderFactories>
    </system.data>
</configuration>

and i've installed Firebird_NETProvider-2.5.2.msi the manipulation in gac i could not do because the link

http://lnssoftware.dnsalias.net:81/blog/?p=56

is broken.

but still i get the same exception

Exception type: FileLoadException
file or assembly"FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c" or a dependency cannot be found.

in gac the version 2.5.2 ist installed.

what could i do????

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 30-Nov-2010 17:43:09   

You get this error when exactly? In your own application? Or with the designer?

If in your application: you're still referencing the old v2.6 Firebird DQE dll perhaps? The v3 one doesn't reference any firebird assembly. I assume this because you mention 2.1.0.0 as version which can't be found.

If in the designer: place it in the Drivers\Firebird folder, as that's probed by Fusion (.net clr assembly loader) as specified in the probe path.

Frans Bouma | Lead developer LLBLGen Pro
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 30-Nov-2010 18:26:55   

Otis wrote:

You get this error when exactly? In your own application? Or with the designer?

If in your application: you're still referencing the old v2.6 Firebird DQE dll perhaps? The v3 one doesn't reference any firebird assembly. I assume this because you mention 2.1.0.0 as version which can't be found.

If in the designer: place it in the Drivers\Firebird folder, as that's probed by Fusion (.net clr assembly loader) as specified in the probe path.

i'm getting this error in the designer when using butten "Test connection". Now i put the firebirdClient.dll in the Drivers\Firebird folder but there ist no difference. i also load the 2.6.0.0 firebirdclient and put it in the directory and update the depency items in the LLBLGenPro.exe.config but there is no difference. the exception references allways 2.1.0.0 irrespectivly what i do with the config. there is a second config LLBLGenPro_x86.exe.config. i executed the corresponding exe - but the same result occurs.

i'm a little bit frustrated! confused any suggestions?????

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 30-Nov-2010 20:50:51   

Please don't put all kinds of dlls everywhere, that's of no use.

What exe do you run, the llblgenpro.exe? or one of the two others (.net4 or x86) ?

In the .net sdk, there's a tool called fuslogvw.exe, please locate it on your harddisk (likely somewhere in the .net sdk folder in vs.net's installation folder) and run it. It should show you the log of fusion for llblgenpro.exe and which dlls were not loading. This should give some insight in where to look.

If you run llblgenpro.exe, the llblgenpro.exe.config file has to have the factory binding. As it complaints that v2.1.0.0 isn't loadable, some other dll is referencing that, and it's not one of ours, as we don't reference any ado.net provider directly in v3.

Also, if you get an exception in the testconnection, please click 'details' and obtain the stacktrace. that also should give insight in where the problem originates. the stacktrace is in the exception viewer.

(edit) I'll ask Jiri (author of the ado.net provider) to share his insight on this matter as well.

Frans Bouma | Lead developer LLBLGen Pro
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 01-Dec-2010 08:32:25   

i've deleted the firebirdclient.dll from gen pro installation directory und reinstalled firebirdclient on my system. now the message is also, that the data provider cannont be found. here is the stack trace i get by pressing test connection:

LLBLGen Pro version 3.0. Build June 28th, 2010
-----[Core exception]--------------------
   bei System.Data.Common.DbProviderFactories.GetFactory(DataRow providerRow)
   bei System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName)
   bei SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.GetDbProviderFactory()
   bei SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.CreateConnection()
   bei SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.TestConnectionData()

i normaly start gen pro via start menu, but i also directly executed LLBLGenPro.exe. here is also the error log from fusion log


*** Protokolleintrag für Assembly-Binder  (01.12.2010 @ 08:21:45) ***

Fehler bei diesem Vorgang.
Ergebnis der Bindung: hr = 0x80070002. Das System kann die angegebene Datei nicht finden.

Der Assemblymanager wurde geladen aus:  C:\Windows\Microsoft.NET\Framework64\v2.0.50727\mscorwks.dll
Als EXE-Datei ausgeführt.  C:\Program Files (x86)\Solutions Design\LLBLGen Pro v3.0\LLBLGenPro.exe
--- Ein detailliertes Fehlerprotokoll folgt. 

=== Zustandsinformationen vor Bindung ===
LOG: Benutzer = GAMMA\SaschaH
LOG: DisplayName = FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c
 (Fully-specified)
LOG: Appbase = file:///C:/Program Files (x86)/Solutions Design/LLBLGen Pro v3.0/
LOG: Ursprünglicher PrivatePath = NULL
LOG: DynamicBase = NULL
LOG: CacheBase = NULL
LOG: AppName = NULL
Aufruf von Assembly : System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089.
===
LOG: Die Bindung des systemeigenen Abbilds FirebirdSql.Data.FirebirdClient, Version=2.1.0.0, Culture=neutral, PublicKeyToken=3750abcc3150b00c wird gestartet.
WRN: Kein übereinstimmendes systemeigenes Abbild wurde gefunden.

if it would help, i could translate it.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Dec-2010 09:26:06   

I think I know it: could you please check the machine.config file in the windows\microsoft.net\Framework<frameworkversionyou'reusing>\Config

folder? (if you run the normal llblgenpro.exe and you have .net 3.5 etc. installed, you've to check the .net 2 folder. Otherwise, if you only have .net 4 installed, check the .net 4 folder)

In there, there's a section <system.data> and below it a node <DbProviderFactories>. Below that, there are the factories defined which are defined through installers. I think you have a firebird factory definition there for v2.1.0.0

Frans Bouma | Lead developer LLBLGen Pro
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 01-Dec-2010 09:51:19   

i've checked all machine.config files in the directories

C:\Windows\Microsoft.NET\Framework64 C:\Windows\Microsoft.NET\Framework

there is no appearance of firebird at all. sorry. it had really sound like a promissing idea.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Dec-2010 10:44:56   

You're using windows 7? Did you alter the llblgenpro.exe.config file as administrator? if not, that's likely the cause: windows 7 then makes a shadow copy, instead of you altering the file. So alter the file as administrator, or copy the complete installation folder to c:\users<yourusername>\ and alter it there.

The stacktrace reveals that we request the factory from .NET, so the binding .NET has at that moment is used, which seems to be v2.1.0.0, instead of the one you specified in the config file.

(an unrelated matter: you use an old build, it's recommended you use the latest build. Unfortunately, you have to alter the file again after that. You can also fix this permanently and alter machine.config instead, with the same binding as you have specified in the config file of llblgenpro.exe.config.

These bindings bind a name to a factory class. When requesting the factory from .NET, the DbProviderfactory system of .NET will then lookup the name and return an instance of the factory class associated with the name specified. So if the wrong class type is bound to the name, you'll get this error. As you've done everything right it seems, it's something really weird that's causing this.

Frans Bouma | Lead developer LLBLGen Pro
shennig
User
Posts: 48
Joined: 14-Nov-2006
# Posted on: 01-Dec-2010 11:56:17   

Otis wrote:

You're using windows 7? Did you alter the llblgenpro.exe.config file as administrator? if not, that's likely the cause: windows 7 then makes a shadow copy, instead of you altering the file. So alter the file as administrator, or copy the complete installation folder to c:\users<yourusername>\ and alter it there.

i don't belief it rage this was the fault!!! after copying the whole directory, changing the config file in there and starting from the copy, testing the connection was successfully completed!!! W7 has really its traps!!

thank you a lot for helping me smile and sorry for my bad english.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 01-Dec-2010 15:51:40   

It's a security protection wink . In windows 7, when you alter a file in program files or a subfolder, and you're not an administrator, it silently copies the file to a hidden folder. This saves you from when you accidentally run a virus and it alters files in windows or program files. However, if you alter the file yourself, you of course don't want to have this hidden security feature get in your way wink .

Just install in c:\users<your username\ instead next time, saves you the trouble wink . You use an old build, so if you download a recent build, you have to manipulate the config file again. This is unfortunate, but a result of Jiri not adding the machine.config file binding in the firebird ado.net provider installer...

Frans Bouma | Lead developer LLBLGen Pro