Skip to content

SetUpFixture causes NUnit to lock with Apartment( STA ) #2534

Closed

Description

@Rantanen

Reproduction:
https://github.com/Rantanen/intercom/tree/nunit-issue

Having both [assembly: Apartment( ApartmentState.STA )] and a type marked as [SetUpFixture] in a test project will cause the tests to lock up. Reproductible with both the NUnit console runner and R# test runner.

The Apartment attribute may be defined on either assembly level or type level with the same results.

> ..\..\..\packages\NUnit.ConsoleRunner.3.7.0\tools\nunit3-console.exe STATest.dll
NUnit Console Runner 3.7.0
Copyright (c) 2017 Charlie Poole, Rob Prouse

Runtime Environment
   OS Version: Microsoft Windows NT 10.0.15063.0
  CLR Version: 4.0.30319.42000

Test Files
    STATest.dll

Activity

  1. ChrisMaddock commented on Nov 6, 2017

    @ChrisMaddock
    Contributor

    Will you try pulling in the latest build of master, which you can get from our MyGet feed?

    https://www.myget.org/F/nunit/api/v2

    I'd expect that this will currently no longer hang, but will run as MTA rather than STA. The fix for that half of the issue is in progress here: #2519

  2. Rantanen commented on Nov 6, 2017

    @Rantanen
    Author

    I'm probably doing something wrong. The only version of NUnit I can see over at that feed when I add it to Visual Studio package manager settings is 2.6.4 from October 2015.

  3. mikkelbu commented on Nov 6, 2017

    @mikkelbu
    Member
  4. ChrisMaddock commented on Nov 6, 2017

    @ChrisMaddock
    Contributor

    @Rantanen - I'm guessing you missed ticking the 'show pre-release' box? 🙂

  5. Rantanen commented on Nov 6, 2017

    @Rantanen
    Author

    Dammit. I was searching for similar box somewhere on the right side in the package manager UI. Not next to the search box. :)

    Got it from @mikkelbu's link anyway, thanks.

    Also seems to fix the issue. Tested with both the assembly level attribute, which doesn't hang but leaves the threads MTA and class level attribute, which also hanged previously but doesn't anymore and actually changes the thread to STA.

  6. Rantanen commented on Nov 6, 2017

    @Rantanen
    Author

    So if that's a master build that means this is already fixed in master and can be closed, right?

  7. ChrisMaddock commented on Nov 6, 2017

    @ChrisMaddock
    Contributor

    Great - thanks for confirming! FYI, 3.9 should be out with the fix soonish, so long as there's no more major issues.

  8. added this to the 3.9 milestone on Nov 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions