onDeserialized method TypeLoadException using .Net Standard 2.0 libraries
What would you like to submit? (put an 'x' inside the bracket that applies)
- [ ] question
- [x ] bug report
- [ ] feature request
Issue description
When using the .Net Standard 2.0 libraries of Accord.MachineLearning as references of a Visual Studio 2017 v15.3 unit test, the execution failed with the following message: System.TypeLoadException: Type 'Accord.MachineLearning.OneVsOne`2' in assembly 'Accord.MachineLearning, Version=3.6.4.0, Culture=neutral, PublicKeyToken=null' has method 'onDeserialized' with an incorrect signature for the serialization attribute that it is decorated with.
To make it work, I have to remove the [onDeserialized] flag in several source files of the MachineLearning and Math components, but this is a quite bad solution.
The methods I use:
MulticlassSupportVectorMachine
MulticlassSupportVectorLearning
Thanks for your help.
Hi @oaimac,
Thanks a lot for reporting the issue. Travis-CI has not been configured to build and test the .Net Standard projects yet, so I was not aware of this problem.
I remember being able to run the suite of unit tests manually though, so this might have been introduced recently. I will investigate.
Regards, Cesar
Hi @oaimac,
I am sorry, I could not reproduce the issue at all using the .NET Standard 2.0 version of Accord.NET v3.7.0 from a .NET Core 2.0 application (installed through NuGet to a brand new .NET Core Console App in VS2017).
I've seen that the error you are getting specifically mentions Accord.NET 3.6.4.0. Please, may I ask if you could upgrade to 3.7.0 to see if the error persists?
Regards, Cesar
Hi, I am using a Visual Studio 2017 15.3 Unit Test, that use the Framework .Net 4.6.1. I am also using the 3.7.0 version of Accord through Nuget. I don't know why it gets version 3.6.4.0 instead of 3.7.0. I also have the same execution failing message I reported when compiling myself the Accord librairies.
Probably you could reproduce the issue using the Standard 2.0 Accord librariries with a .net Framework 4.6.1 application ?
Regards,
Hi @oaimac,
I still haven't been able to reproduce the issue. I've tried creating new .NET Standard 2.0, .NET Framework 4.6.1 and .NET Framework 4.6.2 console applications, installing Accord.MachineLearning through NuGet, and in all cases I had the version 3.7.0 of those assemblies (instead of the 3.6.4.0 you are currently getting). I believe this is an indicator that something went wrong during the last time you updated the packages through NuGet.
As such, have you tried to clean your solution? If plain cleaning doesn't help, try to delete manually the /bin and /obj folders from all your projects so that they can be re-created in the next compilation. Finally, try removing the Accord.NET packages and re-adding them again. Hopefully one of those will end up solving the issue.
Hope it helps, Cesar
I suspect this is a duplicate of https://github.com/dotnet/standard/issues/300
Hi @penderi,
It seems very likely that this is the reason, thank you very much for giving us this update. However, the framework does in fact offer binaries that have been built targeting the full .NET Framework instead of netstandard. @oaimac, could it be that somehow your unit test project is running in the .NET Framework but using Accord.NET's packages for netstandard2.0 rather than net462?
In this case I guess the solution would be to either change the unit tests projects to run as coreapp2.0, or make the unit test projects use the framework packages for net462 instead of netstandard2.0.
Hope it helps, Cesar