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
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
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:
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
All input is welcome because this issue is starting to frustrate me just a bit too long - Thanks in advance!
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