When I set the location property for a control, stack overflows

  • Thread starter Thread starter Will Pittenger
  • Start date Start date
W

Will Pittenger

I have a Control derived class. When the parent of the control changes the
control's Location property, the stack overflows. I have not found a way to
find out what was on the stack when it does overflow. All I know is that
the program is either stopped due to an exception at the end of Main or has
exited after the Stack Overflow exception. (Both cases are Debug builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of confusion
thrown in), I finally tracked the last statement of mine executed to a line
where, as mentioned, the parent sets the child's location. The location
property is not overridden. I have not subscribed to the child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried rebooting
in case Windows was the cause. Neither helped.

Any ideas?
 
Can you post the complete source code for your custom control, as well as
the code that's being used to instantiate the control and add it to the
container, so we can take a look at it?
 
Will said:
I have a Control derived class. When the parent of the control changes the
control's Location property, the stack overflows. I have not found a way to
find out what was on the stack when it does overflow. All I know is that
the program is either stopped due to an exception at the end of Main or has
exited after the Stack Overflow exception. (Both cases are Debug builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of confusion
thrown in), I finally tracked the last statement of mine executed to a line
where, as mentioned, the parent sets the child's location. The location
property is not overridden. I have not subscribed to the child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried rebooting
in case Windows was the cause. Neither helped.

Do you have a handler in the child for size or location changing? If
you do, and don't check to see if its the same as it was, you will
cause an infinite loop....

The easiest way to find these is to set a breakpoint in a handler and
see how it got there, or to use the debugging facilities to print out
where you are in the methods.


Matt
 
Not location. Size, yes, but I checked all that. In fact, I did not know
it was the location until later. Nothing should be dealing with the
location except to set it.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Matt said:
Will said:
I have a Control derived class. When the parent of the control changes
the
control's Location property, the stack overflows. I have not found a way
to
find out what was on the stack when it does overflow. All I know is that
the program is either stopped due to an exception at the end of Main or
has
exited after the Stack Overflow exception. (Both cases are Debug builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine executed to a
line
where, as mentioned, the parent sets the child's location. The location
property is not overridden. I have not subscribed to the child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried
rebooting
in case Windows was the cause. Neither helped.

Do you have a handler in the child for size or location changing? If
you do, and don't check to see if its the same as it was, you will
cause an infinite loop....

The easiest way to find these is to set a breakpoint in a handler and
see how it got there, or to use the debugging facilities to print out
where you are in the methods.


Matt
 
Can you post an entire solution containing your custom UserControl, all
supporting custom classes, and a win forms application that demonstrates the
problem at runtime? Ideally if I could have something that I can just unzip,
load into VS, and then hit F5 and watch it blow up then at least I could
start helping after I see the problem. The code that you posted doesn't
compile because it's missing a definition for "memGraphicsDC". And once I
get it to compile I'll need to be able to reproduce the error. So it's for
these two reasons that it would be nice to have an entire solution (zipped
of course).
 
Will said:
Not location. Size, yes, but I checked all that. In fact, I did not know
it was the location until later. Nothing should be dealing with the
location except to set it.

I'd guess one of two possibilities:

1) The window handle is not valid at the time you try to set the
location
2) The size handler is somehow triggering the location reset. Only a
trace can tell you this one. Set a breakpoint in the size handler and
see when it gets called.

Otherwise, I'd post a message to the form to tell it to resize.

Matt
 
See below.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Matt said:
2) The size handler is somehow triggering the location reset. Only a
trace can tell you this one. Set a breakpoint in the size handler and
see when it gets called.
I know that now. I just do not understand why moving the control would
cause that stack overflow. It sounds like something after the last point I
see in the debugger.
 
I have no way to get it onto the server. The text file unzipped was only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)

The memGraphicsDC class is nothing special. I was actually about to remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any references
to memDC.DrawSurface with that Graphics object. In the paint handler, use
the paint event argument handler for the Graphics object.
 
Just shoot the zip over to the following email account and I can pick it up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com
 
