[xamarin-analysis] Add rule #6 and updated md file (#3088)

- Add XIA0006: HttpClientAvoidManaged.
- Add documentation on how the rules work and how to activate them.
  Also mention that they need to be ran on each active configuration.
- Bump maccore to include XIA 0006.
This commit is contained in:
Vincent Dondain 2017-12-12 12:43:36 -05:00 коммит произвёл GitHub
Родитель 8899158260
Коммит 79e1d3613e
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
4 изменённых файлов: 29 добавлений и 11 удалений

Просмотреть файл

@ -3,18 +3,18 @@ WEBSITE_DOCS ?= $(TOP)/documentation
XAMARIN_ANALYSIS ?=$(TOP)/xamarin-analysis/shared/Xamarin.Analysis
XAMARIN_ANALYSIS_DOC = xamarin-analysis-doc-tool/bin/Debug
diff:
-diff -u $(WEBSITE_DOCS)/guides/ios/troubleshooting/mtouch-errors/index.md mtouch-errors.md
-diff -u $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/objective-c-libraries/index.md binding_objc_libs.md
-diff -u $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/binding-types-reference/index.md binding_types_reference_guide.md
-diff -u $(WEBSITE_DOCS)/guides/ios/troubleshooting/xamarin-ios-analysis/index.md xamarin-ios-analysis.md
all: xamarin-analysis-doc
cp mtouch-errors.md $(WEBSITE_DOCS)/guides/ios/troubleshooting/mtouch-errors/index.md
cp binding_objc_libs.md $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/objective-c-libraries/index.md
cp binding_types_reference_guide.md $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/binding-types-reference/index.md
cp xamarin-ios-analysis.md $(WEBSITE_DOCS)/guides/ios/troubleshooting/xamarin-ios-analysis/index.md
diff:
-diff -u $(WEBSITE_DOCS)/guides/ios/troubleshooting/mtouch-errors/index.md mtouch-errors.md
-diff -u $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/objective-c-libraries/index.md binding_objc_libs.md
-diff -u $(WEBSITE_DOCS)/guides/cross-platform/macios/binding/binding-types-reference/index.md binding_types_reference_guide.md
-diff -u $(WEBSITE_DOCS)/guides/ios/troubleshooting/xamarin-ios-analysis/index.md xamarin-ios-analysis.md
xamarin-analysis-doc:
msbuild xamarin-analysis-doc-tool/xamarin-analysis-doc.sln
mono $(XAMARIN_ANALYSIS_DOC)/xamarin-analysis-doc.exe $(XAMARIN_ANALYSIS)/Xamarin.iOS.Analysis.targets

Просмотреть файл

@ -37,6 +37,10 @@ namespace XamarinAnalysisDoc
section += "[//]: # (The original file resides under https://github.com/xamarin/xamarin-macios/tree/master/docs/website/)\n";
section += "[//]: # (This allows all contributors (including external) to submit, using a PR, updates to the documentation that match the tools changes)\n";
section += "[//]: # (Modifications outside of xamarin-macios/master will be lost on future updates)\n\n";
section += "Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available.\n\n";
section += "Run the analysis rules as often as possible to find possible improvements early on and save development time.\n\n";
section += "To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**.\n\n";
section += "> ⚠️ **NOTE:** Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations.\n\n";
var root = XDocument.Load (path);

Просмотреть файл

@ -1,13 +1,21 @@
---
id: C29B69F5-08E4-4DCC-831E-7FD692AB0886
title: "Xamarin.iOS Analysis Rules"
dateupdated: 2017-06-26
id: c29b69f5-08e4-4dcc-831e-7fd692ab0886
title: Xamarin.iOS Analysis Rules
dateupdated: 2017-12-07
---
[//]: # (The original file resides under https://github.com/xamarin/xamarin-macios/tree/master/docs/website/)
[//]: # (This allows all contributors (including external) to submit, using a PR, updates to the documentation that match the tools changes)
[//]: # (Modifications outside of xamarin-macios/master will be lost on future updates)
Xamarin.iOS analysis is a set of rules that check your project settings to help you determine if better/more optimized settings are available.
Run the analysis rules as often as possible to find possible improvements early on and save development time.
To run the rules, in Visual Studio for Mac's menu, select **Project > Run Code Analysis**.
> ⚠️ **NOTE:** Xamarin.iOS analysis only runs on your currently selected configuration. We highly recommend running the tool for debug **and** release configurations.
### <a name="XIA0001"/>XIA0001: DisabledLinkerRule
- **Problem:** The linker is disabled on device for the debug mode.
@ -31,5 +39,11 @@ To set it up, go to Project > iOS Build > Linker Behavior.
### <a name="XIA0005"/>XIA0005: Float32Rule
- **Problem:** Not using the float32 option (--aot-options=-O=float32) leads to hefty performance cost, specially on mobile, where double precision math is measurably slower. Note that .NET uses double precision internally, even for float, so enabling this option affects precision and, possibly, compatibility.
- **Problem:** Not using the float32 option (--aot-options=-O=float32) leads to hefty performance cost, especially on mobile, where double precision math is measurably slower. Note that .NET uses double precision internally, even for float, so enabling this option affects precision and, possibly, compatibility.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and uncheck the "Perform all 32-bit float operations as 64-bit float".
### <a name="XIA0006"/>XIA0006: HttpClientAvoidManaged
- **Problem:** We recommend using the native HttpClient handler instead of the managed one for better performance, smaller executable size, and to easily support the newer standards.
- **Fix:** Double click on your iOS project, go to Build > iOS Build and change the HttpClient implementation to either NSUrlSession (iOS 7+) or CFNetwork to support version preceding iOS 7.

Просмотреть файл

@ -1,5 +1,5 @@
ifdef ENABLE_XAMARIN
NEEDED_MACCORE_VERSION := c3913ff3ab308ab9aa741e0ccd3df602d5754ff5
NEEDED_MACCORE_VERSION := a2f9f44167c11f71ca9c210118fe88c69f4a1869
NEEDED_MACCORE_BRANCH := master
MACCORE_DIRECTORY := maccore