Solved

Unit Tests are failing after upgrade to 2022R1 - 22.103.0018


Userlevel 2
Badge

I am getting an error on my unit tests after upgrade to 22R1, specifically as shown below:

Am I missing an updated PX.Tests.Unit DLL or other ?

 

  Message:
System.MissingMethodException : Method not found: 'System.Threading.Tasks.Task PX.Licensing.IApiLicensePolicy.ApplyRequestThrottling()'.

  Stack Trace:
TestBase.RegisterServices(ContainerBuilder builder)
LifetimeScope.CreateScopeRestrictedRegistry(Object tag, Action`1 configurationAction)
LifetimeScope.BeginLifetimeScope(Object tag, Action`1 configurationAction)
LifetimeScopeHelper.BeginLifetimeScope(ISlotStore slots, Object tag, Action`1 configurationAction) line 39
TestBase.ctor()

 

icon

Best answer by jedmunds36 4 May 2022, 15:21

View original

6 replies

Userlevel 7
Badge +17

Hi @jedmunds36  Not sure about this issue, but I think this issue can be fixed by performing below steps.

  • Open Acumatica Configuration Wizard
  • Click on Perform Application Maintenance
  • Select the instance and click on the Upgrade → Upgrade only website

 

 

Userlevel 2
Badge

Thanks, Naveen.

Unfortunately, re-running ERP config tool for Upgrade only website did not overcome the error.

john

Userlevel 7
Badge +17

Hi, @jedmunds36  Thanks for the update.

Hope you will get a faster response from Acumatica if you raise a support case.

Userlevel 2
Badge

I updated PX.Tests.Unit from the C:\Program Files\AcumaticaERP\UnitTesting folder
and from the AcumaticaUnitTestDemo on GitHub, it became clear I was missing
Microsoft.Bcl.AsyncInterfaces from Nuget.

Some of my Unit Tests work, such as SalesOrderTests, but my InventoryItemTests
fail with the following details:

Message: 
CommonServiceLocator.ActivationException : Activation error occurred while trying to get instance of type Func`2, key ""
---- Autofac.Core.Registration.ComponentNotRegisteredException : The requested service 'System.Func`2[[PX.Data.PXGraph, PX.Data, Version=1.0.0.0, Culture=neutral, PublicKeyToken=3b136cac2f602b8e],[PX.Objects.CM.Extensions.IPXCurrencyService, PX.Objects, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]' has not been registered. To avoid this exception, either register a component to provide the service, check for service registration using IsRegistered(), or use the ResolveOptional() method to resolve an optional dependency.

Stack Trace: 
ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
ServiceLocatorImplBase.GetInstance[TService]()
PXDBCurrencyPriceCostAttribute._ensurePrecision(PXCache sender, Object row) line 35
PXDBCurrencyPriceCostAttribute.CacheAttached(PXCache sender) line 31
PXEventSubscriberAttribute.InvokeCacheAttached(PXCache cache) line 222
PXCache`1.ctor(PXGraph graph) line 3446
PXCacheCollection.get_Item(Type key) line 669
PXView.ctor(PXGraph graph, Boolean isReadOnly, BqlCommand select) line 1185
PXSelectBase`2.ctor(PXGraph graph) line 1611
View.ctor(PXGraph graph) line 37
InventoryItemMaintBase.ctor() line 37
InventoryItemMaint.ctor() line 115
PXGraph.CreateInstance(Type graphType, String prefix) line 261
PXGraph.CreateInstance[Graph]() line 112
InventoryItemMaintExtTests.PrepareGraph() line 24

Userlevel 2
Badge

Success!

My class file was inheriting TestBase and not UnitTestWithGLSetup, hence the lack of the service registration…

from:

    public class InventoryItemMaintExtTests : TestBase
    {

to:

    public class InventoryItemMaintExtTests : UnitTestWithGLSetup
    {

Userlevel 7
Badge

Thank you for sharing your solution @jedmunds36 !

Reply


About Acumatica ERP system
Acumatica Cloud ERP provides the best business management solution for transforming your company to thrive in the new digital economy. Built on a future-proof platform with open architecture for rapid integrations, scalability, and ease of use, Acumatica delivers unparalleled value to small and midmarket organizations. Connected Business. Delivered.
© 2008 — 2024  Acumatica, Inc. All rights reserved