Runner.Load fails on CF if the test assembly contains a generic method
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
High
|
Charlie Poole | ||
NUnitLite |
Fix Released
|
High
|
Charlie Poole |
Bug Description
For our .NET CF projects, we use our own GUI test runner. It loads the test assemblies using the NUnitLiteTestAs
Everything works well until the test assembly does not contain a non-generic method which has an ancestor with either a generic argument or a generic return value.
Here is an example of such class structure and method:
public abstract class BaseClass<T>
{
public abstract void GenericMethod(T par);
}
public class DerivedClass: BaseClass<string>
{
public override void GenericMethod(
{
}
}
Note: the class need not be a test fixture at all - the AssemblyBuilder
The problem is unfortunately not directly in NUnitFramework but in the system method RuntimeMethodIn
Here is the complete exception:
System.
Message=
StackTrace:
at System.
at System.
at System.
at NUnit.Framework
at NUnit.Framework
at NUnit.Framework
at NUnit.Framework
at NUnit.Framework
at NUnit.Framework
I'm attaching a simple CF project (for Visual Studio 2008, including sources of NUnitFramework 0.8).
The reproduction is within the GUI Form1.cs - there are two reproductions:
1) a failure using the Load method of NUnitLite
2) a pure failure of the system IsDefined method
I know the problem is in .NET CF framework. Since we cannot expect Microsoft will ever fix it, it would be great to put some workaround to NUnitLite.
In our company we use just the TestAttribute on methods (we don't use the TestCaseAttribute, TestCaseSourceA
But in the NUnitLie framework it is not possible so I have only some tips for the workaround:
A) I was thinking about writing a custom IsDefined method, but it would be quite complex problem.
B) Or maybe a searching of ancestor methods would be a little bit more limited. For instance, to check whether the method's base definition is generic using methodInfo.
Changed in nunitlite: | |
status: | New → Triaged |
importance: | Undecided → High |
Changed in nunitlite: | |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 1.0 |
Changed in nunit-3.0: | |
status: | New → Triaged |
importance: | Undecided → High |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 2.9.6 |
Changed in nunitlite: | |
milestone: | 1.0 → 1.0b2 |
Changed in nunitlite: | |
status: | Fix Committed → Fix Released |
Changed in nunit-3.0: | |
status: | Triaged → Fix Committed |
Changed in nunit-3.0: | |
status: | Fix Committed → Fix Released |
It turns out that the true parameter is not needed in this situation and was just added without much thought in the past!