Stackoverflow exception when creating report
Posted: Mon Apr 29, 2013 7:46 am
We've come to a point where our report doesn't work anymore because of a StackOverflow exception when rendering the report from code.
The problem seems to be from how the report code is contstructed. The 'InitializeComponent' code is splitted by StimulReports over different 'InitializeComponent2', 'InitializeComponent3', ... methods. In our report, the code has 66 of this InitializeComponent methods. From somewhere around the 40th InitializeComponent, we get the stackoverflow exception.
This is because StimulReports calls each InitializeComponent method from within another one. So InitializeComponent calls InitializeComponent2, which in turn calls InitializeComponent3, etc. This creates a large call stack which gives us eventually the stackoverflow exception.
The workaround for now is to modify the generated code so it looks like this:
public Report()
{
this.InitializeComponent();
this.InitializeComponent2();
this.InitializeComponent3();
this.InitializeComponent4();
...
this.InitializeComponent66();
}
This is a problem since we always have to modify the code when changes need to be published, and we need to add new code and provide a new software build to our clients, which is nearly impossible because our reports
may change several times a week.
The problem started to occur since we switched from .NET framework 4 to 4.5. Probably since version 4.5 more information is added to the stack so there is less space for nested calls.
Is there any workaround you can suggest or can this issue be addressed in future release?
The problem seems to be from how the report code is contstructed. The 'InitializeComponent' code is splitted by StimulReports over different 'InitializeComponent2', 'InitializeComponent3', ... methods. In our report, the code has 66 of this InitializeComponent methods. From somewhere around the 40th InitializeComponent, we get the stackoverflow exception.
This is because StimulReports calls each InitializeComponent method from within another one. So InitializeComponent calls InitializeComponent2, which in turn calls InitializeComponent3, etc. This creates a large call stack which gives us eventually the stackoverflow exception.
The workaround for now is to modify the generated code so it looks like this:
public Report()
{
this.InitializeComponent();
this.InitializeComponent2();
this.InitializeComponent3();
this.InitializeComponent4();
...
this.InitializeComponent66();
}
This is a problem since we always have to modify the code when changes need to be published, and we need to add new code and provide a new software build to our clients, which is nearly impossible because our reports
may change several times a week.
The problem started to occur since we switched from .NET framework 4 to 4.5. Probably since version 4.5 more information is added to the stack so there is less space for nested calls.
Is there any workaround you can suggest or can this issue be addressed in future release?