34
Views
6
Comments
Solved
C# function not working as expected
Application Type
Reactive, Service

Hi everybody,

I created a project using a function that Integration Studio generated and edited my logic. I understand that to use this C# function, it needs to be built as a library so it cannot be debugged directly. And I have attached the C# function file below (Extenstion.xif) 

My question: 

1. How to solve it the above empty output? Is there any way to debug the function created in Integration Studio? 

2. I wonder if there is any learning material about using C# function in Outsystem model?

Looking forward to receiving everyone's help, thanks in advance.


Extension.xif
2019-01-07 16-04-16
Siya
 
MVP
Solution

I did the same test with the same parameters as yours and it is working. Your extension code seems Ok.  Please check if there are any errors logged in Service Center. Also see  by reinstalling the extension helps.

btw I noticed that you have a line of code

string[] result = ConsoleApp1.Common.slipBy(ssDetermine1, ssDetermine2, ssDetermine3, ssDetermine4, ssDetermine5, ssDetermine6, ssText); and slipBy is inside another dll (ConsoleApp1.dll). You may move that code inside the CssCommon class. This way debugging would be easier.


2024-01-05 18-00-17
Carlos Freitas

Hi Anh,

to test C# code I normally change the project type to Console Application, and add "static void Main()" and to test and debug directly in Visual Studio. After confirming the actions are working as expected, don't forget to change the project type to Class Library.

On the attached file, I've the project set as Console Application. Use it for debugging but don't publish it before changing it to Class Library.


For more information see:

https://success.outsystems.com/documentation/11/integration_with_external_systems/extend_logic_with_your_own_code/



Extension.xif
2026-01-26 10-25-31
Lennart Kraak
Champion

Hi @Anh Nguyen,

I did a little test with your function, but it seems to work just fine. It uses the 6 strings to split your text and returns the individual parts in a record list of TextStructures.

Can you show me what your input is?

UserImage.jpg
Anh Nguyen

Hi @Lennart Kraak,  

This is the input for my function, but when I debug on OS model I still get the following result

 




2019-01-07 16-04-16
Siya
 
MVP
Solution

I did the same test with the same parameters as yours and it is working. Your extension code seems Ok.  Please check if there are any errors logged in Service Center. Also see  by reinstalling the extension helps.

btw I noticed that you have a line of code

string[] result = ConsoleApp1.Common.slipBy(ssDetermine1, ssDetermine2, ssDetermine3, ssDetermine4, ssDetermine5, ssDetermine6, ssText); and slipBy is inside another dll (ConsoleApp1.dll). You may move that code inside the CssCommon class. This way debugging would be easier.


2022-12-30 07-28-09
Navneet Garg

You can add a new console project, add reference to you OS project reference, change name space and instantiate the OS class and use function to test.


2020-09-15 13-07-23
Kilian Hekhuis
 
MVP

Note that although it's difficult to debug extensions from an IDE, you can of course always use printf debugging. For this, use:

GenericExtendedActions.LogMessage(AppInfo.GetAppInfo().OsContext, "Your text", "ModuleName");

Where "Your text" is some message you want to log, and "ModuleName" is the module name in the logging (can be any text). These messages will end up in the General Log in Service Center.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.