Skip to content

fix: overly broad exception handling in VerbosityService #4901

@thomhurst

Description

@thomhurst

Description

File: TUnit.Engine/Services/VerbosityService.cs (Lines 90-101)

catch  // Catches all exceptions, hides real issues
{
    return true;  // Silent default
}

IsConsoleEnvironment catches all exceptions silently, including NullReferenceException and other serious errors.

Suggested Fix

Catch specific exceptions and log:

catch (Exception ex) 
{
    System.Diagnostics.Debug.WriteLine($"Failed to determine console environment: {ex}");
    return true;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions