Friday, February 24, 2012

Out Of Control InteractionRequestTriggers

Recently at $DAYJOB, I ran into an interesting problem with Prism's interaction framework, which made our InteractionRequest actions start firing themselves off more than once. It turns out that the problem was in the InteractionRequestTriggers, specifically, the ones found on a particular view that was nested inside two levels of ContentControl. Tracking down the problem took the better part of a day; fortunately, fixing the problem took less than 10 minutes. (In fairness: the problem wasn't Prism's fault; it's a problem in the Blend classes that Prism derives from. We just happened to be using Prism when we found it.)

Monday, February 20, 2012

We Are Marshal(ing)!

If you've been following my interop posts you've seen me toss around the word "marshaling" a lot, without really talking about what that means or how it works. This is an unfortunate oversight, since marshaling is possibly the most central concept behind interop programming. So, lets remedy that. Lets see what it means to marshal.

Friday, February 03, 2012

Seeking The Unseekable: Managed IStream Wrapper

Previously, we took a look at one of the most useful COM interfaces around, IStream. We first briefly looked at the built-in BCL translation for this interface, before building up a new and improved version. But there were a couple of other salient points in that post, unrelated to the actual translation of IStream:
  1. Despite being part of the BCL, none of the BCL Stream types implement IStream, and
  2. Implementing IStream is more complex than simply deriving an IStream wrapper from the Stream base class.
The problem is, there is not a one-to-one mapping between the things an IStream can do, and the things a Stream can do. In particular, all IStream implementations are seekable: IStream makes no provision for a non-seekable stream. This means you can't wrap a NetworkStream, for example from WCF, in an IStream wrapper and hand it off to COM.

Today, we're going to see how to solve that problem, and in the process, look at a real implementation of a COM interface in managed code.

Wednesday, February 01, 2012

The Zynga Consumer Protection Agency

Lately on Facebook, I've been noticing a massive upswing in the Zynga hate. I'm not sure what's triggering this all at once, though it seems to be centered on Mafia Wars (which I don't play). That there are Zynga hate groups doesn't really surprise me; any company with over 200 million customers is bound to piss off a bunch of them at some point.

One of the biggest complaints leveled at the company are "lost" or "missing" in-game purchases. This got me thinking about the whole concept of app purchases, especially the way social games implement them, and how there is a huge problem here waiting just under the surface.


Every brand of microwave popcorn you can buy says not to use the "Popcorn" button on my microwave to cook it. 

So why do they keep putting "Popcorn" buttons on microwaves?