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

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.

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.

<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.)

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.
2 Likes

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!

1 Like

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"

2 Likes

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!

2 Likes