tags:

views:

147

answers:

1

I've been using AppDomain.CurrentDomain.ApplicationIdentity.FullName to get the name of the executing application from a DLL that is called by the app but have just discovered that AppDomain.CurrentDomain.ApplicationIdentity can be null resulting in a null reference exception.

Couple of questions:

Is there a more reliable way to get the name of the executing application from a called DLL?

Under what use cases would AppDomain.CurrentDomain.ApplicationIdentity be null?

Thanks.

+1  A: 

You might try System.Reflection.Assembly.GetEntryAssembly().GetName().Name

Merritt