In my Silverlight 5 app, I'm getting an ArgumentNullException with no useful stacktrace. I simply see:
System.ArgumentNullException occurred
Message=Value cannot be null.
Parameter name: key
StackTrace:
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Windows.dll!MS.Internal.JoltHelper.FireEvent(System.IntPtr unmanagedObj, System.IntPtr unmanagedObjArgs, int argsTypeIndex, int actualArgsTypeIndex, string eventName, uint flags) + 0x31b bytes
Try as I might, I can't find any uncaught exception to catch! I've disabled Just My Code, I have the debugger set to Break on Thrown for all exceptions, and I've looked for anywhere in my code where this might be happening. I just can't find any way to figure out where it's coming from. It must be a background Silverlight thread applying resources, or otherwise doing something automatically, but I can't figure out what.
The specific scenario is of creating controls through XAML or through code. Through XAML they work fine. When I create them through code I get this mysterious exception.
Help!