Skip to content

System.InvalidOperationException: Console is already in batching mode #4146

Closed

Description

I'm getting this on my pipelines on GitHub actions sometimes:

  Error: Unhandled exception. System.InvalidOperationException: Console is already
  in batching mode.
     at 
  Microsoft.Testing.Platform.OutputDevice.Terminal.NonAnsiTerminal.StartUpdate() 
  in 
  /_/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/NonAnsiTerminal
  .cs:line 125
     at 
  Microsoft.Testing.Platform.OutputDevice.Terminal.TestProgressStateAwareTerminal.
  ThreadProc() in 
  /_/src/Platform/Microsoft.Testing.Platform/OutputDevice/Terminal/TestProgressSta
  teAwareTerminal.cs:line 45
     at System.Threading.Thread.StartCallback()

Looking at the code, every call to StartUpdate is within a lock statement so that all looks correct, so the only thing I can think of is we're hitting some exception (although I can't see anything in the output - Maybe I need to tweak my verbosity?) and therefore not calling StopUpdate?

It should probably be in a finally block to ensure it's always called.

Activity

  1. added
    area/mtp
    and removed
    needs/triage
    on Nov 25, 2024
  2. Youssef1313 commented on Nov 26, 2024

    @Youssef1313
    Member
  3. thomhurst commented on Nov 26, 2024

    @thomhurst
    ContributorAuthor

    Hopefully !

  4. added
    needs/attention
    and removed
    needs/author-feedback
    on Nov 26, 2024
  5. Youssef1313 commented on Nov 26, 2024

    @Youssef1313
    Member

    Let us know please once you're able to confirm.

  6. thomhurst commented on Nov 26, 2024

    @thomhurst
    ContributorAuthor

    When's the next package release?

  7. Youssef1313 commented on Nov 26, 2024

    @Youssef1313
    Member

    On NuGet.org, that would be a question for Amaury Levé (@Evangelink).

    For a nightly/dogfood build, you can use this feed: https://dnceng.pkgs.visualstudio.com/public/_packaging/test-tools/nuget/v3/index.json

    The version 3.7.0-preview.24575.7 includes your change (I wouldn't use that version for production, but you can just do a quick test with it in a draft PR in your repo to see if the issue is fixed).

  8. nohwnd commented on Nov 26, 2024

    @nohwnd
    Member

    Youssef Fahmy (@Youssef1313) idk if you are aware of it, but here is a full guide to the preview releases: https://aka.ms/mstest/preview

  9. thomhurst commented on Nov 26, 2024

    @thomhurst
    ContributorAuthor

    Looks like I'm not getting that exception on the latest now, but I've got a new regex exception: #4159

  10. thomhurst commented on Nov 28, 2024

    @thomhurst
    ContributorAuthor

    I think this is resolved now that it's calling StopUpdate in the finally block. I think that regex timeout exception I'm seeing was throwing and preventing StopUpdate from being called. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mtp

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions