title: SQL Server CLR static variables set back to null
body: <p>I have a CLR DLL (source code written in C#) that gets loaded into SQL Server. The initialization process is expensive so it is something I usually only want to do once. However, there are times that it could be necessary to initialize again and I don't want to have to restart SQL Server to do that. As such, I have <strong>not</strong> marked these static variables as read-only. My problem is that my static variables are getting reset to null in a seemingly random manner. I am pretty confident that I don't have any threading issues and none of my code sets those values to null anyway. By analyzing my log files I can only guess that SQL Server is somehow resetting the values to null (perhaps reloading the DLL at times?). Does SQL Server do this? If so, is there a way to configure it not to?</p>