Print Page | Close Window

SetValueWithChangeNotification throwing null reference exception

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
Printed Date: 18-May-2022 at 12:20am

Topic: SetValueWithChangeNotification throwing null reference exception
Posted By: monikapathak14
Subject: SetValueWithChangeNotification throwing null reference exception
Date Posted: 21-Feb-2014 at 3:00am
I have a partial class for entity ProjectScenario

           [Bindable(true, BindingDirection.OneWay)]
           public IEnumerable<ProjectPOG> Pogs
             get { return _pogs; }
              _pogs = value;
              if (_pogs != null && _pogs.Count() > 0)
         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\\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??

Print Page | Close Window