Unable to find the requested .Net Framework Data Provider. It may not be installed.

Posts   
 
    
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 17-Apr-2018 02:06:39   

I have llblgen 5.3.5 (20-Mar-2018 ) .net 4.5.1 Adapter Postgres 9.4 Database first

I have created a new project using 5.3.5 and got it working in a Model First environment and it generates the scripts for a Postgres database.

Now, I'm trying to convert a LLBLGen 3.5 project to 5.3.5 and when I try to perform the Sync, it throws an exception:

Exception message:

Exception type: ArgumentException Unable to find the requested .Net Framework Data Provider. It may not be installed.

Stack Trace:

LLBLGen Pro version 5.3. Build 5.3.5 -----[Core exception]-------------------- at System.Data.Common.DbProviderFactories.GetFactory(String providerInvariantName) at SD.LLBLGen.Pro.DBDriverCore.DBDriverBase.GetDbProviderFactory() at SD.LLBLGen.Pro.DBDriverCore.ConnectionDataBase.get_FactoryName() at SD.LLBLGen.Pro.Gui.Controls.WizardPages.MetaDataRetrievalWizard_Step_ConnectionData.<LoadDriverAndConnectionControl>b__16_1() at SD.LLBLGen.Pro.Gui.Classes.ApplicationIdleDispatcher.PerformWork() at SD.LLBLGen.Pro.Gui.Classes.ApplicationIdleDispatcherSingleton.Application_Idle(Object sender, EventArgs e) at System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FDoIdle(Int32 grfidlef) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Form.ShowDialog(IWin32Window owner) at SD.LLBLGen.Pro.Gui.Classes.SyncTaskRunner.PerformDbSyncTask(SyncWithDatabaseTask task, LogNode parentNode) at SD.LLBLGen.Pro.Gui.Classes.SyncTaskRunner.PerformTasks(LogNode parentNode) at SD.LLBLGen.Pro.Gui.Classes.GuiController.PerformSyncTasks(List`1 tasksToPerform) at SD.LLBLGen.Pro.Gui.Controls.MdiTabs.SyncRelationalModelDataTab.PerformTasks() at System.Windows.Forms.Control.OnClick(EventArgs e) at DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at DevExpress.Utils.Controls.ControlBase.WndProc(Message& m) at DevExpress.XtraEditors.BaseControl.WndProc(Message& msg) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I have npgsql 3.2.6 installed, and I've put DBProviderFactories tag in pretty much every machine.config and llblgen...config I've found:

<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/>

I still get the error. I've dealt with these issues before and I can't remember any other things to try.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 17-Apr-2018 08:28:21   

usschad wrote:

I have npgsql 3.2.6 installed, and I've put DBProviderFactories tag in pretty much every machine.config and llblgen...config I've found:

<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/>

What installer did you use? Quoting the documentation:

To make the designer work with the Npgsql ADO.NET provider installed on your system, you have to use the installer provided by the Npgsql project at GitHub. This way, you know the DbProviderFactory is properly installed.

David Elizondo | LLBLGen Support Team
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 17-Apr-2018 10:09:25   

strange that it doesn't work, even with the llblgenpro config file. You don't need to specify it there btw, just in the machine.config file of the .net 4.x config file, which is normally at: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config

Frans Bouma | Lead developer LLBLGen Pro
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 17-Apr-2018 18:05:14   

I installed from:

https://github.com/npgsql/npgsql/releases/download/v3.2.6/Npgsql-3.2.6.msi

I checked the GAC:

** Visual Studio 2017 Developer Command Prompt v15.6.4 ** Copyright (c) 2017 Microsoft Corporation


C:\Windows\System32>gacutil /l npgsql Microsoft (R) .NET Global Assembly Cache Utility. Version 4.0.30319.0 Copyright (c) Microsoft Corporation. All rights reserved.

The Global Assembly Cache contains the following assemblies: npgsql, Version=3.2.6.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7, processorArchitecture=MSIL

Number of items = 1

And double checked C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config

<system.data> <DbProviderFactories> <add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/> </DbProviderFactories> </system.data>

A little more about my environment: When I first upgraded llblgen, I was running both 3.5 and 5.3 so that I could start a new project with the new features of 5.3. Now, I just got a new laptop, and I would like to leave v3.5 behind and only run 5.3 on the new laptop (which means convert the old one). I still have my old laptop here, waiting to be wiped, but this is the one issue that I need to resolve before I can (I'm still dependent on 3.5 until I can get my project converted).

I figured it was worth checking to see what happens when I create a database-first project from scratch, and I still get the same error when I select the PostgreSql Driver (npgsql) item from the Database Driver dropdown.

... Looking into this further: On my old laptop, I noticed that I did not have npgsql installed in the GAC. I just installed it. The same install as the new laptop, and I was able to get past that exception. That's a good sign! Now, on the new laptop, I just uninstalled and reinstalled npgsql; I confirmed that it was removed and then added back into the GAC. I still get the exception.

I've reached out to my infrastructure team. They install a nasty blend of AntiVirus software and have some pretty tight security policies on these laptops. Hopefully, they will get back with me soon and I'll have some luck, but in the meantime, I wanted to share my status.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 17-Apr-2018 21:31:14   

In C# code, if you obtain the factories datatable, by calling DbProviderFactories.GetFactories(), is the npgsql provider listed in the datatable returned by it? (just use a simple .net 4.x commandline thingy, in the debugger in vs.net you can then examine the datatable using the built-in visualizer)

Frans Bouma | Lead developer LLBLGen Pro
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 17-Apr-2018 22:01:09   

It looks like it is in there... see attached

Attachments
Filename File size Added on Approval
DbProviderFactories-DataSet-Visualizer.png 21,954 17-Apr-2018 22:01.26 Approved
Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 18-Apr-2018 04:20:42   

That's strange.

I've reached out to my infrastructure team. They install a nasty blend of AntiVirus software and have some pretty tight security policies on these laptops. Hopefully, they will get back with me soon and I'll have some luck, but in the meantime, I wanted to share my status.

Looking forward to hearing more about that.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 18-Apr-2018 09:17:11   

Ok, so can you instantiate the factory by using var factory = DbProviderFactories.GetFactory("Npgsql");

or does it give an exception? The line being there doesn't necessarily mean it works: it's just the definition, the factory itself has to be creatable to be usable simple_smile

Frans Bouma | Lead developer LLBLGen Pro
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 18-Apr-2018 15:23:40   

It did not give an exception. NpgsqlFactory was returned. I apologize for not including that detail yesterday.

daelmo avatar
daelmo
Support Team
Posts: 8245
Joined: 28-Nov-2005
# Posted on: 19-Apr-2018 09:40:18   

I can't reproduce your scenario. The only way I get your exception is running the x86 version of the LLBLGen .exe file, which is logical. Also, I removed the additional line registering the DBProviderFactory in the LLBLGen's config file, then I can reproduce it.

However, if I uninstall and reinstall Npgsql 3.2.6 (ref...) the entry is written in the machine.config again, I can open the Designer and connect to DB.

It was reported before (npgsql 3.2.4) that the wrong version number was written in the config. So just double check that the version in machine.config is the same that you have in the GAC

David Elizondo | LLBLGen Support Team
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 19-Apr-2018 15:43:34   

I'm using the versionless version of the config that is specified on the npgsql site:

<add name="Npgsql Data Provider" invariant="Npgsql" description=".Net Data Provider for PostgreSQL" type="Npgsql.NpgsqlFactory, Npgsql, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7"/>

I have it everywhere, the machine.config, the llblgen..config.

I'm going to double check all of this, though, in hopes of finding a place I might have missed. There are a few machine.config files; maybe I'm editing the wrong one.

I'm also still waiting on my network admins to disable this ESET and webroot software so that I can do a reinstall of the driver and/or llblgen to make sure that nothing odd happened during the install. That might be a pointless effort (I have no idea what kinds of magic happens behind the scenes), maybe something didn't go right. I'm skeptical though, because I am pretty sure I got my hands on the laptop before the network admins and installed llblgen before the AV was installed.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 19-Apr-2018 17:29:57   

Well, if anything: if you have defined the factory in both the llblgenpro.exe.config and the machine.config file it will give an error at startup by .NET that the definition is duplicated, so something is indeed not right. I'd remove / comment out the definition in the llblgenpro.exe.config file though, and just try to configure it through the machine.config file.

It's indeed very strange! I hope you figure it out, as I think we're out of options to look into or possibilities what it can be... you can clearly create the factory from a commandline test app so it's not as if things are not configured properly.

Frans Bouma | Lead developer LLBLGen Pro
usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 19-Apr-2018 22:37:02   

I wish I would have tried uninstalling and reinstalling with my environment in the state I was having the trouble (with the AV activated) just for good measure.

But once my network admin disabled the AV, I uninstalled and reinstalled both LLBLGen and npgsql, it got past the exception when creating a new project (database first) and selecting Postgres Driver.

I'm going to give it a full test now to see if the conversion from 3.5 to 5.3 works out, but it looks promising so far.

usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 20-Apr-2018 04:09:30   

It did the refresh. So far so good.

I'm having another problem moving forward and this is probably more of a Visual Studio issue, but hoping you can help me out.

My custom project that references the llblgen projects didn't recognize the old reference to SD.LLBLGen.Pro.ORMSupportClasses.

I removed the reference, and readded it from the 5.3 program directory:

C:\Program Files (x86)\Solutions Design\LLBLGen Pro v5.3\Frameworks\LLBLGen Pro\RuntimeLibraries\CompiledRuntimeLibraries\SD.LLBLGen.Pro.ORMSupportClasses.dll

When I try to compile the project, I get the error:

The type or namespace name 'SD' could not be found (are you missing a using directive or an assembly reference?)

It references the using statement: using SD.LLBLGen.Pro.ORMSupportClasses;

I removed this and also tried out the version in the .Netstandard2.0 folder just in case and nothing.

I also tried restarting VS to see if that triggered some sort of refresh so it would recognize the library. Any ideas?

usschad
User
Posts: 71
Joined: 11-Sep-2008
# Posted on: 20-Apr-2018 04:21:35   

Nevermind.

I started upgrading my projects from .net framework 4.5.1 to 4.5.2 and the SD reference error was just a side effect of one of the other referenced projects that I forgot to move to the 4.5.2 framework.

It's compiling now.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39612
Joined: 17-Aug-2003
# Posted on: 20-Apr-2018 09:06:17   

Glad it's all sorted! simple_smile

Frans Bouma | Lead developer LLBLGen Pro