I am trying to update the interface file in VS 2017 with a project that is a mix of Oxygene and C#. I want the interface file to be in Oxygene (the current one is) but when I update it, it automatically makes a swift file with the message
“Elements project is using mixed languages or an unknown langage. Will generate Silver (Swift) code.
Created file ZentraServerLibrary_Intf.swift”
If more than 1 language is used in an Elements project then the default CodeGen will be used (that is the Swift one). If you need some concrete codegen then you need to stick to this language in the entire project.
In this project, I use oxygene and Hydrogene. I started the project with oxygene only and the interface file was in oxygene. There was an update to the RODL file so I needed to update the interface file (Hydrogene files were added) and it made the interface a Silver file. Now all my oxygen and hydrogene references to the interface are broke because to my understanding you can’t use namespaces in Silver so it can’t find them. I am probably not understanding something correctly. Any help with this would be great.
I like using mixed languages because some of the team are c# only and other are oxygene (Delphi) only so it works nice but not sure how to make the swift interface file work.
So in general I was wondering if R.O. recommends sticking to one language per project. So use oxygene for one .Net project and maybe hydrogene for another.
ok I just needed to change the namespace in the projects that are in the solution. The interface is in a shared project. everything works now with the swift interface.
Another note. And I probably will try to have to build an example of this but this is in reference to a problem we were having with the service tester.
I am building a “service tester” from scratch that runs automated test scripts against a RO Server. Much like Service Tester but you can schedule a bunch of tests to run and schedule them. Anyway, we had an issue with the TPerson object in Service tester (see link above). I use this same object with the new project and when I used the swift interface file I got an error when running a test concerning the TPerson object (I am assuming).
It logs the person in fine but raises an exception which I catch and display. If I switch back to the oxygene interface file the error goes away. The TPerson is an out parameter passed in the service method. It is supposed to return the person logged in info. Maybe using the swift interface the TPerson object isn’t handled right.
In the meantime, I switched back to the oxygene interface and updated it by copying the generated code from the Service Builder which worked fine.
The login class that is called and run looks like this.
public class Login: RootServiceMethod
{
private String user;
private String password;
private TPerson person;
private Boolean loggedIn;
public String User
{
get { return user; }
set { user = value; }
}
public String Password
{
get { return password; }
set { password = value; }
}
public TPerson Person
{
get { return person; }
set { person = value; }
}
public Boolean LoggedIn
{
get { return loggedIn; }
set { loggedIn = value; }
}
public void Execute(TaskItem taskItem)
{
try
{
taskItem.Log.AddText(true, "Logging in " + User + ".");
ILoginService loginService = CoLoginService.Create(taskItem.ServerConnection.ROMessage,
taskItem.ServerConnection.ROChannel);
if (loginService.ZentraLogin(user, password, out person))
{
loggedIn = true;
taskItem.ServerConnectionInfo.SessionID = taskItem.ServerConnection.ROMessage.ClientID.ToString();
}
taskItem.User.Name = User;
taskItem.Log.AddText(true, "Login was successful for " + User + ".");
}
catch (Exception e)
{
taskItem.Log.AddText(true, e.Message);
taskItem.Log.AddText(true, "Login for " + User + " failed!");
}
}
}
The code is generated from the same CodeDom tree. Still it seems the listed ReadComplex methods are defined for different structures (note that second listing doesn’t mention the SessionID field).
The first listing seems to be fine - for structures with ancestors first data representing ancestors is read and then fields added in the structure are deserialized.