Exception source: Method 'get_Icon'

Hi, I encountered an error in the log of the Smart Client application, and as a result, the plugin from the following repository does not load: https://github.com/milestonesys/mipsdk-samples-plugin/tree/main/Property.

If I create a new project with Visual Studio 2019, I get the same error.

************** Inner Exception **************

Exception source: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

Exception type: System.TypeLoadException

Exception message: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

Exception target site: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

************** Outer Exception **************

Exception source: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

Exception type: System.Exception

Exception message: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

Exception target site: Method ‘get_Icon’ in type ‘Property.Client.PropertyViewItemPlugin’ from assembly ‘Property, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null’ does not have an implementation.

For my investigation could you please tell me: What version is the Smart Client where you try to run the plugin?

I guess you have the newest sample, correct me if that is not so.

The Smart Client version is 2023 RS Build 61

In the Git repository, there is only one main branch (XProtect 2024 R1 version) for the mipsdk-samples-plugin, and I found the templates here:

https://marketplace.visualstudio.com/items?itemName=milestonesys.mipsdk-templates

Are the plugin structures of versions XProtect 2024 and XProtect 2023 different? If they are, how can use a plugin that is compatible with all versions?

Yes.

The sample from 2024R1 will give the error you see in any Smart Client older than 2024R1.

If you look at the 24.1 code:

internal static VideoOSIconSourceBase TreeNodeImage => _treeNodeImage;

If you look at the 23.3 code:

   internal static Image TreeNodeImage

   {

       get { return \_treeNodeImage; }

   }

So the type of icons has been changed!

Smart Client 2024R1 has some code that it will accept both the new and the old type.

Smart Client 2023R3 has no knowledge of the new type and will fail to load it.

Over time Milestone wants to remove the support for the old type, but for now the workaround to be able to support new and old Smart Clients is to use the old type.

It is possible to download the older version of the sample from Github..

https://github.com/milestonesys/mipsdk-samples-plugin/tree/b964a0c9a508f297ad80a4119b167c9424ff0cff

You ask about the template, the template uses the new type. You cannot get an old template. But you can change the code to use the old type.

I think I want to create a knowledge base article to explain this issue, thank you for your observations and this question to the Milestone Developer Forum..

I hope my answer was useful, perhaps especially finding the older sample. I don’t think the answer was totally correct, so let me explain…

The error you see is actually caused by the code

public override VideoOSIconSourceBase IconSource { get => PropertyDefinition.TreeNodeImage; protected set => base.IconSource = value; }

Looking at the older 2023R3 sample it looks like this

public override System.Drawing.Image Icon
{
	get { return PropertyDefinition.TreeNodeImage; }
}

So the issue is the introduction of the ‘VideoOSIconSourceBase’ type.

The property ‘IconSource’ replacing the property ‘Icon’, and thereby ‘VideoOSIconSourceBase’ type replacing ‘System.Drawing.Image’.

Smart Client 2024R1 has some code that it will accept both the new and the old type.

Smart Client 2023R3 (and older versions) has no knowledge of the new type and will fail to load it.

Over time Milestone wants to remove the support for the old type, but for now the workaround to be able to support new and old Smart Clients is to use the old type.

To make it clear how to find older sample code..

This is the mipsdk-samples-plugin repository:

If you then click on “release-milestone”, here marked in yellow..

Now you see the previous versions and you can pick an older one.

If I pick 2023R3 it looks like this..

If I now click “Browse files”, I am back to the overview where I can clone or download..

I just tested Old version. It`s okay thanks.

I’m using this line to write log:

EnvironmentManager.Instance.Log(false, “SocketClient”, “Initializing SocketClient.”, null);

But I didn`t find any lines of my log in path: \XProtect Event Server\logs\MIPLogs

If you have this in the PropertyBackgroundPlugin, and your plugin is loaded by the Event Server, then it should write the log in the place that you mention.

The Property sample already makes one log message from the Init method, do you see that one?

I suggest you debug. Here is help in the form of a guide / knowledge base article..

https://developer.milestonesys.com/s/article/debugging-techniques-for-Event-Server-plugins

PS. If there is more pertaining to this but not directly related to the question that opened this thread please ask a new question here in the forum. It will help us keeping the forum useful and easier to search.

Issue with Backward Compatibility of XProtect 2024 Plugin on Older Versions

Hi,

I’m facing an issue with plugin development. I created a plugin using 2024 R1 XProtect and the latest 2024 version of the MIP SDK templates.

The plugin runs successfully on the XProtect Smart Client 2024 versions. However, when I try to run it on an earlier version, I encounter multiple assembly errors. This happens because the types introduced in the 2024 SDK do not exist in the 2023 version.

This means my plugin cannot run on earlier versions of the Smart Client.

Here are some of the errors I’m getting:

  • Could not load type ‘VideoOS.Platform.Client.ClientActionGroup’ from assembly ‘VideoOS.Platform’
  • Could not load type ‘VideoOS.Platform.Client.ClientAction’ from assembly ‘VideoOS.Platform’
  • Could not load type ‘VideoOS.Platform.Client.ClientAction’ from assembly ‘VideoOS.Platform’

I would really appreciate some help with this issue.