<?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 : SetValueWithChangeNotification throwing null reference exception</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : SetValueWithChangeNotification throwing null reference exception</description>
  <pubDate>Fri, 10 Apr 2026 23:53:04 -700</pubDate>
  <lastBuildDate>Fri, 21 Feb 2014 03:00:11 -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=4651</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>SetValueWithChangeNotification throwing null reference exception : I have a partial class for entity...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4651&amp;PID=17390#17390</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=2090" rel="nofollow">monikapathak14</a><br /><strong>Subject:</strong> 4651<br /><strong>Posted:</strong> 21-Feb-2014 at 3:00am<br /><br />I have a partial class for entity ProjectScenario<div><br></div><div>ProjectScenario.cs</div><div>{</div><div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#091;Bindable(true, BindingDirection.OneWay)&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&#091;DataMember&#093;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;public IEnumerable&lt;ProjectPOG&gt; Pogs</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;get { return _pogs; }</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;set</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; _pogs = value;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (_pogs != null &amp;&amp; _pogs.Count() &gt; 0)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CalcMetrics();</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</div></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<span style="line-height: 1.4;">var qry = _pogs.GroupBy(p =&gt; 1)</span></div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .Select(p =&gt; new</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Sales = p.Sum(x =&gt; x.Sales_ST_Wk_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Units = p.Sum(x =&gt; x.Units_ST_WK_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;AGM = p.Sum(x =&gt; x.AGM_ST_WK_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;GM = p.Sum(x =&gt; x.GM_ST_WK_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;CM = p.Sum(x =&gt; x.CM_ST_WK_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;VPE = p.Sum(x =&gt; x.VPE_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Loy = p.Sum(x =&gt; x.LOYAL_ST_WK_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SFF = p.Sum(x =&gt; x.SFF_CUR),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LFF = p.Sum(x =&gt; x.LFF),</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;SkuCount = p.Sum(x =&gt; x.SKU_Count_CUR)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;});</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; var totals = qry.First();</div><div><br></div><div><span ="Apple-tab-span" style="white-space:pre">	</span>if (RoundOffNullableValues(LOYAL_ST_WK_CUR) != RoundOffNullableValues(totals.Loy))&nbsp;</div><div><span ="Apple-tab-span" style="white-space:pre">		</span><font color="#ff0033">&nbsp;LOYAL_ST_WK_CUR = totals.Loy;</font></div><div>}</div><div><br></div><div>LOYAL_ST_WK_CUR is one of the predefined properties of entity&nbsp;<span style="line-height: 1.4;">ProjectScenario.</span></div><div><span style="line-height: 1.4;">Code breaks on line that's highlighted in red...inside the ideablade code(the designer.cs file for the project inside ProjectScenario entity.):</span></div><div><span style="line-height: 1.4;"><br></span></div><div><p ="Ms&#111;normal"><font size="1">atIdeaBlade.EntityModel.EntityAspect.SetValueWithChangeNotification(DataEntityPropertyproperty, Object newValue)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.EntityModel.EntityAspect.IdeaBlade.EntityModel.IStructuralObject.SetValueWithChangeNotification(DataEntityPropertyproperty, Object newValue)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.EntityModel.DataEntityProperty`2.SetValueWithVerification(TInstanceinstance, TValue newValue)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.EntityModel.DataEntityProperty`2.&lt;.ctor&gt;b__4(DataEntityPropertySetInterceptorArgs`2args)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.Core.PropertyInterceptor`3.ExecuteActions(TArgs args)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, Objectcontext, TValue value)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, TValue value)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atIdeaBlade.EntityModel.DataEntityProperty`2.SetValue(TInstance instance, TValuevalue)<o:p></o:p></font></p><p ="Ms&#111;normal"><font size="1">&nbsp;&nbsp; atPerformanceOptimizer.ProjectScenario.set_LOYAL_ST_WK_CUR(Nullable`1 value) inC:\SPO\ForDeployment\DomainModel.win\SPOdb.IB.Designer.cs:line 14810</font><o:p></o:p></p><p ="Ms&#111;normal"><font size="1"><br></font></p><p ="Ms&#111;normal"><font size="2">It throws a NullReferenceException on the above line.</font></p><p ="Ms&#111;normal"><font size="2">Please suggest what can be the possible reasons and how do i fix this??</font></p><p ="Ms&#111;normal"><font size="1"><br></font></p><p ="Ms&#111;normal"><font size="1"><br></font></p></div>]]>
   </description>
   <pubDate>Fri, 21 Feb 2014 03:00:11 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4651&amp;PID=17390#17390</guid>
  </item> 
 </channel>
</rss>