You're "memGraphicsDC" class had a good number of method calls that needed
to be translated, using best guess, too. It wasn't as simple as just
swapping out "memGraphicsDC" with Graphics. I also got a few exceptions, all
resource related, when I finally got it to compile and run. Some of the main
reasons why a complete example that just unzips and repros the issue is a
good idea. The issue turns out to be that you were referencing the Size
property from within the "getter" of the Size property definition. So it
just keeps calling itself which eventually results in a stack overflow.
You'll need to change the code to call to the base as shown below.

// Old
public new System.Drawing.Size Size
{
get
{
return Size;
}
set
{
...
}
}

// New
public new System.Drawing.Size Size
{
get
{
return base.Size;
}
set
{
...
}
}

--
Tim Wilson
..Net Compact Framework MVP

Will Pittenger said:
Actually, I thought up a better way overnight. The form that instantiates
the header (rather than another control for now) is quite small. I have
difficulty believing you need much more. This class would probably help as
it would create the header within a header that triggered the problem. That
was the header inside the Name column. The main header is docked and does
not appear to have an issue with its location property.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Tim Wilson said:
Just shoot the zip over to the following email account and I can pick it
up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com

--
Tim Wilson
.Net Compact Framework MVP

Will Pittenger said:
I have no way to get it onto the server. The text file unzipped was only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)

The memGraphicsDC class is nothing special. I was actually about to remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any
references
to memDC.DrawSurface with that Graphics object. In the paint handler,
use
the paint event argument handler for the Graphics object.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post an entire solution containing your custom UserControl, all
supporting custom classes, and a win forms application that
demonstrates
the
problem at runtime? Ideally if I could have something that I can just
unzip,
load into VS, and then hit F5 and watch it blow up then at least I
could
start helping after I see the problem. The code that you posted doesn't
compile because it's missing a definition for "memGraphicsDC". And
once
I
get it to compile I'll need to be able to reproduce the error. So
it's
for
these two reasons that it would be nice to have an entire solution (zipped
of course).

--
Tim Wilson
.Net Compact Framework MVP

The class has just over 3000 lines. (Several nested classes are
included.)
I am attaching the entire class. If I attempt to simplify the file, the
problem would probably disappear. It would also take me a while to
get
the
code to work again. The class is intended to be a header (like the
one
in
Explorer). Normally, the header would always be docked. One of the
nested
classes (colDef) represents one of the columns. It serves as the
column's
definition (hence the name) and paints the column inside the header.

Now, I brought colDef up because I built in a way to allow the
column
to
host a header. This allows for, say a name field, to be split into
several
fields. (In that case: First Name, Middle Initial, and Last Name.) When
the header is the top level header, it is, as mentioned, docked and there
is
no problem. When a column hosts the header, it puts the header into
position with the fixChildHeaderPosAndSize member.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post the complete source code for your custom control, as well
as
the code that's being used to instantiate the control and add it
to
the
container, so we can take a look at it?

--
Tim Wilson
.Net Compact Framework MVP

I have a Control derived class. When the parent of the control
changes
the
control's Location property, the stack overflows. I have not
found
a
way
to
find out what was on the stack when it does overflow. All I know
is
that
the program is either stopped due to an exception at the end of
Main
or
has
exited after the Stack Overflow exception. (Both cases are Debug
builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine executed
to a
line
where, as mentioned, the parent sets the child's location. The
location
property is not overridden. I have not subscribed to the child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried
rebooting
in case Windows was the cause. Neither helped.

Any ideas?
 
Sorry, I do not know how I missed that. I should have seen that. Why would
that blow up when Location was set?
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Tim Wilson said:
You're "memGraphicsDC" class had a good number of method calls that needed
to be translated, using best guess, too. It wasn't as simple as just
swapping out "memGraphicsDC" with Graphics. I also got a few exceptions,
all
resource related, when I finally got it to compile and run. Some of the
main
reasons why a complete example that just unzips and repros the issue is a
good idea. The issue turns out to be that you were referencing the Size
property from within the "getter" of the Size property definition. So it
just keeps calling itself which eventually results in a stack overflow.
You'll need to change the code to call to the base as shown below.

// Old
public new System.Drawing.Size Size
{
get
{
return Size;
}
set
{
...
}
}

// New
public new System.Drawing.Size Size
{
get
{
return base.Size;
}
set
{
...
}
}

--
Tim Wilson
.Net Compact Framework MVP

Will Pittenger said:
Actually, I thought up a better way overnight. The form that
instantiates
the header (rather than another control for now) is quite small. I have
difficulty believing you need much more. This class would probably help as
it would create the header within a header that triggered the problem. That
was the header inside the Name column. The main header is docked and
does
not appear to have an issue with its location property.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Just shoot the zip over to the following email account and I can pick
it
up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com

--
Tim Wilson
.Net Compact Framework MVP

I have no way to get it onto the server. The text file unzipped was only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)

