From: Jean-Philippe Bruyère Date: Wed, 18 Jan 2017 14:23:43 +0000 (+0100) Subject: debug remove old binding from ds X-Git-Tag: v0.5.1~38 X-Git-Url: https://git.osiis.dedyn.io/?a=commitdiff_plain;h=cca59d20ce4fa3bed867b82518d819848d86469f;p=jp%2Fcrow.git debug remove old binding from ds --- diff --git a/src/Instantiator.cs b/src/Instantiator.cs index 6aaa7483..db0bd353 100644 --- a/src/Instantiator.cs +++ b/src/Instantiator.cs @@ -822,7 +822,7 @@ namespace Crow //the actual value of the origin member of the datasource and then will bind the value changed //dyn methode. //dm is bound to the instanciator instance to have access to cached dyn meth and delegates - dm = new DynamicMethod ("dyn_dschanged", + dm = new DynamicMethod ("dyn_dschanged" + NewId, typeof (void), CompilerServices.argsBoundDSChange, true); @@ -846,10 +846,10 @@ namespace Crow il.Emit (OpCodes.Brfalse, cancelRemove);//old parent is null //remove handler + il.Emit (OpCodes.Ldarg_1);//3d arg: instance bound to delegate (the source) + il.Emit (OpCodes.Ldstr, "ValueChanged");//2nd arg event name il.Emit (OpCodes.Ldarg_2);//1st arg load old datasource il.Emit (OpCodes.Ldfld, CompilerServices.fiDSCOldDS); - il.Emit (OpCodes.Ldstr, "ValueChanged");//2nd arg event name - il.Emit (OpCodes.Ldarg_1);//3d arg: instance bound to delegate (the source) il.Emit (OpCodes.Call, CompilerServices.miRemEvtHdlByTarget); il.MarkLabel(cancelRemove); } @@ -929,6 +929,11 @@ namespace Crow PropertyInfo piOrig = tOrig.GetProperty (origMember); PropertyInfo piDest = tDest.GetProperty (destMember); + if (piDest == null) { + Debug.WriteLine ("Member '{0}' not found in new DataSource '{1}' of '{2}'", destMember, dest, orig); + return; + } + #region ValueChanged emit DynamicMethod dm = new DynamicMethod ("dyn_valueChanged" + NewId, typeof (void), CompilerServices.argsBoundValueChange, true);