C# Code - Could not create an instance...

fire

New Member
Hello there,

I have a piece of C# code inside a Code object that converts MM/dd/yy date format to proper dd/MM/yy, the Input is the US date format as plain text from a Data Item, while Output is the converted date format, stored in a separate Date Data Item. The conversion works in Visual Studio as expected, however when I try to run it in BP I always get the error "Internal : Could not create an instance of the code class because the class is not compiled" when it reaches the Code object.

I have the required libraries added under Initialize -> Code Options -> Namespace imports, also tried calling all relevant parts of my code through their full path, same result.

The error makes me believe that I've missed some basic switch/setting, but ran out of ideas as what could that be.

Code:
            string dateOne = ToConvert; // ToConvert is my input variable from the Data Item
             ... rest of the code ...
            ConvertedDate = conv; // ConvertedDate is the Output value that goes into a separate Data Item

aa.PNG
 

anisjolly

Administrator
Hi @fire

Could it be that you don't have the correct DLLs / libraries referenced in your object? Double click the rectangular box on the top of the Initialise action in your object and take a look at your Code Options tab.
 

anjali

New Member
Hi @fire

Am using the attached path for the library and it gives the below error .
Can you please attach a code snippet on how to call a function or method in a code stage .
In the attached library i have a function name GetReportHeaders with 2 input parameters
Example : GetReportHeaders(Datatable d1 , Datatable d2) (Note : Datatable is a collection in BP )
output is a string value

View attachment 1539350703297.png
 

Attachments

  • Calling dll.PNG
    21.1 KB · Views: 152
  • 1539350435288.png
    7.4 KB · Views: 121
Top