When System.Data.SqlServerCe has been copied to a path that contains certain symbols, the application will crash with the following error message:
System.Data.SqlServerCe.SqlCeException: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8482. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details.
The workaround for this issue that I found was to rename the directory. The application directory was called "C#", renaming it to "CSharp" solved the issue. I found this by using ReSharper to step through System.Data.SqlServerCe to find this line in NativeMethods.LoadNativeBinaries():
string localPath = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
The Uri class ignores everything after the #, meaning that if the path is "c:\applications\c#\myapp1\bin\debug", the path will be truncated to "c:\applications\c".