Project cannot build after DotConnect downngrade

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Project cannot build after DotConnect downngrade

Post by bairog » Wed 07 Oct 2015 07:16

Hello.

I'm using dotConnect for SQLite 5.2.146 for my C# project (Windows 10 x64 Pro, VS 2010 SP1 Pro, .NET 4.0, Entity Framework 6)

Some time ago I've installed version 5.3.464 to make some perfomance testings (I've just run installer, it performed uninstallation of previous version and then installed new version without any errors). At that stage everything was ok.

Yesterday I've decided to move back to previous version. Again I've simply run installer, it performed uninstallation (at the end it was some error, but description was saying that it is not critical error and asked to click ok button, so I didn't make a screenshot) and then installed version 5.2.146 (without errors).

And after that trying to compile my project results in error:
Description: Exception occurred creating type 'Devart.Data.SQLite.SQLiteConnection, Devart.Data.SQLite, Version=5.2.146.0, Culture=neutral, PublicKeyToken=09af7300eec23701' System.TypeInitializationException: The type initializer for 'Devart.Data.SQLite.d' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Devart.Data, Version=5.0.938.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'Devart.Data, Version=5.0.1256.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The system cannot find the file specified. ---> System.IO.FileNotFoundException: Could not load file or assembly 'file:///C:\Program Files (x86)\Devart\dotConnect\SQLite\Devart.Data.dll' or one of its dependencies. The system cannot find the file specified.
File:C:\Users\Leo.TOPAZ1\Desktop\SysTypesDB.DAL_no_notification\SysTypesDB.DAL.SQLITE.EF\Properties\licenses.licx
Line: 1
Project: SysTypesDB.DAL.SQLITE.EF
Here is my licences.licx file
Devart.Data.SQLite.SQLiteConnection, Devart.Data.SQLite, Version=5.2.146.0, Culture=neutral, PublicKeyToken=09af7300eec23701
Actually "C:\Program Files (x86)\Devart\dotConnect\SQLite\Devart.Data.dll" exists and have version 5.0.938 (which corresponds to installed dotConnect 5.2.146)
But what is "Devart.Data, Version=5.0.1256.0" - is it some kind of junk from dotConnect 5.3.464 installation?

How can I get rid of that compillation error?

Thank you.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Wed 07 Oct 2015 08:16

Try removing references to the Devart.* references from your project and readding them again, then right click the project in Solution Explorer > Clean, and Rebuild.

Does this fix the issue?

If not, please reinstall the provider in the following way:
1) uninstall dotConnect for SQLite
2) make sure that there are no Devart.* and policy.*.Devart.* files in the following folders:
* GAC 2.0 (\Windows\assembly\GAC_MSIL\)
* GAC 4.0 (\Windows\Microsoft.NET\assembly\GAC_MSIL\)
* \Program Files (x86)\Microsoft Visual Studio __._\Common7\IDE\PrivateAssemblies\Devart\
* \Program Files (x86)\Devart\
* \Program Files (x86)\Common Files\Devart\
* \Documents and Settings\All Users\Devart\EntityDeveloper\ (clear the folder)
* \Documents and Settings\All Users\Devart\dotConnect\ (clear the folder)
3) run installation of dotConnect for SQLite v5.2.146 via its right click > Run as administrator menu

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Wed 07 Oct 2015 09:33

First solution doesn't work for me.
Second solution made my project to compile successfully.

But now my application throws an exception
Could not load file or assembly 'Devart.Data.SQLite, Version=5.3.464.0, Culture=neutral, PublicKeyToken=09af7300eec23701' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
after trying to run the following line

Code: Select all

DbProviderFactory sqliteProviderFactory = DbProviderFactories.GetFactory(SQLiteConnectionInfo.InvariantName);
Looks like some junk data provider from version 5.3.464 still exist..

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Wed 07 Oct 2015 11:17

1. Please check the references to Devart.* assemblies in your project. They should be:
Devart.Data.dll v5.0.938.0
Devart.Data.SQLite.dll v5.2.146.0
Clean and rebuild the project.

2. Have you removed the policy.*.Devart.* files from GAC 2.0 (\Windows\assembly\GAC_MSIL\) and GAC 4.0 (\Windows\Microsoft.NET\assembly\GAC_MSIL\)?

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Wed 07 Oct 2015 11:51

1) Versions are correct. Clean and rebuild - nothing

