Migration & Compatibility; Delphi XE2 Hydra 4.0.75.1101 : .NET Plugin Hydra 6.1.95.1207

The plan I’m trying to follow is to create a new development VM (based on Win 10 and VS 2017), purely for .NET DA and / Hydra visual plugin work. An existing VM is based around Win 7, VS2012, Delphi XE2, Hydra 4, DA 8.

A couple of related questions :-

1). Should plugins created in VS2017, using the latest Hydra 6 be compatible with a Delphi XE2 host built using Hydra 4 ? Having tried this, I get the plugins loaded, but when the plugin form is in the process of being displayed, it totally closes down the host application after a pause of 20 seconds or so. Given I’m using two development machines, I’ve not had chance to dig into this to see if I can pin down where the failure is occurring. Given I’m using Hydra 4 on the Delphi host and 6 in the .NET plugin, I’m not surprised. Should I pursue this and expect it to work though ? Ideally I’d like to not touch the Delphi environment for now, but making use of Hydra 6 on the Delphi XE2 side seems like it would be necessary ?

2). Assuming I need to use Hydra 6 on the Delphi XE2 side, I’ve started exploring that route. After a successful installation of Hydra 6 (XML log below), I get the following package errors when loading XE2.

Can you advise on this ?

log.xml (29.9 KB)

yes, they should

Do you have any installed packages into Delphi that use Hydra? if yes, you have to recompile them for avoiding such messages

Thanks Evgeny.

1). I’ll pursue the Hydra 4 route and look to investigate further why the host application crashes out when opening the .NET Hydra 6 plugin.

2). I should have no other Delphi installed packages that use Hydra. I do have the full RemObjects VCL suite in XE2, but are there dependencies in there on Hydra ? At this point given I’m looking to go down option 1, this is not important though.

Hi,

integration RO and Hydra may cause some problems especially if you mixed different versions.
try to disable or recompile manually these packages:

  • Hydra_RO_D16.dpk
  • IDE\Hydra_RO_IDE_D16.dpk

Pursuing the Hydra 4 route, I’m doing a remote debug from the XE2 environment onto the new environment, running a little test host application. As per my main application, it will load a plugin created in the new environment (hydra 6), but fails when trying to display it. Here’s the error point :

As you can see, it fails on the CreatInstance call. Stepping into that call, it succeeds on the call to THYManagedModule.GetAssembly:

…but fails on the CreateInstance itself.

I should also add, that when running the same executable on the original development VM, it will successfully load and display the plugin that was created on the new VM using VS2017, and Hydra 6. As per your first reply, that does suggest that presenting Hydra 6 plugins to a Hyrda Delphi XE2 host should work.

Any thoughts on how to narrow down the problem ?

Hello

The easiest approach would be to send us to support@ the built project. I’ll run it on a clean environment and will try to intercept the error that happens in the .NET domain.

Or you can try to debug it by yourself:

  1. Start a new Visual Studio 2017 instance
  2. Start the host application
  3. In VS issue Debug → Attach to Process
  4. Attach to the running host app
  5. Go to Debug → Options and make sure that the option ‘Enable Just My Code’ is NOT selected
  6. Press Ctrl + Alt + E
  7. ‘Exception Settings’ pane will appear
  8. Expand the Common Language Runtime Exceptions node and check the System.Reflection.TargetInvocationException exception
  9. In the host app try to load the plugin
  10. VS should pause execution and display the exception info. There should be a property InnerException. It will contain the information about the underlying exception and what caused it

Thanks Anton. I’m trying to dig into this myself (but hitting some barriers) .

My issues here may be one root cause, but I have two things to pursue at the moment, so I’d like to clarify them in my own head before presenting them to you. One consistent failure I’m seeing is this.

No error is thrown whilst stepping through the THYModuleManager.ReleaseInstance, but is immediately upon returning. This does NOT happen when using the plugin compiled under Hydra 4 in VS2012, but does using the VS2017, Hydra 6 compiled one.

Generally, the Hydra 6 plugin is loading, and interfaces are able to be called. Releasing the plugin (as above) seems to be one issue). The other issue I can’t describe clearly at the moment, but it could be along the lines of interfaces back into the host are causing problems.

