All my assemblies are dlls and no exes. There are two product P1.dll and P2.dll. A number of assemblies are having common functionalities and thus referred by both P1 and P2. Let me name them as Utility.dll, License.dll, Configuration.dll.
All the assemblies P1, P2, License and Configuration and any other dll refers Utility dll as it has methods to log, other helper functions etc.
The Utility dll has a static Log class which is static with methods like Exception(ex), Trace(String) etc.
The Utility dll also has a static App class with AppVersion, RootAssembly, AppTitle etc which is called during Log, or during any messaging from any dll etc. And the class has an Initialize method where these properties are set from P1 and P2.
Now the problem is once the Initialize is called by P1, and later used gets correct values, valid for P1. If at this time P2 calls Initialize on App and then if this properties are used by P1, the values are relevant to P2 and not P1, the reason being the App class is static.
But it is hard at this stage to change everywhere like in catch block I just call Log.Exception(ex) to pass App too by making it an instance class.
And since the Log.Exception is also a utility dll method, anything can be done to ensure 2 copies of App class exist or 2 memory space for the Utility dll itself?
Thanks in advance
What I have tried:
Read about AppDomain, but not clear how to apply for my scenario