Bug 12354 - Dictionary<string,object> with long as value shows "Incorrect number of types of arguments"
Summary: Dictionary<string,object> with long as value shows "Incorrect number of types...
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
Depends on:
Reported: 2013-05-22 16:38 UTC by Robert Miles
Modified: 2013-07-28 03:41 UTC (History)
4 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:

Description Robert Miles 2013-05-22 16:38:17 UTC
Given the following code...

    Dictionary<string, object> dict = new Dictionary<string, object> ();
    string key = "id";
    long val = 123456;
    dict[key] = val;

If I "watch" the dict var, after assignment dict[0] shows "Incorrect number or types of arguments" in the "Watch" panel. However, if I do...

    long test = (long)dict[key];

then it properly sets "test" to 123456 as long. So, the value is there, it just seems to be an issue when viewing it in the "Watch" panel.

I'm using Xamarin Studio 4.0.8 build 2.
Comment 1 Jeffrey Stedfast 2013-05-28 15:50:27 UTC
Are you sure that you meant "dict[0]"? Because the key has to be a string...

if I add "dict[key]" to the watch window, it correctly shows me "123456" and says the type is "long"
Comment 2 Robert Miles 2013-05-28 22:04:58 UTC
You are correct...watching "dict[key]" works. I wasn't clear. I'm watching "dict" and just expanding the item to see it's collection. To show you, I also added a second KVP of "id2" with a string value of "some string". In the screenshot linked below, you can see that expanding the "dict" var doesn't show the item at "0" that is a long, but will show the "id2" item at "1" that is a string. Shouldn't it be consistent and show something at "0" as well instead of the error message?

Comment 3 Jeffrey Stedfast 2013-05-29 09:50:35 UTC
thanks for the clarification, I'll look into this
Comment 4 Jeffrey Stedfast 2013-05-29 13:57:54 UTC
We're calling .ToString() with no arguments on a KeyValuePair`2 and the runtime is throwing an InvalidArgumentException. Not sure why...

Zoltan: any idea why this fails if the value is a long but works for other types?
Comment 5 Zoltan Varga 2013-05-29 19:24:14 UTC
Is the exception thrown by the sdb code, or by the application ? In the former case, could you obtain a stacktrace from xs ?
Comment 6 Zoltan Varga 2013-07-28 03:41:09 UTC
Fixed in master 7c89014866fd7d162336970a78a89c9f0ffd7a4d.