Capgemini / Cauldron

C# Toolkit
MIT License
76 stars 18 forks source link

PropertyInterceptionInfo not marked as NonSerialized #50

Closed ibutra closed 6 years ago

ibutra commented 6 years ago

The added Property PropertyInterceptionInfo is not marked as NonSerialized which makes it impossible to intercept Properties of classes which shall be serialized

reflection-emit commented 6 years ago

It is actually not a property... It is a field... I will add a NonSerialized attribute to that field.

reflection-emit commented 6 years ago

Ok... It is added... I'll push and release a new version after I am finished with some documentations.

ibutra commented 6 years ago

You are of course right it is a field. And WOW! thank you for that quick reaction and fix. Keep up the great work

reflection-emit commented 6 years ago

I also added Newtonsoft.Json.JsonIgnoreAttribute to the list... In case Newtonsoft.Json is referenced in the project.

reflection-emit commented 6 years ago

Fixed in version 2.0.24 ... The build script has skiped a version... 😄 Packages are uploading now.

ibutra commented 6 years ago

First of all: Thank you for this quick reaction and fix. Unfortunately I still get the following error:

System.Runtime.Serialization.SerializationException HResult=0x8013150C Message=Type 'Cauldron.Interception.PropertyInterceptionInfo' in Assembly 'Cauldron.Interception, Version=2.0.0.24, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

I tried to clean the solution and rebuild. I even restarted Visual Studio. Something else I am missing?

reflection-emit commented 6 years ago

Hmmm…. Weird… Can you give more infos please. What are you intercepting a field or a property? How are you serializing the instance? I have to reproduce the error to build a unit test out of it to avoid such errors in the future.


Firma: Capgemini Deutschland GmbH Aufsichtsratsvorsitzender: Antonio Schnieder • Geschäftsführer: Dr. Michael Schulte (Sprecher) • Jost Förster • Dr. Peter Lempp • Dr. Volkmar Varnhagen

Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

ibutra commented 6 years ago

I will try to minimize it as much as possible to narrow it down and get back to you

reflection-emit commented 6 years ago

Yes! I am able to reproduce it now… Analysing it now… I’ll push an update as soon as I have fixed it.


Firma: Capgemini Deutschland GmbH Aufsichtsratsvorsitzender: Antonio Schnieder • Geschäftsführer: Dr. Michael Schulte (Sprecher) • Jost Förster • Dr. Peter Lempp • Dr. Volkmar Varnhagen

Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

ibutra commented 6 years ago

In case you still need it, here is my minimal example:

Repository

reflection-emit commented 6 years ago

Thanks… That confirms that I am in the right track… It is almost the same code I use to reproduce. So… What I found out… The fields and properties created by Cauldron are all attributed with the NonSerialized Attribute… Seems like it is just ignored. I am trying to find out why. I have to google a bit.


Firma: Capgemini Deutschland GmbH Aufsichtsratsvorsitzender: Antonio Schnieder • Geschäftsführer: Dr. Michael Schulte (Sprecher) • Jost Förster • Dr. Peter Lempp • Dr. Volkmar Varnhagen

Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

reflection-emit commented 6 years ago

Ok now I got it… The compiler seems to remove the Custom attribute and replace it with an IL feature. So the result is: .field private nonserialized class ….. Where my attributes are still custom attributes .field private class… .custom instance class [mscorlib]System.NonSerializedAttribute::ctor()

Fixing that right now.


Firma: Capgemini Deutschland GmbH Aufsichtsratsvorsitzender: Antonio Schnieder • Geschäftsführer: Dr. Michael Schulte (Sprecher) • Jost Förster • Dr. Peter Lempp • Dr. Volkmar Varnhagen

Amtsgericht Berlin-Charlottenburg, HRB 98814 This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message.

reflection-emit commented 6 years ago

Check the newest version please.

ibutra commented 6 years ago

Thank you, it works now.