Category: .NET

Using #region to improve readability of your Code in VS

#region is an interesting instruction that tells Visual Studio how to wrap the code into 'meaningful' chunks. In larger classes, especially, those with several interfaces it is particularly helpful.

Pretty handy if you ask me. The downside is, and I have seen this already a couple of times, is that some engineers use them

Continue Reading

Returning Http Error as Response in WCF

This is arguably one of the more irritating things in WCF, but as it turns out for good reason. WCF is meant to expose services 'universally' of their endpoint i.e. it shouldn't matter how you connect to the server, the service is independent of the underlying protocol. Therefore, returning HTTP errors from WCF service, well,

Continue Reading

Automated WCF RESTful System Testing with VS

Lately, we've been playing around a lot with WCF. Unit testing WCF services is not exactly challenging (well done Microsoft), but it seems that with unit tests it is quite difficult to test certain behaviour, for example, authentication or authorization. There are other means of developing automated tested system tests, but they are not that

Continue Reading

Remember to close files: the process cannot access the file '' because it is being used by another process

I was building a simple web system which relied on XML files. On initiation, the system would open the XML config file, read it and include other XML files defined in it:

The operation was done within a WebForm and it worked just fine. I also had a WCF service whose job was to

Continue Reading