473,624 Members | 2,453 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

10 New Member
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.StackOv erflowException ' occurred in mscorlib.dll

how can i slove this problem?
can any one help me in this
Feb 12 '08 #1
1 4049
Plater
7,872 Recognized Expert Expert
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
7771
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
8515
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, but then immediately started showing me the message "An unhandled exception of type 'System.StackOverflowException' occurred in mscorlib.dll" at InitializeComponent() with all lines containing Image load or default icon, like the following: ...
5
9768
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 Security Exception Description: The application attempted to perform an operation not allowed
12
5113
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 Visit.cls I have got:
1
5745
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 this using "try - catch - end try" block. Thanks in advance
1
2385
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 in my main project. it was working fine few days before but whn i add some more functionality in my asset.dll its started giving me the error. Is thr any way to increase the stack size...so tht it can be compatible wit my software.
2
2402
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 the issue. Any takers? Public Class BankCustomer ' Require proper data, on the creation of a new customer Public Sub New(ByVal firstName As String, ByVal lastName As String, ByVal accountNumber As String, ByVal balance As Decimal) ...
3
12048
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 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. (machine.config) ---> System.Security.SecurityException: Request for the permission of type
7
10379
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 invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
0
8240
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8175
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8625
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8336
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8482
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6111
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4082
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2610
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1487
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.