# Debugging example plugins

**URL:** <https://forum.opentap.io/t/debugging-example-plugins/892>\
**Category:** General\
**Created:** [October 12, 2022, 11:53am UTC](https://forum.opentap.io/t/debugging-example-plugins/892 "2022-10-12T11:53:30Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![andy1](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@andy1](https://forum.opentap.io/u/andy1)\
**Post date:** [October 12, 2022, 11:53am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/1 "2022-10-12T11:53:30Z")

</div>

Hi everybody

How to debug a plugin - I have ran Example Plugin from both within the repository and in the download (in debug)everything runs in the Editor but the break point is not hit. The .pdb file and .dll are in the C:\Program Files\OpenTAP\Packages\SDK\Examples\bin\Debug\

As I understand it the Editor will run in above folder so should find the .pdb ?

Is there additional steps or file moving that needs doing ?

Where should we create our custom plugins ? in Packages or the opentap folder ?  
Many regards Andy

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [October 12, 2022, 12:14pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/2 "2022-10-12T12:14:07Z")

</div>

Hi Andy,

This depends a bit on how you attach the debugger. Which .sln file do you load to do this?

---

<div class="post-metadata">

**Author:** ![andy1](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@andy1](https://forum.opentap.io/u/andy1)\
**Post date:** [October 12, 2022, 2:27pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/3 "2022-10-12T14:27:46Z")

</div>

Hi Rolf  
I’m opening Examples.sln in C:\Program Files\OpenTAP\Packages\SDK\Examples

Thanks Andy

---

<div class="post-metadata">

**Author:** ![ronghuaw](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ronghuaw](https://forum.opentap.io/u/ronghuaw)\
**Post date:** [December 4, 2022, 7:27am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/4 "2022-12-04T07:27:43Z")

</div>

> [@andy1](#):
>
> opening Examples.sln in C:\Program Files\OpenTAP\Packages\SDK\Exa

I hit same issue, any solution for this issue?

---

<div class="post-metadata">

**Author:** ![andy1](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@andy1](https://forum.opentap.io/u/andy1)\
**Post date:** [December 5, 2022, 9:19am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/5 "2022-12-05T09:19:24Z")

</div>

Hi Ronghuaw,  
No unfortunately - I’m not sure if Keysight are using everything in Linux , I’ve abandoned Opentap for now and written my own app as we only have a couple products and only me as test/production engineer so not at the enterprise level yet 😀

regards Andy

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [December 5, 2022, 11:36am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/6 "2022-12-05T11:36:21Z")

</div>

I can verify that everything should work on Windows. That is still our main platform.

But in any case, debugging should work.

Which kinds of development environments are you using?

---

<div class="post-metadata">

**Author:** ![ronghuaw](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ronghuaw](https://forum.opentap.io/u/ronghuaw)\
**Post date:** [December 5, 2022, 12:05pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/8 "2022-12-05T12:05:34Z")

</div>

Hi Andy,

Thank you. I’m sorry to hear you abandoned OpenTAP, framework always a good fridend to ease your life 😀

regards Ronghuaw.

---

<div class="post-metadata">

**Author:** ![ronghuaw](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ronghuaw](https://forum.opentap.io/u/ronghuaw)\
**Post date:** [December 5, 2022, 12:07pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/9 "2022-12-05T12:07:52Z")

</div>

Visual Studio 2019, everything works fine except i can’t debug when open Examples.sln in C:\Program Files\OpenTAP\Packages\SDK\Exaamples (follow the youtube training video). thanks.

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [December 5, 2022, 12:54pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/10 "2022-12-05T12:54:41Z")

</div>

I found the issue.

Since the TargetFramework is netstandard2.0 in the Directory.Build.props file, Visual Studio thinks it should debug the process with the .net6/netcore debugger. This is not the case, because Editor.exe is a .net framework executable.

To fix this, change  
`<TargetFramework>netstandard2.0</TargetFramework>`

To

`<TargetFramework>net480</TargetFramework>`

in Directory.Build.props.

---

<div class="post-metadata">

**Author:** ![ronghuaw](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ronghuaw](https://forum.opentap.io/u/ronghuaw)\
**Post date:** [December 5, 2022, 2:02pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/11 "2022-12-05T14:02:46Z")

</div>

Thanks rolf, i can debug now, does that mean if you like to create the custom plugin and like to debug, only can use the .net framework instead of .net core?

---

<div class="post-metadata">

**Author:** ![andy1](https://avatars.discourse-cdn.com/v4/letter/a/a8b319/32.png) [@andy1](https://forum.opentap.io/u/andy1)\
**Post date:** [December 5, 2022, 2:18pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/12 "2022-12-05T14:18:51Z")

</div>

That’s a Christmas ⭐ for Elf Rolf - Maybe I’ll have another look at OpenTap in the new year 😀

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [December 5, 2022, 2:35pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/13 "2022-12-05T14:35:31Z")

</div>

@ronghuaw, that’s right. If you’re using Visual Studio to debug your custom plugin, you’ll need to target the .NET Framework in order for debugging to work. However, even if you’re using the .NET Framework for debugging purposes, your project will still work on .NET Core. So you can use either .NET Framework or .NET Core for your project, but you may need to use the .NET Framework for debugging purposes if you’re using Visual Studio.

Thanks @andy1, your always welcome ⭐

---

<div class="post-metadata">

**Author:** ![ronghuaw](https://avatars.discourse-cdn.com/v4/letter/r/f04885/32.png) [@ronghuaw](https://forum.opentap.io/u/ronghuaw)\
**Post date:** [December 5, 2022, 2:49pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/14 "2022-12-05T14:49:42Z")

</div>

Thanks rolf, it’s more clear now for the custom plugin debug.

---

<div class="post-metadata">

**Author:** ![jason.hicks](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/jason.hicks/32/281_2.png) [@jason.hicks](https://forum.opentap.io/u/jason.hicks)\
**Post date:** [December 7, 2022, 5:56pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/15 "2022-12-07T17:56:53Z")

</div>

Examples debugging seemed to work fine in VS2019 but caused problems in VS2022. All projects needed switching to .NET Framework. Probably because of the update to .net6 as @rolf_madsen points out. Is there a way to switch debuggers instead of changing TargetFrameworks?

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [December 7, 2022, 9:05pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/16 "2022-12-07T21:05:42Z")

</div>

There is a workaround. You can have an extra project called e.g MyProject.Debug. And that can target .net framework,while everything else targets .netstandard. So when you click F5 and Myproject.Debug is selected it starts the right debugger and everything works as expected.

---

<div class="post-metadata">

**Author:** ![Jim\_B](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@Jim\_B](https://forum.opentap.io/u/Jim_B)\
**Post date:** [April 11, 2023, 9:57pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/18 "2023-04-11T21:57:13Z")

</div>

> [@rolf\_madsen](#):
>
> I found the issue.
> 
> Since the TargetFramework is netstandard2.0 in the Directory.Build.props file, Visual Studio thinks it should debug the process with the .net6/netcore debugger. This is not the case, because Editor.exe is a .net framework executable.
> 
> To fix this, change  
> `<TargetFramework>netstandard2.0</TargetFramework>`
> 
> To
> 
> `<TargetFramework>net480</TargetFramework>`
> 
> in Directory.Build.props.

I ran into the same problem today creating an OpenTAP plugin from scratch targeting netstandard2.0 and using the OpenTAP Nuget package along with TUI to debug. I wanted to say thank you for helping me understand the problem and also share a slightly different workaround I decided to use instead of a dummy project.

First, I created a new configuration called DebugPlugin, then added a conditional PropertyGroup to the CSPROJ file and included TUI as an additional OpenTAP package:

```csharp
  <PropertyGroup Condition="'$(Configuration)'=='DebugPlugin'">
    <TargetFramework>net48</TargetFramework>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="OpenTAP" Version="9.20.4" />
    <AdditionalOpenTapPackage Include="TUI" />
  </ItemGroup>

```

Along with the following launchSettings.json:

```csharp
{
  "profiles": {
    "Run with TUI": {
      "commandName": "Executable",
      "executablePath": ".\\tap.exe",
      "commandLineArgs": "tui"
    }
  }
}

```

Now with the DebugPlugin configuration selected and my plugin set as the startup project, I can use F5 to launch a debugging session using TUI that will hit breakpoints properly.

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [April 12, 2023, 2:20pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/19 "2023-04-12T14:20:26Z")

</div>

Hi @Jim_B,

You can do that too. You risk issues on other platforms (e.g Linux) if you build against “.NET Framework”, but if that is not a big concern for you, then I think your solution is fine.

Otherwise, if you want cross platform projects that are also debuggable (in VS), then I suggest to add a separate ‘debug’ project which is built against .net framework. Also if you want to build on Linux (more stableand cheaper)

---

<div class="post-metadata">

**Author:** ![benstreek](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@benstreek](https://forum.opentap.io/u/benstreek)\
**Post date:** [January 17, 2024, 8:53am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/20 "2024-01-17T08:53:49Z")

</div>

I’ve just hit this issue with a project that has been debugging as expected for some time. Suddenly I’m getting a warning that the breakpoint won’t be hit because the symbols aren’t loaded.

The only thing I think has changed on my system is I installed the .net 8 sdk earlier this month. Could this have messed something up?

Project file looks like this.

```xml
  <PropertyGroup>
    <TargetFramework>net48</TargetFramework>
    <LangVersion>9.0</LangVersion>
    <Configurations>Debug;Release;Remote_FTest</Configurations>
  </PropertyGroup>
  
  <PropertyGroup Condition="'$(Configuration)'=='Debug' Or '$(Configuration)'=='Remote_FTest'">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>full</DebugType>
  </PropertyGroup>

```

---

<div class="post-metadata">

**Author:** ![rolf\_madsen](https://avatars.discourse-cdn.com/v4/letter/r/43a26b/32.png) [@rolf\_madsen](https://forum.opentap.io/u/rolf_madsen)\
**Post date:** [January 17, 2024, 10:05pm UTC](https://forum.opentap.io/t/debugging-example-plugins/892/21 "2024-01-17T22:05:13Z")

</div>

Hi @benstreek,

Did you check if your are debugging a release build?

Otherwise, maybe you have a duplicate DLL in your output folder. For example if you build A.dll, but there is also a file called A.dll in a subfolder, that can be confusing to the debugger too.

---

<div class="post-metadata">

**Author:** ![benstreek](https://avatars.discourse-cdn.com/v4/letter/b/bcef8e/32.png) [@benstreek](https://forum.opentap.io/u/benstreek)\
**Post date:** [January 23, 2024, 10:42am UTC](https://forum.opentap.io/t/debugging-example-plugins/892/22 "2024-01-23T10:42:39Z")

</div>

Hi @rolf_madsen,  
Thanks for the suggestions - thankfully it just fixed itself the next day. No idea what happened.
