1. Roel Pollet
  2. SnapDevelop
  3. Tuesday, 23 November 2021 16:07 PM UTC

Hello,

 

I've followed Bruce's demo about the .NET importer. He says that it's possible to debug the C# assembly. But I have no idea how.

So:

Created DLL in SnapDevelop and published it as Debug config.

Imported DLL in PowerBuilder and written some code to call the DLL function.

In PB system options are set to 'Launch Snapdevelop to debug C# assemblies'.

 

When I'm debugging my PowerBuilder code, I thaught that i just could Step into the DLL function (snapdevelop would open and I could continue to debug in SnapDevelop).

But that's not the case.

 

Am I doing something wrong?

 

Thanks for the help.

 

 

 

Aron Cox Accepted Answer Pending Moderation
  1. Tuesday, 14 December 2021 11:33 AM UTC
  2. SnapDevelop
  3. # 1

I am able to step directly into C# code from PowerScript code as long as I do the following:

* Build the code using SnapDevelop using the Debug and not the Release settings

* I always use x86 to do my builds, not sure how important this is

* I have to step to the line of code that directly calls the C# function in PowerScript and then press F8 to step into the C# code. At this point SnapDevelop launches and enters into the debugger. I don;t have to attach to any processes or anything.

 

I haven't been able to get this to work for builds from Visual Studio (2019 and 2021) where I get "Source Not Available" reported in SnapDevelope after it has launched. I'm trying to work out why. I do notice the PBD files from Visual Studio are smalled than those from SnapDevleop and wonder if that has something to do with it.

Comment
There are no comments made yet.
Miguel Leeuwe Accepted Answer Pending Moderation
  1. Wednesday, 24 November 2021 02:54 AM UTC
  2. SnapDevelop
  3. # 2

What I do is use the Visual Studio 2019 community edition.

Open the solution in VS, compile for 'debug' and 'x86' and then run the powerbuilder application.

Once the pb app has started (the app HAS to be running), in VS you go to the menu "Debug > Attach to Process". (or hit ctrl+alt+p ).

Then you have to select PB190.exe. It works great!

Comment
  1. Roel Pollet
  2. Wednesday, 24 November 2021 13:24 PM UTC
Thanks for the help, Miguel. I got it running in SnapDevelop.



In SnapDevelop you have the same 'Attach to process' option as in Visual Studio.



Start the exe and then in SnapDevelop > Attach to process & Add breakpoints
  1. Helpful
  1. Miguel Leeuwe
  2. Wednesday, 24 November 2021 13:28 PM UTC
Good news!
  1. Helpful
  1. Roel Pollet
  2. Wednesday, 24 November 2021 13:42 PM UTC
It looks like the Debug in SnapDevelop is not always working. So maybe I'll have to try Visual Studio
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 23 November 2021 19:09 PM UTC
  2. SnapDevelop
  3. # 3

Hi Roel,

The PowerScript debugger cannot debug C# code.  It can only debug up to the point that the PowerScript interfaces with the .NET DLL.  But it should still be useful to see if the DLL is being called from PowerScript and what is return value.  Then based on that information, you can also use SnapDevelop to debug the C# code to narrow down which code has the issue.

One suggestion I have is make sure the .NET DLL complies with these requirements; otherwise, definitely it is not going to work: https://docs.appeon.com/pb2021/application_techniques/Calling_C_Assembly_in_an_Application.html

Best regards,
Armeen

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.