Click here to Skip to main content
15,895,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
As we can not create object of ThisAddIn class I have used its member by
C#
var addIn=Globals.ThisAddIn;
addIn.membername;

but as var could not be global I have used it in several method.
Now I am getting stackoverflow error
Could this be a cause of stackoverflow?
Posted
Updated 30-Oct-15 6:23am
v2
Comments
phil.o 30-Oct-15 10:31am    
There are little chances it is the cause of a StackOverflow exception.
Stack overflows usually occur in recursive method calls, where the condition for exiting recursion is not mastered.
Which line of your code does throw the exception?
Member 12100847 30-Oct-15 10:51am    
class Calendars
{
bool isNewAppointment;
string filter1,filter2,syncAppointmentIds;

public Calendars()
{
isNewAppointment = true;
filter1 = string.Empty;
filter2 = string.Empty;
syncAppointmentIds = string.Empty;
}
Configs objectConfig = new Configs();
GetTextFromRecepientsClass objectGetText = new GetTextFromRecepientsClass();
SetSyncCategories objectSetSyncCategories = new SetSyncCategories();
keyValue objContactList = new keyValue();
OlImportance imp = new OlImportance();

the line:
Config objectConfig=new Config() throws exception
Foothill 30-Oct-15 11:34am    
Can you post the constructor for the Configs class?
Member 12100847 2-Nov-15 1:25am    
public Configs()
{
string strContactSynchronization_Conflict = string.Empty, strActivitySynchronization_Conflict = string.Empty, strTaskSynchronization_Conflict = string.Empty;
string strOrganisationName = string.Empty, strCompanyName = string.Empty;
string strDefaultCalendar = string.Empty;
}

Calendars objectCalendars = new Calendars();
AppointmentSync objectAppointmentSync = new AppointmentSync();
SetSyncCategories objectSetSyncCategories = new SetSyncCategories();

1 solution

Well... It might be the reason of stack overflow error, because an addIn refers to "itself" many times.

As Wikipedia[^] states:
Quote:
The most common cause of stack overflow is excessively deep or infinite recursion, in which a function calls itself so many times that the space required to store the variables and information associated with each call is more than can fit on the stack


MSDN[^] says that there are 3 common reasons:
Quote:


  • A thread uses the entire stack reserved for it. This is often caused by infinite recursion.
  • A thread cannot extend the stack because the page file is maxed out, and therefore no additional pages can be committed to extend the stack.
  • A thread cannot extend the stack because the system is within the brief period used to extend the page file.


Follow the links to resolve the issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900