Bug 3764 - Would like compiler warnings when using API that is higher than my target
Summary: Would like compiler warnings when using API that is higher than my target
Alias: None
Product: iOS
Classification: Xamarin
Component: General ()
Version: master
Hardware: Macintosh Windows
: Normal enhancement
Target Milestone: Future Cycle (TBD)
Assignee: Bugzilla
Depends on:
Reported: 2012-03-06 02:31 UTC by John Hair
Modified: 2017-05-18 12:26 UTC (History)
5 users (show)

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 for Bug 3764 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description John Hair 2012-03-06 02:31:06 UTC
Feature Request
Id like to see compiler warnings (configurable) when using API that is for a higher version than I am targetting. I would then want to be able to break my build on warnings and then gracefully handle the lower functional ability of iOS 4 whilst still using the iOS 5 API. I can do this with extension methods with ignore warning flags, for example.

Example: Lets say Im using class1 that has a number of properties. class1.GetMeANumber() is marked as iOS 5 and above, but Im targeting iOS 4. 
If I use class1.GetMeANumber() I want my build to break on a warning, *except* where I specifically say its ok. That would mean Im totally aware of any API's Im using, and can offer appropriately reduced functionality where required.

Comment 1 Rolf Bjarne Kvinge [MSFT] 2016-03-16 11:04:51 UTC
@Jeff, isn't this something that should be done in the IDE using whatever source analysis is able to provide?
Comment 2 Jeffrey Stedfast 2016-03-16 11:10:39 UTC
I thought he wanted it to break the build?
Comment 3 Rolf Bjarne Kvinge [MSFT] 2016-03-16 11:14:27 UTC
You can configure source analysis to show errors instead of warnings.
Comment 5 Vincent Dondain [MSFT] 2017-05-18 12:26:24 UTC
We acknowledge this enhancement request, therefore marked it as CONFIRMED.

However this does not necessarily mean we will take actions on it as we still need to discuss its feasibility internally and make sure it is not conflicting with other features.

About feasibility for instance, the roslyn analyser current does not understand when a given API is covered by an availability check.