Bug 33754

Summary: Invalid IL Code when using elvis operator to call extension struct methods
Product: [Mono] Compilers Reporter: João Vitor <jvlppm>
Component: C#Assignee: Marek Safar <masafa>
Status: RESOLVED FIXED    
Severity: normal CC: mono-bugs+mono
Priority: ---    
Version: 4.0.0   
Target Milestone: 4.2.0 (C6)   
Hardware: Macintosh   
OS: Mac OS   
Tags: Is this bug a regression?: ---
Last known good build:

Description João Vitor 2015-09-07 20:06:38 UTC
Source code:

using System;

namespace NullCoalescing
{
    static class MainClass
    {
        public static void Main()
        {
            TestBug();
        }

        public static void TestBug()
        {
            int? value = null;
            value?.Test();
        }

        public static void Test(this int value)
        {
            Console.WriteLine("Not null");
        }
    }
}


System.InvalidProgramException: Invalid IL code in NullCoalescing.MainClass:TestBug (): IL_0023: call      0x06000003
  at at NullCoalescing.MainClass.Main () in /Users/joao/tmp/Projects/NullCoalescing/NullCoalescing/Program.cs:line 9


=== Xamarin Studio ===

Version 5.10 (build 704)
Installation UUID: 0dca64e4-d900-4836-b697-c381adbe2408
Runtime:
	Mono 4.2.0 (explicit/2701b19)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 402000207

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 5.1.99.653 (Indie Edition)
Android SDK: /Users/joao/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		2.3   (API level 10)
		4.0.3 (API level 15)
		4.4   (API level 19)

SDK Tools Version: 24.1.2
SDK Platform Tools Version: 22.0.0
SDK Build Tools Version: 22.0.1

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

=== Xamarin Android Player ===

Not Installed

=== Apple Developer Tools ===

Xcode 6.4 (7720)
Build 6E35b

=== Xamarin.iOS ===

Version: 8.13.0.131 (Indie Edition)
Hash: 79f8535
Branch: master
Build date: 2015-08-31 15:32:33-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 510000704
Git revision: c16e63aeeaa63ea912638f958ae1547905aed4e5
Build date: 2015-08-31 15:47:00-04
Xamarin addins: a7a74af8bcc6bca9a02f34afb66025c0a3fa18cb
Build lane: monodevelop-lion-master

=== Operating System ===

Mac OS X 10.10.4
Darwin Joaos-MacBook-Pro.local 14.4.0 Darwin Kernel Version 14.4.0
    Thu May 28 11:35:04 PDT 2015
    root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64
Comment 1 Marek Safar 2015-09-08 05:07:52 UTC
Fixed in master/6294c96bab94507577b483ab7bd48f624456a284 and mono-4.2/4a1653412f81ad5c454e067f85ed2e2e6dd3082e