Bug or Feature
A strange thing happened today, I was implementing a small security package for my app. The project file was called Security and it created a Security.Dll file as output. I compiled and ran and BOOM no connection to the database!!! … I am thinking how can adding a new module totally unrelated lead to DB connectivity problems…So I do the usual checks, network connectivity, name resolution, I can connect thru enterprise manager, I can connect using SQL authentication. It seems that when I try to connect using SSPI I get the exception “Cannot initialize SSPI package”….Oh Boy…I am thinking corrupt memory, hard disk what could have happened, is my .Net installation corrupt?...So as any good windows user would do..i reboot…no help…problem persists. Its been an hour and I have only allocated 30 mins…someone suggests trying an earlier build….i think..well let’s give it a try..Viola it works…Light goes on…it has to be the security module, because that is the only change….i change the name of the project output to XXXSecurity.Dll and it works. Problem solved!! What a rush…Ahhh the joys of fixing problems.
Then I start to think, if .Net chooses the Security.Dll in my folder then couldn’t someone else just put a fake Security.Dll in an application folder and override all Code Access Security!! I seriously hope this is a gap in my understanding rather than a bug in my beloved framework.