Skip to content

EDM wizard trouble shooting

kenjiuno edited this page Mar 30, 2015 · 24 revisions

Check the trouble shooting cases, if you have problems on using Entity Data Model wizard in Vs2012/Vs2013:


Case 1: The dialog disappears, when we click [Next]

The repro in this case:

  • Install 2.2.3.0 GAC installer.
  • New C# project.
  • Add 2.2.4.3 Npgsql and Npgsql.EntityFramework assembly references to my project.
  • NuGet EntityFramework 6.0.0 (or later)
  • Edit App.config.
  • Build once.
  • Launch an EDM wizard.

Point:

  • GAC Npgsql and my project's Npgsql version should be same.
  • If I use 2.2.3.0 installer, use 2.2.3.0 Npgsql and Npgsql.EntityFramework for my project.
  • If I use 2.2.4.3 installer, use 2.2.4.3 Npgsql and Npgsql.EntityFramework for my project.

How to fix? 1

  • Install 2.2.4.3 GAC installer.

How to fix? 2

  • Remove 2.2.4.3 Npgsql and Npgsql.EntityFramework assembly references.
  • And then, add 2.2.3.0 Npgsql and Npgsql.EntityFramework assembly references to my project.

Technical report:

System.Data.Entity.Core.ProviderIncompatibleException was thrown in my case.

Here is the thrown exception catched by another VisualStudio instance:

System.Data.Entity.Core.ProviderIncompatibleException: The provider did not return a ProviderManifestToken string. ---> System.InvalidCastException: [A]Npgsql.NpgsqlConnection cannot be cast to [B]Npgsql.NpgsqlConnection. Type A originates from 'Npgsql, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Npgsql\v4.0_2.2.3.0__5d8b90d52f46fda7\Npgsql.dll'. Type B originates from 'Npgsql, Version=2.2.4.3, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7' in the context 'Default' at location 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Npgsql\v4.0_2.2.4.3__5d8b90d52f46fda7\Npgsql.dll'.
   at Npgsql.NpgsqlServices.GetDbProviderManifestToken(DbConnection connection)
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)
   --- End of inner exception stack trace ---
   at System.Data.Entity.Core.Common.DbProviderServices.GetProviderManifestToken(DbConnection connection)

Case 2: The dialog says "A compatible provider not found".

nocompat

The repro in this case:

  • Install 2.2.3.0 GAC installer.
  • New C# project.
  • NuGet Npgsql.EntityFramework and its dependencies.
  • Edit App.config: Add a bad provider so that we can't find assembly like <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=1.2.3.4" />
  • Build once.
  • Launch an EDM wizard.

Point:

  • Check <provider> section in my App.config

How to fix? 1

  • Remove version spec like <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework" />

How to fix? 2

  • Specify valid spec like <provider invariantName="Npgsql" type="Npgsql.NpgsqlServices, Npgsql.EntityFramework, Version=2.2.3.0, Culture=neutral, PublicKeyToken=5d8b90d52f46fda7" />

Technical report:

System.IO.FileLoadException was thrown 2 times in my case.

System.IO.FileLoadException: Could not load file or assembly 'Npgsql.EntityFramework, Version=1.2.3.4' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
File name: 'Npgsql.EntityFramework, Version=1.2.3.4'

=== Pre-bind state information ===
LOG: DisplayName = Npgsql.EntityFramework, Version=1.2.3.4
 (Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: Npgsql.EntityFramework, Version=1.2.3.4 | Domain ID: 10
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Administrator/documents/visual studio 2013/Projects/ConsoleApplication2/bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Administrator\documents\visual studio 2013\Projects\ConsoleApplication2\App.config
LOG: Using host configuration file: 
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\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:///C:/Users/Administrator/documents/visual studio 2013/Projects/ConsoleApplication2/bin/Debug/Npgsql.EntityFramework.DLL.
WRN: Comparing the assembly name resulted in the mismatch: Major Version
ERR: Failed to complete setup of assembly (hr = 0x80131040). Probing terminated.