C#/.net codegen missing IMPL

I’m currently evaluating Remoting SDK v9.4.107.1363 and I’m having a problem with codegen, or maybe I just don’t understand the correct way to do things.

I’ve define a simple service in the Service Builder and done codegen for Delphi and implemented a Delphi server and client and tested them between each other. I then generated the intf for C# and implemented a C#/.Net client. I tested this client communicating to the Delphi server and all was well.

The problem is my last test which is implementing the C#/.Net server for the service. There doesn’t appear to be a codegen for a C#/.Net impl file.

So, is there something I’m missing? Do I need to do the class/file for the impl entirely myself? What is the normal method for this? Am I correct in believing that code-first is not a good fit for cross platform communication? I’ll admit I haven’t tried one yet, but it seems like I would have to define the interface once for each language/platform.

Hello

Which options do you have in Service Builder menu under CodeGenC# for .NET? There should be an option for Implementation.

Given that you already have the RODL file the easiest path is to create a new RODL-based server. Delete the generated _Intf, _Invk and _Impl files. Then close the project and replace the generated .RODL file with the one you have. Reopen the project and dbl-click the RODL file. Then close the Service Builder that will start after that double-click. All RODL-related files will be regenerated.

Note that the recommended workflow is to “develop server app” → “use the resulting RODL”. The steps above go in the opposite way.

No, that’s not correct. From client’s point of view there is no difference between RODL-based and CodiFirst-based servers at all. Both expose RODL at runtime, so there is no difference in the client implementation process.

Regards

1 Like

Which options do you have in Service Builder menu under CodeGen → C# for .NET? There should be an option for Implementation

Interface and Server Access only.

