Closed pilcherd closed 1 year ago
I'm not really familiar with those frameworks but if they are simply adding/injecting attributes then why wouldn't the ignore attribute still be present? Or am I misunderstanding you.
The ReactiveUI library uses Fody in a way that is similar to Fody.PropertyChanged. This uses Fody in the build process to modify a user class and inject code to provide property changed notifications. If you look at the example on the Fody link, it shows how Fody modifies the user's class and injects code into the class. The user does not get to see this updated code, so cannot add the BinarySerializer Ignore attribute.
As a test, I modified a local copy of BinarySerializer to ignore class properties named Changed, Changing and HandledExceptions (which had been injected into the class in the build process) and everything worked well, but it would be useful if that could be done via say a class level attribute on the BinarySerializer. Something like [IgnoreMembersNamed('Changed', 'Changing', 'HandledExceptions')].
Ah, I understand. Ok, let me think about it. It is a little annoying that you have to decorate every field. It almost seems like it should be opt-in vs opt-out by default.
Hi
We are experiencing an issue when using [Reactive] attributes in the ReactiveUI library along with a class we are using BinarySerializer on. ReactiveUI appears to use Fody to inject additional properties 'Changed' and 'Changing' into our class for notification tracking, and so when we come to serialize it, naturally it fails because there are additional properties present without the Ignore attribute added.
I looked at the code and can't see any other method to ignore other attributes (perhaps by name on a class level attribute). Is there any plans to add such a feature or does anyone know a way around this?
Thanks