PC Review


Reply
Thread Tools Rate Thread

custom control StackOverflowException

 
 
éric
Guest
Posts: n/a
 
      13th Feb 2004
I have managed to create my custom control and I can add the dll to the
toolbar in a project no problem.

When I add it to the form however I get a StackOverflowException error.

I am not sure where to begin to figure out this error... any ideas?

I have an override for the OnResize event which then calls this.Invalidate()
I thought this was it but when I compile without this.Invalidate() I get the
same errors.

Regards,

éric


 
Reply With Quote
 
 
 
 
Chris Tacke, eMVP
Guest
Posts: n/a
 
      13th Feb 2004
You've got some sort of recursion going on - probably something in an
eventhandler that in turn causes the even to refire.

-Chris


"éric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have managed to create my custom control and I can add the dll to the
> toolbar in a project no problem.
>
> When I add it to the form however I get a StackOverflowException error.
>
> I am not sure where to begin to figure out this error... any ideas?
>
> I have an override for the OnResize event which then calls

this.Invalidate()
> I thought this was it but when I compile without this.Invalidate() I get

the
> same errors.
>
> Regards,
>
> éric
>
>



 
Reply With Quote
 
éric
Guest
Posts: n/a
 
      13th Feb 2004
Is there a way for me to step through the code causing the error?

Regards,
éric

"Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
news:(E-Mail Removed)...
> You've got some sort of recursion going on - probably something in an
> eventhandler that in turn causes the even to refire.
>
> -Chris
>
>
> "éric" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I have managed to create my custom control and I can add the dll to the
> > toolbar in a project no problem.
> >
> > When I add it to the form however I get a StackOverflowException error.
> >
> > I am not sure where to begin to figure out this error... any ideas?
> >
> > I have an override for the OnResize event which then calls

> this.Invalidate()
> > I thought this was it but when I compile without this.Invalidate() I get

> the
> > same errors.
> >
> > Regards,
> >
> > éric
> >
> >

>
>



 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      14th Feb 2004
Actually, what you want to do is to reach the exception under debugger and
look at the Stack window. When doing this, right-click on the stack window
and check "Show non-user code". YOu should be able to see clearly a
repeating pattern of function calls, which will give you an idea of what is
going wrong

"éric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Is there a way for me to step through the code causing the error?
>
> Regards,
> éric
>
> "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
> news:(E-Mail Removed)...
> > You've got some sort of recursion going on - probably something in an
> > eventhandler that in turn causes the even to refire.
> >
> > -Chris
> >
> >
> > "éric" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I have managed to create my custom control and I can add the dll to

the
> > > toolbar in a project no problem.
> > >
> > > When I add it to the form however I get a StackOverflowException

error.
> > >
> > > I am not sure where to begin to figure out this error... any ideas?
> > >
> > > I have an override for the OnResize event which then calls

> > this.Invalidate()
> > > I thought this was it but when I compile without this.Invalidate() I

get
> > the
> > > same errors.
> > >
> > > Regards,
> > >
> > > éric
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
éric
Guest
Posts: n/a
 
      14th Feb 2004
Hi Alex, thanks for your reply

I am not sure if I understand what you are saying...
The "Call Stack Window" is only available when the application is running in
debug mode.
The problem is I can not even add the control to the form... the error comes
imediatly when I try to place the control on the form.
The control never makes it to the form in the designer and so I can not view
anything in the "Call Stack Window".

What am I missing?

éric

"Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Actually, what you want to do is to reach the exception under debugger and
> look at the Stack window. When doing this, right-click on the stack window
> and check "Show non-user code". YOu should be able to see clearly a
> repeating pattern of function calls, which will give you an idea of what

is
> going wrong
>
> "éric" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Is there a way for me to step through the code causing the error?
> >
> > Regards,
> > éric
> >
> > "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
> > news:(E-Mail Removed)...
> > > You've got some sort of recursion going on - probably something in an
> > > eventhandler that in turn causes the even to refire.
> > >
> > > -Chris
> > >
> > >
> > > "éric" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > I have managed to create my custom control and I can add the dll to

> the
> > > > toolbar in a project no problem.
> > > >
> > > > When I add it to the form however I get a StackOverflowException

> error.
> > > >
> > > > I am not sure where to begin to figure out this error... any ideas?
> > > >
> > > > I have an override for the OnResize event which then calls
> > > this.Invalidate()
> > > > I thought this was it but when I compile without this.Invalidate() I

> get
> > > the
> > > > same errors.
> > > >
> > > > Regards,
> > > >
> > > > éric
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      14th Feb 2004
Sorry, didn't realize you were talking about the designtime
I think you should be able to launch a second instance of VStudio and attach
to the first one, thus being able to catch the exception in the debugger

