40c3f422c4
Closes #19505 We transform `[Preserve(AllMembers = true)]` into `[DynamicDependency(DynamicallyAccessedMemberTypes.All, typeof(T))]`. There is difference between which members are preserved in these two cases. The `DynamicallyAccessedMemberTypes.All` preserves many more, especially nested types and their members. This manifested with the `IL3050` AOT analysis warning we got from ILC when building any app: 1. `NSObject_Disposer` has `[Preserve(AllMembers = true)]` 2. `NSObject_Disposer` is a subclass of NSObject 3. `NSObject` has nested enums `Flags` and `XamarinGCHandleFlags` 4. the base class `Enum` has a public static method `GetValues(Type)` 5. the `GetValues` method is annotated with `RequiresDynamicCode` and ILC produces a warning because even though it isn't used anywhere in the codebase, it could be used via reflection I changed two things when transforming Preserve: - For enums, we only need to preserve public fields. We especially want to avoid `PublicMethods` since that would preserve public methods in the base class which includes the `GetValues(Type)` method. - For other types, I list explicitly the member types that should be preserved instead of using `All`. - The code is verbose, but in the end, I chose the explicit list instead of `All ^ PublicNestedTypes ^ NonPublicNestedTypes` since that would automatically include any new flag added to the enum in the future. |
||
---|---|---|
.config | ||
.github | ||
Localize | ||
builds | ||
docs | ||
dotnet | ||
eng | ||
external | ||
fsharp | ||
jenkins | ||
mk | ||
mono | ||
msbuild | ||
release | ||
runtime | ||
src | ||
tests | ||
tools | ||
.editorconfig | ||
.gitattributes | ||
.gitignore | ||
.gitmodules | ||
CODEOWNERS | ||
DOWNLOADS.md | ||
Directory.Build.props | ||
ISSUE_TEMPLATE.md | ||
LICENSE | ||
Make.config | ||
Make.versions | ||
Makefile | ||
NOTICE.txt | ||
NuGet.config | ||
README.md | ||
SECURITY.MD | ||
Versions-ios.plist.in | ||
Versions-mac.plist.in | ||
Xamarin.Mac.sln | ||
Xamarin.iOS.sln | ||
banner.png | ||
configure | ||
create-make-config.sh | ||
global.json | ||
mac-entitlements.plist | ||
product.snk | ||
system-dependencies.sh | ||
versions-check.csharp |
README.md
Xamarin.iOS & Xamarin.Mac
Welcome!
This module is the main repository for both Xamarin.iOS and Xamarin.Mac.
These SDKs allow us to create native iOS, tvOS, watchOS and macOS applications using the same UI controls we would in Objective-C and Xcode, except with the flexibility and elegance of a modern language (C#), the power of the .NET Base Class Library (BCL), and two first-class IDEs—Visual Studio for Mac and Visual Studio—at our fingertips.
This repository is where we do development for the Xamarin.iOS and Xamarin.Mac SDKs. There are a few ways that you can contribute, for example:
- Submit bugs and feature requests
- Review source code changes
- Submit pull requests to resolve issues and fix bugs
Contributing
If you are interested in fixing issues and contributing directly to the code base, please see the document How to Contribute, which covers the following:
- How to build and run from source
- The development workflow, including debugging and running tests
- Coding Guidelines
- Submitting pull requests
Downloads
The preferred method for installing Xamarin.iOS and Mac is to use the Visual Studio installers (Windows, Mac).
The team also strongly recommends using the latest Xamarin SDK and Xcode whenever possible.
However, we provide links to older Xamarin.iOS and Mac packages for macOS downgrades and build machine configuration, see Downloads.
Feedback
- Ask a question on Stack Overflow or the Xamarin Forums
- Request a new feature on GitHub
- Vote on existing feature requests
- Submit bugs to GitHub Issues
- Discuss development and design on Discord
License
Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.