The memGraphicsDC class is nothing special. I was actually about to
remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any
references
to memDC.DrawSurface with that Graphics object. In the paint handler,
use
the paint event argument handler for the Graphics object.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post an entire solution containing your custom UserControl, all
supporting custom classes, and a win forms application that
demonstrates
the
problem at runtime? Ideally if I could have something that I can
just
unzip,
load into VS, and then hit F5 and watch it blow up then at least I
could
start helping after I see the problem. The code that you posted doesn't
compile because it's missing a definition for "memGraphicsDC". And once
I
get it to compile I'll need to be able to reproduce the error. So it's
for
these two reasons that it would be nice to have an entire solution
(zipped
of course).

--
Tim Wilson
.Net Compact Framework MVP

The class has just over 3000 lines. (Several nested classes are
included.)
I am attaching the entire class. If I attempt to simplify the
file,
the
problem would probably disappear. It would also take me a while to
get
the
code to work again. The class is intended to be a header (like the
one
in
Explorer). Normally, the header would always be docked. One of
the
nested
classes (colDef) represents one of the columns. It serves as the
column's
definition (hence the name) and paints the column inside the
header.

Now, I brought colDef up because I built in a way to allow the column
to
host a header. This allows for, say a name field, to be split into
several
fields. (In that case: First Name, Middle Initial, and Last Name.)
When
the header is the top level header, it is, as mentioned, docked and
there
is
no problem. When a column hosts the header, it puts the header
into
position with the fixChildHeaderPosAndSize member.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post the complete source code for your custom control, as
well
as
the code that's being used to instantiate the control and add it to
the
container, so we can take a look at it?

--
Tim Wilson
.Net Compact Framework MVP

I have a Control derived class. When the parent of the control
changes
the
control's Location property, the stack overflows. I have not found
a
way
to
find out what was on the stack when it does overflow. All I
know
is
that
the program is either stopped due to an exception at the end of
Main
or
has
exited after the Stack Overflow exception. (Both cases are
Debug
builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine
executed
to
a
line
where, as mentioned, the parent sets the child's location. The
location
property is not overridden. I have not subscribed to the
child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried
rebooting
in case Windows was the cause. Neither helped.

Any ideas?
 
I'm not sure. I didn't look into why the Size property was being called, I
just went to the point of locating the recursion that was happening within
the Size property itself.

--
Tim Wilson
..Net Compact Framework MVP

Will Pittenger said:
Sorry, I do not know how I missed that. I should have seen that. Why would
that blow up when Location was set?
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Tim Wilson said:
You're "memGraphicsDC" class had a good number of method calls that needed
to be translated, using best guess, too. It wasn't as simple as just
swapping out "memGraphicsDC" with Graphics. I also got a few exceptions,
all
resource related, when I finally got it to compile and run. Some of the
main
reasons why a complete example that just unzips and repros the issue is a
good idea. The issue turns out to be that you were referencing the Size
property from within the "getter" of the Size property definition. So it
just keeps calling itself which eventually results in a stack overflow.
You'll need to change the code to call to the base as shown below.

// Old
public new System.Drawing.Size Size
{
get
{
return Size;
}
set
{
...
}
}

// New
public new System.Drawing.Size Size
{
get
{
return base.Size;
}
set
{
...
}
}

--
Tim Wilson
.Net Compact Framework MVP

Will Pittenger said:
Actually, I thought up a better way overnight. The form that
instantiates
the header (rather than another control for now) is quite small. I have
difficulty believing you need much more. This class would probably
help
as
it would create the header within a header that triggered the problem. That
was the header inside the Name column. The main header is docked and
does
not appear to have an issue with its location property.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Just shoot the zip over to the following email account and I can pick
it
up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com

--
Tim Wilson
.Net Compact Framework MVP

I have no way to get it onto the server. The text file unzipped was only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)

