Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Initiating Assembly

i have a webclient/windows client (say web1.dll/win1.exe) that calls a method A in DLL1. method A of DLL1 calls method B of DLL2. Inside method B is there anyway of getting the client assembly name(here web1.dll/win1.exe) that initiated the call...please help......i am not getting a clue for this
 

SS
Wednesday, February 09, 2005

Look into System.Reflection.StackFrame to "walk the stack"

Duncan Smart
Wednesday, February 09, 2005

I used stack frame...here is the code....but not getting the assembly name.....Any clue....
StackTrace t = new StackTrace();
                    StackFrame frame = t.GetFrame(t.FrameCount-1);

                    MethodBase currentMethod = frame.GetMethod();

                    Type typeInst = currentMethod.ReflectedType;
                    string name = typeInst.Assembly.ToString();

SS
Thursday, February 10, 2005

So what does typeInst.Assembly.ToString() return?

Duncan Smart
Thursday, February 10, 2005

Also, the code will need to be compiled with Debugging information for the stack walk to work as expected AFAIK.

Duncan Smart
Thursday, February 10, 2005

It gives the assembly name in case of win client but in web client ,it gives the assembly name as System.Web

SS
Thursday, February 10, 2005

*  Recent Topics

*  Fog Creek Home