← Back to team overview

nunit-core team mailing list archive

[Bug 1084181] Re: TestExecutaionContext SerializationException

 

Hi Erik, thanks for the report. We were aware of this problem, which we
inadvertently introduced in 2.6.2 while trying to make the test context
flow the call context across multiple threads. Apparently it's now
flowing too much!

If you have any idea how we could prevent this issue from occurring feel
free to share. Currently the only option I see is to make everything
serializable, although it sounds more a workaround rather than a
solution, since the assembly in which these classes are defined will
most likely not be available in the remote process, but it's also true
that the remote process will not need access to it in any case.

A proper solution in my opinion would be to have the test context flow
across threads but not across process (or even appdomain) boundaries,
but I'm not sure there's a way to achieve this level of granularity.

** Changed in: nunitv2
       Status: New => Confirmed

** Changed in: nunitv2
     Assignee: (unassigned) => Simone Busoli (simone.busoli)

-- 
You received this bug notification because you are a member of NUnit
Developers, which is subscribed to NUnit V2.
https://bugs.launchpad.net/bugs/1084181

Title:
  TestExecutaionContext SerializationException

Status in NUnit V2 Test Framework:
  Confirmed

Bug description:
  Nunit v 2.6.2.12296 throws a SerializationException  because
  TestExecutaionContext is not marked as Serializable.

  Looks like TestExecutaionContext is calling CallContext.LogicalSetData("Nunit.Framework.TestContext",current.contextDictionary)
  however contextDictionary=> TestExecutaionContext  is not Serializable. This prevents remote calls. You will get a 
  System.Runtime.Serialization.SerializationException : Type 'NUnit.Core.TestExecutionContext' in Assembly 'nunit.core, Version=2.6.2.12296, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' is not marked as serializable
  exception.
  You can work around this by calling
  CallContext.FreeNamedDataSlot("NUnit.Framework.TestContext");
  but is ugly and might break your expectation about what is in the context?
  -Erik

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunitv2/+bug/1084181/+subscriptions


References