A set of .NET Framework managed libraries for developing graphical user interfaces.
Hello @Michael Pettigrew ,
This is a design-time serialization error, not a runtime bug. When you change a property and save, the Windows Forms Designer re-serializes the control back into its .Designer file, tracking each field/component by name in an internal dictionary. The message means the serializer looked up the name reader and couldn't find it, so that key is your main clue, and likely the reason one control saves and the other doesn't.
Please try the following:
- Search the failing control for
reader. Check the code-behind, the.Designerfile, and the.resxfor a field/control/event named or referencingreader, then compare against the working control. A copied or renamed control often leavesInitializeComponentreferencingthis.readerwhile the field was renamed or removed (or vice-versa), the declaration, instantiation, property assignments, and event hookups must all use the same name. - Hide runtime-only members from the serializer. If the control exposes a public property backed by a
readerobject, mark it with[Browsable(false)]and[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]so the designer doesn't try to serialize it. - Rebuild and reset stale state. Clean + Rebuild, fix any compile errors, then close VS, delete the
binandobjfolders, reopen and rebuild. Also confirm the control is the first class declared in its file.
To help identify the exact mismatch, please share the full exception / call stack (the “Show Call Stack” link in the error bar, or the entries in %APPDATA%\Microsoft\VisualStudio\<ver>\ActivityLog.xml), the .Designer files of both controls, and your VS version + target framework (.NET Framework vs .NET).
References
- Design-time error troubleshooting (Windows Forms Designer)
- Debug custom Windows Forms controls at design time
- DesignerSerializationVisibilityAttribute
If you found my response helpful or informative, I would greatly appreciate it if you could follow this guide for your confirmation.
Thank you.