The memGraphicsDC class is nothing special. I was actually about to
remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any
references
to memDC.DrawSurface with that Graphics object. In the paint handler,
use
the paint event argument handler for the Graphics object.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post an entire solution containing your custom
UserControl,
all
supporting custom classes, and a win forms application that
demonstrates
the
problem at runtime? Ideally if I could have something that I can
just
unzip,
load into VS, and then hit F5 and watch it blow up then at least I
could
start helping after I see the problem. The code that you posted doesn't
compile because it's missing a definition for "memGraphicsDC". And once
I
get it to compile I'll need to be able to reproduce the error. So it's
for
these two reasons that it would be nice to have an entire solution
(zipped
of course).

--
Tim Wilson
.Net Compact Framework MVP

The class has just over 3000 lines. (Several nested classes are
included.)
I am attaching the entire class. If I attempt to simplify the
file,
the
problem would probably disappear. It would also take me a while to
get
the
code to work again. The class is intended to be a header (like the
one
in
Explorer). Normally, the header would always be docked. One of
the
nested
classes (colDef) represents one of the columns. It serves as the
column's
definition (hence the name) and paints the column inside the
header.

Now, I brought colDef up because I built in a way to allow the column
to
host a header. This allows for, say a name field, to be split into
several
fields. (In that case: First Name, Middle Initial, and Last Name.)
When
the header is the top level header, it is, as mentioned, docked and
there
is
no problem. When a column hosts the header, it puts the header
into
position with the fixChildHeaderPosAndSize member.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post the complete source code for your custom control, as
well
as
the code that's being used to instantiate the control and add
it
to
the
container, so we can take a look at it?

--
Tim Wilson
.Net Compact Framework MVP

