473,386 Members | 1,799 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.d

Hi

I have classes property and sketch in htis property will be linked to skecth class
and foure different classes which r linked to the skecth class
and two generic list one is for skecth and other is for data of type Object
when i run the program i iam grtting the error here

Expand|Select|Wrap|Line Numbers
  1. public Sketch FirstData()
  2. {
  3. // return Datas[Datas.Count];
  4.  
  5. foreach (Object data in Datas)
  6. {
  7. if (data is Door)
  8. {
  9. Door door = (Door)data;
  10. }
  11. if (data is Fixture)
  12. {
  13. Fixture fixture = (Fixture)data;
  14. }
  15. if (data is Wall)
  16. {
  17. Wall wall = (Wall)data;
  18. }
  19. if (data is Window)
  20. {
  21. Window window = (Window)data;
  22. }
  23. //return 
  24. }
  25. return getSketch(1);
  26. }
  27.  
  28. private Sketch getSketch(Int32 id)
  29. foreach (Object data in Datas)
  30. {
  31. if (data is Door)
  32. {
  33. Door door = (Door)data;
  34. door.Id = id; 
  35. }
  36. if (data is Fixture)
  37. {
  38. Fixture fixture = (Fixture)data;
  39. fixture.Id = id;
  40. }
  41. if (data is Wall)
  42. {
  43. Wall wall = (Wall)data;
  44. wall.Id = id;
  45. }
  46. if (data is Window)
  47. {
  48. Window window = (Window)data;
  49. window.Id = id;
  50. }
  51. }
  52. return getSketch(id);
  53. }
  54.  
An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll

how can i slove this problem?
can any one help me in this
Feb 12 '08 #1
1 4025
Plater
7,872 Expert 4TB
The stack overflow exception normally happens when you have made a cylical loop out of your functions.
i.e. FunctionA calls FunctionB and FunctionB calls FunctionA. (There can be more functions involved, but they have to make a loop)

In your case however, getSketch calls itself for some unknown reason, thus making a cycle with itself. Fix that and your overflow problems should go away.
Feb 12 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: .YC | last post by:
Hi, I was trying on the following code n I got an exception. Can anyone tell me whats wrong? using System; namespace Module_2 { /// <summary>
0
by: Nikhil Khade | last post by:
Hello, After around 3 months, I reopened a old VB.NET solutions which used to work (and build) without any errors. Just to test it again, I build it again and it completed, without any errors,...
5
by: Ankit Aneja | last post by:
This is my problem. I am using Visual 2003, .Net framework 1.1 and the Application Block I configured the DAAB using the Enterprise Library Configuration now this is the error which is coming ...
12
by: daz_oldham | last post by:
Hi everyone As my expedition into OOP takes another shaky step, I now am getting the error: An unhandled exception of type 'System.StackOverflowException' occurred in xxx.dll. In my...
1
by: vighnesh | last post by:
Hi All Can anyone please let me know how to catch an unhandled exception like " An Unhandled exception of type 'system.stackoverflowexception' occured in mscorlib.dll " I am unable to catch...
1
by: bunnyjoshi | last post by:
"An unhandled exception of type 'System.StackOverflowException' occurred in asset.dll" Above error is occuring when i m debugging my code. asset.dll is file which is created by me n i m using it...
2
geo039
by: geo039 | last post by:
I am a beginner and I have a class that keeps giving me the "An unhandled exception of type 'System.StackOverflowException' occurred" error. I have looked online and do not understand how to correct...
3
by: Mike | last post by:
Hi I have problem as folow: Caught Exception: System.Configuration.ConfigurationErrorsException: An error occurred loading a configuration file: Request for the permission of type...
7
by: j4richard | last post by:
Help please, I am getting this "Unhandled Exception has occurred in your application" " A Generic error occurred in GDI+" See the end of this message for details on...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.