question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warnings are not reported for repeated builds

See original GitHub issue

Steps to reproduce

  1. dotnet new classlib

  2. Change Class1.cs to:

    class C
    {
        async void M() {}
    }
    
  3. dotnet build

  4. dotnet build

Expected behavior

The second dotnet build prints the CS1998 warning, just like the first one.

Actual behavior

The second dotnet build does not print any warnings:

> dotnet build
Microsoft (R) Build Engine version 15.6.82.30579 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 87,92 ms for C:\code\tmp\hwapp\hwapp.csproj.
Class1.cs(3,16): 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. [C:\code\tmp\hwapp\hwapp.csproj]
  hwapp -> C:\code\tmp\hwapp\bin\Debug\netstandard2.0\hwapp.dll

Build succeeded.

Class1.cs(3,16): 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. [C:\code\tmp\hwapp\hwapp.csproj]
    1 Warning(s)
    0 Error(s)

Time Elapsed 00:00:02.37
> dotnet build
Microsoft (R) Build Engine version 15.6.82.30579 for .NET Core
Copyright (C) Microsoft Corporation. All rights reserved.

  Restore completed in 81,94 ms for C:\code\tmp\hwapp\hwapp.csproj.
  hwapp -> C:\code\tmp\hwapp\bin\Debug\netstandard2.0\hwapp.dll

Build succeeded.
    0 Warning(s)
    0 Error(s)

Time Elapsed 00:00:01.96

Environment data

dotnet --info output:

.NET Command Line Tools (2.1.300-preview2-008251)

Product Information: Version: 2.1.300-preview2-008251 Commit SHA-1 hash: 94fd3fd392

Runtime Environment: OS Name: Windows OS Version: 10.0.16299 OS Platform: Windows RID: win10-x64 Base Path: C:\Program Files\dotnet\sdk\2.1.300-preview2-008251\

Microsoft .NET Core Shared Framework Host

Version : 2.1.0-preview2-26131-06 Build : b13a0d5c331f374afd35ded57b9a4b4ab128864c

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
petermorlioncommented, Apr 16, 2018

I think you want to use the --no-incremental option, i.e.:

dotnet build --no-incremental

This does, however, mean a full rebuild.

0reactions
svickcommented, Mar 4, 2018
Read more comments on GitHub >

github_iconTop Results From Across the Web

Warnings are not reported for repeated builds · Issue #3046
Apparently, this happens because targets that are up to date are not re-run. Maybe warnings from previous builds could be saved somewhere and ......
Read more >
Analysis warning list updated only with rebuild-all
Using build compiles the modified files, then shows the warning list from the last rebuild all, regardless how the composition changed. To get ......
Read more >
Maven build [WARNING] we have a duplicate class
The shade plug in complained about duplicates since commons-io and commons-beansutil shared some common classes. Note that beansutiul was being ...
Read more >
6.8. Duplicate PV Warnings for Multipathed Devices
The following examples show a duplicate PV warning for two devices that are both multipath maps. In these examples we are not looking...
Read more >
dotnet build command - .NET CLI
The dotnet build command builds a project and all of its dependencies.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found