windows form with custom controls - duplicate declaration of member errors

This forum is meant for questions and discussions about the X# language and tools
Post Reply
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

windows form with custom controls - duplicate declaration of member errors

Post 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
Attachments
winformdupdec.jpg
winformdupdec.jpg (32.78 KiB) Viewed 567 times
User avatar
Chris
Posts: 4911
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

windows form with custom controls - duplicate declaration of member errors

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4911
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

windows form with custom controls - duplicate declaration of member errors

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

windows form with custom controls - duplicate declaration of member errors

Post 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
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

windows form with custom controls - duplicate declaration of member errors

Post 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!
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

windows form with custom controls - duplicate declaration of member errors

Post by robert »

Leigh,
Thanks for the confirmation

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
Post Reply