New Posts New Posts RSS Feed: SetValueWithChangeNotification throwing null reference exception
  FAQ FAQ  Forum Search Search  Calendar Calendar  Register Register  Login Login

SetValueWithChangeNotification throwing null reference exception

 Post Reply Post Reply
Author
monikapathak14 View Drop Down
Newbie
Newbie


Joined: 26-Jun-2013
Location: Gurgaon
Posts: 10
Post Options Post Options   Quote monikapathak14 Quote  Post ReplyReply Direct Link To This Post Topic: SetValueWithChangeNotification throwing null reference exception
    Posted: 21-Feb-2014 at 3:00am
I have a partial class for entity ProjectScenario

ProjectScenario.cs
{
           [Bindable(true, BindingDirection.OneWay)]
           [DataMember]
           public IEnumerable<ProjectPOG> Pogs
          {
             get { return _pogs; }
             set
             {
              _pogs = value;
              if (_pogs != null && _pogs.Count() > 0)
                  CalcMetrics();
             }
          }
          
         var qry = _pogs.GroupBy(p => 1)
              .Select(p => new
                               {
                                   Sales = p.Sum(x => x.Sales_ST_Wk_CUR),
                                   Units = p.Sum(x => x.Units_ST_WK_CUR),
                                   AGM = p.Sum(x => x.AGM_ST_WK_CUR),
                                   GM = p.Sum(x => x.GM_ST_WK_CUR),
                                   CM = p.Sum(x => x.CM_ST_WK_CUR),
                                   VPE = p.Sum(x => x.VPE_CUR),
                                   Loy = p.Sum(x => x.LOYAL_ST_WK_CUR),
                                   SFF = p.Sum(x => x.SFF_CUR),
                                   LFF = p.Sum(x => x.LFF),
                                   SkuCount = p.Sum(x => x.SKU_Count_CUR)
                               });
          var totals = qry.First();

if (RoundOffNullableValues(LOYAL_ST_WK_CUR) != RoundOffNullableValues(totals.Loy)) 
 LOYAL_ST_WK_CUR = totals.Loy;
}

LOYAL_ST_WK_CUR is one of the predefined properties of entity ProjectScenario.
Code breaks on line that's highlighted in red...inside the ideablade code(the designer.cs file for the project inside ProjectScenario entity.):

at IdeaBlade.EntityModel.EntityAspect.SetValueWithChangeNotification(DataEntityProperty property, Object newValue)

   at IdeaBlade.EntityModel.EntityAspect.IdeaBlade.EntityModel.IStructuralObject.SetValueWithChangeNotification(DataEntityProperty property, Object newValue)

   at IdeaBlade.EntityModel.DataEntityProperty`2.SetValueWithVerification(TInstance instance, TValue newValue)

   at IdeaBlade.EntityModel.DataEntityProperty`2.<.ctor>b__4(DataEntityPropertySetInterceptorArgs`2 args)

   at IdeaBlade.Core.PropertyInterceptor`3.ExecuteActions(TArgs args)

   at IdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, Object context, TValue value)

   at IdeaBlade.Core.PropertyInterceptor`3.SetValue(TInstance instance, TValue value)

   at IdeaBlade.EntityModel.DataEntityProperty`2.SetValue(TInstance instance, TValue value)

   at PerformanceOptimizer.ProjectScenario.set_LOYAL_ST_WK_CUR(Nullable`1 value) in C:\SPO\ForDeployment\DomainModel.win\SPOdb.IB.Designer.cs:line 14810


It throws a NullReferenceException on the above line.

Please suggest what can be the possible reasons and how do i fix this??



Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down