Assert.Catch<T> should return T instead of System.Exception

Bug #430100 reported by Kenneth Xu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
NUnit Framework
Fix Released
High
Charlie Poole
NUnit V2
Fix Released
High
Charlie Poole

Bug Description

The Assert.Catch<T> should return the generic exception type instead of overly widened System.Exception. So that code below is possible:

ArgumentException e = Assert.Catch<ArgumentException>( ()=>...);
Assert.That(e.ParamName, ....);

Changed in nunitv2:
assignee: nobody → Charlie Poole (charlie.poole)
importance: Undecided → High
milestone: none → 2.5.3
status: New → Confirmed
Changed in nunit-3.0:
assignee: nobody → Charlie Poole (charlie.poole)
importance: Undecided → High
milestone: none → 2.9.2
status: New → Confirmed
Changed in nunitv2:
status: Confirmed → Fix Committed
Changed in nunit-3.0:
status: Confirmed → In Progress
Changed in nunit-3.0:
status: In Progress → Fix Committed
Changed in nunitv2:
status: Fix Committed → Fix Released
Changed in nunit-3.0:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.