Bug 22745 - Compiler warnings do not appear in sequential builds without cleaning
Summary: Compiler warnings do not appear in sequential builds without cleaning
Status: RESOLVED INVALID
Alias: None
Product: Android
Classification: Xamarin
Component: MSBuild ()
Version: 4.16.0
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: ---
Assignee: Jonathan Pryor
URL:
Depends on:
Blocks:
 
Reported: 2014-09-08 11:56 UTC by Sean Pearl
Modified: 2014-09-08 12:53 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on Developer Community or GitHub with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED INVALID

Description Sean Pearl 2014-09-08 11:56:11 UTC
Overview:

When an application is built in the IDE or with xbuild in shell, a list of warnings typically appears in the Errors dialogue or at the end of standard output. However, if the build target is called again without cleaning the solution, those messages no longer appear. Cleaning and building, or just rebuilding, causes them to be output again.

Steps to reproduce:

xbuild /t:Build ~/Downloads/WarningsTest/WarningsTest.sln 
Confirm that the warning appears at the end of output.
Repeat the above command. Confirm that no warnings appear.

Expected result:

The compiler warnings should appear again in subsequent builds without cleaning the solution.

Platform:

Xamarin Studio
Version 5.3 (build 440)
Installation UUID: 47444c7f-ce4e-4ab9-a7c0-0e3b40968ddf
Runtime:
	Mono 3.8.0 ((no/45d0ba1)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 308000009

Xamarin.Android
Version: 4.16.0 (Business Edition)
Android SDK: /Library/Developer/adt-bundle-mac-x86_64-20140624/sdk
	Supported Android versions:
		2.1    (API level 7)
		2.2    (API level 8)
		2.3    (API level 10)
		3.0    (API level 11)
		3.1    (API level 12)
		3.2    (API level 13)
		4.0    (API level 14)
		4.0.3  (API level 15)
		4.1    (API level 16)
		4.2    (API level 17)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		4.5    (API level 21)
Java SDK: /usr
java version "1.7.0_67"
Java(TM) SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot(TM) 64-Bit Server VM (build 24.65-b04, mixed mode)
Comment 1 Sean Pearl 2014-09-08 12:14:16 UTC
I initially thought I wasn't seeing this with iOS apps, but they're definitely affected as well, along with just about any project type I try the above on.
Comment 2 Jonathan Pryor 2014-09-08 12:53:15 UTC
This isn't a Xamarin.Android bug/IDE; this is a Visual Studio feature.

Within Visual Studio:

1. Create a new Solution: File > New > Project... > Console Application > ...

2. Within the Solution panel, right-click the Solution name > Add > New Project... > Class Library > ...

3. Edit Class1.cs within the the project from (2), and add:

    #warning This is a warning.

4. Edit the Console Application project's References (from (1)), and add the project from (2).

5. Build the solution. One warning is produced, the one from (3).

6. Build the solution. The warning remains.

This appears to corroborate the behavior you want.

However:

7. Build the solution via MSBuild in CMD.EXE.

Result: no warnings:

The problem is that when a project's outputs are Up To Date, the project is not rebuilt, and since it's the act of building the project which generates the warnings, those warnings are "lost" unless preserved "elsewhere" (what Visual Studio appears to do) OR the project is rebuilt (the "clean and rebuild" case).

Rephrased into CMD.EXE terms, after creating the solution (steps 1-4):

    > msbuild.exe
    # generates 1 warning
    > msbuild.exe
    # generates 0 warnings

Xamarin Studio could plausibly cache generated warnings and re-display them on Build when the project is skipped, which is what Visual Studio appears to do, but this is outside the bounds/scope of Xamarin.Android's build system.