Bug 26719 - MemoryLeak in MonoTouch.NUnitLite for parameterized tests
Summary: MemoryLeak in MonoTouch.NUnitLite for parameterized tests
Alias: None
Product: iOS
Classification: Xamarin
Component: Tools (show other bugs)
Version: XI 8.6.0
Hardware: Macintosh Mac OS
: Normal normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2015-02-04 05:06 UTC by roschilu
Modified: 2015-02-13 04:03 UTC (History)
2 users (show)

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

Sample App (9.64 KB, application/zip)
2015-02-13 04:03 UTC, Udham Singh

Description roschilu 2015-02-04 05:06:57 UTC
Instances of test classes are never released if they are created from a parameterized test.
See example below, Dispose() is never called when executing SimpleTestParameterized() or SimpleTestParameterized2(). However it is when executing SimpleTest()

using System;
using NUnit.Framework;

namespace TestFieldLinkSupervisorApp
	public class TestBase : IDisposable
		int instanceId;
		static int nextInstanceId = 1;

		public TestBase() {
			instanceId = nextInstanceId++;
			Console.WriteLine(string.Format("TestAppDelegateBase {0} created", instanceId));

		public void SimpleTestParameterized(int i) {

		[Test, Combinatorial]
		public void SimpleTestParameterized2([Values(0, 1)] int i) {

		public void Dispose() {
			Console.WriteLine(string.Format("Instance {0} disposed", instanceId));
Comment 1 Udham Singh 2015-02-13 04:03:14 UTC
Created attachment 9814 [details]
Sample App

I have checked this issue and able to reproduce the reported behaviour. To reproduce this issue I have followed the steps mentioned below.

1. Create an 'iOS Unit Tests Project' via 'iOS > Unified API > iOS Unit Tests Project'.
2. Implement the code given in bug in class UnitTestAppDelegate.
3. Run the app, follow the steps shown in screencast : http://www.screencast.com/t/k6PTgmQYWyA and see the reported behaviour.

System Log : https://gist.github.com/Udham1/63eb55fbfa922ef625b5
Application Output : https://gist.github.com/Udham1/3cd5158b05a3ec6362c9
Ide Log : https://gist.github.com/Udham1/bb415ae043a619360bc6

Note : I am attaching a sample app which I have created to reproduce this issue.

Environment Info :

=== Xamarin Studio ===

Version 5.7.1 (build 17)
Installation UUID: ce927b2a-2c07-44c5-b186-09cfdafba6dc
	Mono 3.12.0 ((detached/a813491)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 312000068

=== Apple Developer Tools ===

Xcode 6.1.1 (6611)
Build 6A2008a

=== Xamarin.iOS ===

Version: (Business Edition)
Hash: 09ae75f
Build date: 2015-02-11 22:34:42-0500

=== Build Information ===

Release ID: 507010017
Git revision: 0bc7d3550b6b088ac25b08dcf7bbe73bcc8658b3
Build date: 2015-02-03 19:43:29-05
Xamarin addins: f7b7d34419c9ec24501bfa7c658e80a6305613e0

=== Operating System ===

Mac OS X 10.9.5
Darwin Xamarin76s-Mac-mini.local 13.4.0 Darwin Kernel Version 13.4.0
    Sun Aug 17 19:50:11 PDT 2014
    root:xnu-2422.115.4~1/RELEASE_X86_64 x86_64

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