Comments (10)
Could it be because it's actually called "Property"? There is an "OnPropertyChanged" virtual method and the property is called OnPropertyChanged. Or does it happen to any sort of property name?
from catel.fody.
the name of the property does not matter.
from catel.fody.
I've written reproducable unit tests. Will investigate why this happens.
from catel.fody.
Generated code:
public object MyProperty
{
[CompilerGenerated]
get
{
return <MyProperty>k__BackingField;
}
[CompilerGenerated]
set
{
<MyProperty>k__BackingField = value;
OnMyPropertyChanged();
RaisePropertyChanged("MyProperty");
}
}
from catel.fody.
It also seems to happen to Catel 5 (according to the unit tests). It's probably because the ObservableObject does not do a equality check before raising the property.
There could be 2 solutions here (but I think both need to be fixed in Catel itself):
- Get value before assigning in the model (but it will be "more expensive")
- Add equality checks in ObservableObject setters (bonus)
from catel.fody.
Yes, ObservableObject does not check the old value before setting it again.
But I don't understand why the line: Model.Property = "test"; causes the value to be set twice?
from catel.fody.
It only happens to ObservableObject (not ModelBase) because the ModelBase does equality checks under the hood. I think the best way to solve this is in the ViewModelBase since we can never rely on any model handling this correctly.
from catel.fody.
Closing this ticket in favor of the Catel one (this will be (is actually) fixed in Catel itself).
from catel.fody.
btw the other request is covered by #357 , but that will only solve this issue when using the Catel one. If you use any others, it would still fail (hence the fix in Catel itself).
from catel.fody.
Ok, I'm waiting for a fix in Catel.
from catel.fody.
Related Issues (20)
- StackOverflowException in OnPropertyChangedWeaver for indexer properties HOT 3
- BadImageFormatException with Expose - weaver cannot resolve type of property HOT 14
- Support migration of RaisePropertyChanged(() => MyProperty) to RaisePropertyChanged(nameof(MyProperty)) HOT 3
- Generate error in case Argument expressions are used inside Catel HOT 2
- Weave calculated property notifications as if-else-if, not consecutive ifs HOT 6
- Allow visibility of generated properties to be customized HOT 1
- CatelFodyNullException with IEquatable implemented in another assembly HOT 6
- Catel.Fody doesn't weave the virtual properties correctly HOT 4
- Catel.Fody Fails to weave properties that are referenced across multiple projects HOT 2
- Object reference not set to an instance of an object HOT 9
- Part 2 of Object Reference not set to an instance of an object. HOT 2
- ObservableObject setters should check for equality before assigning HOT 1
- ViewModelBase derived classes with own SetValue method generating wrong code HOT 7
- Can you guide me how to use Crypto Obfuscator For .Net for obfuscated encryption? Before Costura.Fody works ? HOT 4
- Can anyone please help me how to use Costura.Fody to package LevelDB.Standard ? HOT 2
- Reference to ExposeAttribute not found. HOT 7
- Init only properties are not being weaved HOT 1
- Method OnPropertyChanged for exposed property is called with old value HOT 5
- Attribute to suppress message HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from catel.fody.