Mister Goodcat

Peter's home of all things life

Wednesday, 5/7/2014 5:00 AM
by Peter Kuhn
4 Comments

How Ninject inadvertently made the case for SOLID

Wednesday, 5/7/2014 5:00 AM by Peter Kuhn | 4 Comments

It's wonderful to use a robust, great, field-tested tool that simply works. Except when it doesn't.

A recent design change in some component I worked on involved switching the Ninject bindings for some type to request scope. The idea is to keep the same instance of a certain type around in a web application until the request is completed, thus creating a pseudo-singleton for as long as a request is processed. Ninject has a strategy to dispose instances when they are deactivated, meaning that when the request ends, the scoped binding would result in calls to IDispose.Dispose() when your bound type implements that interface. In my case, disposal of these instances was crucial, as they occupy valuable resources (connections to external systems). After the scope change however, I realized that my instances never were disposed and started investigation. More...

Thursday, 11/17/2011 5:22 PM
by Peter Kuhn
0 Comments

Silverlight: Bugs in the multicast client

Thursday, 11/17/2011 5:22 PM by Peter Kuhn | 0 Comments

One of the attendees of my recent webinar on sockets programming for Windows Phone (you can watch it online on Silverlight Show here) brought up a rather complex issue in the Q&A session that I then took offline for further review. As it turns out, what he was facing is not one, but even two bugs in (desktop) Silverlight's multicast client implementation. At first I thought this may be a problem with Silverlight 5, but amazingly everything described here seems to be valid for Silverlight 4 too. I don't know whether this also affects Windows Phone, but since the platforms presumably share that code it's likely. More...

Thursday, 11/10/2011 4:49 PM
by Peter Kuhn
0 Comments

Windows Phone 7: The kind of bug you don't want to discover

Thursday, 11/10/2011 4:49 PM by Peter Kuhn | 0 Comments

I have strong faith in Microsoft's code quality. When I run into problems and errors in my components, I always assume I did something wrong. Why shouldn't I? In almost all cases it indeed is me who has done something wrong – apparently I'm very good at screwing up :). Unfortunately, in some cases it's not me.

"Unfortunately"? Yes. When it's my fault that code is not behaving correctly, I can simply go ahead, review or debug, and fix it. If it's a bug in the runtime or platform however, I have to find a way around it somehow, and a million other people are potentially affected by it too. Seems like the worse alternative to me. This posts describes a particular bug with WP7 developing and hopefully saves some of you some time in the future. More...