Bug 33754 - Invalid IL Code when using elvis operator to call extension struct methods
Summary: Invalid IL Code when using elvis operator to call extension struct methods
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 4.0.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: 4.2.0 (C6)
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2015-09-07 20:06 UTC by João Vitor
Modified: 2015-09-08 05:07 UTC (History)
1 user (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 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