Error in Importing .Net class library as extension

Error in Importing .Net class library as extension

  
Hi,

I have created a simple class libraray with two methods as shown below and import this libraray as extension via intgration studio.

 public SortedList GetEmployeeDetails(int eno)
        {
            SortedList empList = new SortedList();
            //logic here
            return empList;        
        }

public SortedList GetDeptDetails(int dno,out SortedList deptList)        {
           
            //logic here
                   
        }

When I am trying to import this libraray as extension I am getting below error.

location specified in the SDKInstallRootv2.0 value of the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\.NETFramework.  You may be able to solve the problem by doing one of the following:
  1.) Install the .NET Framework SDK.  2.) Manually set the above registry key to the correct location.
SampleEmpExtension.cs(124,26): error CS0029: Cannot implicitly convert type 'System.Collections.SortedList' to 'OutSystems.NssSampleEmpExtension.RLEmpoyeeListRecordList'

Can anyone help me on resolving this issue? How can I successfully upload this libraray as an extenion?

Thanks,
Prashanth

Hi Prashanth,

That error comes from Visual Studio and not Integration Studio itself. That message refers to an error when Building your solution from Visual Studio.

As the message suggests, you should create a registry key in that location. When you build the solution, it looks like you are targeting "Any Cpu" but the registry key might have been placed in the folders of x86 or x64.
Tiago Neves wrote:
Hi Prashanth,

That error comes from Visual Studio and not Integration Studio itself. That message refers to an error when Building your solution from Visual Studio.

As the message suggests, you should create a registry key in that location. When you build the solution, it looks like you are targeting "Any Cpu" but the registry key might have been placed in the folders of x86 or x64.
 Hi Tiago,

I am able to successfully compile the class libraray using visual studio and tested the methods without any issues.Also I have tested another class library  which has a simple method "Sum" which returns only int and imported method "Sum" of that class libraray as extension without any issues.

But the class libraray which has the methods shown to you was returning a .net(sortedList) type is throwing erros when importing the methods as extensions.

Is there any reason why only  class library which has method with return type "int" is successfully imported as extension and why not the other library which has return type "SortedList"(.net)

Thanks,
Prashanth
 
Can someone help me in resolving this issue?

Thanks,
Prashanth
prashanth charl wrote:
Can someone help me in resolving this issue?

Thanks,
Prashanth
 Hi All,

Can anyone know how can I resolve this issue?

Thanks,
Prashanth
 
Hi Prashanth,
Same problem has been solver here ..Please see the link below.
https://social.msdn.microsoft.com/Forums/expression/en-US/6fee2ffc-d42d-4eec-809d-cdaea0f192fe/could-not-locate-net-framework-sdk


Pramod Jain wrote:
Hi Prashanth,
Same problem has been solver here ..Please see the link below.
https://social.msdn.microsoft.com/Forums/expression/en-US/6fee2ffc-d42d-4eec-809d-cdaea0f192fe/could-not-locate-net-framework-sdk

 
 Hi Pramod,

Thanks for the reply.

As I saidin earlier reply,I do not see any issues when importing a class library which has simple method which returns an int/string values.But I am facing isues when importing a method which returns .net collection type such as SortedList,arraylist etc.

In your experience,were you able to import any class library which has methods that returns .net generic collection types?

Thanks,
prashanth 

Thanks,
Prasahnth Reddy CH
 
Prashanth,

If you want to return .NET collections, arrays and the like, you'll need to build a platform record list from it. Create a structure in Integration Studio, create an output parameter to the action with type Record List with that structure, create the necessary local variables in C# and use the Record List Append function to append a record to the record list.
Kilian Hekhuis wrote:
Prashanth,

If you want to return .NET collections, arrays and the like, you'll need to build a platform record list from it. Create a structure in Integration Studio, create an output parameter to the action with type Record List with that structure, create the necessary local variables in C# and use the Record List Append function to append a record to the record list.
 Hi Killian,

Thanks for the reply.I will try it out as per suggestion.

Thanks,
Prashanth
 
One thing to note is that when creating a new record in the extension, don't use the default constructor, but pass null as a parameter. This ensures that all attributes of the record will be initialized, and that attributes that are records or record lists are properly created. In general, you'll get something like this:

RLMyData myList = new RLMyData();       // MyData is a structure defined in the extension

foreach (NativeType element in elementList)
{
   RCMyData myData = new RCMyData(null);     // use the constructor with a parameter, pass null

   // convert the stuff from the list to our stuff
   myData.field1 = element.elementField1;
   myData.field2 = element.elementField2;
   // etc.

   myList.Append(myData);   // append the data to the list, equal to ListAppend in Service Studio
}