1. Raja RAMASAMY
  2. PowerBuilder
  3. Thursday, 13 July 2023 04:59 AM UTC

Hello PowerBuilder experts, following is my scenario.

  • We have a PowerBuilder application (version 2022 build 1892)
  • We have a bunch of PDFs stored in Azure Blob Store
  • We also have a C# DLL (.NETCore 6.0), that uses Azure Blob SDK to upload and download documents from the Azure Blob Store
  • I am trying to integrate this C# DLL with PowerBuilder (using .NET DLL Import)
  • It works perfectly in the PowerBuilder Development Environment
  • But when I do a build and copy the build to the client PC, it does not work
  • On further investigation i found out that LoadWithDotNetCore throws -19
  • My sample code attached.
  • Client PC has following versions of .NETCore
    • Microsoft.NETCore.App 3.1.32
    • Microsoft.NETCore.App 6.0.16
    • Microsoft.WindowsDesktop.App
    • Microsoft.WindowsDesktop.App

 Any help will be greatly appreciated.

This.of_ResetError( )
If This.ib_objectCreated Then Return True // Already created => DONE

Long ll_status 
String ls_action
integer	li_fp
string	ls_version

/* Load assembly using .NET Core */
ls_action = 'Load ' + This.is_AssemblyPath

DotNetAssembly lnv_assembly
lnv_assembly = Create DotNetAssembly
ll_status = lnv_assembly.LoadWithDotNetCore(This.is_AssemblyPath) // NOTE: returns 1 in my local machine and returns -19 in client machine
ls_version = lnv_assembly.getdotnetcoreversion( ) // NOTE: returns 7.0.5 in my local machine and returns EMPTY STRING in client machine

This.is_AssemblyPath + ', ll_status = ' + string( ll_status))

/* Abort when load fails */
If ll_status <> 1 Then
	This.of_SetAssemblyError(This.LOAD_FAILURE, ls_action, ll_status, lnv_assembly.ErrorText)
	Return False // Load failed => ABORT
End If

/*   Create .NET object */
ls_action = 'Create ' + This.is_ClassName
ll_status = lnv_assembly.CreateInstance(is_ClassName, This)
ls_version = lnv_assembly.getdotnetcoreversion( )

/* Abort when create fails */
If ll_status <> 1 Then
	This.of_SetAssemblyError(This.CREATE_FAILURE, ls_action, ll_status, lnv_assembly.ErrorText)
	Return False // Load failed => ABORT
End If

This.ib_objectCreated = True
Return True
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Friday, 14 July 2023 07:26 AM UTC
  2. PowerBuilder
  3. # 1

Hi Raja,

FYI: you can create a self-contained build of your .net DLL. That way you don't have to worry about what's installed or not on your customer's PC. It will include all of the .net Core DLL's needed and no need to install it on the client's PC.

https://learn.microsoft.com/en-us/dotnet/core/deploying/deploy-with-cli

regards

Comment
There are no comments made yet.
Raja RAMASAMY Accepted Answer Pending Moderation
  1. Friday, 14 July 2023 00:59 AM UTC
  2. PowerBuilder
  3. # 2

Hi all super geniuses.

I have resolved it. Finally it was 32-bit version of DotNet 6.0.16 did the trick. Installed DotNetCore 6.0.16 x86 on client's PC. Started working.

This forum is GREAT.

Thank you all.

Raja

Comment
There are no comments made yet.
Raja RAMASAMY Accepted Answer Pending Moderation
  1. Thursday, 13 July 2023 15:05 PM UTC
  2. PowerBuilder
  3. # 3

Hi. Thanks for the response. I have checked the following.

1. Following is the screenshot I got from client's PC. "dotnet" is already part of the PATH variable, and the command "dotnet" runs fine.

2. Reference to the assembly path is prefixed with CURRENT PATH ".\....dll"

Comment
  1. Francisco Martinez @Appeon
  2. Thursday, 13 July 2023 16:18 PM UTC
Are PB's .NET runtime files in the same directory as the application?
  1. Helpful
  1. Miguel Leeuwe
  2. Thursday, 13 July 2023 17:10 PM UTC
In the links that I added in my answer, you could have read that the "current path" might no longer be pointing to where your DLL is. Any file operations read or write, might change it. FileOpenSavename etc. They can all change the current directory.
  1. Helpful
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Thursday, 13 July 2023 14:21 PM UTC
  2. PowerBuilder
  3. # 4

Please make sure that you're including the appropriate runtime files for .NET execution on either on your PATH or the application's directory.

See here: https://docs.appeon.com/pb2022/application_techniques/PowerBuilder_runtime_files.html

Also, verify that the path to the assembly is relative and not absolute, as this might lead into issues when you deploy the application to your customers.

 

Regards,
Francisco

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Thursday, 13 July 2023 05:21 AM UTC
  2. PowerBuilder
  3. # 6

 

Check for dotnet directory in PATH variable. The runtime directory is different for 32bit and 64bit application.

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.