Showing posts with label thrown. Show all posts
Showing posts with label thrown. Show all posts

Tuesday, March 13, 2012

System.StackOverflowException

Hi All,

When I set the property of title in my class (Shown below) I get a
"Exception of type System.StackOverflowException was thrown." error message.

I'm guessing I got some sort of horrible loop going on, where did I go
wrong?

Thanks,
Simon.

Private pTitleAs String

Public Property Title() As String
Get
Return pStrTitle
End Get
Set(ByVal Value As String)
Title = pStrTitle
End Set
End PropertyHello
Change
Title = pStrTitle
to
pStrTitle = Value

Best regards,
Sherif

"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
you're setting the title of the string with pstrTitle, but the set action
itself calls the property again recursively. The solution provided by sherif
will fix the problem, i just thought you wanted to know the why.

--
Regards,
Alvin Bruney - ASP.NET MVP

[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
Never mind - Realised my properties were in a right old mess :)

"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property

--
I am using the free version of SPAMfighter for private users.
It has removed 2175 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
...but thanks for the replies (I posted my reply before yours appeared)

System.StackOverflowException


Server Error in '/' Application.
------------------------

Exception of type 'System.StackOverflowException' was thrown.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.StackOverflowException: Exception of type 'System.StackOverflowException' was thrown.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[StackOverflowException: Exception of type 'System.StackOverflowException' was thrown.]

I was poking around with some of the controls in ASP.NET 2.0, and suddenly got this message. I have tried everything I can think of, but it just won't go away! Please help!

Thomas ><>Can you be more specific? For example can you post some code or tell us when this happen, what you did that will cause this exception to be thrown etc? This kind of exception will often be thrown when the stack is full, probably when there is loop that will do something with the stack and never. For example like a recursive method that will never end.

