Bug 14372 - Incorrect number or types of arguments
Summary: Incorrect number or types of arguments
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
: 16991 18557 ()
Depends on:
Blocks:
 
Reported: 2013-09-02 06:19 UTC by Marek Safar
Modified: 2014-03-26 16:33 UTC (History)
7 users (show)

Tags:
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:
Status:
RESOLVED FIXED

Description Marek Safar 2013-09-02 06:19:39 UTC
1. The error message is quite confusing
2. It happens in code with no generics

http://screencast.com/t/mopmLlMv

The sample code can be downloaded from bug report #14309
Comment 1 Jeffrey Stedfast 2013-10-01 10:02:30 UTC
I fixed a similar issue the other day, but I don't know if this case is also fixed...
Comment 2 Andrew Young 2013-11-13 11:53:44 UTC
As of version 4.2, this is still a problem.

Often when I mouseover a struct variable, the inspector window (tooltip?) will appear with only the following message in red:

"Incorrect number of types or arguments"

The immediate window has the same problem, and it's impossible to access the properties of these structs in the immediate window either. In fact, about the only thing I can do to get access to the members while debugging is to make a temporary method that serializes the type to a string, and call that method from the immediate window. This is affecting a lot of types in my solution and makes them very difficult to debug.

I narrowed down a few cases which are easy to reproduce.

(1) All properties show the error message for a struct which contains an enum field followed by another field (i.e. the enum field is not last). In this example struct, "Property" cannot be seen in debug mode, but if you move the "ConsoleModifiers a" field below the "int b", or delete the "int b" altogether, it can.

    public struct Test1
    {
        public string Property { get { return "Value"; } }
        ConsoleModifiers a;
        int b;
    }

(2) A struct which contains static property returning an instance of itself. For this struct, try opening the "Static Members" node in the inspector window and the same error message appears.

    public struct Test2
    {
        public static Test2 Empty { get { return default(Empty); } }
    }
Comment 3 Jeffrey Stedfast 2013-11-13 12:19:32 UTC
Zoltan: any idea why this is failing and what can be done?
Comment 4 Zoltan Varga 2013-11-13 13:22:53 UTC
I think this was fixed in mono master 9c2e07499ec0cbd6ee94516a9aec539b0162862f . What product/version is this ?
Comment 5 Andrew Young 2013-11-13 21:02:12 UTC
Xamarin Studio 4.2 (build 2)
Mono 3.2.4 ((no/294f999)

Looks like this same error message was reported in bug 14942 (though the steps to reproduce were different) and that bug is marked as RESOLVED FIXED.  The test case in that bug is still broken for me, too.
Comment 6 Andrew Young 2013-11-13 21:04:44 UTC
Forgot to mention: running Xamarin Studio on OS X Mavericks.
Comment 7 Zoltan Varga 2013-11-13 21:26:34 UTC
The fix is not in mono 3.2.4, it will be in the upcoming 3.2.5.
Comment 8 Zoltan Varga 2013-12-09 22:11:46 UTC
3.2.5 is out now with the fix. Please reopen if this still happens.
Comment 9 BurnSpamAddress 2013-12-30 09:59:26 UTC
I can still reproduce this with mono 3.2.5 on OSX Mavericks:

$ mono --version
Mono JIT compiler version 3.2.5 ((no/964e8f0 Thu Nov 14 14:48:50 EST 2013)
Copyright (C) 2002-2012 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           normal
	SIGSEGV:       altstack
	Notification:  kqueue
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          yes(3.3svn-mono)
	GC:            sgen

Test case follows. Hover over the bar and not_bar variables to observe the issue.

using System;

[Flags]
enum Foo : byte
{
	Unknown = 0,
	Something = 1 << 0,
	SomethingElse = 1 << 1,
	SomethingLast = 1 << 7,
}

struct Bar
{
	Foo foo;
	bool is_bar;

	public Foo Foo
	{
		get { return foo; }
		set { foo = value; }
	}

	public bool IsBar
	{
		get { return is_bar; }
		set { is_bar = value; }
	}

	public override string ToString()
	{
		return string.Format("[Bar: Foo={0}, IsBar={1}]", Foo, IsBar);
	}
}

class MainClass
{
	public static void Main(string[] args)
	{
		var bar = new Bar { Foo = Foo.Something, IsBar = true };
		var not_bar = new Bar { Foo = Foo.Unknown, IsBar = false };

		Console.WriteLine(bar);
		Console.WriteLine(not_bar);

		System.Diagnostics.Debugger.Break();
	}
}
Comment 10 Zoltan Varga 2014-01-03 07:29:05 UTC
It looks like the fix doesn't made 3.2.5 which was branched before the fix. I can reproduce with 3.2.5, but not with current master.
Comment 11 BurnSpamAddress 2014-01-05 16:19:35 UTC
*** Bug 16991 has been marked as a duplicate of this bug. ***
Comment 12 Sean Hederman 2014-02-20 04:35:55 UTC
Please note that this bug is NOT FIXED in 3.2.6
Comment 13 Zoltan Varga 2014-03-26 16:33:30 UTC
*** Bug 18557 has been marked as a duplicate of this bug. ***