Bridges the worlds of .NET with the native APIs of macOS, iOS, tvOS, and watchOS.
Перейти к файлу
Jonathan Peppers 050453fa4b
[build] generate Errors.Designer.cs for runtime assemblies (#8763)
Fixes: https://github.com/xamarin/xamarin-macios/issues/8467
Fixes: https://github.com/xamarin/xamarin-macios/issues/8727

If you add this code to an `AppDelegate.cs`:

    [Export ("f:")]
    public void F (DateTime t) { }

This will cause an exception at runtime, on purpose.

Instead of the actual error string, you get:

    System.Resources.MissingManifestResourceException:
      Could not find any resources appropriate for the specified culture or the neutral culture.  Make sure "Errors.mtouch.resources" was correctly embedded or linked into assembly "Xamarin.iOS" at compile time, or that all the satellite assemblies required are loadable and fully signed.
      ...
      at Xamarin.Bundler.Errors.get_MT4102 () [0x00000] in tools/mtouch/Errors.Designer.cs:1582

In 00985a55, `mtouch/Errors.designer.cs` was added to various .NET
assemblies, so things would compile. Unfortunately, the `.resx` file
was not included as an `EmbeddedResource`.

*Compiled* `.resx` files are generated by MSBuild:

e3146f30df/src/Tasks/GenerateResource.cs

Or via `resgen.exe`:

https://docs.microsoft.com/dotnet/framework/resources/creating-resource-files-for-desktop-apps

Instead of using this, we could just generate `Errors.Designer.cs`
ourselves. I wrote a small `generate-errors.csharp` script that will
parse the `.resx` file generating `internal const` fields. This will
be more performant at runtime and work well with the linker. The `const`
strings will be compiled into the IL inline if done this way.

After doing this, I got the correct error message in VS for Mac:

    Could not register the assembly 'brokenlocalization': ObjCRuntime.RuntimeException: The registrar found an invalid type `System.DateTime` in signature for method `brokenlocalization.AppDelegate.F`. Use `Foundation.NSDate` instead.
      at Registrar.Registrar.ToSignature (System.Type type, Registrar.Registrar+ObjCMember member, System.Boolean& success, System.Boolean forProperty) [0x00380] in src/ObjCRuntime/Registrar.cs:2611
      at Registrar.Registrar.ComputeSignature (System.Type declaring_type, System.Boolean is_ctor, System.Type return_type, System.Type[] parameters, System.Reflection.MethodBase mi, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x00113] in src/ObjCRuntime/Registrar.cs:2526
      at Registrar.Registrar.ComputeSignature (System.Type DeclaringType, System.Reflection.MethodBase Method, Registrar.Registrar+ObjCMember member, System.Boolean isCategoryInstance, System.Boolean isBlockSignature) [0x00059] in src/ObjCRuntime/Registrar.cs:2492
      at Registrar.Registrar+ObjCMethod.ComputeSignature () [0x00000] in src/ObjCRuntime/Registrar.cs:923

Co-authored-by: Rolf Bjarne Kvinge <rolf@xamarin.com>
2020-06-05 17:27:57 +02:00
builds A few minor improvements to speed up rebuilds. (#8597) 2020-05-14 16:45:23 +02:00
docs [generator] Remove [RetainList] from generator-attributes and docs (#8746) 2020-06-03 20:15:43 -04:00
dotnet [dotnet-linker] Add support for passing configuration from the MSBuild targets to our linker steps. (#8780) 2020-06-05 16:04:53 +02:00
external Bump Touch.Unit. (#8724) 2020-06-02 16:04:16 +02:00
fsharp Add config file for libmono-native dllmap 2019-03-13 00:34:47 +01:00
jenkins [jenkins] Fix assumption in build-nugets.sh. (#8693) 2020-05-27 17:16:54 +02:00
mk [dotnet] Improve incremental builds in make. (#8754) 2020-06-04 16:39:19 +02:00
mono Add config file for libmono-native dllmap 2019-03-13 00:34:47 +01:00
msbuild [msbuild] Share the _DetectSdkLocations target. (#8755) 2020-06-05 17:08:02 +02:00
opentk [xcode11] Stop building/shipping 32-bit Xamarin.Mac bits. Partial fix for #6300. (#6393) 2019-07-15 10:19:24 -07:00
runtime [runtime] Remove Classic code. (#8720) 2020-06-02 08:18:24 +02:00
src [build] generate Errors.Designer.cs for runtime assemblies (#8763) 2020-06-05 17:27:57 +02:00
tests [dotnet] Detect, compile and publish Info.plist into the app. (#8752) 2020-06-05 14:47:54 +02:00
tools [mtouch] Remove empty comment tags from localization resx files. (#8781) 2020-06-05 17:08:36 +02:00
.editorconfig Add .editorconfig (#8058) 2020-03-10 11:24:46 -04:00
.gitignore [.gitignore] Ignore vscode settings dit. (#8747) 2020-06-03 18:40:22 -04:00
.gitmodules Merge xcode11 head 2019-06-12 00:44:31 -04:00
CODEOWNERS [CODEOWNERS] Update ownership. (#8771) 2020-06-04 21:11:14 -04:00
ISSUE_TEMPLATE.md Instruction to find the build logs (#6871) 2019-08-29 10:42:14 -04:00
LICENSE Adjust license to match requested format 2016-04-25 16:38:57 -04:00
Make.config [sharpie] Use a better CDN download link (#8766) 2020-06-04 20:19:25 -04:00
Make.versions [master] Merge Xcode11.5 Support and include provisionator changes (#8643) 2020-05-21 12:16:33 -04:00
Makefile A few minor improvements to speed up rebuilds. (#8597) 2020-05-14 16:45:23 +02:00
NuGet.config [Localization] Add generator error messages (#7531) 2020-01-08 16:07:46 -05:00
README.md Add d16-6 X.I/X.M links to our README (#8741) 2020-06-03 12:34:26 -04:00
SECURITY.MD Add SECURITY.MD to repo (as suggested by OSPO) (#7019) 2019-09-19 17:44:22 -04:00
Versions-ios.plist.in [master] Merge Xcode11.5 Support and include provisionator changes (#8643) 2020-05-21 12:16:33 -04:00
Versions-mac.plist.in Merge remote-tracking branch 'origin/xcode11' into master-xcode11 2019-09-13 18:35:18 +02:00
Xamarin.Mac.sln Fix path to dont link project in Xamarin.Mac.sln. (#8109) 2020-03-16 09:42:52 +01:00
Xamarin.iOS.sln [src] Use `Runtime.NSLog` instead of `System.Console.WriteLine` (#8626) 2020-05-20 13:38:44 -04:00
banner.png [README] Add Xamarin.iOS + Xamarin.Mac banner (#1665) 2017-02-08 17:42:48 -05:00
configure Only build dotnet/ if dotnet is enabled. (#8614) 2020-05-20 09:26:27 +02:00
mac-entitlements.plist Implement notarization. (#6928) 2019-09-09 00:34:11 -07:00
product.snk Add our mono runtimes to the build. 2016-04-24 14:47:24 -04:00
system-dependencies.sh [system-dependencies] Remove the 'com.apple.quarantine' attribute from the downloaded dotnet sdk. (#8617) 2020-05-20 15:04:10 +02:00
versions-check.csharp [Versions-ios.plist] watchOS started at 1.0 (#1328) 2016-12-13 10:52:58 +01:00

README.md

Xamarin.iOS + Xamarin.Mac logo

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:

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:

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.

Platform Link
Xamarin.iOS d16.6 13.18.2.1
Xamarin.Mac d16.6 6.18.2.1
Xamarin.iOS d16.5 13.16.0.13
Xamarin.Mac d16.5 6.16.0.13
Xamarin.iOS d16.4 13.10.0.21
Xamarin.Mac d16.4 6.10.0.21
Xamarin.iOS d16.3 13.6.0.12
Xamarin.Mac d16.3 6.6.0.12
Xamarin.iOS d16.2 12.14.0.114
Xamarin.Mac d16.2 5.14.0.114
Xamarin.iOS d16.1 12.10.0.157
Xamarin.Mac d16.1 5.10.0.157
Xamarin.iOS d16.0 12.8.0.2
Xamarin.Mac d16.0 5.8.0.0

Feedback

Gitter

License

Copyright (c) .NET Foundation Contributors. All rights reserved. Licensed under the MIT License.