ThreadAbortException and Unmanaged Code

As you are probably aware Thread.Abort() raises a ThreadAbortException in the thread on which it is invoked, to begin the process of terminating the thread. Please note that if Abort is called on a managed thread while it is executing unmanaged code, a ThreadAbortException is not thrown until the thread returns to managed code. That…

1

Unearthing LINQ’s hidden gems – part 1

I was writing a little application using Visual Studio 2008 today and came across a few nifty but lesser known features of LINQ and though to share those with you: How to filter queries based on the position of elements in data source System.Linq.Enumerable class provides extension methods that enable query expressions in LINQ. For…

1

More on self-replicating tasks

Some more stuff to remember when dealing with self-replicating tasks. (See my earlier post for an introduction to Parallel FX and self-replicating tasks): –          Self-replicating tasks should have an inter-replica communication mechanism for communicating the progress/details of the activity. This depends on what the activity is trying to achieve. See here for an example. –         …

1

SQL Server 2005 Compact Edition is now available

SQL Server 2005 Compact edition runs as an in-process application, with a very small footprint  (less than 2 MB disk footprint) offering you a good subset of the T-SQL features, and replication features of a full blown SQL install. DB Size is capped at 4GB, should you want to be able to deal with that…

1

Digging deeper into PLINQ’s internal implementation

PLINQ is built on top of the Task Parallel Library (TPL) and promises to revolutionise the way we write programs that can benefit from the multi-core processor era. But how does it work internally? This article assumes that you are familiar with the basics of LINQ and have an understanding PLINQ and TPL. In this…

1

Microsoft adds natural language search over data to Office 365

We are excited to announce a preview of Q&A, a natural language based experience for interacting with data as part of the Power BI for Office 365 offering. Q&A builds upon Microsoft’s first in class Business Intelligence platform and allows the use of natural language to discover, understand, and report over your own datasets. In…


How to maintain state in a data-driven unit test

Imagine you need to maintain a list of processed data rows in a running data-driven unit test. Well, you can use the code below as a starting point: [DataSource(   “System.Data.SqlClient”, “Data Source=.;Initial      Catalog=FeatureDemo;Integrated Security=True”,   “Person”,   DataAccessMethod.Sequential),   TestMethod(),]public void Test(){   if (!TestContext.Properties.Contains(“Session”))   {      TestContext.Properties[“Session”] = Guid.NewGuid();   }   Guid session = (Guid)TestContext.Properties[“Session”];   // Now add your unit test code here   // …} TestContext is the way to go in…


Building a LINQ Provider

Throughout this article, I will build a simple IQueryable provider similar to the LINQ to SQL provider demonstrating what is needed to build a custom provider that is capable of executing LINQ queries and performing create, update and delete operations. Read the rest on MSDN at http://msdn.microsoft.com/en-us/vcsharp/ee672195.aspx Pedram  


Non-CLS Exceptions

Many developers are not aware that according to CLR it is perfectly OK to throw exceptions which are NOT derived from System.Exception: Exceptions such as DateTime, Int64 and String. Although languages such as C# do not allows programmers to throw these types of exceptions it should still be possible to catch non-CLS compliant exceptions using…


Use of string.Format for the purpose of tracing

Application tracing is usually turned off on production releases. Therefore it is recommended not to use string formatting methods if their output is being ignored. string.Format is usually an expensive method and should be avoided if its output is not consumed: Log.Write(string.Format(“User {0} tried to log on at {1}”, userName, logonTime)); Many tracing and logging…