As I said, I’m trying to simplify the test case(s), but I’m currently blocked by the other issue I linked to above.

Btw are you using a Visual or a NonVisual plugin?

The production plugin I’m working with here is a visual one. I do have a non visual one in the same module that I can try and see if that fails at the same release point.

Hi,

try to change Delphi plugin declaration in uHYCrossPlatformInterfaces.pas from

IHYCrossPlatformNonVisualPlugin = interface(IHYCrossPlatformPlugin)

with

  IHYCrossPlatformNonVisualPlugin = interface(IHYCrossPlatformInterface)

It may be a reason for such failure with Hydra/.NET v6 plugins

HI Evgeny,

Just to be clear, are you referring to :-

C:\Program Files (x86)\RemObjects Software\Hydra for Delphi\Source\uHYCrossPlatformInterfaces.pas

i.e.

  // Original Name: RemObjects.Hydra.CrossPlatform.IHYCrossPlatformNonVisualPlugin
  IHYCrossPlatformNonVisualPlugin = interface(IHYCrossPlatformInterface)
  ['{45076085-e147-4fef-8fb9-2da3bc22aef2}']
    procedure Start; safecall;
    procedure Stop; safecall;
    procedure Pause; safecall;
    procedure Resume; safecall;
  end;

… which is in the Win 7 Delphi XE2 environment. As you can see, that declaration is already as I think you’re suggesting it should be changed to ?

the latest Hydra v4 release (4.0.83.1133) was released at Nov 11, 2016

above change was made in 2017 …

what exactly Hydra/Delphi version you are using? check version in HYVersion.inc

4.0.75.1101

my bad.
interface declaration was changed only in .NET and now it equals to Delphi one.


try to disable non-visual plugin. will your plugin be released correctly?

No problem…

In the module I’m working on, I have 5 visual plugins and 1 non visual. I’m only creating an instance of one of the visual plugins i.e. not creating the non visual one.

  1. Would removing the non visual plugin from the module make a difference ?
  2. Is there a difference between removing and “disabling” the non visual plugin ?

I’m aiming to produce a simple test case for this, not involving production code which has database links and other dependencies. I’m currently reinstalling VS 2017 on another snapshot of my new VM to try and see if that helps with the issue that is blocking me progressing this i.e. the one I linked to at the top of this thread. Maybe not you’re area, but if you have a view on that, it might help with this issue or at least let me progress in making a simplified test case.

Just to bring the thread to a slightly inconclusive end…

In one of my earlier screenshots there is a call from the host into the plugin
image

I found that without that call, the module instance would release without problem. I modified the “NotifyFormClose” call to return a boolean, re-imported the interface to the host and it worked. I further modified the interface back to how it was i.e. to not return anything and it still worked.

I’m fairly confident that I imported the interface to the host when I started working on the plugin conversion initially i.e. the host and plugin should have been in line. If that is the case, then all that has effectively changed is that the source file containing the interface definition has been saved ( return value added and then removed) and reimported to the host when the DLL is built.

From my side, the release of the plugin is working without issue. I have numerous other plugins to convert to Hydra 6 and the latest elements, so maybe they will throw up similar issues. If not, I’m happy to put it down to me possibly not having imported as fresh version of the the interface when the plugin was converted to Hydra 6 / latest VS2017 / Elements. That said, nothing having changed on the interface, I don’t think I should have needed to anyway.

Hi,
can you show file with old imported interface and new one, pls?
if it is private, you can send it to support@

Hi Evgeny,

Thanks for replying, but I don’t think this is worth your time.

I’ve just been through it again, using a clean copy of the interface file i.e. the same as I would have had originally.

I built the plugin DLL, then re-imported the interfaces to the Delphi host, recompiled and tested it out. It worked without issue. So I can only assume it was something on my side, not a problem for you as far as I can tell.

I still have numerous plugins to carry over from my old VS 2012 Hydra 4 environment, but they all use the same interfaces, so I’m hopeful I’ve seen most of the issues already.

Thanks again.