I have Xamarin Forms application for Android, having my dll as reference. Let's call it A.dll (.net standard 2.0).
I have 2nd dll in user folder (Environment.GetFolderPath(Environment.SpecialFolder.Personal)
). Let's call it B.dll (.net standard 2.0 as well)
Fuction in A.dll tries to load class from B.dll using reflection:
var privatePath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
var asmPath = Path.Combine(privatePath, "B.dll");
if (File.Exists(asmPath))
{
var asm = Assembly.LoadFrom(asmPath);
foreach (var t in asm.GetTypes()) { }
}
It throws exception in GetTypes()
method:
Could not load file or assembly 'netstandard, Version=2.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies.
Weird thing is, that it works in Debug build during debugging (in emulator), but not when trying Release build (in emulator as well).
The question is, whether such a load of dll is even possible? Why it cannot load 'netstandard' assembly when A.dll is already loaded and it's same version of .net standard? Why it works during debugging, but not release?
Aucun commentaire:
Enregistrer un commentaire