Based on your responses I’ve come to the conclusion (maybe incorrectly) that RO might not be installed correctly. When I downloaded the trial I downloaded both the Delphi and .Net trials and during install it seemed that each contained both, which I admit I found confusing/surprising. I ended up only installing the Delphi ‘version’. Do I need to install the .Net version to get the .Net tools, even though I clearly have the .Net assemblies (as I am able to manually develop a C# client in VS though generating the interface in SB)?

I’m currently either opening the Service Builder from Delphi or from the EXE itself - I’m not seeing anything obvious in VS that indicates I can launch/do anything related to RO.

No, that’s not correct. From client’s point of view there is no difference between RODL-based and CodiFirst-based servers at all. Both expose RODL at runtime, so there is no difference in the client implementation process.

I don’t think I asked this properly - but please correct me if I misunderstood. I understood that code-first development is defining the RODL via the code itself, rather that designing a .RODL file. My question is: if I’m developing a server in one language (C#) and define the RODL using code-first in C# and then need to develop a Delphi client - how do I port the code-first definition from C# to Delphi (ie develop the interface)? Do I need to manually develop code in Delphi in the same fashion? It seems like i need to develop two sets of code (one in each language) to do code-first and wouldn’t need to do that if the client and server were the same language.

More information: installing the .net version made everything worse. It apparently uninstalls the Delphi version, leaving me without SB installed into Delphi. In addition to that, I did not see any improvement in VS integration. I did however see (via the web) that the packages determine where you can design/build servers. What is the proper method (even after purchase).

Also, to any RO staff reading: the trials reference http://rosdk.com and http://docs.rosdk.com, which for me doesn’t work

Thank you for the report. Apparently auto-redirect is broken there. Site names should be https://remotingsdk.com and http://docs.remotingsdk.com

Yes, sorry for the inconvenience. .NET package is called ‘… for .NET and all clients’ whine Service Builder integration into RAD Studio is a part of the Server package that gets uninstalled. Btw the Service Builder itself is not uninstalled, you should see it in the Start menu.

After purchase there are additional download options available that allow to load installation packages for .NET that do not affect RAD Studio at all (i.e. .NET Server and .NET Client only package).

Unfortunately in your case (Trial packages) you’ll need to use a separate virtual machine for either VS or RAD Studio.

Which exactly VS version do you use?

That said, SDK Server doesn’t do much to the VS integration. What is added is license compiler registation (transparently used during project build process), more components in the Toolbox and Server project templates, and a couple of additional menu item actions like ‘Convert Server to CodeFirst’ and ‘Regenerate Files form RODL’.

Thank you for the report.

Welcome.

Unfortunately in your case (Trial packages) you’ll need to use a separate virtual machine for either VS or RAD Studio.

Ok, I can work with that for the time being.

Which exactly VS version do you use?

I’m using 2017 - v15.7.4.

Nothing I’ve done in either Delphi or VS or just launching the SB separately has given me an option to generate the impl for C#.

Ok, I see how creating a new project in VS for the server creates the .rodl and the associated files automatically, but I still have three problems.

  1. The _impl file doesn’t see to regenerate properly all the time. If I double click on the .rodl, add a new method and then close the SB the new method is not added to the _impl, but the _intf is correctly regenerated/includes the new method.

  2. I will need to create a new .rodl for an existing C# program/project. What is the correct/best way to embed RO into a VS project? I assume there must be some setup that happens in VS that lets double clicking on the .rodl work when it does not when I manually add it to my project.

  3. (And maybe this should be a separate post) In Delphi, in a server application, once the basic interface in done and I’ve done my implementation code what is the best method for not getting that wiped out later when I need to add a new method and regenerate the _impl (and the other files)? Is it best to simple not regenerate that file? I’ve found that I can comment out the creation of the TROClassFactory (and have a corresponding create in my unit) and create my own class derived from the one in the _impl, but that requires I edit the generated _impl every time it’s regenerated.

And BTW, thanks for the all the help.

I’ll get that fixed tomorrow, my apologies for that.

We should fix that, Anton. And/or provide a combined installer…

Hello

If you change service definition in RODL it is up to you to make corresponding changes in the implementation file. Otherwise your project just won’t compile. Actually that was one of the main reasons we introduced CodeFirst approach where changes needs to be done in one place only.

Please note that _Intf and _Invk files are regenerated entirely. In case of _Impl file it would be not clear how to properly merge changes made in RODL into an existing code file. At the very least this would require introducing code parsers for all supported languages. This would be a huge overkill, especially considering that a result of such operation anyway had to be double-checked by developer.

Here’s a sample:
SampleWindowsFormsApp.001.zip (8.5 KB) - a just created simple WinForms app
SampleWindowsFormsApp.002.zip (11.9 KB) - a RODL has been added to the app via ‘Add New Item’ menu command in Solution Explorer. I defined a service method and closed the Service Builder. Note that all Remoting SDK references were added automatically and required files were generated.
Also I added some code to the service method body.

Now something has to listen to the incoming network requests. I’ve added a IpHttpServerChannel and BinMessage components to the MainForm. Note the licenses.licx file that has been added to the Properties folder. This file is used by the .NET license compiler to embed your components license hash into the resulting assembly. Without this file (or a valid license described by it) you’ll get an error saying “License not found for ...” at runtime.

Then I added a simple button to the main form to actually activate the server channel (and another one to deactivate it). Here’s the Click event handler code for these buttons:

	private void ActivateButton_Click(object sender, EventArgs e)
	{
		this.ipHttpServerChannel1.Dispatchers.Clear();
		this.ipHttpServerChannel1.Dispatchers.Add("bin", this.binMessage1);

		this.ipHttpServerChannel1.Active = true;
	}

	private void DeactivateButton_Click(object sender, EventArgs e)
	{
		this.ipHttpServerChannel1.Active = false;
	}

Also I’ve changed BuildAction of the RODL file to Embedded Resource. Without this step the server will work but it won’t be possible to access its metadata remotely.

SampleWindowsFormsApp.003.zip (14.6 KB)

Please remember that this is a really simple sample that cannot be even remotely compared feature-wise to the servers based on the ApplicationServer class (ones that you create by the Server App template). They have a lot of additional features like automatic generation of SSL certificates, support for running as console app or Windows Service, support for installing/uninstalling themselves as a Windows Service etc.

Regards

Fixed.