StackOverflowException at print

Stimulsoft Reports.WEB discussion
Post Reply
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

StackOverflowException at print

Post by hfirst »

2015.3, Windows 10, VS 2013, C# 4.5.1

When I run the entire web application from my notebook, if my network printer for some reason ends up not being in a connected state, when I issue the call to report.Print(false,printerSettings) in my web mvc controller action, it blows up with an exception that says

Unhandled exception of type StackOverflow
{Cannot evaluate expression because the current thread is in a stack overflow state}

At this point, the catch for this exception does not fire and it brings down the whole asp.net process.

Please note, this time the stack overflow is happening at the time I print, not when I new the StiReport() object. I do have StiOptions.Print.AllowUsePaperSizesFromPrinterSettings = false in my code before I print.

1) I would hope that the library could more gracefully handle a printer not being connected.
2) Why is it bringing down the whole process? Is there unmanaged code in your library?

EDIT - More info. In digging into this more, it turns out the printer is connected. The windows 10 printers app says not connected, but if I go to the traditional control panel, there it is connected and I can print from the machine. I have a feeling the printer name I am passing to stimulsoft is not valid. Still, I hope that it could handle an invalid printer name more gracefully.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StackOverflowException at print

Post by HighAley »

Hello.

There is a try..catch statement in the Print method.
Please, set the StiExceptionProvider.HideExceptions static option to true to hide the exception.

Thank you.
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Re: StackOverflowException at print

Post by hfirst »

I set that to true just before I call print, but I still get the exception and the worker process is killed.

Also, is that HideExceptions thread safe? This is a web app and I'd like to be able to get and log other sti exceptions. I don't have a problem with print throwing an exception, but whatever is happening, it's killing the process and the catch around my call to print doesn't fire so I can't even catch it to log it.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StackOverflowException at print

Post by HighAley »

Hello.

It seems that the error is out of .Net Framework.
We had such issues when the printing on network printer crashed.
How do you specify the printer name? Please, try to use IP-address instead of its network name.
Also try to install it in the system.

If you still have the issue, please, send us more information about the issue.

Thank you.
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Re: StackOverflowException at print

Post by hfirst »

The printer is specified by name. I tried by IP but then you threw an exception (that I was able to catch) that is was not a valid printer. The printer driver is installed on the machine. I rebooted but still had issue. What I've found is that the error only happens when I try and trigger the printing from within asp.net on my win 10 notebook. If I try to print from a console application on the win 10 machine, it works.
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: StackOverflowException at print

Post by Jan »

Hello,
What I've found is that the error only happens when I try and trigger the printing from within asp.net on my win 10 notebook.
Can you clarify how you print from asp.net in more details? You mean print from the web page through the web browser? Or something also?

Thank you.
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Re: StackOverflowException at print

Post by hfirst »

You're right, sorry. I do not mean printing from the browser to a client installed printer.

Our application is an internal business web app only used by local users. The printer drivers are installed onto the server hosting the internal site and asp.net. All the network printers are configured on that server. The user clicks our own gui print button (or other business logic fires) and its the asp.net process on the server sending the print to a printer installed on the server.

In the case of my dev notebook, the client and server happen to be the same. When I test from my C# windows service agent, it is able to send the print job to the printer. When it's the asp.net worker process, it fails with the mentioned exception and most times kills the process. This is only happening on my Win 10 dev machine. On my Win 7 desktop and Server 2012 R2 test server, it works fine. I'm wondering if it's security related, but then I need to figure out how to get it to work and also not blow up.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StackOverflowException at print

Post by HighAley »

Hello.

Could you specify are you trying to print on the same printer from your dev notebook and from server?
Is the printer installed on both machines? Maybe there are spaces in printer name?
What is the version of printer driver?
How do you specify the printer name?

Thank you.
hfirst
Posts: 25
Joined: Mon Apr 20, 2015 2:11 pm

Re: StackOverflowException at print

Post by hfirst »

Yes, same printer, it's networked (with cable). The printer drivers are installed on both machines. There are spaces in the name, but it's always the same name whenever I install it. I copied the printer name from the printer settings and put that into my db. It's an HP 8600. Remember, stimulsoft can print from the equivalent of a console application on the notebook, so I don't think the issue is related to the driver or it's name, I think asp.net is somehow getting in the way, and stimulsoft isn't able to give me a good exception.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: StackOverflowException at print

Post by HighAley »

Hello.

We faced some issues with printing on last versions of .Net Framework.
Could you specify which version of .Net Framework is installed on your notebook?
Can you check printing from other machines with Windows 10 installed?
Please, check 32- and 64-bit systems if it's possible.
Could you also try to install the 4.6.1 .Net Framework on machine with Windows 7 and try to print on it?

Please, let us know about results.

Thank you.
Post Reply