How do I get the calling application from a called dll file if GetEntryAssembly returns null?

I

Ishai Sagi

Hello folks,
I wrote myself a logging infrastructure that logs events to an xml
file. nice and simple.

I want to add to the xml file the details of the assembly that called
the logger. if the called is a windows application (exe) I could just
used "system.Reflection.Assembly.GetEntryAssembly" and logged the name.

however, some of the applications using the logger dll are VSTO2005
customizations, with custom windows controls that throw the errors. so
basically its:

word customization>custom control>log handler

I want to know which word customization called me, and GetEntryAssembly
returns null...

so, short of passing the assembly information down the track to the
dll, is ther any way I can from the dll know who called me???
 
T

Thaddaeus Parker

Try
System.Reflection.Assembly.GetCallingAssembly()

System.Reflection.Assembly.GetExecutingAssembly()

These will probably work in your case, especially if your dll is an add-in.



Regards,

Thaddaeus.
 
I

Ishai Sagi

sadly, no..didnt get the upper level dll.


Thaddaeus said:
Try
System.Reflection.Assembly.GetCallingAssembly()

System.Reflection.Assembly.GetExecutingAssembly()

These will probably work in your case, especially if your dll is an add-in.



Regards,

Thaddaeus.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top