I Got Rhythm

Eli Arbel (@aelij)

.NET 4 Animation AppFabric Async Axum Blog C# CLR ClearType Cloud CodeValue Concurrency Contests Deep Zoom Experiments Generics GitHub Google Ink Lectures Modeling Performance Personal Pivot Prism Programming Languages Prolog ReSharper Reflector Roslyn RoslynPad Service Fabric Silverlight Themes Threading Tips WCF WPF WPFContrib Windows 2003 Windows 7 Windows Azure Windows Forms Windows Phone Windows Vista XAML Zune

    *N Async, the next generation

    Aug 10, 2016

    In the previous installment, I discussed how to use iterators (yield return) to create async methods. This time, we’re about to do almost the opposite – use async methods to implement async iterators.

    Simple access to Roslyn`s internals

    Mar 27, 2016

    TL;DR Just grab the .snk from the Roslyn repo, name your bridge assembly to something from the InternalsVisibleTo (e.g. Roslyn.Hosting.Diagnostics), sign it with the key, and you can access all the internals at compile time, with IntelliSense!

    RoslynPad 0.1

    Feb 22, 2016

    I have been waiting for while for the Roslyn team to expose the completion and signature help services so I could use them in RoslynPad without having to compile my own version. This was expected to be included in Update 1 but got pushed back.

    Async-friendly stack traces

    Feb 19, 2016

    If you’re using async/await a lot (a given nowadays), you may have noticed stack traces are not very readable. For example, this is a 3 async method chain’s stack:

    Adding headers and instrumentation to Service Fabric default comm. stack

    Dec 11, 2015

    Update

    With Service Fabric SDK v2 this became much simpler. Check out this SO answer of mine for details.

    Windows Performance Monitor – Reimagined

    Jul 23, 2015

    Windows PerfMon is an invaluable tool, but it’s UI remained the same for years, stuck somewhere in the 1990’s. This is my attempt at “reimagining” it.

    Better stack traces with async in Silverlight

    Jul 23, 2015

    I recently found out that using the Microsoft.Bcl.Async package to support async/await in Silverlight has a major downside – it rethrows exceptions without preserving the stack trace. That’s because Silverlight lacks ExceptionDispatchInfo, a mechanism that was added in .NET 4.5 that allows rethrowing exceptions while keeping their stack traces intact.

    RoslynPad Reloaded

    Apr 1, 2015

    Updated Post

    To ConfigureAwait or not to ConfigureAwait?

    Sep 21, 2014

    When awaiting tasks in C#, you have the option to configure how the continuation behaves - whether it uses the Synchronization Context or not.

    The Misbehaving Dialog

    Apr 23, 2014

    Windows’ dialogs can be bad for your app

    Processing Raw Input in WPF

    Apr 9, 2014

    One of my clients recently needed to hook up a USB barcode reader to their app. Input from the reader needed to be redirected and handled by a special service, and ignored by the rest of the application. WPF has a property named Device in its KeyEventArgs class, but unfortunately it turns out that it uses the same instance for all input devices hooked up to the PC.

    WPF Contrib 2.0

    Mar 17, 2014

    I finally got around to releasing a new version of WPF Contrib. What's new? See inside.

    Building Windows

    Jul 9, 2013

    I’ve recently attended Microsoft’s Build conference in San Francisco, and I wanted to share some of my experiences.

    RoslynPad

    May 11, 2013

    The first experiment I'm about to present in this post is a simple code editor (similar to the acclaimed LINQPad) that uses two parts of Roslyn: the Script Engine and Completion Service.

    Best Practices for Using ConcurrentDictionary

    Feb 3, 2013

    One of the goals in concurrent programming is to reduce contention. Contention is created when two (or more) threads contend for a shared resource. The performance of synchronization mechanisms can vary considerably between contended and uncontended cases.

    The Case of the Elusive TransportManager

    Jun 28, 2012

    Hosting WCF services in AppFabric has its benefits, but it can cause a lot of pain as well. I was trying to resolve the following error which kept appearing at one of my customers:

    Drawing Something?

    May 20, 2012

    WPF enables you to develop great looking applications very fast. But sometimes with this rapid approach one can overlook an important aspect - performance. It’s very common for developers to look into UI performance last, especially in LOB applications, but performance can have a significant effect on how professional your application is perceived to be.

    E4D Expert Days – I’ll be there

    Jun 4, 2011

    Want to learn more about Windows Phone? Check out my lecture at E4D's Expert Days.

    Slides from my Windows Phone + Azure lectures

    Jun 4, 2011

    Last month I gave a series of lectures in various campuses around Israel about Windows Phone and Azure.

    WCF + Tasks

    Jun 4, 2011

    In WCF we can use the APM pattern to create an asynchronous client. For example, consider the following service contract:

    *N Async, Part 1

    Nov 12, 2010

    You’ve all read about the asynchrony promise of C# 5 (if you haven’t, I highly recommend reading Eric Lippert’s series about the subject or this post won’t make much sense). I think it’s a great step forward, and it would make asynchronous programming all a lot easier.

    Creating the CodeValue Blogs Pivot

    Nov 12, 2010

    Pivot is a Microsoft Silverlight control which can visualize collections of data, filter and sort them in a very appealing manner. To see what I mean, check out the CodeValue Blogs Pivot:

    Goodbye and hello, as always

    Aug 22, 2010

    Today I’m saying goodbye to Sela. I’ve been a senior consultant at Sela for the past 9 months, and it has been a good experience for me; I’m much more experienced with giving lectures and teaching classes. I’ve also had a chance to meet and work with some of the leading experts in their fields.

    Reflectoron: Transform and Roll Out!

    Jul 15, 2010

    A few months ago I’ve decided to write a Prism tutorial by building a WPF UI for the .NET Reflector.

    WPF Controls Class Diagram

    Jun 25, 2010

    I’ve prepared a class diagram for my students of main WPF controls, divided into Decorators, Panels, Content Controls and Items Controls. The diagram was generated using the new Visual Studio 2010 Visualization and Modeling Tools (with a bit of manual cleanup).

    Peaceful Coexistence

    Jun 25, 2010

    One of the new features in .NET 4.0 is Side-By-Side In-Process (SxS InProc) execution of older CLRs (e.g. .NET 2.0). Previously, SxS was supported only in different processes. If you look it up, you’ll find these two (yet to be updated) blog posts by the CLR team, an MSDN Magazine article as well as one in the MSDN Library. You can get a good review of supported scenarios and some code, but what they all sorely lack is a working sample. (Update: There’s a new detailed article from the CLR team.)

    MIX10

    Mar 21, 2010

    I recently attended the Microsoft MIX10 conference in Las Vegas. I had a nice time, but mostly because of the location; Las Vegas is an interesting place. The conference itself was mainly a PR for the new Windows Phone, but there were a couple of very interesting lectures I would like to share:

    My SDP Lecture: .NET Numerical Computing

    Dec 18, 2009

    Josh Reuben and I will be giving a lecture in the upcoming Sela Developer Practice about .NET Numerical Computing and Scaling Up (DSE502). It is intended to be a swift yet exhaustive review of what’s available out there for .NET developers. We will cover topics such as Cloud Computing, Infer.NET, GPGPU, Axum and StreamInsight. Should be pretty interesting.

    Local values in DependencyObjects

    Nov 4, 2009

    If you’re writing a custom control in WPF, you may have encountered a very annoying bug: if you set the value of a DependencyProperty in your implementation code, the local value will trump any changes that you may try to apply to this property using bindings, styles, etc. You can read more about this in this post in Vincent Sibal’s blog.

    Hey La, Hey La, ClearType's Back

    Nov 4, 2009

    One of the most referenced posts in this blog is the one dealing with the ClearType issues. Those of you who shared my pain will be glad to hear that Microsoft has delivered on its promise: WPF is getting a new text rendering stack in v4, which has the ability to render ClearType (and even aliased text) in every scenario. The new stack is also supposed to match the GDI text renderer, which means that small text will be much more readable.

    Presenting PresentationHost

    Feb 9, 2009

    I always prefer simpler solutions. The solution I proposed on my previous post was not that simple, and was not complete. It may still be useful for other stuff, but for the purpose of preserving ClearType while using DWM, I just have to admit it has too many issues.

    Casper to the Rescue!

    Feb 6, 2009

    WPF has ClearType issues. Hopefully some of them will be solved in the upcoming .NET 4.0. Meanwhile, however, I have concocted a nifty solution to one of the scenarios – placing stuff on the Aero Glass DWM frame.

    Normality Restored

    Jan 27, 2009

    The past 24 hours have been a blogger’s nightmare for me. I wanted to upgrade my GoDaddy’s hosting account to IIS 7. Unfortunately, they do not have any upgrade option, so you have to call their customer service, cancel your current hosting account, create a new one and build everything from scratch.

    Theme Manager: A Hackly Hack

    Dec 28, 2008

    One of the most popular posts in this blog is the one explaining how to override the system theme and get the Vista look on non-Vista systems. This is possible because WPF ships with the theme files for all operation systems (well, all Microsoft OSs that WPF works on, i.e. XP, XP Media Center and Vista) and due to the fact that WPF doesn’t really use the system resources to get the OS theme, but rather relies on a private implementation of them that resides in the PresentationFramework.{Classic, Luna, Royale, Aero} assemblies.

    New Release of WPF Contrib

    Nov 5, 2008

    I’ve released a new version of WPF Contrib (October 2008, although it’s released in November. I changed the release name a few times, so I decided to leave it like that. I’m only late by a few days…

    Activator 2: XAML and Generics Day

    Oct 27, 2008

    First of all, you didn’t miss part one. Just thought it was a funny reference.

    License Page

    Oct 26, 2008


    id: 178 title: License date: 2008-10-26T15:54:00+00:00 author: Eli Arbel layout: post redirect_from:

    • /blog/archive/2008/10/26/license-page.aspx.html guid: /blog/archive/2008/10/26/license-page.aspx permalink: /2008/10/26/license-page/ categories:
    • Uncategorized

    All code in this blog (unless noted otherwise) is released under the MIT license.

    Improper use of InteropBitmap can cause a memory leak

    Oct 22, 2008

    I’ve been using InteropBitmap in my GdiTextBlock. The control creates a new GDI+ Bitmap every measure pass, which it then converts to a WPF BitmapSource using the Imaging.CreateBitmapSourceFromHBitmap() method (this method returns an InteropBitmap).

    Shady Pixels

    Oct 19, 2008

    In my previous post I mentioned the new Zune 3.0 visualizations. I really liked them, so I decided to try and create them using WPF’s new (3.5 SP1) Effects.

    In the Zune

    Sep 17, 2008

    I’m loving the new Zune 3.0 client software. V1 was terrible. Just an ugly version of Windows Media Player. V2 was completely rewritten using a Microsoft internal platform called UIX, which is based on Media Center. Although it’s still .NET, I was slightly disappointed they didn’t use WPF.

    Good Old GDI+ (or: Unblur Thy Text)

    Aug 18, 2008

    It’s been a while since I’ve done anything with GDI+ (i.e. System.Drawing). System.Windows (i.e. WPF) is so much more powerful.

    Writing Methods and Classes in LINQPad

    Aug 18, 2008

    LINQPad is a very useful code snippet IDE. I use it all the time to test small pieces of code. It’s much more convenient than opening a new Visual Studio console application. It also formats the results very nicely.

    C# Partial Specialization With Extension Methods

    Nov 22, 2007

    One of the things C# generics lacks (compared to C++ templates) is specialization (neither explicit nor partial). This can be very useful in some cases where you want to perform something differently for a specific T in a Class<T>.

    The WPF Contrib Project

    Sep 3, 2007

    I’ve been quiet for a while. Working a lot, and also burning the midnight oil, trying to bring life into this project I call… the WPF Contrib.

    Trace (route) that call!

    May 6, 2007

    Have you ever used EventManager.RegisterClassHandler()? If so, make sure you know what you’re doing. This method allows you to listen to events passing through (as I like to put it) an element (i.e. bubbling or tunneling), regardless of the class that invoked the call. Most of the times you would call it in a static constructor, and pass it a typeof of that class, but that is only a recommendation. The documentation is a bit weak on this point.

    Dispatch It

    Feb 16, 2007

    In WPF, like most UI frameworks, UI elements can only be updated from the thread they were created on. If you do background work, and want to affect the UI from a different thread, you’ll have to dispatch it. The Dispatcher class has a CheckAccess() method (which is marked as EditorBrowsableState.Never, making it invisible to intellisense for some reason.)

    BitmapEffect Begone

    Feb 9, 2007

    You can do really neat things with Bitmap Effects in WPF. Shadow, Bevel, Outer Glow can all have a great impact on how your application looks. But you should be aware that they don’t come cheap. They are rendered in software, which yields very poor performance. Also, ClearType is turned off on elements that have them applied, so your text becomes blurry.

    Give me back my ClearType

    Feb 3, 2007

    WPF has a separate ClearType rendering system, which is better than GDI’s (mostly because it also does y-direction antialiasing; read more here and in the WPF Text Blog.)

    Monopolij: Avalon* Edition

    Nov 7, 2006

    First – great news. .NET Framework 3.0 has finally been released. Get it now!

    Revamped Style Snooper

    Nov 5, 2006

    Update: This utility has become a bit irrelevant since Reflector now has a BAML Viewer add-in. You can use it to view any assembly containing BAML resources, which it will automatically decompile into XAML.

    Forcing WPF to use a specific Windows theme

    Nov 3, 2006

    WPF comes with a few theme assemblies, one for each Windows theme (Luna, Royale and Aero and the fallback theme, Classic.) Usually the theme is loaded according to your current system theme, but if you want to create a consistent look for your application, you may want to force-load a specific one.

    Aelij's Little Helpers

    Nov 1, 2006

    • These helpers are a extension methods in WPF Contrib.

    Creating new animation types

    Oct 31, 2006

    It’s a fairly uncommon scenario to want to animate a type that’s not already built into WPF. But when you do, it takes quite a lot of work, mostly hacking it with Reflector to explore this undocumented venue.

    Force-Enable DWM in Vista 5308 CTP

    Feb 2, 2006

    I’ve been toying around with the CTP for a couple of days. There are some very nice stuff to see, and everything seems to be much smoother and faster (beside the setup, that is; I tried a clean install – which took over an hour – and an upgrade from Windows XP [first available in this CTP] – which took well over three hours…)

    Monopolij: PDC05 Edition

    Aug 17, 2005

    I’ve posted my “PDC 4 Free” contest entry. It’s a game of Monopoly where you can play as your favorite PDC lecturer (such as Bill Gates :) Wish me luck!

    Replacing P#

    Aug 20, 2004

    I’ve decided to replace P# with a great C# SWI-Prolog Interface, written by Uwe Lesta (I changed it a bit. See attachment.) The main reason for this decision was performance. P# was considerably slower, and the project had to meet certain standards.

    My Prolog Project: Connect 4

    Aug 3, 2004

    I’ve finally decided on a Prolog project: the game Connect 4. I’m writing the GUI in VC# Express and using P# as the Prolog engine. I’ll probably also write a text version using SWI-Prolog. Here’s a screenshot of what I’ve come up with so far:

    Gmail-like Conversation View in Outlook 2003

    Jul 29, 2004

    Well, it’s not perfect, but it may be useful to some.

    The Hidden C# "Typedef"

    Jul 7, 2004

    I’ve just seen a blog entry about C# generics, concerning C#’s lack of typedefs. Actually, C# has a way of aliasing classes, using the using directive:

    RTL Mirroring in .NET 2.0/VS 2005

    Jun 27, 2004

    Apparently there’s a new API method, Application.EnableRTLMirroring(), in the next version of the framework, which is supposed to handle the mirroring in Windows Forms for you.

    Mirrored CommandBar

    Jun 25, 2004

    I’ve been working on a mirrored RTL (right-to-left) version of Lutz Roeder’s great CommandBar control for Windows Forms. There’s one problem left, which I haven’t solved yet, so I’d appreciate any comment on the matter.

    Think in Ink Contest Winners Announced

    Jun 3, 2004

    Microsoft finally announced the winners in the DYCTII contest (I got tired of writing the full name :). But they only mentioned the first two winning categories, so I’m not there : . Anyway, is there anyone interested in buying my VS.NET Enterprise Developer?

    My Code Doth Think In Ink

    May 16, 2004

    I won 3rd prize in the Microsoft “Does Your Code Think In Ink?” contest: Visual Studio .NET 2003 Enterprise Developer and a one year subscription to PC Magazine.

  • GitHub
  • Twitter
  • Mastodon
  • LinkedIn
  • Email
  • © Eli Arbel
  • Design: HTML5 UP
  • Demo Images: Unsplash
  • Jekyll Template: Cloud Cannon