Bug 21812 - mcs generates IL which NUnit fails to execute (async delegate)
Summary: mcs generates IL which NUnit fails to execute (async delegate)
Status: RESOLVED DUPLICATE of bug 20849
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-08-05 06:16 UTC by Mart Roosmaa
Modified: 2014-08-06 01:54 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
Test project & resulting Tests.dll (8.86 KB, application/zip)
2014-08-05 06:16 UTC, Mart Roosmaa
Details


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 DUPLICATE of bug 20849

Description Mart Roosmaa 2014-08-05 06:16:34 UTC
Created attachment 7581 [details]
Test project & resulting Tests.dll

The new version of Mono (3.6.0.0) in the stable channel currently (5th August) seems to have changed some ways it generates async helper classes and how it handles variables.

        public void HelloBug ()
        {
            string someParameter = null;

            RunAsync (async delegate {
                Assert.IsNull (someParameter);
            });
        }

This compiles fine, but NUnit (bundled with Xamarin Studio, NUnit 2.6.3 from console, NUnit 2.9.6 from console) fails to execute the tests.

I've attached a simple test project with the invalid binaries in bin folder.


NUnit 2.6.3 output:

----------------------------------------------
NUnit-Console version 2.6.3.13283
Copyright (C) 2002-2012 Charlie Poole.
Copyright (C) 2002-2004 James W. Newkirk, Michael C. Two, Alexei A. Vorontsov.
Copyright (C) 2000-2002 Philip Craig.
All Rights Reserved.

Runtime Environment -
   OS Version: Unix 13.3.0.0
  CLR Version: 2.0.50727.1433 ( Mono 3.5 ( 3.6.0 ((no/f540f8a Tue Jul 15 19:37:27 EDT 2014) ) )

ProcessModel: Default    DomainUsage: Single
Execution Runtime: mono-3.5
Unhandled Exception:
System.TypeLoadException: Could not load type Tests.Test+<HelloBug>c__async1 while decoding custom attribute  at (wrapper xdomain-invoke) NUnit.Core.RemoteTestRunner:Load (NUnit.Core.TestPackage)
  at NUnit.Util.TestDomain.Load (NUnit.Core.TestPackage package) [0x00000] in <filename unknown>:0

Exception rethrown at [1]:

  at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke (System.Runtime.Remoting.Proxies.RealProxy rp, IMessage msg, System.Exception& exc, System.Object[]& out_args) [0x00000] in <filename unknown>:0
----------------------------------------------


NUnit 2.9.6 output:

----------------------------------------------
NUnit Console Runner 3.0.0 ()
Copyright (C) 2011, Charlie Poole

Runtime Environment -
   OS Version: Unix 13.3.0.0
  CLR Version: 2.0.50727.1433

Options -
    ProcessModel: Default    DomainUsage: Default
    Execution Runtime: Not Specified
    Work Directory: /private/tmp/AsyncBug
    Internal Trace: Off

Could not load file or assembly 'nunit.framework' or one of its dependencies. The system cannot find the file specified.
----------------------------------------------
Comment 1 Marek Safar 2014-08-06 01:54:18 UTC

*** This bug has been marked as a duplicate of bug 20849 ***