Bug 43471 - pragma warning disable still shows warnings in "Errors" pad
Summary: pragma warning disable still shows warnings in "Errors" pad
Status: RESOLVED FIXED
Alias: None
Product: Compilers
Classification: Mono
Component: C# (show other bugs)
Version: 4.4.2 (C7SR1)
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2016-08-17 16:13 UTC by alan.spires
Modified: 2016-08-18 21:15 UTC (History)
3 users (show)

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


Attachments

Description alan.spires 2016-08-17 16:13:59 UTC
Example.

#pragma warning disable CS0162 // Unreachable code detected
   Some Code
#pragma warning restore CS0162 // Unreachable code detected


In Errors Pad:
Api.cs(21,21): Warning CS0162: Unreachable code detected (CS0162) (APP)





=== Xamarin Studio Business ===

Version 6.0.2 (build 73)
Installation UUID: 6af89f91-ac7c-424b-9d39-3b89f09f1ada
Runtime:
	Mono 4.4.2 (mono-4.4.0-branch-c7sr1/f72fe45) (64-bit)
	GTK+ 2.24.23 (Raleigh theme)

	Package version: 404020011

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.1.2.21 (Xamarin Business)
Android SDK: /Users/alan/Library/Developer/Xamarin/android-sdk-macosx
	Supported Android versions:
		4.0.3  (API level 15)
		4.3    (API level 18)
		4.4    (API level 19)
		4.4.87 (API level 20)
		5.0    (API level 21)
		5.1    (API level 22)
		6.0    (API level 23)

SDK Tools Version: 25.1.7
SDK Platform Tools Version: 24
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Version: 0.6.5
Location: /Applications/Xamarin Android Player.app

=== Apple Developer Tools ===

Xcode 7.3 (10183.3)
Build 7D175

=== Xamarin.iOS ===

Version: 9.8.2.22 (Xamarin Business)
Hash: f37444a
Branch: cycle7-sr1
Build date: 2016-07-28 12:17:02-0400

=== Xamarin.Mac ===

Version: 2.8.2.22 (Xamarin Business)

=== Build Information ===

Release ID: 600020073
Git revision: a6f7a24a9723a2d4f5d33c176615b0d44703ab5b
Build date: 2016-07-26 13:36:15-04
Xamarin addins: f5acb37866a0141bc5ddbe95118f18dae4014568
Build lane: monodevelop-lion-cycle7-sr1

=== Operating System ===

Mac OS X 10.11.6
Darwin Alans-MacBook-Pro.local 15.6.0 Darwin Kernel Version 15.6.0
    Thu Jun 23 18:25:34 PDT 2016
    root:xnu-3248.60.10~1/RELEASE_X86_64 x86_64
Comment 1 Matt Ward 2016-08-17 17:46:19 UTC
I suspect this is a compiler/xbuild difference compared with MSBuild on Windows. On the Mac you can remove the CS part of the warning code to fix the build warning:

#pragma warning disable 0162
   Some Code
#pragma warning restore 0162

Windows supports using CS0162 in the pragma this does not seem to work on the Mac.
Comment 2 Matt Ward 2016-08-17 17:56:42 UTC
MSBuild on Windows supports both formats for the code in the #pragma where as XBuild and MSBuild in Mono 4.4.2 does not.

Looking at the spec the CS part is optional.

https://msdn.microsoft.com/en-us/library/441722ys.aspx
Comment 3 alan.spires 2016-08-17 22:45:51 UTC
Ok but just to note. I was using the built in refactoring of Xam Studio to create those pragmas.
Comment 4 Matt Ward 2016-08-18 08:15:00 UTC
@Alan - Thanks. I have opened a separate bug #43501 for the code fix not generating a #pragma that works with Mono. This code fix may be coming from Roslyn so not sure if it is that easy to be fixed, but there is a separate bug report now logged against Xamarin Studio.
Comment 5 Marek Safar 2016-08-18 21:15:58 UTC
Fixed in master and Mono 4.6

Notice (2018-05-21): bugzilla.xamarin.com will be switching to read-only mode on Thursday, 2018-05-25 22:00 UTC.

Please join us on Visual Studio Developer Community and GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs and copy them to the new locations as needed for follow-up. The See Also field on each Bugzilla bug will be updated with a link to its new location when applicable.

After Bugzilla is read-only, if you have new information to add for a bug that does not yet have a matching issue on Developer Community or GitHub, you can create a follow-up issue in the new location. Copy and paste the title and description from this bug, and then add your new details. You can get a pre-formatted version of the title and description here:

In special cases you might also want the comments:

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.

Note You need to log in before you can comment on or make changes to this bug.