Solved

Getting error when running ClassGenerator.exe from Test SDK 22.211.0034

  • 12 September 2023
  • 9 replies
  • 150 views

Userlevel 2

I’m trying to generate wrapper classes using ClassGenerator.exe and running it as a CLI tool with the config file.

I’m getting the following error as soon as executable starts:

C:\Users\abaranov\Documents\Work\_AcumaticaSoftware\TestSDK_22_211_0034_35\ClassGenerator>ClassGenerator.exe
Wrapper generation has started, please wait. It may take up to 5 minutes for the first wrapper to be successfully generated.
Process FAILED - so301000
System.Exception: Unable to get screen so301000 with url /CstDesigner/abaranov_PCBCustomizations/so301000.aspx ---> System.Exception: Exception of type System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation.; StackTrace: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: This method cannot be called during the application's pre-start initialization phase.

Configuration file ClassGenerator.exe.config:

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <appSettings>
    <add key="SitePhysicalPath" value="C:\AcumaticaInstances\hemasource" />
    <add key="GenResultPath" value="C:\Users\abaranov\source\repos\gitlab-hemasource\TestSDK_22_211_0034_35\ClassGenerator\Out" />
    <add key="Username" value="abaranov" />
    <add key="Namespace" value="GeneratedWrappers.Acumatica" />
    <add key="ClearOutput" value="true" />
    <add key="FilenameFilter" value="SO301000" />
    <!--<add key="PagesList" value="list.txt"/>
    <add key="PagesParameters" value="ParamsPP.txt"/>
    <add key="GenericInquiryParameters" value="ParamsGI.txt"/>
    <add key="PagesListAttribute" value="exclude"/>
    <add key="PagesListAttribute" value="include"/>-->
  </appSettings>
  <startup>
    <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
  </startup>
</configuration>

icon

Best answer by AaronB 7 December 2023, 14:30

View original

9 replies

Userlevel 4
Badge +1

Hello Andrey,

 

I would ask if the page is accessible from the website. Its possible you need to restore the web.config of the website if the site is offline. Go to the website install folder and copy the contents of the backup web.config.d846d25d.txt into the web.config and reload the webpage.

 

It is recommended to do wrapper generation via code - and to use the following project as your base code template/file structure.

https://github.com/Acumatica/Test-SDK-Starter-Guide

Please note the GenerateWrappers() method in Test.cs for the example - The variable physicalSitePath must also be filled on line 17 as well. Line 29 and 30 also need to be correct for your website’s username & check that you are using the correct path in the projects launchsettings.json to the configured config.xml in the TestSDK_22_211_0034_35 folder you have.

 

You will also need to ensure you go to Manage Nuget Packages and add the “packages” folder from the above testSDK folder as a nuget source & import all the packages.

 

All this is found in the readme of the template project - it gives instructions on how to set up the project step by step, it takes about 5-15 minutes to configure the project and import any existing tests/extensions you have.

Userlevel 2

Hello Andrey,

 

I would ask if the page is accessible from the website. Its possible you need to restore the web.config of the website if the site is offline. Go to the website install folder and copy the contents of the backup web.config.d846d25d.txt into the web.config and reload the webpage.

 

It is recommended to do wrapper generation via code - and to use the following project as your base code template/file structure.

https://github.com/Acumatica/Test-SDK-Starter-Guide

Please note the GenerateWrappers() method in Test.cs for the example - The variable physicalSitePath must also be filled on line 17 as well. Line 29 and 30 also need to be correct for your website’s username & check that you are using the correct path in the projects launchsettings.json to the configured config.xml in the TestSDK_22_211_0034_35 folder you have.

 

You will also need to ensure you go to Manage Nuget Packages and add the “packages” folder from the above testSDK folder as a nuget source & import all the packages.

 

All this is found in the readme of the template project - it gives instructions on how to set up the project step by step, it takes about 5-15 minutes to configure the project and import any existing tests/extensions you have.

 

Hi Aaron,

Thank you for comments.

Yes, page is accessible from the website.

I tried running wrapper generation via code (actually used your project for that), and it fails with the same error on the line where wrapper is excuted:

WG.Run("SO301000"); // add all screens here you need to use in your test

 

Actually, I found that both CLI and “via code” work correctly on a clean vanilla site with sales demo data, but both fail when running against our customized instance.

 

Best regards,

Andrey

Userlevel 4
Badge +1

Hi @abaranovhs 

I see your error is “This method cannot be called during the application's pre-start initialization phase.” indicating the website was not fully online yet. 

 

  1. Try to load the website on your browser first to let the server wake the website up before running the test
  2. Make sure you run the GenerateWrapers() method after a PxLogin.LoginToDestinationSite(); command
  3. Check that the GenerateWrapers() method runs inside the Execute or BeforeExecute
Userlevel 2

Hi @abaranovhs 

I see your error is “This method cannot be called during the application's pre-start initialization phase.” indicating the website was not fully online yet. 

 

  1. Try to load the website on your browser first to let the server wake the website up before running the test
  2. Make sure you run the GenerateWrapers() method after a PxLogin.LoginToDestinationSite(); command
  3. Check that the GenerateWrapers() method runs inside the Execute or BeforeExecute

Hi Aaron,
Yes, I tried all 3, and also I found that both CLI and “via code” work correctly on a clean vanilla site with sales demo data, but both fail when running against our customized instance.

Userlevel 7
Badge

Hi @abaranovhs were you able to find a solution? Thank you!

Userlevel 2

Hi @abaranovhs were you able to find a solution? Thank you!

Hi Chris,

No, I wasn’t. So far my experience with Acumatica Test SDK was a complete failure, and I switched to looking for other options.

Thanks for asking, though

Userlevel 4
Badge +1

Hi @abaranovhs 

I have created a walkthrough video guide going through the process of setup so there is no ambiguity on the required config steps
 

 

Userlevel 2

Hi @abaranovhs 

I have created a walkthrough video guide going through the process of setup so there is no ambiguity on the required config steps
 

 

Hi Aaron,

I watched the video, but it did not help.

The problem is that wrappers are not generated, and exception is exactly the same as in the original post.

I am running your solution against my local Acumatica site that has all customizations already published in it, and WG.Run(“<custom screen>”) fails, no clues on why, exception as you can see is not informative at all.

Will be happy to jump on a call and work on this together

 

Best regards,

Andrey

Userlevel 4
Badge +1

Hi @abaranovhs 
If you are an ADN L2 subscriber you can create a ticket on the partner portal and we can organize a meeting to debug your issue together.

 

I still believe your website is corrupted in ways causing this issue. Please try to follow the guide from the very start including downloading and installing a new version of Acumatica and Acumatica Test SDK and using the recommended file paths.

If on a new website it still doesnt work - it means your customization project has some bad code inside of it relating to that CstDesigner/abaranov_PCBCustomizations/so301000.aspx file.

I bolded the parts i don't expect to see in the wrapper generation process.

Process FAILED - so301000
System.Exception: Unable to get screen so301000 with url /CstDesigner/abaranov_PCBCustomizations/so301000.aspx ---> System.Exception: Exception of type System.Reflection.TargetInvocationException

  1. The screen path is usually found in the pages folder of the website not CstDesigner
  1. The screen is usually SO301000 with Capital SO
  2. If you are working with the same PCB team that work with for certification, I can assure you the PCB package is working and would not produce this issue normally

 

 

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