Is this a by design or is it a bug?

Is this a by design or is it a bug?

Old forum URL: forums.lhotka.net/forums/t/4382.aspx


bitburner posted on Wednesday, February 20, 2008

I thought that the PropertyChanged event was only supposed to get fired if the value actually changes in our propertyInfo objects?  I found this in the latest get of BusinessBase for 3.5 (pulled down a fresh copy today at about 4:45 CST)...

protected void SetProperty<P>(PropertyInfo<P> propertyInfo, P newValue, bool throwOnNoAccess)

{

if (CanWriteProperty(propertyInfo.Name, throwOnNoAccess))

{

OnPropertyChanging(propertyInfo.Name);

try

{

P oldValue = default(P);

var fieldData = FieldManager.GetFieldData(propertyInfo);

if (fieldData == null)

{

oldValue = propertyInfo.DefaultValue;

fieldData = FieldManager.LoadFieldData<P>(propertyInfo, oldValue);

}

else

{

var fd = fieldData as FieldManager.IFieldData<P>;

if (fd != null)

oldValue = fd.Value;

else

oldValue = (P)fieldData.Value;

}

LoadPropertyValue<P>(propertyInfo, oldValue, newValue, true);

}

catch (Exception ex)

{

throw new PropertyLoadException(string.Format(Properties.Resources.PropertyLoadException, propertyInfo.Name, ex.Message));

}

PropertyHasChanged(propertyInfo.Name);

}

}

Looks like Property has changed get's fired no matter what happens (unless you don't have access to the property - then of course it doesnt because it's at the tail end of an if statement - is this the way it's supposed to be or is it a bug?

 

-Chase

 

 

RockfordLhotka replied on Wednesday, February 20, 2008

That seems rather like a bug to me...

RockfordLhotka replied on Wednesday, February 20, 2008

Yes, a bug – fixed now in svn – thanks!!

 

Rocky

 

 

From: RockfordLhotka [mailto:cslanet@lhotka.net]
Sent: Wednesday, February 20, 2008 5:32 PM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Is this a by design or is it a bug?

 

That seems rather like a bug to me...

Copyright (c) Marimer LLC