Comment 1 for bug 893919

Revision history for this message
Charlie Poole (charlie.poole) wrote :

Although the 2.6 beta 2 has a fix for use of polling with After, this particular issue hasn't come up before.

Although what you propose makes sense, it's not entirely clear how we can implement it because it's entirely possible to be testing for a null value...

   Assert.That(() => statusString, Is.Null.After(3000,100));

A silly example, but one we have to deal with.

One approach would be for DelayedConstraint to analyze all following constraints to determine if a null reference will cause a problem. This could be messy and violates the independence of composed constraints. Another might be to catch the null reference exception and ignore it during polling.

I think your first workaround is better, since it doesn't depend on knowledge of NUnit's internals. The After constraint is in fact run on a separate thread, but the main thread blocks until it is complete.

Charlie