You have to program as if everything breaks, nothing works, the cyberworld is not perfect, the attached hardware is flakey, the network is slow and unreliable, the harddrive is about to fail, every method will return an error and every user will do their best to break your software. Confirm everything. Range check every value. Make no assumptions or presumptions.
Why you cant go any further outside the Dotnet, if you develop in Doptnet
https://blog.expensify.com/2011/03/25/ceo-friday-why-we-dont-hire-net-programmers/
The Six Dumbest Ideas in Computer Security
http://www.ranum.com/security/computer_security/editorials/dumb/
Source: https://msdn.microsoft.com