Search Results for

    Show / Hide Table of Contents

    NUnit1008

    Specifying ParallelScope.Self on assembly level has no effect

    Topic Value
    Id NUnit1008
    Severity Warning
    Enabled True
    Category Structure
    Code ParallelizableUsageAnalyzer

    Description

    Specifying ParallelScope.Self on assembly level has no effect.

    Motivation

    Bring developers' attention to a scenario in which they may believe they are parallelizing something when in fact they are not and their efforts will have no effect.

    How to fix violations

    Example Violation

    In AssemblyInfo.cs:

    [assembly: Parallelizable(ParallelScope.Self)]
    

    Explanation

    ParallelScope.Self only applies to classes and methods, not to assemblies.

    Fix

    Either remove it or change to a valid option, such as:

    [assembly: Parallelizable(ParallelScope.Children)]
    

    Or:

    [assembly: Parallelizable(ParallelScope.Fixtures)]
    

    Configure severity

    Via ruleset file

    Configure the severity per project, for more info see MSDN.

    Via .editorconfig file

    # NUnit1008: Specifying ParallelScope.Self on assembly level has no effect
    dotnet_diagnostic.NUnit1008.severity = chosenSeverity
    

    where chosenSeverity can be one of none, silent, suggestion, warning, or error.

    Via #pragma directive

    #pragma warning disable NUnit1008 // Specifying ParallelScope.Self on assembly level has no effect
    Code violating the rule here
    #pragma warning restore NUnit1008 // Specifying ParallelScope.Self on assembly level has no effect
    

    Or put this at the top of the file to disable all instances.

    #pragma warning disable NUnit1008 // Specifying ParallelScope.Self on assembly level has no effect
    

    Via attribute [SuppressMessage]

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Structure",
        "NUnit1008:Specifying ParallelScope.Self on assembly level has no effect",
        Justification = "Reason...")]
    
    • Edit this page
    In this article
    Back to top Generated by DocFX | Copyright (c) 2018- The NUnit Project - Licensed under CC BY-NC-SA 4.0