How to restart Azure Worker Role

Ok, here’s partial solution to the problem of restarting worker roles within an Azure Computing Cloud. As suggested by Daniel C. Wang, I’ve tried something that you normally never do in an application – throwing unhandled exceptions. When you launch the Development Fabric by clicking F5 (with the debugger attached) any unhandled exception is intercepted by the IDE. However, …

How to Get Parameter Name and Argument Value From C# Lambda via IL?

Or “How NOT to Use .NET Linq Expressions in Order to Get Parameter Name and Argument Value From C# Lambda?” Yesterday I’ve managed to get overhead of 3-4 seconds per 1 million operations for the methods that did allowed to pass parameter name and argument value in one C# statement: Enforce.Argument(() => args); public static void …

How to handle .NET ReaderWriter locks efficiently?

Writing code for the concurrent execution requires, among over things, proper data access synchronization (locking) to avoid any problems. One of the most useful primitives to do that is the Slim version of ReaderWriterLock that has been introduced in .NET 3.5 ReaderWriterLockSlim represents a lock that is used to manage access to a resource, allowing …

xLim 2 Engine concept or simple continuous integration for businesses

xLim 2 Engine is an extremely simple concept and continues the idea from post on “How to simplify complex maintenance tasks of your information management solution?”. So, if you have architecture like this, you can just: take multiple maintenance and automation tools of yours throw out all the repetitive code (connection, logging, security, etc) and …

How to create configurable reliability layer with Photon.NET

Note: this article is based on the Photon.NET codebase tag 0.0.28.0 (follow the project link to find additional info on acquiring the specific version) Reliability layer represents a simple concept: we want to retry some unreliable method call (the one that throws exceptions or returns unexpected results) till it succeeds or some other condition is met. In the regular …

Shortcuts for NUnit Exception Expectations

Are you tired of specifying NUnit exception expectations? [Test] [ExpectedException(typeof(InvalidOperationException))] public void Reference_Value_Is_Checked_For_Null() { // if you have R#, this should be highlighted Result.Success<object>(null); } There is a shortcut that is more compact: [Test] [Expect.ArgumentNull] public void Reference_Value_Is_Checked_For_Null() and also has nice IntelliSense: You just need to define class like this: static class Expect { …

.NET Application Block for Validation and Business Rules

A while ago I wrote about a simple .NET Validation Framework. A lot has changed since then, and more elaborate rules had to be implemented in various projects. So let me introduce you to the next version of .NET Validation and Business Rules (Micro) Application Block. You can download latest release of Lokad Shared Libraries to get started …

Organization of xLim solutions: development, svn and integration 2

In the last post in xLim 2 series I’ve talked about the overall folder organization of the xLim solutions (including documentation, version control and integration). Let’s drill down to the scope of the atomic Visual Studio solution. Caveat, Reader: although this solution structure is based on multiple articles, guidelines and delivered projects, it is tailored specifically for the xLim …

Some tips on writing event handling code in C# .NET

How often do you write repetitive code like this? public delegate void MessageEventHandler(object sender, MessageEventArgs e); [Serializable] public sealed class MessageEventArgs : EventArgs { // some class contents } // … event MessageEventHandler OnMessageArrived; private void RaiseOnMessageArrived(string message) { // BTW, what about thread-safety of this call? if (OnMessageArrived != null) { OnMessageArrived(this, new MessageEventArgs(message)); …

On AI, Neuro-Evolution and Azure

One of the topics that I’ve never covered in this blog is about developing data-mining and business analytics applications. Especially, the analytics part (which happened to have popularity with terms like Artificial Intelligence or Neural Networks) which is one of the most curious implementation fields in the area of software development. If you are unfamiliar with the subject …