Hello,
we have a Delphi App that executes commands in a .NET plugin.
The .NET command is very simple, in this case it just executes a batch file.
System.Diagnostics.Process.Start(myBatchFileName);
The batch file makes use of robocopy.
If we launch our app with Visual Studio or if we launch our app directly all works correctly.
If we launch our app from the Delphi IDE (Delphi 10.3, have not tried with older versions) then executing the batch file fails with the following error. The problem also happens if you launch our app without attaching the debugger.
’robocopy’ is not recognized as an internal or external command,
operable program or batch file.
When starting our app from Visual Studio or the Delphi IDE the command line parameters are empty in both cases.
This is most likely not a Hydra problem. It is most likeley a Delphi IDE issue.
But maybe you have an idea that could help us.
In the past I ran into a similar problem. We make use of NLog in our .NET plugin.
If our app was launched from the Delphi IDE, an exception would be thrown when trying to activate NLog.
In that case I could locate the problem and implement a workaround.
The problem was that if our app is started from the Delphi IDE the following C# call would generate an exception:
AppDomain.CurrentDomain.SetupInformation.PrivateBinPath;
somehow PrivateBinPath is corrupted when our app (I guess the same is true for any app) is launched from the Delphi IDE. The workaround was an ugly hack:
static private void AppDomainPrivateBinPathBugWorkaround()
{
var currentDomain = AppDomain.CurrentDomain;
try
{
currentDomain.SetupInformation.PrivateBinPath = currentDomain.SetupInformation.PrivateBinPath;
}
catch (ArgumentException)
{
var fusionProperty = typeof(AppDomain).GetProperty(“FusionStore”, BindingFlags.NonPublic | BindingFlags.Instance);
if (fusionProperty != null)
{
var setupInfo = fusionProperty.GetValue(currentDomain) as AppDomainSetup;
if (setupInfo != null)
{
setupInfo.PrivateBinPath = currentDomain.BaseDirectory};
}
}
}
}
I just checked and the work around is still needed for Delphi 10.3.
Do you have any idea, what the issue could be?
Thanks!