My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

NRE while using RenderAsPDF, after package update Options
Posted: Saturday, October 2, 2021 3:29:30 AM
Rank: Newbie
Groups: Member

Joined: 10/2/2021
Posts: 1
Hi everyone.
We have a problem with the latest version of EO.Pdf and EO.Pdf.Mvc.
Would appreciate any help with the following.

After updating from version (EO.Pdf and EO.Pdf.Mvc) to version (latest at the moment).
[EO.Pdf.Mvc.RenderAsPDF(AutoConvert = false)] stopped working.
To be more precise the problem occurs while accessing some static property/method of "
"MVCToPDF" class.
These calls are giving NullReferenceException.

In our case it's MVCToPDF.ResultAsDownload and MVCToPDF.RenderAsPDF();
Both methods are being used at base controller, as a final step of OnResultExecuting.
The project is .net framework 4.6.2 project.

Best regards,
Posted: Monday, October 4, 2021 5:27:03 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 23,072

These properties are no longer accessible in OnResultExecuting method. It is only meant to be accessible in your action method.

The change is in order to support async action method. This is not supported in early versions. In early versions the internal data used by MVCToPDF properties are initialized as thread static and would retain the value between "action" and "result" stage. This leads to problem in async action method case because the "action" and "result" stage are called by different thread. To avoid this issue, we no longer use thread static variables to retain these internal data and they are only initialized before your action method and cleared after your action method has completed, which means these properties are only accessible inside your action method in the new version. So you will need to change your code to avoid accessing these properties outside of your action method.

Please feel free to let us know if you still have any more questions.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.