1. Aron Cox
  2. SnapDevelop
  3. Tuesday, 14 December 2021 11:55 AM UTC

I have a set of C# code I am migrating from COM wrapped assemblies to be called directly from PowerBuilder 2019 R3 after using the C# Class Importer.

It seems to work very well, and the fact you can step into the SnapDevelop debugger from PowerScript is going to make it much easier for PoweBuidler developers to work out what the C# code is doing.

However, debugging like this only works if I build the assemblies from SnapDevelop. If I build them from Visual Studio then when I step into the C# code SnapDevelop is launched and says "Source Not Available". I am building both as x86 and in Debug not Release mode. The code itself works just fine wherever I build, it's only debugging that's an issue.

Is there anything I can do to get Visual Studio builds to work? I have a lot more tools in Visual Studio, like source control and Resharper, than I do in SnapDevelop, so it would be nice I coould get them to play together.


Accepted Answer
Aron Cox Accepted Answer Pending Moderation
  1. Wednesday, 5 January 2022 13:21 PM UTC
  2. SnapDevelop
  3. # Permalink

I finally found the time to work out what was going on. It seems the default build in Visual Studio doesn't include enough information in the debug PBD file for SnapDevelop to find the source code. It seems I can make it work by telling Visual Studio to embed the source code in the PBD file like so:

* Edit the .csproj file with something like Notepad

* Add these lines inside of a <PropertyGroup> block


CopyLocalLockFileAssemblies - Ensure all used dlls are copied to the build folder - Not required for this but I have found it very useful

DebugType - This is the default and may not be required here, but I added it anyway

EmbedAllSources - This seems to be the important one, embeds source code in the debug file

EmitDebugInformation - I believe this may not be needed as the documentation says it is overridden by DebugType, but I left it in there anyway


Now I can debug an assembly built in Visual Studio with SnapDevelop stepping from PowerBuilder :)

  1. Aron Cox
  2. Friday, 7 January 2022 14:30 PM UTC
Thanks again Miguel! I remember now you've explained it to me.

I can't recommend enough trying it "my" way - I can just step to the call in the PowerBuilder code then do a Step Into (F8) and SnapDevelop will automatucally launch and take me to the first line of code in the call. Then I can just step through the C# code. No need to have Visual Sudio or SnapDevelop opened, no need to have the source code on your PC at all as it's embedded in the debug PDB file.

I'm trying to get the PowerBuilder developers in my compamy to at least learn a little C#, and I'm hoping being able to step into already existing C# code from PowerBuilder with zero effort will help :)
  1. Helpful
  1. Miguel Leeuwe
  2. Friday, 7 January 2022 23:24 PM UTC
So if I understand well, you're saying that with 'your way' there's no need to hook into any process from SnapDevelop? If so, that's really great!
  1. Helpful
  1. Aron Cox
  2. Tuesday, 11 January 2022 08:11 AM UTC
Yes that's right. If you build with SnapDevelop then it just works, if you build with Visual Studio then you need to add a line or two to the project file to tell the compiler to include the source code in the PDB and it will work from then on :)
  1. Helpful
There are no comments made yet.
Francisco Martinez @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 14 December 2021 17:08 PM UTC
  2. SnapDevelop
  3. # 1

Hi Aaron,

Could this be an issue of mismatching .NET SDKs? Please verify that you're compiling on Visual Studio targeting SDK 4.8


  1. Aron Cox
  2. Wednesday, 5 January 2022 13:49 PM UTC
Sorry totally missed this reply. I am using .NET Core 3.1, and I have managed to get it working (see my reply below).
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 14 December 2021 17:05 PM UTC
  2. SnapDevelop
  3. # 2

Hi Aaron, why do you want to use Visual Studio instead of SnapDevelop for this particular debugging scenario?

  1. Aron Cox
  2. Wednesday, 5 January 2022 13:10 PM UTC
Sorry, somehow I missed these replies. Visual Studio is a much better editing tool, for example I use Resharper, and I need to work with Azure DevOps for source control. So I like to develop and build with Visual Studio and am them fine with stepping into SnapDevelop for debugging. See my answer (I am just about to post) for what is needed to get a build in Viaul Studio to work when stepping into SnapDevelop for debugging.
  1. Helpful
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.