Bug 36640 - Delegate.Method null for comined delegates
Summary: Delegate.Method null for comined delegates
Status: VERIFIED FIXED
Alias: None
Product: Runtime
Classification: Mono
Component: General ()
Version: 4.2.0 (C6)
Hardware: PC All
: Normal normal
Target Milestone: (C6SR1)
Assignee: Ludovic Henry
URL:
Depends on:
Blocks:
 
Reported: 2015-12-04 22:12 UTC by Igor Kiselev
Modified: 2015-12-16 14:30 UTC (History)
6 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:
VERIFIED FIXED

Description Igor Kiselev 2015-12-04 22:12:46 UTC
System.Delegate::Member property is null for combined delegates. Test case:

using System;

public static class Program
{
    public static void Main()
    {
        Action a = M1;
        a += M2;
        WriteAction(a);
    }


    public static void WriteAction(Action action)
    {
        Console.WriteLine(action.Method.Name);
    }

    public static void M1()
    {

    }

    public static void M2()
    {

    }
}

Current result: System.NullReferenceException

Expected result: M1 or M2 or something else.
.Net result is "M2".

This worked on Mono 4.0.
Comment 1 asimk 2015-12-07 13:44:34 UTC
I have checked this issue with current stable Mono 4.2.1.102 with the help of test case provided in bug description and able to reproduce the reported behaviour. I have checked the same with Mono 3.12.1 and getting result "M2" with Mono 3.12.1.

Please refer the screencast : http://www.screencast.com/t/kEnZ8CYrX

Exception Log : https://gist.github.com/Udham1/2ba8790acb75a3bd49d7
Ide Log : https://gist.github.com/Udham1/d147f29c4429d5da283c

Environment Info : 

=== Xamarin Studio ===

Version 5.10.1 (build 3)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
Runtime:
	Mono 4.2.1 (explicit/6dd2d0d)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402010102

=== Xamarin.Profiler ===

Version: 0.24.354.0
Location: /Applications/Xamarin Profiler.app/Contents/MacOS/Xamarin Profiler

=== Apple Developer Tools ===

Xcode 7.1 (9079)
Build 7B91b

=== Xamarin.iOS ===

Version: 9.2.1.54 (Business Edition)
Hash: eb4c1ef
Branch: master
Build date: 2015-12-01 02:12:30-0500

=== Xamarin.Android ===

Version: 6.0.0.34 (Business Edition)
Android SDK: /Users/xamarin76/Desktop/android-sdk-macosx
	Supported Android versions:
		2.3    (API level 10)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 24.4.1
SDK Platform Tools Version: 23.0.1
SDK Build Tools Version: 23

Java SDK: /usr
java version "1.7.0_65"
Java(TM) SE Runtime Environment (build 1.7.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)

=== Xamarin Android Player ===

Version: 0.3.7
Location: /Applications/Xamarin Android Player.app

=== Xamarin.Mac ===

Version: 2.4.0.109 (Business Edition)

=== Build Information ===

Release ID: 510010003
Git revision: f2021a209d66d49cbc0649a6d968b29040e57807
Build date: 2015-12-01 10:43:40-05
Xamarin addins: dfd4f5103e8951edbc8ac24480b53b53c55e04ff
Build lane: monodevelop-lion-cycle6-baseline

=== Operating System ===

Mac OS X 10.10.5
Darwin Xamarin76s-Mac-mini.local 14.5.0 Darwin Kernel Version 14.5.0
    Wed Jul 29 02:26:53 PDT 2015
    root:xnu-2782.40.9~1/RELEASE_X86_64 x86_64
Comment 3 Udham Singh 2015-12-14 11:51:08 UTC
I have checked this issue with latest master lane mono build MonoFramework-MDK-4.3.0.2057.macos10.xamarin.universal_dd0a6c3e651fc453a99ab2610927f13590322586 and observed that this issue has been fixed with this build. 

Screencast : http://www.screencast.com/t/v76NuTIL0
Environment Info : https://gist.github.com/Udham1/556256bafaaef13d3e54

Hence I am closing this issue.

Thanks!
Comment 4 Udham Singh 2015-12-16 14:30:29 UTC
I have checked this issue with latest C6SR1 lane mono build MonoFramework-MDK-4.2.1.17.macos10.xamarin.x86_2e19bf113b3f02634b4745adaa420c9f84653ee0 and observed that the fix for this issue has been merged with C6SR1 lane builds.

Environment Info : https://gist.github.com/Udham1/5ab0a72eba19b2cbac7d

Thanks!