# Custom plugin wont load - 'Could not load file or assembly 'System.ObjectModel' or one of its dependencies

**URL:** https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805
**Category:** Technical
**Tags:** plugin
**Created:** [August 17, 2022, 12:23am UTC](https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805 "2022-08-17T00:23:30Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![iansmith](https://avatars.discourse-cdn.com/v4/letter/i/ac8455/32.png) [@iansmith](https://forum.opentap.io/u/iansmith)
#### Post date: [August 17, 2022, 12:23am UTC](https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805/1 "2022-08-17T00:23:31Z")

</div>

Full disclosure… This is my first OpenTAP plugin so I could be making a few rookie mistakes here, but Im having trouble getting my DUT plugin to load. I was able to get a mostly blank DUT template plugin to work, but now I’m trying to include some Windows specific API and compiling against “net6.0-windows10.0.18362”. This is where things seemed to break.

Here is the error logs im getting from the editor when I try to load my plugin.

```csharp
16:47:20.631 PluginManager Unable to load type 'FirstProject.xxxxx' from 'c:\Program Files\OpenTAP\Packages\FirstProject\FirstProject.dll'. Reason: 'Could not load file or assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.'.
16:47:20.631 PluginManager FileNotFoundException: Could not load file or assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
16:47:20.631 PluginManager at System.Reflection.RuntimeAssembly.GetType(RuntimeAssembly assembly, String name, Boolean throwOnError, Boolean ignoreCase, ObjectHandleOnStack type)
16:47:20.631 PluginManager at System.Reflection.RuntimeAssembly.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
16:47:20.631 PluginManager at OpenTap.TypeData.Load()
16:47:20.641 PluginManager Exception caught at:
16:47:20.641 PluginManager at System.Type GetInnerType(OpenTap.ITypeData)
16:47:20.641 PluginManager at Void set_Type(OpenTap.ITypeData)
16:47:20.641 PluginManager at StepTree a(System.Collections.Generic.IEnumerable`1[OpenTap.ITypeData])
16:47:20.641 PluginManager at Void .ctor(System.Type)

```

Im building a plugin that uses windows APIs and compiles with the following csproj.

```csharp
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="Current">
  <PropertyGroup>
    <TargetFrameworkIdentifier></TargetFrameworkIdentifier>
    <TargetFrameworkVersion></TargetFrameworkVersion>
    <TargetFramework> **net6.0-windows10.0.18362** </TargetFramework>
  </PropertyGroup>

  <PropertyGroup>
    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>
  </PropertyGroup>

  <PropertyGroup>
    <OpenTapPackageDefinitionPath>package.xml</OpenTapPackageDefinitionPath>
    <CreateOpenTapPackage>false</CreateOpenTapPackage>
  </PropertyGroup>

  <PropertyGroup Condition="'$(Configuration)' == 'Release'">
    <CreateOpenTapPackage>true</CreateOpenTapPackage>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="<Custom nuget with windows API calls>" Version="xxx" />
    <PackageReference Include="OpenTAP" Version="$(OpenTapVersion)" />
  </ItemGroup>
</Project>

