Bug 21325 - xbuild doesn't handle #pragma warning disable (result in syntax error)
Summary: xbuild doesn't handle #pragma warning disable (result in syntax error)
Status: RESOLVED FEATURE
Alias: None
Product: Compilers
Classification: Mono
Component: C# ()
Version: 3.2.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Marek Safar
URL:
Depends on:
Blocks:
 
Reported: 2014-07-15 04:20 UTC by benapetr
Modified: 2014-07-15 08:06 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 GitHub or Developer Community 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 FEATURE

Description benapetr 2014-07-15 04:20:28 UTC
I have this code which works perfectly everywhere else:

                #pragma warning disable
                if (Configuration.Window.RememberPosition)
                {
                    if (ID == null)
                    {
                        return;
                    }
                    if (!WindowInfo.ContainsKey(ID))
                    {
                        Core.DebugLog("Invalid key for window: " + ID);
                        return;
                    }
                    Info info = WindowInfo[ID];
                    info.X = this.Left;
                    info.Y = this.Top;
                    info.Width = this.Width;
                    info.Height = this.Height;
                }
                #pragma warning enable

but after I upgraded mono on my system (this happens now both on debian as well as ubuntu) I am getting errors from xbuild like this:

XBuild Engine Version 12.0
Mono, Version 3.2.8.0
Copyright (C) 2005-2013 Various Mono authors
GTK/PidgeonForm.cs(242,12): error CS1525: Unexpected symbol `catch'
GTK/PidgeonForm.cs(242,29): error CS1525: Unexpected symbol `fail'
GTK/PidgeonForm.cs(242,33): error CS1525: Unexpected symbol `)'
GTK/PidgeonForm.cs(248,8): error CS1524: Unexpected symbol `private', expecting `catch' or `finally'
GTK/PidgeonForm.cs(248,34): error CS1525: Unexpected symbol `(', expecting `catch' or `finally'
GTK/PidgeonForm.cs(250,27): error CS1525: Unexpected symbol `null', expecting `catch' or `finally'
Comment 1 benapetr 2014-07-15 04:21:40 UTC
removal of #pragma lines apparently fix the problem, but it should work, it does in visual studio and older xbuild / mono for sure
Comment 2 Marek Safar 2014-07-15 08:06:20 UTC
This is kind of expected.

"#pragma warning enable" is wrong syntax. You need to use #pragma warning restore.

Recent versions give better error message