Bug 14503 - Cannot invoke interface methods
Summary: Cannot invoke interface methods
Status: RESOLVED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: Debugger ()
Version: unspecified
Hardware: PC Mac OS
: Normal normal
Target Milestone: ---
Assignee: Zoltan Varga
URL:
Depends on:
Blocks:
 
Reported: 2013-09-06 16:32 UTC by Alan McGovern
Modified: 2015-02-20 12:29 UTC (History)
3 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 Alan McGovern 2013-09-06 16:32:57 UTC
Testcase:

using System;

namespace asdfshgdfh
{
	class MainClass
	{
		public static void Main (string[] args)
		{
			IDisposable disposable = new System.IO.MemoryStream ();
			Console.WriteLine ("disposable");
		}
	}
}

Steps:
1) Put a breakpoint on the Console.WriteLine
2) Try to invoke 'disposable.Dispose ()'  in the immediate window

Result:
A "System.InvalidProgramException: Missing or incorrect header for method" exception is thrown.

This appears to happen when you try to invoke methods declared on any interface when you have a local variable whose compile time type is that interface, as above.

I consulted with Jeff already and thinks this is a runtime issue. The same issue may exist for properties.

This particular bug has been reported several times on Bugzilla ( https://bugzilla.xamarin.com/show_bug.cgi?id=4390 and https://bugzilla.xamarin.com/show_bug.cgi?id=6986 at least) and I've reported it in IRC a few times and had it fixed several times in the past. It'd be great if we could add regression tests for this as breaking the same feature in the same way multiple times should not happen.
Comment 1 Zoltan Varga 2013-09-07 00:33:00 UTC
Fixed in mono master 31db4c7cb4e41f4e66c6b6bb821005d4666b1a8c.