```

When I build my project and check the project.assets.json file i don’t find the “System.ObjectModel” referenced anywhere. I think it isn’t referenced in my code or dependent nuget packages… unless it gets it automatically included because im targeting a net6.0-windows version… I tried to add the 'System.ObjectModel" nuget directly but that also didn’t work. Not sure why it wasn’t picked up. It could also be due to framework version compatibilty issues.

Here is the package part of the compile output. (i xxx out our custom packages, and remoted my email alias.)

```csharp
FirstProject -> C:\Users\<my_alias>\git\OpenTapEval\bin\Release\FirstProject.dll
Multiple assemblies of different versions named Microsoft.Bcl.AsyncInterfaces exists
Multiple assemblies of different versions named System.CodeDom exists
Satisfying assembly reference to OpenTap by adding dependency on package OpenTAP
Adding dependency on package 'OpenTAP' version 9.18.4+7dec4717
'FirstProject.dll' depends on 'xxxxx' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'FirstProject.dll' depends on 'xxxxx' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'FirstProject.dll' depends on 'xxxxx' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'xxxxx' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'TraceParser' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'Tools' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'SmartThreadPool' version '2.2.6.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'Microsoft.Windows.SDK.NET' version '10.0.18362.24'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'ToolsWindowsOnly' version '0.0.0.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'System.Diagnostics.PerformanceCounter' version '6.0.0.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'SharpAvi' version '2.1.2.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'System.Management' version '4.0.0.0'. Adding dependency to package, it was not found in any other packages .
'xxxxx.dll' depends on 'WinRT.Runtime' version '1.6.0.0'. Adding dependency to package, it was not found in any other packages.
'xxxxx.dll' depends on 'SocketCommunication' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'TraceParser.dll' depends on 'ObjectDumping' version '101.0.1.0'. Adding dependency to package, it was not found in any other packages.
'ToolsWindowsOnly.dll' depends on 'Emgu.CV.Platform.NetStandard' version '4.5.4.4788'. Adding dependency to package, it was not found in any oth er packages.
'ToolsWindowsOnly.dll' depends on 'System.Drawing.Common' version '6.0.0.0'. Adding dependency to package, it was not found in any other packages.
'ToolsWindowsOnly.dll' depends on 'System.ServiceProcess.ServiceController' version '6.0.0.0'. Adding dependency to package, it was not found in any other packages.
'ToolsWindowsOnly.dll' depends on 'Emgu.CV.Bitmap' version '4.5.4.4788'. Adding dependency to package, it was not found in any other packages.
'System.Management.dll' depends on 'System.CodeDom' version '6.0.0.0'. Adding dependency to package, it was not found in any other packages.
'System.ServiceProcess.ServiceController.dll' depends on 'System.Diagnostics.EventLog' version '6.0.0.0'. Adding dependency to package, it was not found in any other packages.
Updated assembly version info using Mono method. [353 ms]
Package action IncludePackageDependencies completed [2.85 ms]
Package action FileHashPackageAction completed [108 ms]
Creating OpenTAP package.
Compressing [================] (54.12% | 13.12 MB of 24.24 MB)
Compressing [==============================] (100.00% | 24.24 MB of 24.24 MB)
OpenTAP plugin package 'FirstProject.0.2.0-alpha.TapPackage' containing 'FirstProject' successfully created.
Installed 'FirstProject' (C:\Users\<my_alias>\git\OpenTapEval\bin\Release\Packages\FirstProject\package.xml)
FirstProject.Tests -> C:\Users\<my_alias>\git\OpenTapEval\bin\Release\FirstProject.Tests.dll
Build succeeded.

```

---

<div class="post-metadata">

### Author: ![jeff.dralla](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/jeff.dralla/32/220_2.png) [@jeff.dralla](https://forum.opentap.io/u/jeff.dralla)
#### Post date: [August 17, 2022, 5:34am UTC](https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805/2 "2022-08-17T05:34:36Z")

</div>

Welcome to the OpenTAP forum @iansmith!

Not sure why but your thread got flagged as potential spam, cleared it and someone should respond back to you shortly!

Really great to have you in the community!

---

<div class="post-metadata">

### Author: ![kaushik.santhanam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.opentap.io/kaushik.santhanam/32/208_2.png) [@kaushik.santhanam](https://forum.opentap.io/u/kaushik.santhanam)
#### Post date: [August 17, 2022, 11:33pm UTC](https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805/3 "2022-08-17T23:33:21Z")

</div>

Hi @iansmith

I tried creating a plugin from a template and targeted `.net6.0 ` and was able to get it load and work without any issue.

I think your `"xxx.dll"` might be indirectly requiring `System.ObjectModel` as a dependency. Can you check by adding the `DLL` directly to your bin folder. If so, then you would have to get the right version of `System.ObjectModel.dll` that is required for `.net6.0` and your other `"xxx.dll"`

---

<div class="post-metadata">

### Author: ![iansmith](https://avatars.discourse-cdn.com/v4/letter/i/ac8455/32.png) [@iansmith](https://forum.opentap.io/u/iansmith)
#### Post date: [August 18, 2022, 7:44pm UTC](https://forum.opentap.io/t/custom-plugin-wont-load-could-not-load-file-or-assembly-system-objectmodel-or-one-of-its-dependencies/805/4 "2022-08-18T19:44:32Z")

</div>

Hi @kaushik.santhanam,  
You were right, it was simply a missing single DLL. Not sure why this is, but will have to investigate this more.

I can confirm that this fixed my issue…  
copy c:\Users\<alias\>.nuget\packages\system.objectmodel\4.3.0\ref\netstandard1.3\System.ObjectModel.dll “c:\Program Files\OpenTAP”.

I’ll have to figure out a cleaner way to fold this into my custom plugin. Somehow force it to include this dll.

Thanks for the help!