2) I have no \Windows\assembly\GAC_MSIL\, only \Windows\assembly\ for GAC 2.0 (and I've worked with it between uninstallation and installation).

I've removed policy.*.Devart.* files from GAC 2.0 and GAC 4 between uninstallation and installation of dotConnect for SQLite v5.2.146 as you adviced me in your previous post.

Now my GAC 2.0 contains several policy.*.Devart.* files with correct versions (Devart.Data.dll v5.0.938.0 and Devart.Data.SQLite.dll v5.2.146.0 - version 5.3.464 is not present here).
My GAC 4 folder has no Devart.Data or Devart.Data.SQLite folder (only Devart.Data.Linq.Web, Devart.Data.Linq.Web.DynamicData, Devart.Data.SQLite.Entity, Devart.Data.SQLite.Entity.Migrations and Devart.Data.SQLite.Web are present).

Do you advice me to delete them now, when I have dotConnect installed?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Wed 07 Oct 2015 12:59

bairog wrote:Versions are correct. Clean and rebuild - nothing
1. Does the issue persist with the newly created projects?
bairog wrote:I have no \Windows\assembly\GAC_MSIL\, only \Windows\assembly\ for GAC 2.0
2. Try using any file manager (e.g.: Total Commander) for navigating to C:\Windows\assembly\GAC_MSIL\.
Now my GAC 2.0 contains several policy.*.Devart.* files with correct versions (Devart.Data.dll v5.0.938.0 and Devart.Data.SQLite.dll v5.2.146.0 - version 5.3.464 is not present here).
Do you advice me to delete them now, when I have dotConnect installed?
3. You can remove all policy.*.Devart.* folders from \Windows\assembly\GAC_MSIL\ .

4. Are Devart.Data.dll and Devart.Data.SQLite.dll the only Devart.* assemblies referenced by your application? If not, specify their names and exact versions (x.x.x.x).

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Wed 07 Oct 2015 13:19

1) I'll try it tomorrow - end of working day, sorry.

2) Found that folder with FAR

3) Removed all policy.*.Devart.* folders. Nothing changed.

4) No, enother one is Devart.Data.SQLite.Entity.dll v5.2.146.6

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Wed 07 Oct 2015 14:46

Additional steps:
5. Open the *.config file of your application and make sure that there are no 5.3.464 entries.
6. Run your project in the debug mode. When the exception occurs, navigate to Debug > Windows > Modules, order assembies by Name and specify the exact (x.x.x.x) versions of the Devart.* assemblies loaded in the process of your application.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Thu 08 Oct 2015 06:02

1) I have no *.config file in my application (due to over program limitations all data provider configuration should be done in code, not in *.config file)
2) Devart.Data.dll v5.0.938.0, Devart.Data.SQLite.dll v5.2.146.0 and Devart.DataSQLite.Entity.dll v5.2.146.6 - all versions are correct.

P.S. I've found the core of the problem: as I told you above I don't use *.config file, I install data provider programmatically (our client machines of course don't have dotConnect installed). Here is the code:

Code: Select all

public void AddDataProviderIfNeeded()
  {
     var dataTable = (ConfigurationManager.GetSection("system.data") as System.Data.DataSet).Tables[0];    
                
     //delete DataProvider with same name is such exists
     /*foreach(DataRow row in dataTable.Rows)
          if (row[2].Equals(SQLiteConnectionInfo.InvariantName))
            {
              row.Delete();
              row.AcceptChanges();
              break;
            }*/

     try
     {
        dataTable.Rows.Add(
           "dotConnect for SQLite", 
           "dotConnect for SQLite",                                       
           SQLiteConnectionInfo.InvariantName,  
           "Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Culture=neutral, PublicKeyToken=09af7300eec23701");
     }
     catch (ConstraintException ex)
     {
        //DataProvider with same name already exists in current system
     }                
 }
Some time ago, when everything was working fine on my machine ConstraintException was thrown (dotConnect v5.2.146 is installed); on client machine DataProvider is added by code (dotConnect is not installed).

Now ConstraintException is also thrown on my machine, BUT if I uncomment code for deleting DataProvider - i see that installed provider has version 5.3.464 (row.ItemArray is "dotConnect for SQLite", "Devart dotConnect for SQLite", "Devart.Data.SQLite", "Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.3.464.0, Culture=neutral, PublicKeyToken=09af7300eec23701"). That's the problem.

If I uncomment that code for deleting - my program runs with no problem, BUT that is not correct solution.

I need to understand how it happened that DataProvider v5.3.464 exists on my computer despite of dotConnect v5.2.146 installed. How can i uninstall DataProvider v5.3.464 and install correct one?
Last edited by bairog on Thu 08 Oct 2015 09:22, edited 2 times in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Thu 08 Oct 2015 07:17

Does the issue persist with the newly created projects? Please localize the problem and send us a small test project so that we can reproduce the exception in our environment.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Thu 08 Oct 2015 08:45

Yes the problem exists in new projects.
Due to 2Mb size limitations I cannot send test project from your contact form. I've uploaded it here
But almost definitely you will cannot reproduce the exception in your environment, because almost definitely the error depends on my environment.

I've already localized a problem in my previous post:
bairog wrote:DataProvider v5.3.464 exists on my computer despite of dotConnect v5.2.146 installed. How can i uninstall DataProvider v5.3.464 and install correct one?
Moreover even if I uninstall dotConnect 5.2.146 - I still see installed provider v5.3.464 for some reason.

Code: Select all

var dataTable = (ConfigurationManager.GetSection("system.data") as System.Data.DataSet).Tables[0];    

//delete DataProvider with same name is such exists
foreach(DataRow row in dataTable.Rows)
   if (row[2].Equals(SQLiteConnectionInfo.InvariantName))
   {
       //Still have row.ItemArray="dotConnect for SQLite", "Devart dotConnect for SQLite", "Devart.Data.SQLite", "Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.3.464.0, Culture=neutral, PublicKeyToken=09af7300eec23701" here. Why????

       row.Delete();
       row.AcceptChanges();
       break;
    }
How to get rid of it?

P.S. I've even tried install again and uninstall dotConnect 5.3.464 - after uninstallation I still see installed provider v5.3.464 in the list. Argh...

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Fri 09 Oct 2015 16:04

bairog wrote:But almost definitely you will cannot reproduce the exception in your environment, because almost definitely the error depends on my environment.
I confirm: the issue is specific to your environment. On my workstation row.ItemArray includes "Devart.Data.SQLite, Version=5.2.146" when v5.2.146 is actually installed.
bairog wrote:I need to understand how it happened that DataProvider v5.3.464 exists on my computer despite of dotConnect v5.2.146 installed. How can i uninstall DataProvider v5.3.464 and install correct one?
1. Please open C:\Windows\Microsoft.NET\Framework\v4.0.30319\Config\machine.config, navigate to

Code: Select all

<configuration>
    <system.data>
      <DbProviderFactories>
and make sure that there is only one "Devart.Data.SQLite" entry with a correct (5.2.146.0) version

Code: Select all

      <add name="dotConnect for SQLite" invariant="Devart.Data.SQLite"
        description="Devart dotConnect for SQLite" type="Devart.Data.SQLite.SQLiteProviderFactory, Devart.Data.SQLite, Version=5.2.146.0, Culture=neutral, PublicKeyToken=09af7300eec23701" />
2. Check the same in C:\Windows\Microsoft.NET\Framework\v2.0.50727\CONFIG\machine.config.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Mon 12 Oct 2015 11:23

1) Here I have (as I expected) entry with a incorrect (5.3.464.0) version.
2) Same here - 5.3.464.0.

