Silverlight exception being thrown (ARG_ARGUMENTEXCEPTION), no clue why or where
So I've be开发者_如何学Pythonen having quite an issue tracking this problem down.
Let me break it down real quick: I've got a Silverlight 4 control that displays information in Telerik RadGridViews. There's some additional functionality to the grids, but nothing too strange. I have 3 dashboards, each of them being shown/hidden via a main control. Each sub-control hosts the same kind of controls, so they are pretty much the same. The controls report activity to the parent control via custom events. Every time I switch the control visibility, I load the data for that dashboard based on some information. The data is stored in XML files on a web server (using http://) and are retrieved using the WebClient class in .NET. Once the files are retrieved, they are deserialized into POCOs and passed to the grids which bind to those collections.
So now for the problem: A couple weeks ago, the control started just going blank when transitioning from the first control to the 2nd. The default Silverlight behaviour is to report the error to the DOM. We received "ARG_ARGUMENTEXCEPTION". However, the issue is specific to certain users and also to certain files. However, inspection of the files themselves prove fruitless. I started outputting more information via textboxes, but the stack trace is empty. I cannot find how or why this error is occuring.
My question is this: How do I start to diagnose this issue? I have tried outputting information, but the exact place at which the error occurs eludes me. I cannot find what makes one control crash with a set of files and not with a different set. Any ideas?
EDIT: I was modifying a UI element that had a bug. The error was being thrown from the XAML, not the code-behind, so there was no stack trace. I ended up determining the error simply by commenting out code. Thanks for the help!
Recently Silverlight 5 beta was releases and I got same error in my app indicating a style error somewhere in resource dictionary. Different silverlight version will cause this error. Make sure your users have latest release version of silverlight.
99% of time this error was because of wrong style in resource dictionary xaml such as generic.xaml.
I had similar problem at build time when vs picked up silverlight 3 dlls while adding control from toolbox to my user control. Visual Studio does not filter silverlight 3 dlls in add reference for silverlight 4 projects which also caused the same error.
Mostly it is due to inconsistent xaml and clr type mapping. If xaml has wrong value or wrong type of value then expected in properties this error will show up but if there is no line number information then it has to be in generic.xaml.
精彩评论