Skip to content

Stop compiler warnings being written to stdout #657

@mcintyre321

Description

@mcintyre321

I've written a dotnet script which I'm using as part of a unix pipe chain.

A problem I'm finding is that if I leave some non-breaking code in the csx file, that throws a warning, e.g.

public async Task Foo()
{
    //no code in this method currently uses await, but I can't face refactoring all the 
    //task code out of existence as I'm probably going to use some await code in a minute
}

then

warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread.

will be written to StdOut, messing up my unix piping.

is there a way to suppress these warnings, or have them written to StdErr (which is ignored when piping)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions