[Stimulsoft Reports .NET] Object reference not set error while running simultaneous requests
Forge component by Paulo Fagundes Jr.
Application Type
Traditional Web

Hi,

We get Object reference not set to an instance of an object errors when we have multiple report requests running simultaneously. In our use case we submit several report requests that run in a background process to generate and email reports to recipients.

Each report request must take at least a couple of seconds to complete for this error to occur. 

We were also able to reproduce this by downloading the PDF of the same report simultaneously from two browsers (again the report must take at least a couple of seconds to render before this error occurs).

Do you have any suggestion how to resolve this issue?

Regards,
Alfio Esposito

Solution

Hi Alfio,
I'm happy to know that worked.

I found the issue already and I have released another version. Now everything should be ok.

Please let me know if I can help you with something else and thank you so much for your feedback.

I would like just ask if that's all could you make this case as solved? 

Best Regards,
Paulo.

Hi Alfio, 

The way that is built is likely that happen. Are you using the last version with the SDK? 

The SDK wrapper version helps us to isolate that instance in another request because a service action is used to wrap up the extension actions. It should not have the same instance for different requests.


To try to solve it you can try to make your own action server wrapper to wrap this up or you can download the last version, where you can see how that was improved.

Let me know if that worked.

Sorry for taking too much to reply I'm really excited to see it working in a real scenario, so anything that you would like to discuss please, reach me out.

Cheers,
Paulo


Hi Paulo,

We indeed are currently using service actions to wrap around the extension methods. But still this error occurs.

I have also tried to modify the extension by creating a single method that contains all logic to create a new report object (with license key), set the culture, render the report, create a pdf and then return the pdf file (which is what we actually need for our use-case). All with local variables in the method. Unfortunately the Object reference not set error still occurs. Below is a screenshot of the error in service center.

As you can see the error is thrown by a method in "StmulsoftReportCore". What is that dll?

(Oh yes, as a side note: when I download and install the latest version of the component and then try to publish it again from Integration Studio I get this error. What might be wrong here?)

Regards,
Alfio

Hi Alfio,

The dll "StmulsoftReportCore" is the wrapper of all methods used to generate a report, that was created by me. 


The issue seems that Outsystems does not create a new instance of the object even though you are calling a service action which in terms of the transaction is different.

Indeed I reproduced it, so one solution would be to give the option to send the object as the input of the report generator, and create the report based on the object. but I do not like this option, although for sure that works. So I'm going to see if there is any another update that I can do to make sure this is not going to happen.


I'll back to you soon.


Cheers,
Paulo

Thanks Paulo.

A question: what is the reason that you made all the separate methods in the extension instead of a method where you can put in the template file (.mrt), webservice URL, licence key, culture, parameter list and required output format and then it returns the rendered report converted into the requested format?

Hi Alfio, 


I've just deployed a new Version 2021.01.22.1, it's still under-development because I would like to check out with you if that solved the issues that you're facing. There are some changes that I made to avoid "sharing" objects through sessions, however, if you are using the SDK module those changes will be transparent, only one field has changed.

-----------


Backing your question, there are two main actions when a report is created, Render Report and Export Report. 

The render method is responsible to get everything ready in the report, eg. Fetching data, translating, calculating, calling web services, etc...

Those preparations are executed when the report is rendering. Once it's done, the next step is to export the report which basically gets the rendered report and export to whatever is the format that you want. You can use the same rendered report to export several times without executing any query or web service again.

is that makes sense?
Please send me feedback, once that is working nicely for you I'll make that version stable.

Best Regards,
Paulo Fagundes


Hi Paulo,

Thank you very much for looking into this. I managed to have a quick glance this morning in my personal environment and first impression looks good. On Thursday I will again be working for the customer where we have this issue. I hope to give you a final answer then.

Best regards,
Alfio Esposito

Hi Paulo,

Today I was finally able to check the new version in the customer's system. I can now have multiple report requests running simultaneously. So that is good.

I did run into the following issue. At first I kept getting "Object reference not set to an instance of an object" errors. They were caused by the fact that the parameter list was empty. I our case we have no parameters in the report that have to be set. I was able to circumvent this by adding a dummy parameter to the list but it would be better in my opinion to be able to just leave that list empty if there are no parameters to set. Is that something you can look at?

Best regards,
Alfio Esposito

Solution

Hi Alfio,
I'm happy to know that worked.

I found the issue already and I have released another version. Now everything should be ok.

Please let me know if I can help you with something else and thank you so much for your feedback.

I would like just ask if that's all could you make this case as solved? 

Best Regards,
Paulo.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.