System.NullReferenceException thrown when ExpectedExceptionAttribute is used in a static class
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
NUnit Framework |
Fix Released
|
Critical
|
Charlie Poole | ||
NUnitLite |
Fix Released
|
Critical
|
Charlie Poole |
Bug Description
I have this simple unit test :
[Test]
public static void CreateQueryEndN
{
throw new ArgumentOutOfRa
}
When I run the test program (no args) i get :
1) CreateQueryEndN
System.
object.
at System.
at NUnit.Framework
n(Exception exception, TestExecutionCo
at NUnit.Framework
cutionContext context)
at NUnit.Framework
onContext context)
i cannot confirm if the error will still be there in a small test project , I will investigate further - but as it is now, the unit test method does not call any of my code, and still I get the rather weird error from inside the unit testing framework (would have expected the test to pass silently)
My project has 200+ unit tests and almost all of them succeed, also other that use expectedexception - but perhaps not others that use [ExpectedExcept
I will comment further on this bug report when I have created a test project away from my main project.
Even if I did something wrong with setup or whatever, the error is still a bit confusing.
The same test in the same source passes fine with Nuint (reference the same sourcefile from a NUnit using project)
I use NUnitLite 1.0.0 .net 4.5 64 bit windows 7, running 64 bit assembly CLR runtime 4.0.30319.1852, building with Visual Studio 2012 sp3
the same bug appears also on the same machine running mono , 32 bit (also if I compile in mono (using xamarin) and run in .net or the other way around)
The NUnitlite installation I use was gotten via NuGet, i simply reference a binary from my test project.
Changed in nunit-3.0: | |
status: | New → Triaged |
importance: | Undecided → Critical |
assignee: | nobody → Charlie Poole (charlie.poole) |
milestone: | none → 2.9.6 |
Changed in nunitlite: | |
status: | Triaged → Fix Committed |
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 |
I have now created a small solution that does the same - and it does NOT fail the same way - in fact it works fine. I Will try to investigate what the difference is between the two, and report back.
If anyone have an idea what might provoke this kind of error, please let me know .