<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : System.Reflection.TargetInvocationException in Silverlight Model</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2012 : System.Reflection.TargetInvocationException in Silverlight Model</description>
  <pubDate>Fri, 10 Apr 2026 18:54:39 -700</pubDate>
  <lastBuildDate>Thu, 17 Apr 2014 11:19:07 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=4674</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model :  Yes, I agree that the workaround...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17512#17512</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 17-Apr-2014 at 11:19am<br /><br /><div>Yes, I agree that the workaround can be tedious and easily forgettable. Thank you for bringing that to my attention. After further discussion with the lead engineer, we have decided to classify this as a bug due to the performance hit. We'll try to find a way to see if we can detect the NullRefEx for this specific case ahead of time so it doesn't throw an exception.</div><div><br></div><div>We will respond to your other post.</div><div><br></div><div>In general, we try our best to only handle exception internally if we have to and if we see that there's no visible cost to performance. Thanks to you, this specific case proves that we have to modify our handling of the NullRefEx.</div><span style="font-size:10px"><br /><br />Edited by DenisK - 17-Apr-2014 at 11:35am</span>]]>
   </description>
   <pubDate>Thu, 17 Apr 2014 11:19:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17512#17512</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Hi Denis,  OK. So no code at all...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17509#17509</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 16-Apr-2014 at 1:45am<br /><br />Hi Denis,<br /><br />OK. So no code at all in the constructor of an abstract class. Always put (duplicate !) the code in a no abstract sub class. It can become boring when you have lots of sub-sub-sub-class like I do. The risk to forget to initialize some fields is there. Anyway, I can live with that. <br /><br />But what is really bothering me here is that devforce handled it internally but it has a very HUGE impact on the performance. Don't forget that in this case for 7 entities we are talking about 7 milliseconds without exception versus 6 seconds with exceptions !!! <br />To handle them internally it's nice but not at this cost. Knowing the side effect of these exceptions, 100% of the time I will prefer to get an exception on my side to force me to fix my code rather than to have this HUGE downfall performance (which is almost impossible to identify).<br /><br />When I see all the others exception internally handled by devforce (see my other post http://www.ideablade.com/forum/forum_posts.asp?TID=4678&title=invalidoperationexception-while-accessing-a-navigation-property) I wonder if those also have an impact on the performance of my application (which I currently suspect).<br />What can I do to avoid all these costly exceptions (see other post) ? How can I know what I should or not write ?<br /><br />Note : in my opinion the "no code policy" in an abstract constructor should be added to the documentation and specify that otherwise it could have an impact on the performance of application. <br />]]>
   </description>
   <pubDate>Wed, 16 Apr 2014 01:45:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17509#17509</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Thanks for the sample.After further...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17505#17505</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 15-Apr-2014 at 6:19pm<br /><br />Thanks for the sample.<div><br></div><div>After further investigation, it turns out that the exception is expected which explains why it's being internally handled by DF.</div><div><br></div><div>It's not currently being classified as a bug because we have a reason to implement it this way.</div><div><br></div><div>To avoid the NullRefEx, you may want to move the initialization of "Actif" to your sub-type classes' constructor instead.</div><div><br></div><div>The missing assembly exception is also being internally handled and it's safe to be ignored as well.</div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Tue, 15 Apr 2014 18:19:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17505#17505</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model :  hi DenisK,Here is a repro project...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17490#17490</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 11-Apr-2014 at 2:52am<br /><br />hi DenisK,<div><br></div><div><div><span style="line-height: 1.4;">Here is a repro project <a href="uploads/1623/TargetInvocati&#111;nExcepti&#111;nBis.zip" target="_blank">uploads/1623/TargetInvocationExceptionBis.zip</a>&nbsp;. The exception happen when the entity is created.</span></div><div><br></div><div><br></div><div><span style="line-height: 1.4;">also, on this project I noticed when the entitymanager is created, there is another internal exception in devforce. Seems it is looking for and assembly named IdeaBlade.EntityModel.Web which doesn't exists in the nuget packages ...</span></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>L'exception System.IO.FileNotFoundException s'est produite</div><div>&nbsp; _HResult=-2147024894</div><div>&nbsp; _message=Impossible de charger le fichier ou l'assembly 'IdeaBlade.EntityModel.Web, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0' ou une de ses dépendances. Le fichier spécifié est introuvable.</div><div>&nbsp; HResult=-2147024894</div><div>&nbsp; IsTransient=false</div><div>&nbsp; Message=Impossible de charger le fichier ou l'assembly 'IdeaBlade.EntityModel.Web, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0' ou une de ses dépendances. Le fichier spécifié est introuvable.</div><div>&nbsp; Source=mscorlib</div><div>&nbsp; FileName=IdeaBlade.EntityModel.Web, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0</div><div>&nbsp; FusionLog==== Informations d'état de liaison préalable ===</div><div>JRN : DisplayName = IdeaBlade.EntityModel.Web, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0</div><div>&nbsp;(Fully-specified)</div><div>JRN : Appbase = file:///C:/Dev/Ideablade/Bugs/TargetInvocationExceptionBis/TargetInvocationExceptionBis/bin/Debug/</div><div>JRN : PrivatePath initial = NULL</div><div>Assembly appelant : IdeaBlade.Core, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0.</div><div>===</div><div>JRN : cette liaison démarre dans le contexte de chargement de default.</div><div>JRN : utilisation du fichier de configuration de l'application : C:\Dev\Ideablade\Bugs\TargetInvocationExceptionBis\TargetInvocationExceptionBis\bin\Debug\TargetInvocationExceptionBis.vshost.exe.Config</div><div>JRN : utilisation du fichier de configuration d'hôte :&nbsp;</div><div>JRN : utilisation du fichier de configuration de l'ordinateur à partir de C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.</div><div>JRN : référence post-stratégie : IdeaBlade.EntityModel.Web, Version=7.2.2.0, Culture=neutral, PublicKeyToken=287b5094865421c0</div><div>JRN : tentative de téléchargement de la nouvelle URL file:///C:/Dev/Ideablade/Bugs/TargetInvocationExceptionBis/TargetInvocationExceptionBis/bin/Debug/IdeaBlade.EntityModel.Web.DLL.</div><div>JRN : tentative de téléchargement de la nouvelle URL file:///C:/Dev/Ideablade/Bugs/TargetInvocationExceptionBis/TargetInvocationExceptionBis/bin/Debug/IdeaBlade.EntityModel.Web/IdeaBlade.EntityModel.Web.DLL.</div><div>JRN : tentative de téléchargement de la nouvelle URL file:///C:/Dev/Ideablade/Bugs/TargetInvocationExceptionBis/TargetInvocationExceptionBis/bin/Debug/IdeaBlade.EntityModel.Web.EXE.</div><div>JRN : tentative de téléchargement de la nouvelle URL file:///C:/Dev/Ideablade/Bugs/TargetInvocationExceptionBis/TargetInvocationExceptionBis/bin/Debug/IdeaBlade.EntityModel.Web/IdeaBlade.EntityModel.Web.EXE.</div><div><br></div><div>&nbsp; StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)</div><div>&nbsp; InnerException:&nbsp;</div><div><br></div><div></pre></td></tr></table></div></div>]]>
   </description>
   <pubDate>Fri, 11 Apr 2014 02:52:48 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17490#17490</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Ok. I think at this point if you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17485#17485</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 1:04pm<br /><br />Ok. I think at this point if you can isolate that to a small test solution, I'd be able to investigate further.]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 13:04:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17485#17485</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Still the same issue when I remove...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17484#17484</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 12:07pm<br /><br />Still the same issue when I remove the abstract keyword.]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 12:07:46 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17484#17484</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Can you try making the ReferenceBase...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17483#17483</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 11:52am<br /><br />Can you try making the ReferenceBase non-abstract and see if the NullRefEx still occurs?]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 11:52:58 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17483#17483</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : it&amp;#039;s just a bool property,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17481#17481</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 11:21am<br /><br /><div>it's just a bool property, no specific code.</div><div><br></div><div>Here is the full code of tyhe Entity</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&nbsp;&#091;DataContract(IsReference = true)&#093;</div><div>&nbsp; &nbsp; public abstract class ReferenceBase: KatekAuditEntity</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; protected ReferenceBase()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div><span style="line-height: 1.4;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Actif = true;</span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public int Id { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public bool Actif { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;StringLengthVerifier(MaxValue = CommonCst.Strings.Code)&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public string Code { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;StringLengthVerifier(MaxValue = CommonCst.Strings.LblCourt)&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public string Libelle { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public DateTime DateDebut { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public DateTime DateFin { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public RelatedEntityList&lt;RefInvisible&gt; RefsInvisibles { get { return null; } }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;ForeignKey("TypeInterne")&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public int TypeInterne_Discriminant { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;ForeignKey("TypeInterne")&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public string TypeInterne_Code { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public TypeInterne TypeInterne { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; public override string ToString()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return Libelle;</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; #region EntityPropertyNames</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public partial class EntityPropertyNames</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public const string&nbsp;RefsInvisibles&nbsp;= "RefsInvisibles&nbsp;";</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; public const string TypeInterne = "TypeInterne";</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; #endregion EntityPropertyNames &nbsp; &nbsp;</div><div>&nbsp; &nbsp; }</div><div></pre></td></tr></table></div>]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 11:21:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17481#17481</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Can you post a code snippet for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17480#17480</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 11:05am<br /><br />Can you post a code snippet for the property Actif?]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 11:05:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17480#17480</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Below the differents exceptions...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17479#17479</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 10-Apr-2014 at 1:35am<br /><br /><div><span style="line-height: 1.4;">Below the differents exceptions raised :</span></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>L'exception System.NullReferenceException s'est produite</div><div>&nbsp; Message=La référence d'objet n'est pas définie à une instance d'un objet.</div><div>&nbsp; StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à MyApp.Module.Domain.Entities.TypeInterv.get_ForProf()</div><div>&nbsp; InnerException:&nbsp;</div><div></pre></td></tr></table></div><div><br></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>L'exception System.Reflection.TargetInvocationException s'est produite</div><div>&nbsp; Message=Une exception a été levée par la cible d'un appel.</div><div>&nbsp; StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.RuntimeMethodHandle.InvokeMethod(Object target, Object&#091;&#093; arguments, Signature sig, Boolean constructor)</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object&#091;&#093; parameters, CultureInfo culture, Boolean skipVisibilityChecks)</div><div>&nbsp; InnerException: System.NullReferenceException</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Message=La référence d'objet n'est pas définie à une instance d'un objet.</div><div>&nbsp; &nbsp; &nbsp; &nbsp;StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; à MyApp.Module.Domain.Entities.TypeInterv.get_ForProf()</div><div>&nbsp; &nbsp; &nbsp; &nbsp;InnerException:&nbsp;</div><div></pre></td></tr></table></div><div><br></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><span style="line-height: 1.4;">L'exception System.NullReferenceException s'est produite</span></div><div>&nbsp; Message=La référence d'objet n'est pas définie à une instance d'un objet.</div><div>&nbsp; StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à MyApp.Module.Domain.Entities.TypeInterv.get_Taux()</div><div>&nbsp; InnerException:&nbsp;</div><div></pre></td></tr></table></div><div><br></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><span style="line-height: 1.4;">L'exception System.Reflection.TargetInvocationException s'est produite</span></div><div>&nbsp; Message=Une exception a été levée par la cible d'un appel.</div><div>&nbsp; StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.RuntimeMethodHandle.InvokeMethod(Object target, Object&#091;&#093; arguments, Signature sig, Boolean constructor)</div><div>&nbsp; &nbsp; &nbsp; &nbsp;à System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object&#091;&#093; parameters, CultureInfo culture, Boolean skipVisibilityChecks)</div><div>&nbsp; InnerException: System.NullReferenceException</div><div>&nbsp; &nbsp; &nbsp; &nbsp;Message=La référence d'objet n'est pas définie à une instance d'un objet.</div><div>&nbsp; &nbsp; &nbsp; &nbsp;StackTrace:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; à MyApp.Module.Domain.Entities.TypeInterv.get_Taux()</div><div>&nbsp; &nbsp; &nbsp; &nbsp;InnerException:&nbsp;</div><div></pre></td></tr></table></div><div><br></div><div><br></div><div>While debugging with all CLR exception ON, the exception did put a breakpoint in the internal constructor of the base classe which looks like this :</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div><div>&nbsp; &nbsp; &#091;DataContract(IsReference = true)&#093;</div><div>&nbsp; &nbsp; public abstract class ReferenceBase: KatekAuditEntity</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; internal ReferenceBase()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Actif = true; &nbsp;&lt;--- The exception happens here&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div>&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; ....</div><div><span style="line-height: 1.4;">&nbsp; &nbsp; }&nbsp;</span></div><div><span style="line-height: 1.4;"></pre></td></tr></table></span></div><div><br></div><div>I did put this line in comment. All the exceptions did disapeer and the import was fast as excepted !</div><div><br></div><div>Are we not allowed to put code in a constructor of a base class with Devforce ? Is this a limitation ? An issue with postsharp ?</div><div>Note : I tried to change the visibility of the constructor from internal to protected and the issue still exists.</div><div><br></div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Thu, 10 Apr 2014 01:35:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17479#17479</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : You can try turning on all CLR...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17474#17474</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 09-Apr-2014 at 3:32pm<br /><br />You can try turning on all CLR exceptions and manually drill in when the NullRefEx occurs.]]>
   </description>
   <pubDate>Wed, 09 Apr 2014 15:32:54 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17474#17474</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Hi deniskI can&amp;#039;t catch the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17472#17472</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 09-Apr-2014 at 2:55pm<br /><br />Hi denisk<div><br></div><div>I can't catch the exception, it must be handled in the importEntities. Unless there a way to do it that i am not aware of ?</div>]]>
   </description>
   <pubDate>Wed, 09 Apr 2014 14:55:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17472#17472</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Hi Kdev,are you able to catch...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17471#17471</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 09-Apr-2014 at 2:49pm<br /><br />Hi Kdev,<div><br></div><div>are you able to catch and drill into the exception?</div><div><br></div><div>I'd like to see a stack trace on where this is occurring in DevForce.</div>]]>
   </description>
   <pubDate>Wed, 09 Apr 2014 14:49:55 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17471#17471</guid>
  </item> 
  <item>
   <title>System.Reflection.TargetInvocationException in Silverlight Model : Hi,I am using Cocktail, Devforce...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17463#17463</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1623" rel="nofollow">kdev</a><br /><strong>Subject:</strong> 4674<br /><strong>Posted:</strong> 09-Apr-2014 at 9:21am<br /><br /><div>Hi,</div><div><br></div><div>I am using Cocktail, Devforce 2012 7.2.2 and I have a codeFirst model.</div><div><br></div><div>When I try to preload my entities using cocktail, one of my entity use an abnormal amount of time to import only 7 entities into my entityManager's cache !!</div><div>Following to the log below, it takes ~6s to import them.&nbsp;</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>(DEBUG SL) 16:32:28.187 : MyApp.Common.PreLoadRepository`1:OnManagerCreated : PreLoadRepository&lt;MyApp.Module.Domain.Entities.ModeTraitment&gt;.Seed() imported 0 entites in 0.9998 ms. : ThreadId(1)</div><div>(DEBUG SL) 16:32:28.226 : MyApp.Common.PreLoadRepository`1:OnManagerCreated : PreLoadRepository&lt;MyApp.Module.Domain.Entities.Motif&gt;.Seed() imported 23 entites in 33.0001 ms. : ThreadId(1)</div><div>(DEBUG SL) 16:32:28.230 : MyApp.Common.PreLoadRepository`1:OnManagerCreated : PreLoadRepository&lt;MyApp.Module.Domain.Entities.Attribut&gt;.Seed() imported 0 entites in 1.0002 ms. : ThreadId(1)</div><div>Une exception de première chance de type 'System.NullReferenceException' s'est produite dans MyApp.Module.Domain.tn.SL</div><div>Une exception de première chance de type 'System.Reflection.TargetInvocationException' s'est produite dans mscorlib.dll</div><div>Une exception de première chance de type 'System.NullReferenceException' s'est produite dans MyApp.Module.Domain.tn.SL</div><div>Une exception de première chance de type 'System.Reflection.TargetInvocationException' s'est produite dans mscorlib.dll</div><div><br></div><div>...</div><div><br></div><div>Une exception de première chance de type 'System.NullReferenceException' s'est produite dans MyApp.Module.Domain.tn.SL</div><div>Une exception de première chance de type 'System.Reflection.TargetInvocationException' s'est produite dans mscorlib.dll</div><div>(MyApp DEBUG SL) 16:32:34.958 : MyApp.Common.PreLoadRepository`1:OnManagerCreated : <b>PreLoadRepository&lt;MyApp.Module.Domain.Entities.TypeInterv&gt;.Seed() imported 7 entites in 6726.06 ms. : ThreadId(1)</b></div><div>(MyApp DEBUG SL) 16:32:34.972 : MyApp.Common.PreLoadRepository`1:OnManagerCreated : PreLoadRepository&lt;MyApp.Module.Domain.Entities.TypeIdentity&gt;.Seed() imported 2 entites in 10.0012 ms. : ThreadId(1)</div><div></pre></td></tr></table></div><div><br></div><div>All the exception shown in the logs happen during the execution of : entityManager.ImportEntities(entities, MergeStrategy.OverwriteChanges) on this entity : <b>TypeInterv</b></div><div><br></div><div><span style="line-height: 1.4;">This entity use TPH. TypeInterv inherit of a base class named RefenceBase. The Preloader also loads many entities which also inherit of this base class (</span><span style="line-height: 1.4;">ModeTraitment, Attribut, ...</span><span style="line-height: 1.4;">) without any problem !</span></div><div><br></div><div>The entity looks like this :</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&#091;DataContract(IsReference = true)&#093;</div><div>public class TypeInterv : ReferenceBase</div><div>{</div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; public bool ForProf { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; &#091;Required&#093;</div><div>&nbsp; &nbsp; &#091;Taux&#093;</div><div>&nbsp; &nbsp; public decimal TauxRet { get; set; }</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public RelatedEntityList&lt;Tarif&gt; Tarif { get { return null; } }</div><div>}</div><div></pre></td></tr></table></div><div><br></div><div>I tried to cleanup the entity to find out what could be the issue. If I remove the RelatedEntityList I still get the exceptions and the excessive execution time.</div><div>If I remove the <b>TWO</b> properties (only one doesn't fix it), I no longer get the exceptions and the entities imports in 7ms.</div><div><br></div><div><span style="line-height: 1.4;"><br></span></div><div><span style="line-height: 1.4;">What could cause the issue ? I am guessing something related to the code injected by postsharp ?</span></div><div><span style="line-height: 1.4;"><br></span></div><div><br></div><div><span style="line-height: 1.4;">Note : The entity have a basic Configuration class :</span></div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&nbsp; &nbsp; public class TypeIntervConfiguration: EntityTypeConfiguration&lt;TypeInterv&gt;</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public TypeIntervConfiguration()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Map(e =&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.ToTable(Cst.Tables.TblReferenceBase);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; e.Requires(Cst.Fields.Discriminant)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .HasValue(Cst.ReferenceBase.DiscriminantTypeInterv);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });</div><div><br></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Property(p =&gt; p.ForProf)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .HasColumnName(Cst.Fields.TypeIntervForProf);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Property(p =&gt; p.TauxRet)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .HasColumnName(Cst.Fields.TypeIntervTauxRet);</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div></pre></td></tr></table></div><div><br></div><div>The attribute Taux is an EF Convention (I tried to test without the attribut and it doesn't fix it)</div><div><span style="line-height: 1.4;"><br></span></div><div><span style="line-height: 1.4;"><table width="99%"><tr><td><pre class="BBcode"></span></div><div>&nbsp; &nbsp; public class TauxConvention: Convention</div><div>&nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;summary&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// Constructeur</div><div>&nbsp; &nbsp; &nbsp; &nbsp; /// &lt;/summary&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; public TauxConvention()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; this.Properties()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Where(x =&gt; x.GetCustomAttributes(false).OfType&lt;TauxAttribute&gt;().Any())</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Configure(c =&gt; c.HasPrecision(18, 8));</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }</div><div>&nbsp; &nbsp; }</div><div></pre></td></tr></table></div><div><br></div><div><br></div><div>Any idea ?</div><div><br></div>]]>
   </description>
   <pubDate>Wed, 09 Apr 2014 09:21:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4674&amp;PID=17463#17463</guid>
  </item> 
 </channel>
</rss>