0

My .Net application is referring some nuget packages. When I try to use the .Net DLL in java/scala using JavoNet. Please let me know how to get resolve this error. Thanks

I am getting below " Message: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information. Stack Trace: at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module) at System.Reflection.Assembly.GetTypes() at SicsClrController.Engine.ClrEngine.FindTypeInAssembly(Assembly assembly, String className, List`1 genericTypes). Loader Exceptions: ------------------------- Loader Exception #0

Message: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. Full print: System.IO.FileNotFoundException: Could not load file or assembly 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. File name: 'System.Memory, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'"

1 Answers1

0

Library you have issues with is System.Memory which is a framework library.

Therefore there could be number of reasons:

  1. make sure it works in .NET itself sometimes Nuget packages are referencing concrete versions of framework libraries which might be in conflict with other nuget package resulting in similar issue even without Javonet
  2. if it works in pure .NET then it might be problem that some libraries load System.Memory dynamically and in such case Javonet sometimes might have problem to identify the right version. The solution is to use small helper that injects to event AssemblyLoad in .NET and provides full path to concrete System.Memory implementation based library name.

You can use for it helper from Javonet: http://download.javonet.com/support/AssemblyResolverLibV2.zip

Javonet.addReference("AssemblyResolverLib.dll");

//Register custom sections DLLs (if you have more than one call this line for each DLL)
Javonet.New("AssemblyResolver","log4net","c:\\samplepath\\log4net.dll");