<%@. Master Debug="true" %>
<!DOCTYPE HTML SYSTEM>
<html xmlns="http://www.w3.org/1999/xhtml"
<!-- Begin Head. -->
<head>
<title>A Random Design</title>
<meta http-equiv="Content-Type" content="text/html" />
<link type="text/css" rel="stylesheet" href="http://links.10026.com/?link=/ard.css" />
</head>
<!-- End Head. --
<body class="bodycolor02">
<form id="mainform" runat="server"
<div align="center">
<table width="98%">
<tr>
<td colspan="3">
<!-- Begin Header. -->
<table id="header" class="header01" align="center" width="100%" height="100">
<tr>
<td class="backcolor02">><> A Random Design </td>
</tr>
</table>
<!-- End Header. -->
</td>
</tr>
<tr>
<td id="left" align="left" valign="top" width="200">
<!-- Begin Controls. -->
<table id="controls" class="nav01" width="200">
<tr>
<td class="backcolor02" colspan="3" align="center">Navigation</td>
<td class="backcolor02" colspan="5" align="center">Paragraph</td>
</tr>
<tr>
<td class="backcolor02" align="center" valign="bottom"><span class="nav01">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="nav02">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="nav03">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="text01">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="text02">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="text03">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="text04">A</span></td>
<td class="backcolor02" align="center" valign="bottom"><span class="text05">A</span></td>
</tr>
</table>
<!-- End Controls. -->
<!-- Begin Summary. -->
<table id="summary" class="nav01" width="200" height="25">
<tr>
<td class="backcolor02"><span align="center">Latest Updates:</span>
<p>The conversion to ASP.NET 2.0 was a success!<br />
It's a colourful world!<br />
Note the tweaked layout...</p>
</td>
</tr>
</table>
<!-- End Summary. -->
<!-- Begin Menu. -->
<table id="menu" class="nav01" width="200">
<tr>
<td class="backcolor02" valign="top">
<asp:SiteMapDataSource Runat="Server" ID="sitemap" />
<asp:TreeView Runat="Server" ShowExpandCollapse="true" DataSourceID="sitemap">
<DataBindings>
<asp:TreeNodeBinding PopulateOnDemand="true" NavigateUrlField="url" TextField="title" />
</DataBindings>
</asp:TreeView>
</td>
</tr>
</table>
<!-- End Menu. -->
</td>
<td id="center" class="backcolor00" width="100%" align="center" valign="top">
<!-- Begin NavLinks. -->
<table id="navlinks1" class="nav01" align="center" width="100%">
<tr>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="~/">Home</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="javascript:history.back(1)">Back</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><a href="http://links.10026.com/?link=../">Up</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="javascript:history.forward(1)">Forward</asp:HyperLink></span></td>
</tr>
<tr>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">First</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Previous</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Next</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Last</span></td>
</tr>
</table>
<!-- End NavLinks. -->
<!-- Begin BreadCrumbs. -->
<table id="breadcrumbs" class="nav01" align="center" width="100%">
<tr>
<td class="backcolor00">You are here: <asp:SiteMapPath ID="SiteMapPath1" Runat="Server" PathDirection="RootToCurrent" PathSeparator=":-:" CurrentNodeStyle-Font-Italic="true" />
</td>
</tr>
</table>
<!-- End BreadCrumbs. -->
<!-- Begin BodyHead. -->
<table class="header02" align="center" width="100%">
<tr>
<td class="backcolor02">
<asp:ContentPlaceHolder id="bodyhead" runat="server" />
</td>
</tr>
</table>
<!-- End BodyHead. -->
<!-- Begin BodyText. -->
<asp:Panel Runat="Server" ScrollBars="Auto" Width="100%" Height="500">
<table class="text02" align="center" width="100%">
<tr>
<td class="backcolor02" valign="top">
<asp:ContentPlaceHolder id="bodytext" runat="server" />
</td>
</tr>
</table>
</asp:Panel>
<!-- End BodyText. -->
<!-- Begin PageCounter. -->
<table class="nav01" align="center" width="100%">
<tr>
<td class="backcolor00" valign="top">
This page has been viewed <!-- Page Counter --> times.
</td>
</tr>
</table>
<!-- End PageCounter. -->
<!-- Begin NavLinks. -->
<table id="navlinks2" class="nav01" align="center" width="100%">
<tr>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="~/">Home</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="javascript:history.back(1)">Back</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><a href="http://links.10026.com/?link=../">Up</asp:HyperLink></span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled"><asp:HyperLink Runat="Server" NavigateUrl="javascript:history.forward(1)">Forward</asp:HyperLink></span></td>
</tr>
<tr>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">First</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Previous</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Next</span></td>
<td class="backcolor00" style="text-align: center"><span class="linkdisabled">Last</span></td>
</tr>
</table>
<!-- End NavLinks. -->
</td>
<td id="right" align="center" valign="top" width="200">
<!-- Begin AdsTable. -->
<table valign="top" width="100%">
<tr>
<td class="backcolor00">
<!-- Begin AdsTable. -->
<table valign="top" width="100%">
<tr>
<td class="backcolor00">
<asp:ContentPlaceHolder runat="server" ID="adstable">
<asp:AdRotator Runat="server" ID="AdRotator" AdvertisementFile="~/images/adrotate.xml" />
</asp:ContentPlaceHolder>
</td>
</tr>
</table>
<!-- End AdsTable. -->
</td>
</tr>
</table>
<!-- End AdsTable. --></td>
</tr>
<tr>
<td colspan="3">
<!-- Begin Footer. -->
<table id="footer" class="nav01" align="center" width="100%">
<tr>
<td class="backcolor02" width="100%">
<p style="text-align: center">Copyright © 2002-2004 Thomas Ingram ><> All Rights Reserved.</p>
</td>
</tr>
</table>
<!-- End Footer. -->
</td>
</tr>
</table>
</div
</form>
</body
</html>

That is the source for the Master page. I am certain the problem is not with the Content pages. Also I am using an XML file that has the menu info in it. I am sure the problem is not there either, since the menu worked at one point. Thank you.

Thomas ><>
Has anyone else seen this error? How is it fixed?
If you could send me your code and the XML file, I could check if I will have the same problem. My e-mail is fnormen@.<no spam>hotmail.com

System.StackOverflowException

