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
Status: CONFIRMED
Alias: None
Product: iOS
Classification: Xamarin
Component: Xamarin.iOS.dll (show other bugs)
Version: 7.4.x
Hardware: PC Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2014-09-03 14:00 UTC by John Miller [MSFT]
Modified: 2015-11-20 05:04 UTC (History)
6 users (show)

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


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

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

**Overview:**

   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 7.4.0.108 (also tested with 7.2.6.28)
   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.

http://screencast.com/t/jJ8ylcOevoj
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. 

Screencast:http://screencast.com/t/nCLYT2rwBe
Build Log:https://gist.github.com/Parmendrak/c271822797fe8dedd369
ZipXamarinLog:https://gist.github.com/Parmendrak/58283d05a81dc1bd8b4a

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   3.5.55.0 (2db5ccd228887372e207e112bc3b5f1b16b24293)
Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android
Comment 3 Johann 2015-06-05 10:28:23 UTC
Hello,

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.

Note You need to log in before you can comment on or make changes to this bug.