I have a Control derived class. When the parent of the control
changes
the
control's Location property, the stack overflows. I have not found
a
way
to
find out what was on the stack when it does overflow. All I
know
is
that
the program is either stopped due to an exception at the end of
Main
or
has
exited after the Stack Overflow exception. (Both cases are
Debug
builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine
executed
to
a
line
where, as mentioned, the parent sets the child's location. The
location
property is not overridden. I have not subscribed to the
child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I tried
rebooting
in case Windows was the cause. Neither helped.

Any ideas?
 
The more I think about it, it depends on how much .NET relies on Win32 calls
to do simple things. (I worked with MFC/C++ for close to a decade before
getting C#.) Windows stores rectangles using the lower right corner rather
than the size. If Windows is relying on .NET to track that rect, .NET is
going to use the Size property. Does that make sense?
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

Tim Wilson said:
I'm not sure. I didn't look into why the Size property was being called, I
just went to the point of locating the recursion that was happening within
the Size property itself.

--
Tim Wilson
.Net Compact Framework MVP

Will Pittenger said:
Sorry, I do not know how I missed that. I should have seen that. Why would
that blow up when Location was set?
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
You're "memGraphicsDC" class had a good number of method calls that needed
to be translated, using best guess, too. It wasn't as simple as just
swapping out "memGraphicsDC" with Graphics. I also got a few
exceptions,
all
resource related, when I finally got it to compile and run. Some of the
main
reasons why a complete example that just unzips and repros the issue is a
good idea. The issue turns out to be that you were referencing the Size
property from within the "getter" of the Size property definition. So
it
just keeps calling itself which eventually results in a stack overflow.
You'll need to change the code to call to the base as shown below.

// Old
public new System.Drawing.Size Size
{
get
{
return Size;
}
set
{
...
}
}

// New
public new System.Drawing.Size Size
{
get
{
return base.Size;
}
set
{
...
}
}

--
Tim Wilson
.Net Compact Framework MVP

Actually, I thought up a better way overnight. The form that
instantiates
the header (rather than another control for now) is quite small. I have
difficulty believing you need much more. This class would probably help
as
it would create the header within a header that triggered the problem.
That
was the header inside the Name column. The main header is docked and
does
not appear to have an issue with its location property.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Just shoot the zip over to the following email account and I can
pick
it
up
from there. The email address is, of course, mangled.
dllhell [remove] AT hotmail [dot] com

--
Tim Wilson
.Net Compact Framework MVP

I have no way to get it onto the server. The text file unzipped
was
only
101K. That was refused until I zipped it. The solution would be much
larger even zipped. (MS must be skimping there.)

The memGraphicsDC class is nothing special. I was actually about
to
remove
it due to .NET having everything it was meant to do. Replace the
memGraphicsDC parameters with a Graphics object and replace any
references
to memDC.DrawSurface with that Graphics object. In the paint handler,
use
the paint event argument handler for the Graphics object.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post an entire solution containing your custom UserControl,
all
supporting custom classes, and a win forms application that
demonstrates
the
problem at runtime? Ideally if I could have something that I can
just
unzip,
load into VS, and then hit F5 and watch it blow up then at least
I
could
start helping after I see the problem. The code that you posted
doesn't
compile because it's missing a definition for "memGraphicsDC".
And
once
I
get it to compile I'll need to be able to reproduce the error. So
it's
for
these two reasons that it would be nice to have an entire
solution
(zipped
of course).

--
Tim Wilson
.Net Compact Framework MVP

The class has just over 3000 lines. (Several nested classes are
included.)
I am attaching the entire class. If I attempt to simplify the
file,
the
problem would probably disappear. It would also take me a while to
get
the
code to work again. The class is intended to be a header (like the
one
in
Explorer). Normally, the header would always be docked. One of
the
nested
classes (colDef) represents one of the columns. It serves as
the
column's
definition (hence the name) and paints the column inside the
header.

Now, I brought colDef up because I built in a way to allow the
column
to
host a header. This allows for, say a name field, to be split into
several
fields. (In that case: First Name, Middle Initial, and Last Name.)
When
the header is the top level header, it is, as mentioned, docked and
there
is
no problem. When a column hosts the header, it puts the header
into
position with the fixChildHeaderPosAndSize member.
----------
Will Pittenger
E-Mail: mailto:will.pittenger1 at gmail.com
All mail filtered by Qurb (www.qurb.com)

"Tim Wilson" <TIM(UNDERSCORE)WILSON(AT)ROGERS(PERIOD)COM> wrote in
message
Can you post the complete source code for your custom control, as
well
as
the code that's being used to instantiate the control and add it
to
the
container, so we can take a look at it?

--
Tim Wilson
.Net Compact Framework MVP

message
I have a Control derived class. When the parent of the control
changes
the
control's Location property, the stack overflows. I have not
found
a
way
to
find out what was on the stack when it does overflow. All I
know
is
that
the program is either stopped due to an exception at the end of
Main
or
has
exited after the Stack Overflow exception. (Both cases are
Debug
builds
running in the debugger.)

After a lot of trial and error (mostly the latter with a dose of
confusion
thrown in), I finally tracked the last statement of mine
executed
to
a
line
where, as mentioned, the parent sets the child's location. The
location
property is not overridden. I have not subscribed to the
child's
LocationChanged event.

I tried full rebuilds in case the executable was corrupt. I
tried
rebooting
in case Windows was the cause. Neither helped.

Any ideas?
 
I don't think that the problem lies with the way .NET is doing things. If
you take, for example, the following code, create an instance of the
MyButton class, and then set the Location property, the Size property is not
called. You can set breakpoints in both the set and get and neither will be
called. Maybe there is something else in your code that is causing the call
to the Size property.

public class MyButton : System.Windows.Forms.Button
{
public new Size Size
{
get
{
return base.Size;
}
set
{
base.Size = value;
}
}
}
 
Back
Top