"éric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi Alex, thanks for your reply
>
> I am not sure if I understand what you are saying...
> The "Call Stack Window" is only available when the application is running

in
> debug mode.
> The problem is I can not even add the control to the form... the error

comes
> imediatly when I try to place the control on the form.
> The control never makes it to the form in the designer and so I can not

view
> anything in the "Call Stack Window".
>
> What am I missing?
>
> éric
>
> "Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Actually, what you want to do is to reach the exception under debugger

and
> > look at the Stack window. When doing this, right-click on the stack

window
> > and check "Show non-user code". YOu should be able to see clearly a
> > repeating pattern of function calls, which will give you an idea of what

> is
> > going wrong
> >
> > "éric" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Is there a way for me to step through the code causing the error?
> > >
> > > Regards,
> > > éric
> > >
> > > "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
> > > news:(E-Mail Removed)...
> > > > You've got some sort of recursion going on - probably something in

an
> > > > eventhandler that in turn causes the even to refire.
> > > >
> > > > -Chris
> > > >
> > > >
> > > > "éric" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > I have managed to create my custom control and I can add the dll

to
> > the
> > > > > toolbar in a project no problem.
> > > > >
> > > > > When I add it to the form however I get a StackOverflowException

> > error.
> > > > >
> > > > > I am not sure where to begin to figure out this error... any

ideas?
> > > > >
> > > > > I have an override for the OnResize event which then calls
> > > > this.Invalidate()
> > > > > I thought this was it but when I compile without this.Invalidate()

I
> > get
> > > > the
> > > > > same errors.
> > > > >
> > > > > Regards,
> > > > >
> > > > > éric
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
éric
Guest
Posts: n/a
 
      14th Feb 2004
Can I assume that the problem is in or called by my constructor?


"Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Sorry, didn't realize you were talking about the designtime
> I think you should be able to launch a second instance of VStudio and

attach
> to the first one, thus being able to catch the exception in the debugger
>
> "éric" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi Alex, thanks for your reply
> >
> > I am not sure if I understand what you are saying...
> > The "Call Stack Window" is only available when the application is

running
> in
> > debug mode.
> > The problem is I can not even add the control to the form... the error

> comes
> > imediatly when I try to place the control on the form.
> > The control never makes it to the form in the designer and so I can not

> view
> > anything in the "Call Stack Window".
> >
> > What am I missing?
> >
> > éric
> >
> > "Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Actually, what you want to do is to reach the exception under debugger

> and
> > > look at the Stack window. When doing this, right-click on the stack

> window
> > > and check "Show non-user code". YOu should be able to see clearly a
> > > repeating pattern of function calls, which will give you an idea of

what
> > is
> > > going wrong
> > >
> > > "éric" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Is there a way for me to step through the code causing the error?
> > > >
> > > > Regards,
> > > > éric
> > > >
> > > > "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > You've got some sort of recursion going on - probably something in

> an
> > > > > eventhandler that in turn causes the even to refire.
> > > > >
> > > > > -Chris
> > > > >
> > > > >
> > > > > "éric" <(E-Mail Removed)> wrote in message
> > > > > news:(E-Mail Removed)...
> > > > > > I have managed to create my custom control and I can add the dll

> to
> > > the
> > > > > > toolbar in a project no problem.
> > > > > >
> > > > > > When I add it to the form however I get a StackOverflowException
> > > error.
> > > > > >
> > > > > > I am not sure where to begin to figure out this error... any

> ideas?
> > > > > >
> > > > > > I have an override for the OnResize event which then calls
> > > > > this.Invalidate()
> > > > > > I thought this was it but when I compile without

this.Invalidate()
> I
> > > get
> > > > > the
> > > > > > same errors.
> > > > > >
> > > > > > Regards,
> > > > > >
> > > > > > éric
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      14th Feb 2004
Not necessarily - it could be one of the member functions

"éric" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Can I assume that the problem is in or called by my constructor?
>
>
> "Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Sorry, didn't realize you were talking about the designtime
> > I think you should be able to launch a second instance of VStudio and

> attach
> > to the first one, thus being able to catch the exception in the debugger
> >
> > "éric" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi Alex, thanks for your reply
> > >
> > > I am not sure if I understand what you are saying...
> > > The "Call Stack Window" is only available when the application is

> running
> > in
> > > debug mode.
> > > The problem is I can not even add the control to the form... the error

> > comes
> > > imediatly when I try to place the control on the form.
> > > The control never makes it to the form in the designer and so I can

