Released: Code Contracts VS2012 Editor Extensions

Sunday, March 24, 2013

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...
no comments

WF 4.5 and Code Contracts: Slide Decks and Code

Thursday, March 21, 2013

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!...
no comments

Upcoming Event: Code Contracts Lecture

Monday, March 11, 2013

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...
no comments

Upcoming Event: WF 4.5 Lecture

Tuesday, March 5, 2013

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...
tags: , ,
no comments

Accessing the AggregateException with await

Monday, December 31, 2012

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...
no comments

Task.Wait() vs. await

Sunday, December 23, 2012

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) { if (s...
no comments

VS2012 WF Designer Issues with High DPI Settings

Wednesday, December 12, 2012

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...
no comments

Assembly Binding Redirect Not Working

Wednesday, November 28, 2012

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> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="myAssembly" publicKeyToken="1234abcd1234abcd" ...
tags: ,
no comments

The async Keyword and Thrown Exceptions

Monday, November 12, 2012

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"); ProcessCore(s); } private void ProcessCore(string s) { for (int len = 1; len <= s.Length; len++) { ...
no comments

BUILD 2012 – Day 4

Tuesday, November 6, 2012

The BUILD party has passed, and the final day of BUILD has unfortunately arrived. This day had some interesting sessions which I’ll summarize in this post. Remember – all BUILD sessions are available for free on MSDN Channel 9. BUILD Session – Deep Dive Into the Kernel of .NET on Windows Phone 8 Unfortunately, the session with this promising name ended up not providing the deep-dive that some of us expected, but I did pick up an interesting pointer. As it turns out, when you deploy a .NET application to Windows Phone 8, the application does...
no comments