I'm trying to implement SQL CE in a WP7 Mango project, but now I'm encountering this error when I try to insert/save an object to my DB.
My code below:
public static void Save(MyObject myobject)
{
using (DBDataContext dc = new DBDataContext(DBDataContext.ConnectionString))
{
dc.MyObject.InsertOnSubmit(myobject);
dc.SubmitChanges();
}
}
When code hits the insertonsubmit line, it breaks with
MissingMethodException was unhandled
MissingMethodException
And that's all it tells me.
Call stack:
mscorlib.dll!System.Activator.InternalCreateInstance(System.Type type, bool nonPublic, ref System.Threading.StackCrawlMark stackMark) + 0xe4 bytes
mscorlib.dll!System.Activator.CreateInstance(System.Type type) + 0x2 bytes
System.Data.Linq.dll!System.Data.Linq.WorkAround.ActivationHelper.CreateInstance(System.Type type)
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.StandardTrackedObject.CreateDataCopy(object instance) + 0x12 bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.StandardTrackedObject.StartTracking() + 0x16 bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.OnPropertyChanging(object sender, System.ComponentModel.PropertyChangingEventArgs args) + 0x16 bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.Attach(object obj) + 0x1f bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.Track(System.Data.Linq.Mapping.MetaType mt, object obj, System.Collections.Generic.Dictionary<object,object> visited, bool recurse, int level) + 0x4e bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.Track(object obj, bool recurse) + 0x1d bytes
System.Data.Linq.dll!System.Data.Linq.ChangeTracker.StandardChangeTracker.Track(object obj) + 0x3 bytes
System.Data.Linq.dll!System.Data.Linq.Table<FotoDok.EkstraFeltMulighed>.InsertOnSubmit(FotoDok.EkstraFeltMulighed entity) + 0xac bytes
FotoDok.dll!FotoDok.EkstraFeltMulighed.Gem(FotoDok.EkstraFeltMulighed ekstrafeltmulighed) Line 70 + 0xc bytes C# FotoDok.dll!FotoDok.opdaterProjekter.behandlProjektJson(Newtonsoft.Json.Linq.JObject o) Line 202 + 0x7 bytes C# FotoDok.dll!FotoDok.opdaterProjekter.ReadCallbackValgteProjekter.AnonymousMethod__1(System.Windows.Controls.CheckBox delChk, Newtonsoft.Json.Linq.JObject delO) Line 141 + 0x7 bytes C# mscorlib.dll!System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo rtmi, object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object parameters, System.Globalization.CultureInfo culture, bool isBinderDefault, System.Reflection.Assembly caller, bool verifyAccess, ref System.Threading.StackCrawlMark stackMark)
mscorlib.dll!System.Reflection.RuntimeMethodInfo.InternalInvoke(object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, object[] parameters, System.Globalization.CultureInfo culture, ref System.Threading.StackCrawlMark stackMark) + 0x168 bytes mscorlib.dll!System.Reflection.MethodBase.Invoke(object obj, object[] parameters) + 0xa bytes
mscorlib.dll!System.Delegate.DynamicInvokeOne(object[] args) + 0x98 bytes
mscorlib.dll!System.MulticastDelegate.DynamicInvokeImpl(object[] args) + 0x8 bytes
mscorlib.dll!System.Delegate.DynamicInvoke(object[] args) + 0x2 bytes
System.Windows.dll!System.Windows.Threading.DispatcherOperation.Invoke() + 0xc bytes
System.Windows.dll!System.Windows.Threading.Dispatcher.Dispatch(System.Windows.Threading.DispatcherPriority priority) + 0x83 bytes
System.Windows.dll!System.Windows.Threading.Dispatcher.OnInvoke(object context) + 0x8 bytes System.Windows.dll!System.Windows.Hosting.CallbackCookie.Invoke(object[] args) + 0x19 bytes System.Windows.dll!System.Windows.Hosting.DelegateWrapper.InternalInvoke(object[] args) + 0x2 bytes System.Windows.RuntimeHost.dll!System.Windows.RuntimeHost.ManagedHost.InvokeDelegate(System.IntPtr pHandle, int nParamCount, System.Windows.Hosting.NativeMethods.ScriptParam[] pParams, ref System.Windows.Hosting.NativeMethods.ScriptParam pResult) + 0x5e bytes [External Code]
I've managed to insert other objects, using the same approach just fine, but I can't figure out what makes this object any different.