SQL Server Compact 4.0 + Sync Framework 2.1 + Entity Framework 6.1.3 = how?

entity-framework-6 microsoft-sync-framework sql-server-ce

Question

Ok, after a week of frustration I think it is time to reach out to the experts available on the world wide web, and hence StackOverflow.

What I've been doing is migrate an application to EF 6.1.3, SQL Server Compact 4.0 SP1 and Sync Framework 2.1. The results are actually not something that I am proud of, the past few days I don’t seem to be able to get rid of the famous:

Exception thrown: 'System.MethodAccessException' in Microsoft.Synchronization.Data.SqlServerCe.dll

Additional information: Attempt by method 'Microsoft.Synchronization.Data.SqlServerCe.SqlCeClientSyncProvider..ctor()' to access method 'System.Data.SqlServerCe.NativeMethods.CreateErrorInstance(IntPtr ByRef)' failed.

This exception is thrown by the constructor of the provider that inherits from SqlCeClientSyncProvider.

After digging into the matter using SysInternals Process Explorer and the fusion logs it seems that the sync framework assembly Microsoft.Synchronization.Data.SqlServerCe is unable to consume the code available in System.Data.SqlServerCe.

I've tried countless approaches related to the issue on the internet, even going as far as removing all related installations from my system and only using the bare minimum but up until now no success.

The current bare minimum involves the following NuGet packages:

  • EntityFramework.SqlServerCompact.PrivateDeployment v6.1.3
    Created by ErikJ: ensures applications can run with a private deployment of SQL Server CE 4.0.0.1.
  • Microsoft.SyncFramework v2.1.0.2
    Darrel Tunnell – Installs and maintains Microsoft Sync Framework 2.1 Core component packages, both for x64 and x86.
  • Microsoft.SyncFramework.DatabaseProvider v3.1.0.0
    Darrel Tunnell – Installs and maintains Microsoft Sync Framework 2.1 Database Provider packages, both for x64 and x86.

The problem however still exists. :-(

Some details that might be interesting:

All projects in the solution target the x86 architecture due some other constraint we have on some kinky COM interop assemblies (whole other subsystem though).

The development OS is Windows 7, 64 bit. I'm even starting to think that an 64 bit OS and a 32 bit SQL Compact 4.0 might even be what is interfering.

To put the above in a concrete question: how do I get rid of the MethodAccessException?

All input is welcome because this issue is starting to frustrate me just a bit too long - Thanks in advance!

1
1
3/9/2016 5:55:27 PM

Popular Answer

Sync Framework is not supported in SQL CE 4. Try binding redirect as @ErikEJ mentioned and have a look at this on how to go about itpost

1
3/10/2016 1:05:55 AM


Related Questions





Related

Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow