Code Contracts is an experimental project from Microsoft Research which provides a language-agnostic way to express coding assumptions in .NET programs, thus allowing for improved testability, static verification at compile time and automatic API documentation. If you participated in my session about Code Contracts last week, then you already know that. At my session, I said that Microsoft has not yet released the Code Contracts Editor Extensions for VS2012. Well that, my friends, has changed… Microsoft has just released the Code Contracts Editor Extensions for VS2012! This extension allows you display Code Contracts in code, Intellisense and...
I’d like to thank all those who attended yesterday’s sessions at the Israeli .NET Developer User Group. I had a good time delivering the sessions, and I hope you enjoyed them as well. What’s New in Windows Workflow Foundation (WF) 4.5? Sample code for the session can be found here. Enhance Your Code Quality with Code Contracts Sample code for the session can be found here. If you attended the session and have an open question, feel free to ask. See you next time!...
If you ever used a 3rd party API, you surely know the importance of proper documentation - Can this method return "null"? Do I have to check this return value? What are the valid values of this argument? You also probably know that the only way to discover if your assumptions are correct is to execute the code and pray that exceptions won't be flying around. There must be a better way! Enter "Code Contracts". Code Contracts is an experimental project from Microsoft Research which provides a language-agnostic way to express coding assumptions in .NET programs, thus allowing...
Windows Workflow Foundation (WF) is Microsoft's .NET implementation of a Workflow authoring and hosting environment. With WF 4.5 developers can easily author workflows using the Visual-Studio built-in WF designer, host them in multiple application environments using the provided runtime engine and even expose them as services for the outside world to consume. Oh, and it's totally free… On Wednesday, March 20th 2013, I’ll give a presentation on WF 4.5 at the Israeli .NET User Group (Microsoft Israel, Ra’anana). In this session we'll focus on the cool new features which version 4.5 brings to the table with demonstrations including...
The await keyword is a new keyword in C# 5.0 which, in tandem with async keyword, allows us to easily author methods which execute asynchronously in regards to the calling code. In previous posts I’ve shown certain issues you should look out for when using these keyword. In this post we’ll look at another issue with the await keyword – how to access the AggregateException. await Only Throws One Exception As we saw in a previous post, await (unlike Task.Wait()) does not wrap a thrown exception in an AggregateException and instead just re-throws the exception thrown within...
The await keyword is a new keyword in C# 5.0 which, in tandem with async keyword, allows us to easily author methods which execute asynchronously in regards to the calling code. In a previous post I’ve shown a certain issue you should look out for when using the async keyword. In this post we’ll check a similar issue with the await keyword. The await Trap Let’s remember our test code from the previous post: class AsyncClass
public void Process(string s)
Windows Workflow Foundation (WF) is a core .NET technology for authoring long-running, scalable & integrated business processes. The WF designer that ships with VS2012 is the main tool of choice for declaratively creating workflows in .NET 4.5, however, unfortunately, it has an issue with high Dots-Per-Pixel (DPI) settings. Introducing the Windows DPI Settings As computer monitors arrive with an ever growing resolution on smaller and smaller screens, you might have noticed that the text and icons you’re viewing in Windows are getting small, sometimes too small to be readable properly. That’s exactly why Windows has a...
Assembly Binding Redirect is a .NET mechanism allowing developers who's application was compiled against a certain strongly-named assembly version to swap that assembly with a different version without recompiling the entire assembly. One of the methods for achieving this goal is by placing a special directive in the application’s configuration file, as described on MSDN. .NET Ignores My Assembly Binding Redirect An example of such a configuration section can be seen below: <configuration>
<assemblyIdentity name="myAssembly" publicKeyToken="1234abcd1234abcd"
Windows Phone 8 SDK was released during the BUILD conference about 3 weeks ago, and an increasing number of developers are actively developing new apps for the new platform. This post focuses on the software and hardware requirements for running the Windows Phone 8 Emulator, and specifically the requirement for hardware Second-Level Address Translation (SLAT) support. Hyper-V and SLAT Hyper-V is Microsoft’s virtualization platforms which allows creating, managing and operating virtual machines on top of a host OS. Up until Windows 8, this platform was only available on Windows Server operating systems while the client OS was...
async is a new keyword in C# 5.0 which allows us to easily author methods which execute asynchronously in regards to the calling code. The calling code can call the async method and continue its execution until it decides to join with the called method at a later stage. The async Trap Consider the following method: public void Process(string s)
if (s == null) throw new ArgumentNullException("s");
private void ProcessCore(string s)
for (int len = 1; len <= s.Length; len++)