← Back to team overview

nunit-core team mailing list archive

[Bug 1082330] Re: Better Exception if SetCulture attribute is applied multiple times

 

This is due to the fact that SetCultureAttribute is allowed multiple
times in order to provide for a future extension whereby the test might
be run multiple times under different cultures. In fact, the
implementation may change to using a single attribute with multiple,
comma-separated cultures.

For NUnit 2.x and NUnitLite, the simple solution is to not allow
multiple occurrences of the attribute. For NUnit 3.0, we could do that
at first but then implement the preferred solution of running multiple
times.

Charlie

** Changed in: nunit-3.0
       Status: New => Triaged

** Changed in: nunit-3.0
   Importance: Undecided => Medium

** Also affects: nunitv2
   Importance: Undecided
       Status: New

** Also affects: nunitlite
   Importance: Undecided
       Status: New

** Changed in: nunitlite
       Status: New => Triaged

** Changed in: nunitlite
   Importance: Undecided => Medium

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

** Changed in: nunitv2
   Importance: Undecided => Medium

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

Title:
  Better Exception if SetCulture attribute is applied multiple times

Status in NUnit Test Framework:
  Triaged
Status in NUnitLite Testing Framework:
  Triaged
Status in NUnit V2 Test Framework:
  Triaged

Bug description:
  The following exception is throw If I accidentally apply twice a
  SetCulture attribute to a test case. It would be nice if the exception
  message would point to the cause of the problem.

  System.ArgumentException: An entry with the same key already exists.
  Server stack trace: at
  System.Collections.Specialized.ListDictionary.Add(Object key, Object
  value) at NUnit.Core.NUnitFramework.ApplyCommonAttributes(Attribute[]
  attributes, Test test) at
  NUnit.Core.Builders.NUnitTestCaseBuilder.BuildSingleTestMethod(MethodInfo
  method, Test parentSuite, ParameterSet parms) at
  NUnit.Core.Builders.NUnitTestCaseBuilder.BuildFrom(MethodInfo method,
  Test parentSuite) at
  NUnit.Core.Extensibility.TestCaseBuilderCollection.BuildFrom(MethodInfo
  method, Test suite) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.AddTestCases(Type
  fixtureType) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildSingleFixture(Type
  type, Attribute attr) at
  NUnit.Core.Builders.NUnitTestFixtureBuilder.BuildFrom(Type type) at
  NUnit.Core.Extensibility.SuiteBuilderCollection.BuildFrom(Type type)
  at NUnit.Core.TestFixtureBuilder.BuildFrom(Type type) at
  NUnit.Core.Builders.TestAssemblyBuilder.GetFixtures(Assembly assembly,
  String ns) at NUnit.Core.Builders.TestAssemblyBuilder.Build(String
  assemblyName, Boolean autoSuites) at
  NUnit.Core.Builders.TestAssemblyBuilder.Build(String assemblyName,
  String testName, Boolean autoSuites) at
  NUnit.Core.TestSuiteBuilder.Build(TestPackage package) at
  NUnit.Core.SimpleTestRunner.Load(TestPackage package) at
  NUnit.Core.ProxyTestRunner.Load(TestPackage package) at
  NUnit.Core.ProxyTestRunner.Load(TestPackage package) at
  NUnit.Core.RemoteTestRunner.Load(TestPackage package) at
  System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
  md, Object[] args, Object server, Object[]& outArgs) at
  System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage
  msg)

To manage notifications about this bug go to:
https://bugs.launchpad.net/nunit-3.0/+bug/1082330/+subscriptions