Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

FrameworkContext.Current.CurrentDateTime can work improperly in scheduled job

Found in

EPiServer.Commerce 11.0.0

Fixed in

EPiServer.Commerce 12.8.0

(Or a related package)

Created

Jun 28, 2018

Updated

Aug 31, 2018

Area

Core

State

Closed, Fixed and tested


Description

FrameworkContext.Current is stored in HttpContext if it presents, or an internal field if it does not. The problem is your scheduled job is most likely run without a HttpContext. Therefore, FrameworkContext.Current is created once and reused. That's why the time is can be so off (minutes, if not even hours)

The entire class is fairly useless so should be obsoleted.

https://world.episerver.com/forum/developer-forum/Episerver-Commerce/Thread-Container/2018/6/lineitems-removed-from-purchaseorder-on-save/