So, should I manualy edit that entries via notepad++ and set entries to the correct one?

P.S. What about C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config and C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config? Should I also edit them?

P.P.S. Why uninstalling dotConnect 5.3.464.0 redistributable didn't delete those entries? Is that normal workflow to manualy edit files every time?

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Re: Project cannot build after DotConnect downngrade

Post by Shalex » Mon 12 Oct 2015 12:59

bairog wrote:1) Here I have (as I expected) entry with a incorrect (5.3.464.0) version.
2) Same here - 5.3.464.0.

So, should I manualy edit that entries via notepad++ and set entries to the correct one?
Yes, you should.
bairog wrote:P.S. What about C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Config\machine.config and C:\Windows\Microsoft.NET\Framework64\v2.0.50727\CONFIG\machine.config? Should I also edit them?
Yes, you should.
bairog wrote:P.P.S. Why uninstalling dotConnect 5.3.464.0 redistributable didn't delete those entries?
Looks like the uninstall process didn't have access to those files to edit them. For getting more infomation, please run the uninstall with the /log option next time:

Code: Select all

"C:\Program Files (x86)\Devart\dotConnect\Oracle\Uninstall\unins000.exe" /log=D:\1.log
Are there any errors in the generated log file?
You can also use /log with installation.
bairog wrote:Is that normal workflow to manualy edit files every time?
No, it isn't.

bairog
Posts: 120
Joined: Mon 29 Apr 2013 09:05

Re: Project cannot build after DotConnect downngrade

Post by bairog » Tue 13 Oct 2015 06:00

Shalex wrote:Looks like the uninstall process didn't have access to those files to edit them. For getting more infomation, please run the uninstall with the /log option next time:

Code: Select all

"C:\Program Files (x86)\Devart\dotConnect\Oracle\Uninstall\unins000.exe" /log=D:\1.log
Are there any errors in the generated log file?
You can also use /log with installation.
So, I've done the following (at the beginning i had dotConnect 5.2.146 installed with incorrect (5.3.464) entries in machine.config):
1) I didn't changed those incorrect entries, instead I started command line as admin and:
2) Uninstalled dotConnect 5.2.146, log file "1-uninstall.log"
3) Installed dotConnect 5.3.464, log file "2-install.log"
4) Uninstalled dotConnect 5.3.464, log file "3-uninstall.log"

After both uninstallations I've checked machine.config - entries still there.
I've checked log files for the word "error" - found nothing suspicious.

So I've uploaded all three logs here.

Post Reply