Can't get Assembly.GetCallingAssembly() to reflect the proper assembly

B

Brad Wood

I have an executable that references a separate .dll assembly. Inside the
..dll I call GetCallingAssembly and I always get a reference to the .exe.

Documentation for GetCallingAssembly says, "Returns the Assembly of the
method that invoked the currently executing method." Obviously that wasn't
the case. Reading further, I see that the copiler may be inlinining my
method and that I should decorate the method I'm calling GetCallingAssembly
from with MethodImpl(MethodImplOptions.NoInlining). No joy.

Is there anything else I can try? I couldn't find anyone else who
experienced this...
 
S

Steve B.

Use GetExecutingAssembly if you wantto return the dll... the exe is the
calling assembly, not the executing...
 

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