Re: StackOverflowException with attribute
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 11 May 2007 10:00:34 -0400
I don't know what atlaste was trying to indicate by saying to raise the
maximum recursion depth, because in the end, if you have a loop that loops
infinitely, it's always going to be larger than whatever the threshold is.
To me, it would seem that the call to GetProperties on the
TypeDescriptor class is calling back into your GetProperities method, and
it's always going to instantiate another call.
You need to find some way to break this loop. What is it that you are
trying to do?
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"windsim" <windsim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:2CAF805A-EC2C-41E0-A09A-3979D4B5A3A9@xxxxxxxxxxxxxxxx
Thanks guys!
public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
{
PropertyDescriptorCollection globalizedProps;
PropertyDescriptorCollection baseProps =
TypeDescriptor.GetProperties(this, attributes, true);
...
}
I can not set break point at above code line and I think the problem is
maybe TypeDescriptor.GetProperties(...)
The info from call stack looks like a endless loop below :
...
[External Code]
SystemFrameworks.dll!SystemFrameworks.DataObject.GlobalizedObject.GetProperties(System.Attribute[]
attributes = {Dimensions:[1]}) Line 350 + 0xd bytes C#
SystemFrameworks.dll!SystemFrameworks.DataObject.ModuleProperties.GetStatefulPropertyDescriptors()
Line 92 + 0x26 bytes C#
SystemFrameworks.dll!SystemFrameworks.DataObject.ModuleProperties.GetModulePropertyListCurrent(SystemFrameworks.DataObject.ModuleProperties
mp = {SystemFrameworks.DataObject.DTMProperties}) Line 122 + 0x8 bytes C#
SystemFrameworks.dll!SystemFrameworks.DataObject.ModuleProperties.ToString()
Line 350 + 0xb bytes C#
SystemFrameworks.dll!SystemFrameworks.DataObject.ModuleProperties.GetHashCode()
Line 313 + 0x7 bytes C#
[External Code]
by the way how to increase this max recursion depth in VS 2005?
--
windsim
"Nicholas Paldino [.NET/C# MVP]" wrote:
windsim,
Well, more likely than not you have a recursive call somewhere (or
something that results in an endless loop of calls). Have you set a
breakpoint and looked a the call stack to see where the calls are
repeating
in a loop?
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"windsim" <windsim@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:ABD92005-416A-4FB2-AB0C-C177F161F535@xxxxxxxxxxxxxxxx
Hi,
I have a project based on .Net 1.1 and VS 2003,now I am trying to
upgrade
it
to .Net 2.0 and VS 2005.The project passes the 'Build Solution',but
When I
start Debug, it suddenly comes StackOverflowException and Debug stops.
The main Exception point is the function below:
public System.ComponentModel.PropertyDescriptorCollection
GetStatefulPropertyDescriptors()
{
DataObject.StatefulPropertyAttribute a = new
StatefulPropertyAttribute();
return this.GetProperties(new Attribute[] { a }); //exception
point
//class System.Attribute that is base class for customer
attributes
}
[AttributeUsage(AttributeTargets.Property, AllowMultiple=false,
Inherited=true)]
public class StatefulPropertyAttribute : Attribute{}
Under .Net 1.1 and VS 2003 there is no problem, no exception for the
function, but why does it come StackOverflowException under .Net 2.0
and
How
to solve it?
--
windsim
.
- Follow-Ups:
- Re: StackOverflowException with attribute
- From: atlaste
- Re: StackOverflowException with attribute
- References:
- Re: StackOverflowException with attribute
- From: Nicholas Paldino [.NET/C# MVP]
- Re: StackOverflowException with attribute
- From: windsim
- Re: StackOverflowException with attribute
- Prev by Date: Re: fundamental scope question
- Next by Date: Re: Passing XML data as parameter of web service
- Previous by thread: Re: StackOverflowException with attribute
- Next by thread: Re: StackOverflowException with attribute
- Index(es):