Have a question about static classes/variables and DLL versions.
If I have a static variable in a DLL (Version 1) and I load it into the GAC, then create a newer version of the DLL (Version 2) and load it into the GAC, when either version is called will it refer to the same variable in memory?
Example:
- Client 1 sets a static variable
IsAuthenticated = Truein Version 1 of the DLL. - Client 2 gets the value of the same static variable (
IsAuthenticated) however its referencing Version 2 of the DLL.
The namespaces are the same.
Will/Should IsAuthenticated be True when Client 2 calls it?
No, each (version of a) DLL has its own copy of all static variables even if both DLLs are loaded into the same process. Sharing memory across processes like that (that’s my interpretation of the question) would be not only a technical nightmare but also a very bad idea.