Hi All,
When I set the property of title in my class (Shown below) I get a
"Exception of type System.StackOverflowException was thrown." error message.
I'm guessing I got some sort of horrible loop going on, where did I go
wrong?
Thanks,
Simon.
Private pTitleAs String
Public Property Title() As String
Get
Return pStrTitle
End Get
Set(ByVal Value As String)
Title = pStrTitle
End Set
End PropertyHello
Change
Title = pStrTitle
to
pStrTitle = Value
Best regards,
Sherif
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
you're setting the title of the string with pstrTitle, but the set action
itself calls the property again recursively. The solution provided by sherif
will fix the problem, i just thought you wanted to know the why.
Regards,
Alvin Bruney - ASP.NET MVP
[Shameless Author Plug]
The Microsoft Office Web Components Black Book with .NET
Now available @. www.lulu.com/owc, Amazon.com etc
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
Never mind - Realised my properties were in a right old mess :)
"Simon Harris" <too-much-spam@.makes-you-fat.com> wrote in message
news:u1VhjPBVFHA.3432@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> When I set the property of title in my class (Shown below) I get a
> "Exception of type System.StackOverflowException was thrown." error
> message.
> I'm guessing I got some sort of horrible loop going on, where did I go
> wrong?
> Thanks,
> Simon.
> Private pTitleAs String
> Public Property Title() As String
> Get
> Return pStrTitle
> End Get
> Set(ByVal Value As String)
> Title = pStrTitle
> End Set
> End Property
>
I am using the free version of SPAMfighter for private users.
It has removed 2175 spam emails to date.
Paying users do not have this message in their emails.
Try www.SPAMfighter.com for free now!
...but thanks for the replies (I posted my reply before yours appeared)

System.StackOverflowException: Exception of type System.StackOverf

Error:-
System.StackOverflowException: Exception of type
System.StackOverflowException was thrown.
When is this thrown..
Any ideasthis should happen when you have a cicling method which is never finishig.
It should happen to have a property like this

private int a ;
public int A{
get{ return A;} instead of A put a
set{ A = value;} instead of A put a
}

this is the most usuall content in which you get the error.

"Patrick.O.Ige" wrote:

> Error:-
> System.StackOverflowException: Exception of type
> System.StackOverflowException was thrown.
> When is this thrown..
> Any ideas
Thx mate.
I get it when i work with VS.NET!
But works with asp.net
Do u know why?:)

"Psycho" wrote:

> this should happen when you have a cicling method which is never finishig.
> It should happen to have a property like this
> when i work with VS.NET
> private int a ;
> public int A{
> get{ return A;} instead of A put a
> set{ A = value;} instead of A put a
> }
> this is the most usuall content in which you get the error.
> "Patrick.O.Ige" wrote:
> > Error:-
> > System.StackOverflowException: Exception of type
> > System.StackOverflowException was thrown.
> > When is this thrown..
> > Any ideas
it is throw when you make an infinite recurvise method.

http://msdn.microsoft.com/library/d...nclasstopic.asp

"Patrick.O.Ige" wrote:

> Thx mate.
> I get it when i work with VS.NET!
> But works with asp.net
> Do u know why?:)
>
> "Psycho" wrote:
> > this should happen when you have a cicling method which is never finishig.
> > It should happen to have a property like this
> > when i work with VS.NET
> > private int a ;
> > public int A{
> > get{ return A;} instead of A put a
> > set{ A = value;} instead of A put a
> > }
> > this is the most usuall content in which you get the error.
> > "Patrick.O.Ige" wrote:
> > > Error:-
> > > System.StackOverflowException: Exception of type
> > > System.StackOverflowException was thrown.
> > > When is this thrown..
> > > Any ideas

System.StackOverflowException: Exception of type System.StackOverf

Error:-
System.StackOverflowException: Exception of type
System.StackOverflowException was thrown.
When is this thrown..
Any ideasthis should happen when you have a cicling method which is never finishig.
It should happen to have a property like this
private int a ;
public int A{
get{ return A;} instead of A put a
set{ A = value;} instead of A put a
}
this is the most usuall content in which you get the error.
"Patrick.O.Ige" wrote:

> Error:-
> System.StackOverflowException: Exception of type
> System.StackOverflowException was thrown.
> When is this thrown..
> Any ideas