Page 1 of 1
windows form with custom controls - duplicate declaration of member errors
Posted: Fri Jan 28, 2022 4:00 pm
by leighproman
Trying to open some Windows Forms for the first time since going to X# 2.10 and getting lots of "Duplicate declaration of member '...'" errors.
All seem to relate to custom controls.
Any ideas where to start looking?
Thanks
windows form with custom controls - duplicate declaration of member errors
Posted: Fri Jan 28, 2022 4:29 pm
by Chris
Hi Leigh,
I suspect it has to do with this message about Date/DateTime, some control that is using that is some way, although it could also be a red herring.
The most reliable way to debug this is to start removing code from the InitializeComponent() (most likely the culprit) method, until the error is not shown anymore, which will show which was the line of code that caused it. If you'd like I can do this myself (have done it 100s of times so I am very familiar with the procedure) if you can send me a repro sample.
windows form with custom controls - duplicate declaration of member errors
Posted: Fri Jan 28, 2022 5:30 pm
by Chris
Hi Leigh,
Actually I just found this: If there's a line of code in designer.prg like:
SELF:oMyControl:MyDateProperty := (DATE)DateTime.now
then i indeed get the error message about an invalid cast from the form designer and the form doesn't open. I will log this for Robert to fix and it's possible that this is exactly the problem in your form as well, but maybe it's also something different, so we still need to figure this out to be sure.
windows form with custom controls - duplicate declaration of member errors
Posted: Fri Jan 28, 2022 8:12 pm
by leighproman
Hi Chris
I've had issues like this before and even after removing the obvious surplus code from the designer I still have problems this time.
Have emailed you a much simpler example with a single custom control on it.
Leigh
windows form with custom controls - duplicate declaration of member errors
Posted: Mon Jan 31, 2022 10:24 am
by leighproman
Just a quick follow-up to say thanks to Chris and Robert for having this issue investigated, diagnosed and patched by Monday morning!
windows form with custom controls - duplicate declaration of member errors
Posted: Mon Jan 31, 2022 11:20 am
by robert
Leigh,
Thanks for the confirmation
Robert