Bug 22606 - Non-static method requires a target when running iOS Unit Test Project
Summary: Non-static method requires a target when running iOS Unit Test Project
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll ()
Version: 7.4.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-09-03 14:00 UTC by John Miller [MSFT]
Modified: 2015-11-20 05:04 UTC (History)
6 users (show)

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

Test Case (50.27 KB, application/zip)
2014-09-03 14:00 UTC, John Miller [MSFT]

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 for Bug 22606 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Miller [MSFT] 2014-09-03 14:00:48 UTC
Created attachment 7903 [details]
Test Case


   Exceptions are thrown when trying to run an iOS unit test project. 

**Steps to Reproduce:**

   1. Open the attached sample in Visual Studio.
   2. Run the unit test project on an iOS device attached to a Mac build host.

**Actual Results:**

>System.Reflection.TargetException : Non-static method requires a target.
>2014-09-02 14:36:17.296 TestableAppTests[5615:60b] at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006b] in >/Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MonoMethod.cs:243
>2014-09-02 14:36:17.298 TestableAppTests[5615:60b] at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Developer/MonoTouch/Source/mono/mcs/class/corlib/System.Reflection/MethodBase.cs:114
>2014-09-02 14:36:17.300 TestableAppTests[5615:60b] at NUnit.Framework.Internal.Reflect.InvokeMethod (System.Reflection.MethodInfo method, System.Object fixture, System.Object[] args) [0x00000] in /Developer/MonoTouch/Source/NUnitLite/NUnitLite-1.0.0/src/framework/Internal/Reflect.cs:211

**Expected Results:**

   No exceptions, the tests should run successfully.

**Build Date & Platform:**

   XS 5.3 (also tested with 5.2.1)
   XI (also tested with
   XVS 3.5 / 4.0

**Additional Information**

   I had trouble running in this with XS. I also noticed that the unit test project references an .exe (iOS APP) project. Should that be possible from Visual Studio (XS does not allow this)?
Comment 1 David Hathaway 2014-09-03 15:54:40 UTC
Here is a recording of the scenario.  It is only happening in a subset of use cases:

1. Click "Run All" at the highest level, which invokes all test cases.  Note that all tests cases run successfully.

2. Navigate down to the set of tests for a given class, and click "Run all".  Note that the tests fail with the error above

3. Drill down to the most granular level, and run each test individually.  Note that they pass.

The issue appears to be localized to running a set of tests for a given class, but can be run when executed from the highest, or most granular levels.

Comment 2 Parmendra Kumar 2014-09-04 09:41:15 UTC
I have checked this issue and able to reproduce this issue with given steps in bug description.And observed the same behavior as bug description and comment1. 

Build Log:https://gist.github.com/Parmendrak/c271822797fe8dedd369

Environment Info:

Microsoft Visual Studio Professional 2013
Version 12.0.30723.00 Update 3
Microsoft .NET Framework
Version 4.5.51641

Installed Version: Professional
LightSwitch for Visual Studio 2013   06177-004-0446016-02383
Microsoft LightSwitch for Visual Studio 2013

Xamarin (2db5ccd228887372e207e112bc3b5f1b16b24293)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 3 Johann 2015-06-05 10:28:23 UTC

Are you considering a solution for this in one of the new releases?
Thank you.
Comment 4 Rolf Bjarne Kvinge [MSFT] 2015-11-20 05:04:39 UTC
This is probably related to bug #36064.