PictureService uses HttpContext.Current, risk of NullReferenceException

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 年 前
In nop 2.1, the properties LocalThumbImagePath and LocalImagePath both call HttpContext.Current to get the physical path. However, if the picture service is used in for instance a task, HttpContext.Current is null and getting the physical path will throw a NullReferenceException. A better way to do this is to call HttpRuntime.AppDomainAppPath
12 年 前
Thanks!
12 年 前
This problem is still there in nop 2.3. It doesn't throw NullReferenceException but NotImplementedException
12 年 前
Thanks for info. I'll create a work item
12 年 前
[email protected] wrote:
A better way to do this is to call HttpRuntime.AppDomainAppPath

Just found that HttpRuntime.AppDomainAppPath cannot be used in unit tests. I think it should be wrapper to some class, such as IWebHelper.
12 年 前
See changeset de44d5f7de13. Please let me know if it works fine now
12 年 前
a.m. wrote:
See changeset de44d5f7de13. Please let me know if it works fine now

Seems to work now, thanks a lot!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.