Hydra 6: Import of interfaces from .Net assemblies fails

Hello,

we have a problem with the import of interfaces from .net assemblies. Interface types are translated into << Unsupported Type >> (see below).
Are we doing something wrong?

Thanks,
Bernd

Source:

using RemObjects.Hydra.CrossPlatform;
using System;
using System.Runtime.InteropServices;

namespace Vehicles
{
    [Guid("9CA09E61-2F4E-4B0D-B231-AC61AB38DBFB"), ComVisible(true)]
    public interface ICar : IHYCrossPlatformInterface
    {
    }

    [Guid("6396FC41-BFEE-43E9-800A-D3B666A3EA6D"), ComVisible(true)]
    public interface IWheel : IHYCrossPlatformInterface
    {
        ICar Car { get; }
        double Diameter { get; set; }
    }
}

Result:

unit Hydra_Import;

{ This unit has been automatically created by Hydra. Any changes in this unit might be lost in automatic updates}

interface

uses
  uHYCrossPlatformInterfaces;

type
  ICar = interface;
  IWheel = interface;

  // Original name: Vehicles.ICar
  ICar = interface(IHYCrossPlatformInterface)
  ['{9CA09E61-2F4E-4B0D-B231-AC61AB38DBFB}']
  end;

  // Original name: Vehicles.IWheel
  IWheel = interface(IHYCrossPlatformInterface)
  ['{6396FC41-BFEE-43E9-800A-D3B666A3EA6D}']
    function get_Car: << Unsupported Type >>; safecall;
    function get_Diameter: Double; safecall;
    procedure set_Diameter(const value: Double); safecall;
    property Car: << Unsupported Type >> read get_Car;
    property Diameter: Double read get_Diameter write set_Diameter;
  end;

implementation
end.

Vehicles.zip (4.0 KB)

I suggest you provide with is the type of car. Cant see in the code. Share the original dot net code.

Attached please find our test project: Vehicle.zip

Another problem is that the importer locks the assembly. So I have to close Delphi before I can recompile the solution.

  1. Missed types are clearly a bug. Working on it atm. As a workaround modify the imported .pas file

  2. Assembly files shouldn’t be locked. This can be probably caused by (1). I’ll investigate this and fix as well.

Sorry for the inconvenience.

Thanks, logged as bugs://81543

Thanks, logged as bugs://81544

bugs://81544 got closed with status fixed.

bugs://81543 got closed with status fixed.

Fixes will be available in the next Beta biuld

Hello I just updated to the beta version: RemObjects Hydra - 6.1.0.1211.exe
Now when I try to Import the interfaces from a .NET assembly (using Delphi 10.3 Rio) I get the following error:

Thank you!

I get the same error using Delphi Tokyo

  • open regedit
  • go to HKEY_CLASSES_ROOT\Wow6432Node\CLSID\{F8D1C79B-5D1E-4861-8740-4C360BB1391E}\InprocServer32\
  • remove 6.1.95.1207 subkey.

as a result, only beta version key (6.1.0.1211) should be here.
after removing subkey, you should restart Delphi

Wow that fast! Thanks!! :slight_smile:

Removing the subkey allowed the import to run through.

But now I get compile errors in Delphi.

Below you see the diff (left old import-> compiled fine, right: new import).

The Item property generates the following error:
[dcc32 Error] Core_Import.pas(313): E2008 Incompatible types

relevant section of .NET interface:
public interface IMatrix : IHYCrossPlatformInterface
{
double this[int Row, int Col] { get; set; }
double[,] AsArray { get; }
double[] AsRowMajorArray { get; }
float[] AsRowMajorArrayFloat { get; }
}

Here is another import error:


[dcc32 Error] Core_Import.pas(1028): E2038 Illegal character in input file: ‘}’ (#$7D)
.NET function is declared as:
byte[] ReadAsBytes();

I also notice that all the IHYCrossPlatformInterface arguments are no longer const.
Why this change?

Hello

Both importer issues are clearly importer bugs and will be addressed ASAP.

As for the ‘const’ issue - I’ll need to discuss it with Eugene and either fix it or let it be AS IS.

If you need a Hydra version with the fixed importer the please send a mail to support@ with your account name.

Thanks, logged as bugs://81810

Thanks, logged as bugs://81811

Thanks, logged as bugs://81812

Thanks @antonk,

Let me know when the issues have been addressed and we will request the fixed importer from support.

fyi,

@bmaier

bugs://81810 got closed with status fixed.

bugs://81811 got closed with status fixed.