The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
BinarySerializer is a very useful tool, with much less "ceremony" (annotations) required than DataContract. It does have its own brutal ways: it will serialize private Fields.
The fact my WinForm app created an instance of another project (generic 'ctor) separate from the Form, and then called its internally defined Serialize/Deserialize methods ... that in turn used BinarySerializer ...
Well I didn't expect it to break trying to serialize with an error saying the Form must be marked as Serializable: after all, a WinForm is a Control, and you can't serialize Controls.
I went back over every part of the code: external Class project has parameterless 'ctor: check.
There were some properties of Type Action in the external project that had code injected into them at run-time in the Form Load event: I recalled that BinarySerializer ignored Properties being said somewhen by Marc Gravell.
After much gnashing of teeth, I finally let go of fantasizing that some new Framework version had screwed things up, and, went in and added [NonSerializable] attributes on the Action Property definitions.
Whoops: that's illegal: with BinarySerializer, that Attribute works only on Fields. Changed Actions to Fields, and voila, things save and restore as expected.
And now, I'm going to go outside and cry, because I have proven to myself, again, that my tendency toward certainty is my relentless enemy, and I burn with shame.
«One day it will have to be officially admitted that what we have christened reality is an even greater illusion than the world of dreams.» Salvador Dali