jeudi 22 juin 2017

Howto get an assembly containing interface without Assembly.GetCallingAssembly()

I have a C# WinForms application and two assemblies involved - first contains an interface, second contains class which implements that inteface.

Application loads second assembly (via MS Enterprise Library Unity - i. e. via Reflection) and calls class methods.

I need to log that fact and before I was using the following code

var ApplicationInfo = Assembly.GetEntryAssembly().ToString();
var InterfaceInfo = Assembly.GetCallingAssembly().ToString();
var ImplementationInfo = Assembly.GetExecutingAssembly().ToString();

It was working correctly some time ago (it obtained application, first assembly and second assembly respectively).

But now for some reason GetCallingAssembly() and GetExecutingAssembly() both return second assembly (containing class inplementation).

Is there way to get an assembly containing interface without Assembly.GetCallingAssembly()?

Any idea why GetCallingAssembly() started to be equal GetExecutingAssembly()?





Aucun commentaire:

Enregistrer un commentaire