Comment 4 for bug 1235891

Revision history for this message
Charlie Poole (charlie.poole) wrote : Re: [Bug 1235891] Re: Proposed 2.6.3 release: ArgumentNullException in NUnit.Framework.AsyncInvocationRegion..cctor

Yes, I did something similar as my first attempt, removing the static
constructor as well and adding a PreserveStackTrace method that uses
lazy initialization. The problem is twofold: (1) Mono doesn't have the
PerserveStackTrace method and (2) there's no reason to be messing
around with AsyncInvocationRegion in this example anyway, since no
async methods are involved.

The trouble is that IsAsyncOperation is a static method of
AsyncInvocationRegion and calling it triggers the static constructor.
Either that method has to be in another class or we need to do away
with all the static initialization. I did the latter.

I'm testing on Windows right now, by using the Gui runner to run the
NUnit tests under Mono. Before my fix, the tests would not even load.
With it they load but I'm getting some errors. I may need to move to a
Linux system to really get into this.

Charlie

On Sun, Oct 6, 2013 at 8:51 AM, Stefan Bodewig
<email address hidden> wrote:
> I'm having a hard time building NUnit trunk on Mono 2.10 - this would be
> Mono 4.0 and things aren't quite where the build system expects them.
>
> What happens is that the type constructor for AsyncInvocationRegion is
> triggered in line 579 of Assert - the framework assembly I use has been
> built for Windows - but in Mono the Exception class has no
> PreserveStackTrace method.
>
> The branch I've just linked falls back to a no-op if the
> PreserveStackTrace isn't found at runtime.
>
> TBH I'm not sure this is the best way to fix it - in particular since I
> don't have a Windows environment at hand right now - so I don't claim my
> trivial change would fix anything.
>
> --
> You received this bug notification because you are subscribed to NUnit
> Extended Testing Platform.
> https://bugs.launchpad.net/bugs/1235891
>
> Title:
> Proposed 2.6.3 release: ArgumentNullException in
> NUnit.Framework.AsyncInvocationRegion..cctor
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/nunitv2/+bug/1235891/+subscriptions