not
> > view
> > > anything in the "Call Stack Window".
> > >
> > > What am I missing?
> > >
> > > éric
> > >
> > > "Alex Feinman [MVP]" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Actually, what you want to do is to reach the exception under

debugger
> > and
> > > > look at the Stack window. When doing this, right-click on the stack

> > window
> > > > and check "Show non-user code". YOu should be able to see clearly a
> > > > repeating pattern of function calls, which will give you an idea of

> what
> > > is
> > > > going wrong
> > > >
> > > > "éric" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Is there a way for me to step through the code causing the error?
> > > > >
> > > > > Regards,
> > > > > éric
> > > > >
> > > > > "Chris Tacke, eMVP" <ctacke[at]Open_NET_CF[dot]org> wrote in

message
> > > > > news:(E-Mail Removed)...
> > > > > > You've got some sort of recursion going on - probably something

in
> > an
> > > > > > eventhandler that in turn causes the even to refire.
> > > > > >
> > > > > > -Chris
> > > > > >
> > > > > >
> > > > > > "éric" <(E-Mail Removed)> wrote in message
> > > > > > news:(E-Mail Removed)...
> > > > > > > I have managed to create my custom control and I can add the

dll
> > to
> > > > the
> > > > > > > toolbar in a project no problem.
> > > > > > >
> > > > > > > When I add it to the form however I get a

StackOverflowException
> > > > error.
> > > > > > >
> > > > > > > I am not sure where to begin to figure out this error... any

> > ideas?
> > > > > > >
> > > > > > > I have an override for the OnResize event which then calls
> > > > > > this.Invalidate()
> > > > > > > I thought this was it but when I compile without

> this.Invalidate()
> > I
> > > > get
> > > > > > the
> > > > > > > same errors.
> > > > > > >
> > > > > > > Regards,
> > > > > > >
> > > > > > > éric
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
éric
Guest
Posts: n/a
 
      14th Feb 2004
I found out what it was but I can't explain it
this line is what messes it up... why? (conditional statement prevents the
StackOverflowException error)
#if !NETCFDESIGNTIME
lblDLStatus.Parent = pnllblDLStatus;
#endif
I put the conditions to avoid the problem in design time... but why does
this cause an error when this line is in the constructor?

Now my problem is 2 fold... without that line the design time does not look
exactly as it should
Second and most important I get the following error when I run the app with
my control:
--------------------------------
TypeLoadException
Could not load type
System.Windows.Froms.Panel from
assembly System.Windows.Forms,
Version = 1.0.5000.0, Culture = neutral
PublickKeyToken=B77A5C561934E089
--------------------------------
This Error comes up before the first line of code is executed?
What am I missing?
Regards,
éric


 
Reply With Quote
 
Alex Yakhnin, MVP
Guest
Posts: n/a
 
      14th Feb 2004
Do you have any code in the OnParentChanged event override?

--
Alex Yakhnin, NET CF MVP
IntelliProg, Inc.
http://www.intelliprog.com

"éric" <(E-Mail Removed)> wrote in message
news:efWJ$(E-Mail Removed)...
> I found out what it was but I can't explain it
> this line is what messes it up... why? (conditional statement prevents the
> StackOverflowException error)
> #if !NETCFDESIGNTIME
> lblDLStatus.Parent = pnllblDLStatus;
> #endif
> I put the conditions to avoid the problem in design time... but why does
> this cause an error when this line is in the constructor?
>
> Now my problem is 2 fold... without that line the design time does not

look
> exactly as it should
> Second and most important I get the following error when I run the app

with
> my control:
> --------------------------------
> TypeLoadException
> Could not load type
> System.Windows.Froms.Panel from
> assembly System.Windows.Forms,
> Version = 1.0.5000.0, Culture = neutral
> PublickKeyToken=B77A5C561934E089
> --------------------------------
> This Error comes up before the first line of code is executed?
> What am I missing?
> Regards,
> éric
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
StackOverflowException when Control added to Form MaxGruven Microsoft Dot NET Framework Forms 1 26th Jan 2008 12:41 PM
Re: Code for setting Forms to open with custom tool bar, menubar and control custom short Rick Brandt Microsoft Access 0 5th Feb 2006 01:06 PM
Capturing event from other custom control within another custom control Jonah Olsson Microsoft ASP .NET 1 5th Apr 2005 02:39 PM
zooming a custom control - layout custom controls in grid john menke Microsoft C# .NET 1 31st May 2004 06:21 PM
Using Table control in a custom composite control. Control does not render properly in design time. jb_in_marietta@yahoo.com Microsoft ASP .NET 0 1st Jul 2003 10:26 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:56 AM.