Граф коммитов

3909 Коммитов

Автор SHA1 Сообщение Дата
Alex Soto dca6d79881
[generator] Teach generator about WrapAttribute on Getters and Setters (#3388)
* [generator] Teach generator about WrapAttribute on Getters and Setters

https://bugzilla.xamarin.com/show_bug.cgi?id=57870

`WrapAttribute` can now be used in property getters and setters,
this allows to Wrap virtually anything the way you need, for example
smart enums, consider the following API definition:

```csharp
// Smart enum.
enum PersonRelationship {
	[Field (null)]
	None,

	[Field ("FMFather", "__Internal")]
	Father,

	[Field ("FMMother", "__Internal")]
	Mother
}
```

```csharp
// Property definition.

[Export ("presenceType")]
NSString _PresenceType { get; set; }

PersonRelationship PresenceType {
	[Wrap ("PersonRelationshipExtensions.GetValue (_PresenceType)")]
	get;
	[Wrap ("_PresenceType = value.GetConstant ()")]
	set;
}
```

* Fix Feedback

* Fix doc error

* Update error message
2018-02-05 21:14:08 -06:00
Sebastien Pouliot e390fefe08
[linker] Mark all TypeConverter if TypeDescriptor is used. Fixes #3372 (#3396)
Moving to reference sources added a few, new converters so the existing
logic to preserve them was not complete.

This update the list of converters, sorted like the reference sources
(RS) for easier reviews.

It also adds:
* a canary test in "dont link" that will fail it the RS code change
or is replaced;
* more complete unit tests to ensure all cases works

https://github.com/xamarin/xamarin-macios/issues/3372
2018-02-05 21:19:46 -05:00
Rolf Bjarne Kvinge 9c2010e440
[registrar] Register models in the static registrar. (#3386)
* [registrar] Register models in the static registrar.

This also means we need to quiet a few types of warnings:.

* Models declares virtual methods of required protocol members. We don't
  export virtual methods (only when they're overridden are they exported),
  which results in numerous warnings about protocol members not being
  implemented:

        Xamarin.Mac.registrar.mobile.x86_64.m:37827:17: warning: method 'deviceBrowserView:selectionDidChange:' in protocol 'IKDeviceBrowserViewDelegate' not implemented [-Wprotocol]
        @implementation ImageKit_IKDeviceBrowserView__IKDeviceBrowserViewDelegate {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/Quartz.framework/Frameworks/ImageKit.framework/Headers/IKDeviceBrowserView.h:29:1: note: method 'deviceBrowserView:selectionDidChange:' declared here
        - (void)deviceBrowserView: (IKDeviceBrowserView *)deviceBrowserView selectionDidChange: (ICDevice *)device;

* These two are the same as above, just for properties instead of methods.

        Xamarin.Mac.registrar.mobile.x86_64.m:31988:17: warning: auto property synthesis will not synthesize property 'boundingMapRect' declared in protocol 'MKOverlay' [-Wobjc-protocol-property-synthesis]
        @implementation MKOverlay {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/MapKit.framework/Headers/MKOverlay.h:24:43: note: property declared here
        @property (nonatomic, readonly) MKMapRect boundingMapRect;
                                                  ^
        Xamarin.Mac.registrar.mobile.x86_64.m:32002:1: note: add a '@synthesize' directive
        @end
        ^

        Xamarin.Mac.registrar.mobile.i386.m:28957:17: warning: property 'repeatCount' requires method 'repeatCount' to be defined - use @synthesize, @dynamic or provide a method implementation in this class implementation [-Wobjc-property-implementation]
        @implementation CAMediaTiming {
                        ^
        /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/QuartzCore.framework/Headers/CAMediaTiming.h:58:17: note: property declared here
        @property float repeatCount;
                ^

* [AVFoundation] Special-case AVCaptureDataOutputSynchronizer[Delegate] in the registrar for macOS.

This class and protocol were incorrectly added to our macOS bindings, but
since we can't remove them because it would break backwards compatibility, we
must skip them manually in the registrar, since the registrar would otherwise
produce uncompilable code:

    In file included from Xamarin.Mac.registrar.full.x86_64.m:2:
    ./Xamarin.Mac.registrar.full.x86_64.h:2929:63: error: 'AVCaptureDataOutputSynchronizerDelegate' is unavailable: not available on macOS
    @interface AVCaptureDataOutputSynchronizerDelegate : NSObject<AVCaptureDataOutputSynchronizerDelegate> {
                                                                  ^
    /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/System/Library/Frameworks/AVFoundation.framework/Headers/AVCaptureDataOutputSynchronizer.h:101:11: note: 'AVCaptureDataOutputSynchronizerDelegate' has been explicitly marked unavailable here
    @protocol AVCaptureDataOutputSynchronizerDelegate <NSObject>
              ^
    In file included from Xamarin.Mac.registrar.mobile.x86_64.m:2:
    ./Xamarin.Mac.registrar.mobile.x86_64.h:3370:63: error: 'AVCaptureDataOutputSynchronizerDelegate' is unavailable: not available on macOS
    @interface AVCaptureDataOutputSynchronizerDelegate : NSObject<AVCaptureDataOutputSynchronizerDelegate> {

* [AVFoundation] Stub out AVCaptureDataOutputSynchronizer[Delegate] on macOS.

AVCaptureDataOutputSynchronizer[Delegate] were incorrectly added to our macOS
bindings, which makes the static registrar's life difficult. So remove those
bindings, and re-implemented them as normal classes, without any attributes,
which makes the static registrar ignore them (to a certain extent: enough to
not generate uncompilable code at least).

* [registrar] Remove more model exclusion code.

* [xtro] Update ignored entries.
2018-02-05 22:19:34 +01:00
Chris Hamons c0202e0e2b
PMCS Removal (#3197)
You were the preprocessor we wished C# had natively

Removing PMCS requires these changes:
* Remove XamCore from src/
* Remove XamCore from tools/
* Remove XamCore from runtime/
* nint/nuint enum conversion
* _compat_ enum conversion
* NSAction conversion
* Hand fix single API incorrectly converted by PMCS to unbreak compatibility
   - Due to a bug in PMCS, the nuint was incorrectly converted in this API.
   - However, as that ship as sailed, we must "fix" it until XAMCORE_4_0
* Update readme
* Bump macios-binaries
2018-02-05 10:26:29 -05:00
Rolf Bjarne Kvinge 597be76231
[ObjCRuntime] Add [Flags] to the InitializationFlags enum. (#3390)
After all, that's what it is.
2018-02-05 15:58:59 +01:00
Rolf Bjarne Kvinge 6b5870d668
[tests] Move linker tests to match introspection directory layout. (#3365)
* [tests] Move linker tests to match introspection directory layout.

Move linker tests to match introspectio directory layout: tests/linker/ios and
tests/linker/mac instead of tests/linker-ios and tests/linker-mac.

This creates a logical place for shared linker files (tests/linker).

* [tests] Fix path to GuiUnit_NET_4_5.csproj in sln as well.

This is the path used to find referenced projects when building Classic.

Fixes this build problem:

    warning: Referenced project 'GuiUnit_NET_4_5' not found in the solution.
    /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/common/mac/MacTestMain.cs(11,7) : error CS0246: The type or namespace name `GuiUnit' could not be found. Are you missing an assembly reference?
    /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/common/mac/MacTestMain.cs(64,42) : error CS0246: The type or namespace name `IMainLoopIntegration' could not be found. Are you missing an assembly reference?
    /Users/builder/jenkins/workspace/xamarin-macios-pr-builder/tests/common/mac/MacTestMain.cs(75,34) : error CS0246: The type or namespace name `InvokerHelper' could not be found. Are you missing an assembly reference?
2018-02-05 15:09:04 +01:00
Rolf Bjarne Kvinge 5319266503
[static registrar] Compute the conversion methods for smart enums and embed those as token references in the generated code. (#3385)
Converting to and from smart enums and their corresponding native value
requires knowing the conversion function, since each smart enum has its own
conversion function.

The dynamic registrar can do this at runtime, but it's something that can be
computed in the static registrar at build time, so do that. The static
registrar will now embed the metadata token (as a token reference) in the
generated code, which can be used at runtime to find the conversion method,
without requiring anything from dynamic registrar.

This requires some refactoring in the conversion methods to allow passing more
information around (the `context` parameter in the conversion functions, which
the smart enum conversion methods now use for the token reference).

It turns out this is a massive improvement (although the scenarios where this
is relevant are rare): a simple test case [1] is 300x faster (from ~30s to
0.1s).

[1]: https://gist.github.com/rolfbjarne/961af28d1c2727b256fbcdfd6aa65e98
2018-02-05 07:54:13 +01:00
Sebastien Pouliot bec116c273
Bump mono to 2010-10 head (#3384)
This fix #3241 on master (already bumped on 15.6)

Commit list for mono/mono:

* mono/mono@38502063ca Revert "[mini] Align stack when resuming to catch handler" (#6744)
* mono/mono@3c3e692887 Bump linker

Diff: ab882c0c3d...38502063ca
2018-02-02 14:50:50 -05:00
Rolf Bjarne Kvinge 98edb545c9
[xharness] Store a computed make variable in a temporary variable to avoid computing it many times. (#3382)
This makes `make` in (with nothing to do) run 18x faster in tests/ (from 1.3s to 0.07s).
2018-02-02 17:17:59 +01:00
Rolf Bjarne Kvinge 15c44504ad
[generator] The generated block code is also generated, so add the corresponding attributes. (#3381)
Generator diff: https://gist.github.com/rolfbjarne/269ab7f24060ccd844fa1c140f43fec8
2018-02-02 17:17:26 +01:00
Rolf Bjarne Kvinge 1a260e542b
[tests] Build the native test library for macOS and create a binding project for it. (#3373)
* [tests] Build the native test library for macOS and create a binding project for it.

Also add the new binding project to the xammac and link all XM test projects,
which allows us to stop excluding tests that require the native library and
the corresponding bindings.

* [tests] Include more tests in xammac_tests.

* [tests] Correctly ignore the ObjC exception tests in release mode.
2018-02-02 11:14:44 +01:00
Rolf Bjarne Kvinge f905427739
[tests] Share supporting code between the mtouch and mmp tests. (#3374)
* [tests] Share supporting code between the mtouch and mmp tests.

Create a new class 'BundlerTool', which now contains most of the code in
MTouchTool that's also applicable to mmp (and the new MmpTool class).

This will make it easier to share tests between the mtouch and mmp tests.

Some tweaks are still probably required, but this should get us most of the
way.

* [tests] Fix generator tests after changes in shared test code.

* [tests] Add new file to the MSBuild/XM tests.
2018-02-02 07:09:04 +01:00
Rolf Bjarne Kvinge 32ea9bd930
[tests] Fix compiler warning. (#3375)
This file is included in several projects, some projects use property, some
don't (and report the warning). There's no harm in not setting this property
(it's expected), ignore the warning.
2018-02-01 19:07:23 +01:00
Rolf Bjarne Kvinge 83c8ba688a
[tests] Enable LLVM for all Release|Device configurations. (#3376)
This won't affect device tests on the bots (because those already set LLVM
manually when testing Release), but it becomes less confusing when trying to
reproduce any problems locally, since now the project configuration on disk
matches the tested configuration.
2018-02-01 17:59:40 +01:00
Rolf Bjarne Kvinge c3560bf726
[mmptest] Fix compiler warning by not including code we get from a reference. (#3366)
Fixes this:

    tests/common/mac/ProjectTestHelpers.cs(154,22): warning CS0436: The type 'StringUtils' in 'tests/mmptest/../../tools/common/StringUtils.cs' conflicts with the imported type 'StringUtils' in 'mmp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'tests/mmptest/../../tools/common/StringUtils.cs'.
    tests/common/Configuration.cs(162,53): warning CS0436: The type 'StringUtils' in 'tests/mmptest/../../tools/common/StringUtils.cs' conflicts with the imported type 'StringUtils' in 'mmp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null'. Using the type defined in 'tests/mmptest/../../tools/common/StringUtils.cs'.
2018-02-01 07:35:35 +01:00
Rolf Bjarne Kvinge 83b81ca9f4
[Foundation] Simplify NSValue code to use [No*] instead of ifdefs. (#3364)
* [Foundation] Simplify NSValue code to use [No*] instead of ifdefs.

Also enable the MKCoordinateSpan and CLLocationCoordinate2D values for NSValue
in macOS, since they're now available (since macOS 10.9).

    Type Changed: Foundation.NSValue

    Added properties:

        public virtual MapKit.MKCoordinateSpan CoordinateSpanValue { get; }
        public virtual CoreLocation.CLLocationCoordinate2D CoordinateValue { get; }

* [Foundation] Mark the new NSValue selectors as 64-bit only.
2018-02-01 07:31:52 +01:00
Jeffrey Stedfast a61c7dc2ca
[msbuild] Use the proper MM vs MT error code prefix (#3360)
* [msbuild] Use the proper MM vs MT error code prefix

* Removed unused variable (artifact of debugging)
2018-01-31 09:56:45 -05:00
Rolf Bjarne Kvinge 48813af819
[generator] Ensure we don't generate code that creates pointers to local variables that then go out of scope. (#3362)
Instead of generating the following:

    var converted = IntPtr.Zero;
    if (value.HasValue) {
    	var v = value.Value;
    	converted = new IntPtr (&v);
    }
    // now 'converted' points to a local variable that is out of scope

do this:

    var converted = IntPtr.Zero;
    var v = default (float);
    if (value.HasValue) {
    	v = value.Value;
    	converted = new IntPtr (&v);
    }
    // now 'converted' points to a local variable that's still in scope

so that we don't store a pointer to a local variable and use that pointer
after the local variable has gone out of scope.

I'm not entirely sure this really is a problem in C#, but it doesn't hurt to
be on the safe side.

Also add newlines to the generated code to make it look nicer.

Generator diff: https://gist.github.com/rolfbjarne/225d920b7fa28d07fbeab13754cebd2a
2018-01-31 14:57:33 +01:00
Rolf Bjarne Kvinge 6fc7b1ea89
[tests] Run dont link, link all and link sdk tests in both Debug and Release in the simulator. Fixes #53181. (#3363)
* [xharness] Add support for running XI projects with different platform configurations.

* [xharness] Run dont link, link all and link sdk tests in both Debug and Release in the simulator. Fixes #53181.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=53181.

* [tests] Fix dont link to always optimize C# code in release mode.

* [tests] No need to weak link GameController anymore in dont link.

This was removed long ago from the Debug configurations, so remove it from the
Release configuration as well.
2018-01-31 14:56:22 +01:00
Jeffrey Stedfast cb51d9364d
[msbuild] Removed old logging conven ience method (#3352) 2018-01-30 13:51:01 -05:00
Rolf Bjarne Kvinge b632c2348e
[xharness] Don't discriminate iPods, they can be useful too. (#3355) 2018-01-30 17:11:04 +01:00
Rolf Bjarne Kvinge f786a88636
[tests] Make linker-ios tests look like they're from this century. (#3356) 2018-01-30 17:10:54 +01:00
Rolf Bjarne Kvinge 52c1a6127a
[AVFoundation] Mark NSExtensionRequestHandling as 64-bit only. (#3334)
* [AVFoundation] Mark NSExtensionRequestHandling as 64-bit only.

The correct binding already existed, but for some reason it was
incorrectly duplicated/readded and marked as available in 32-bit here:
https://github.com/xamarin/xamarin-macios/commit/ca028ea15#diff-7ea102419ab3567d665e35d010e90a58R11401

So simplify the bindings by removing the incorrect version.

* [Foundation] Remove superfluous availability attribute.
2018-01-30 10:28:21 +01:00
Vincent Dondain 12a5e429e8
[avfoundation] Fix AVAudioUnitComponentManager default .ctor crash (#3314) (#3351)
It looks like this should not have been bound since there's a singleton-like static property to use the type.
Keeping binary compatibility.

- Fixes github issue #3303: AVAudioUnitComponentManager default .ctor can crash on macOS 10.13.3
(https://github.com/xamarin/xamarin-macios/issues/3303)
2018-01-29 14:32:30 -05:00
Marius Ungureanu 5d50f81cb8 [runtime] Use mono's runtime default to load config files when it's not embedded (#3290)
* [Launcher] Don't set the configuration dir to the bundle

When using system-mono launcher, do not make mono probe for
configuration files in the bundle, but rather rely on the
default behaviour of system mono resolving it to /etc/mono

* Update comments
2018-01-29 16:58:33 +01:00
Rolf Bjarne Kvinge 018f715344
[xharness] Ask mono to not attach gdb/ldb when XM tests crash. (#3307)
* [xharness] Ask mono to not attach gdb/ldb when XM tests crash.

Attaching gdb/ldb usually hangs, thus causing the test run to time out instead
of finishing early (due to the crash).

Also bump the timeout for finding crash reports to 60 seconds when the tests
crash, since macOS can be quite slow to create the crash report.

* [xharness] Timestamp mac logs to aid diagnostics.
2018-01-29 11:27:43 +01:00
Rolf Bjarne Kvinge fa2f6dc207
[ObjCRuntime] Remove unused functions. (#3337) 2018-01-29 11:23:48 +01:00
Rolf Bjarne Kvinge b3bb59d42b
[registrar] Don't skip CoreNFC types. (#3332)
It seems Apple started shipping CoreNFC headers some time (in a later beta)
after we first implemented (which was Xcode 9 beta 1).

Xcode 9.0, 9.1 and 9.2 all contain the exact same NFC headers (CoreNFC was
introduced with Xcode), so no version checks should be needed when removing
this exclusion.
2018-01-29 11:09:18 +01:00
Rolf Bjarne Kvinge 779dffcb7c
[registrar] watchOS got headers for GameKit in watchOS 3.2 (#3333)
See https://trello.com/c/Okdw58IO/51-27476259-gamekit-header-files-are-missing-for-watchsimulator
2018-01-29 11:08:30 +01:00
Curtis Wensley 3a493154a5 Make NSScreen nullable in NSWindow.ConstrainFrameRect (#3335)
When overriding this method, the framework can feed us a null screen, e.g. when calling `NSWindow.SetFrame()`

An example stack trace:

```
2018-01-26 10:08:17.580 Rhinoceros[2975:238051] System.ArgumentNullException: Value cannot be null.
Parameter name: screen
  at AppKit.NSWindow.ConstrainFrameRect (CoreGraphics.CGRect frameRect, AppKit.NSScreen screen) [0x0000c] in <5dd442fafc4842c391a0a802c0c12c43>:0 
  at System.Windows.Forms.FormHelper.ConstrainFrameRect (CoreGraphics.CGRect frameRect, AppKit.NSScreen screen) [0x00017] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:85 
--- End of stack trace from previous location where exception was thrown ---
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSendSuper_CGRect_bool (intptr,intptr,CoreGraphics.CGRect,bool)
  at AppKit.NSWindow.SetFrame (CoreGraphics.CGRect frameRect, System.Boolean display) [0x00031] in <5dd442fafc4842c391a0a802c0c12c43>:0 
  at System.Windows.Forms.Form.UpdateBounds (AppKit.NSView super) [0x00055] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:529 
  at System.Windows.Forms.Control.SetBoundsInternal (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height) [0x0001c] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.Cocoa.cs:570 
  at System.Windows.Forms.Control.SetBounds (System.Int32 x, System.Int32 y, System.Int32 width, System.Int32 height, System.Windows.Forms.BoundsSpecified specified) [0x0005a] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.cs:2370 
  at System.Windows.Forms.Control.set_Location (System.Drawing.Point value) [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.cs:1483 
  at System.Windows.Forms.Form.set_Location (System.Drawing.Point value) [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cs:3179 
  at Grasshopper.GUI.GH_DocumentEditor.RestoreDialogPositionData () [0x0006d] in /Users/curtis/Projects/McNeel/rhino/src4/rhino4/Plug-ins/Grasshopper_osx/Grasshopper/GUI/GH_DocumentEditor.cs:168 
  at Grasshopper.GUI.GH_DocumentEditor.DocumentEditorFormLoad (System.Object sender, System.EventArgs e) [0x0002d] in /Users/curtis/Projects/McNeel/rhino/src4/rhino4/Plug-ins/Grasshopper_osx/Grasshopper/GUI/GH_DocumentEditor.cs:60 
  at System.Windows.Forms.Form.OnLoad (System.EventArgs e) [0x0001f] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cs:2146 
  at System.Windows.Forms.Form.CallLoad () [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:583 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:CallLoad ()
  at System.Windows.Forms.FormHelper.CallLoad () [0x0000f] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:134 
  at System.Windows.Forms.FormHelper.BecomeKeyWindow () [0x00008] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:146 
--- End of stack trace from previous location where exception was thrown ---
  at (wrapper managed-to-native) ObjCRuntime.Messaging:void_objc_msgSendSuper_bool (intptr,intptr,bool)
  at AppKit.NSWindow.set_IsVisible (System.Boolean value) [0x00030] in <5dd442fafc4842c391a0a802c0c12c43>:0 
  at System.Windows.Forms.Form.set_VisibleInternal (System.Boolean value) [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:486 
  at System.Windows.Forms.Control.set_Visible (System.Boolean value) [0x00012] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.Cocoa.cs:1348 
  at System.Windows.Forms.Control.InternalShow () [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.cs:2377 
  at System.Windows.Forms.Form.InternalShow () [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:367 
  at System.Windows.Forms.Control.Show () [0x00001] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Control.cs:2382 
  at System.Windows.Forms.Form.Show (System.Windows.Forms.IWin32Window parent) [0x000ad] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/MonoMac.Windows.Form/MonoMac.Windows.Forms/System.Windows.Forms/Form.cocoa.cs:416 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:Show (System.Windows.Forms.IWin32Window)
  at Grasshopper.Plugin.Commands.ShowGrasshopperEditor (System.Boolean showUponLoad) [0x001ee] in /Users/curtis/Projects/McNeel/rhino/src4/rhino4/Plug-ins/Grasshopper_osx/Grasshopper/Plugin/GH_GrasshopperCommands.cs:73 
  at Grasshopper.Plugin.Commands.Run_Grasshopper () [0x0001f] in /Users/curtis/Projects/McNeel/rhino/src4/rhino4/Plug-ins/Grasshopper_osx/Grasshopper/Plugin/GH_GrasshopperCommands.cs:139 
  at GrasshopperPlugin.GrasshopperCommand.RunCommand (Rhino.RhinoDoc doc, Rhino.Commands.RunMode mode) [0x00010] in /Users/curtis/Projects/McNeel/rhino/src4/rhino4/Plug-ins/Grasshopper_osx/GrasshopperPlugin/GrasshopperCommands.cs:17 
  at Rhino.Commands.Command.OnRunCommand (System.Int32 commandSerialNumber, System.UInt32 docSerialNumber, System.Int32 mode) [0x00035] in /Users/curtis/Projects/McNeel/rhino/src4/DotNetSDK/rhinocommon/dotnet/rhino/rhinosdkcommand.cs:311 
```
2018-01-29 11:02:33 +01:00
Jeffrey Stedfast d86b0822a4 [msbuild] Always codesign libraries and frameworks (#3341)
Fixes issue #3289
2018-01-29 10:56:03 +01:00
Rolf Bjarne Kvinge a3b425bf97
[AVFoundation] Remove AVCaptureDataOutputSynchronizer[Delegate] from macOS. (#3336)
This class and protocol were incorrectly added to our macOS bindings.

The catch is that we can't remove them because it would break backwards
compatibility, so mark them for removal in XAMCORE_4_0.
2018-01-29 07:39:06 +01:00
Rolf Bjarne Kvinge b2bcad7a94
Add a BindingImpl attribute and use to to teach the linker look for it to search for optimizable code. (#3299)
* [ObjCRuntime] Add a BindingImplAttribute.

* [linker] Make ProviderToString an extension method on ICustomAttributeProvider to make it more discoverable.

* [generator] Use [BindingImpl] instead of [CompilerGenerated].

The entire diff is big (89MB), so it can't be gisted. However, most of it is
either removal of `using System.Runtime.CompilerServices;` or the change from
`[CompilerGenerated]` to `[BindingImpl (...)]` like this:
https://gist.github.com/rolfbjarne/8bfda3ed37b956d0342a1c1e9b079244

If I remove those parts of the diff, there's nothing significant left:
https://gist.github.com/rolfbjarne/4156164d6bdb1376366200394eb8a091

* [linker] Teach the linker about the new [BindingImpl] attribute.

In addition to the existing logic where the linker would optimize some
[CompilerGenerated] code (sometimes with additional requirements), it will now
also optimize all [BindingImpl (Optimizable)] code (without any additional
requirements).

* [tests] Add tests to make sure [BindingImpl (Optimizable)] works as expected.

* [linker] Check for [BindingImpl] before [CompilerGenerated] and stop checking for [CompilerGenerated] in XAMCORE_4_0.

Check for [BindingImpl] before checking for [CompilerGenerated], since the
former is more common.

Also stop checking for [CompilerGenerated] (at least to mean that code is
optimizable) in our next non-compatible evolutionary leap (XAMCORE_4_0):

* [introspection] Impl a better typo check.
2018-01-26 18:38:23 +01:00
Rolf Bjarne Kvinge f0b2c254c7
[registrar] Merge the SharedStatic class into the StaticRegistrar class. (#3309)
The SharedStatic class is a leftover from when there were two static
registrars: the old one (OldStaticRegistrar) and the new one
(StaticRegistrar).

Since there's only one static registrar left (the old one died some time ago),
all the SharedStatic code can be put into the StaticRegistrar class.

There are no functional changes in this PR, only this refactoring.
2018-01-26 07:48:42 +01:00
Rolf Bjarne Kvinge 7d0c4d5b09
[tests] Skip High Sierra image filters in Classic tests. Fixes #622. (#3308)
Skip High Sierra image filters in Classic introspection tests, since the
Classic bindings won't be updated.

https://github.com/xamarin/maccore/issues/622
2018-01-26 07:46:54 +01:00
Rolf Bjarne Kvinge 61d3d399c8
[xharness] Don't try to parse inexistent or empty files. (#3306) 2018-01-26 07:39:05 +01:00
Marius Ungureanu b7230a1176 [Mmp] Allow multiple assemblies to be passed to generate the registrar (#3129)
By convention, the first assembly is the target platform assembly

* Add support for recursive extra search directories.
2018-01-25 19:57:44 -05:00
Rolf Bjarne Kvinge 8fb757fec6
[tests] Allow 11 frameworks in linked XM apps. Fixes maccore GH #615. (#3302)
Fixes this test failure:

    1) Failed : Xamarin.MMP.Tests.MMPTests.UnifiedWithLinking_ShouldHaveFewFrameworkClangLines
      Found more framework entries in clang invocation then expected - Foundation AppKit QuartzCore CoreData Quartz CoreFoundation CoreServices Security Carbon CloudKit
    		xcrun -sdk macosx clang -mmacosx-version-min=10.7 -arch x86_64 -fobjc-runtime=macosx -Wno-unguarded-availability-new -ObjC -framework Foundation -framework AppKit -framework QuartzCore -framework CoreData -framework Quartz -framework CoreFoundation -framework CoreServices -framework Security -framework Carbon -weak_framework CloudKit -u _xamarin_timezone_get_data -u _xamarin_get_block_descriptor /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/libxammac.a -o /work/maccore/master/xamarin-macios/tests/mmptest/bin/Debug/tmp-test-dir/Xamarin.MMP.Tests.MMPTests.RunMMPTest/bin/Debug/UnifiedExample.app/Contents/MacOS/UnifiedExample -D_THREAD_SAFE -I/work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/pkgconfig/../../include/mono-2.0   /work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/lib/pkgconfig/../../lib/libmonosgen-2.0.a -liconv -x objective-c++ -I/work/maccore/master/xamarin-macios/_mac-build/Library/Frameworks/Xamarin.Mac.framework/Versions/Current/include /work/maccore/master/xamarin-macios/tests/mmptest/bin/Debug/tmp-test-dir/Xamarin.MMP.Tests.MMPTests.RunMMPTest/obj/Debug/mmp-cache/registrar.m -fno-caret-diagnostics -fno-diagnostics-fixit-info -isysroot /Applications/Xcode92.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk /work/maccore/master/xamarin-macios/tests/mmptest/bin/Debug/tmp-test-dir/Xamarin.MMP.Tests.MMPTests.RunMMPTest/obj/Debug/mmp-cache/main.m
      Expected: less than 10
      But was:  10

This regressed in 4da8016db4, where new API is
partially unremovable by the linker, and as such causes XM to link with more
frameworks at build time.

This is expected, so change the test to accept more frameworks (11).

Fixes https://github.com/xamarin/maccore/issues/615.
2018-01-25 17:59:19 +01:00
Rolf Bjarne Kvinge 3910c7943a
[tests] Fix apitest to ignore CoreSpotlight on 32-bit since it's 64-bit only. (#3300)
Fixes this test failure on High Sierra:

    Xamarin.Mac.Tests.EveryFrameworkSmokeTests.ExpectedLibrariesAreLoaded: CoreSpotlightLibrary (/System/Library/Frameworks/CoreSpotlight.framework/CoreSpotlight) failed to load but this was not expected
2018-01-25 17:55:51 +01:00
Rolf Bjarne Kvinge b1d3a9109b
[registrar] Don't skip models when registering assemblies. (#3301)
Unfortunately models are not abstract, and users can create instances of them.
This means that the type must be registered - and that's exactly what happens
when the app tries to create such an instance: the dynamic registrar will
register it.

However, previously we didn't register the type when registering all the types
in an assembly, the type would only be registered when it was needed. This
prevents the static registrar from registering it, and it always ends up using
the dynamic registrar, which means the dynamic registrar will always be
required.

By not excluding models when registering all types in an assembly these types
are also included in the generated code from the static registrar, and we're
one step closer to being able to remove the dynamic registrar when using the
static registrar.
2018-01-25 15:45:12 +01:00
Manuel de la Pena b35b479cea
[Harness] Add the System.IdentityModel bcl tests. (#3295) 2018-01-25 10:19:41 +01:00
Rolf Bjarne Kvinge 90a2ac27b1
[linker] Implement a generic method of storing attributes the linker removes. (#3280)
* [linker] Implement a generic method of storing attributes that may be removed by the linker.

Implement a generic method of storing attributes that may be removed by the
linker, so that those attributes can be accessed after the linker has linked
them away.

* [linker] Store availability attributes using the new generic location.

* [linker] Store the CompilerGenerated attribute using the new generic location.
2018-01-24 15:58:47 +01:00
Rolf Bjarne Kvinge 45e01cf36b
[docs] Fix typo (MM -> MT). (#3293) 2018-01-24 15:58:25 +01:00
Manuel de la Pena 35806edb5a
[Harness] Add System.ServiceModel tests to the bcl tests. (#3238)
* [Harness] Add System.ServiceModel tests from the bcl.
2018-01-24 12:56:20 +01:00
Rolf Bjarne Kvinge 98993c467a
Update docs about build optimizations. (#3285)
* Show final link to official documentation in error help.
* Add makefile targets to copy docs to the documentation repo.
2018-01-24 07:26:09 +01:00
Rolf Bjarne Kvinge 03d78d13f3
[tests][mtouch] Simplify code to fetch symbols from a binary (nm). (#3286)
Simplify/refactor code to fetch symbols from a binary to reuse an existing
function instead of manually calling `nm` every time.
2018-01-24 00:31:32 +01:00
Rolf Bjarne Kvinge 77aac2ceef
[tests] Package linker tests too for the packaged XM tests. (#3287)
Make sure to package the linker tests when packaging XM tests (this broke
recently because the dontlink tests were moved).

Fixes this problem when running the packaged tests:

    make[2]: linker-mac/dont link/bin/x86/Debug/dont link.app/Contents/MacOS/dont link: No such file or directory
    make[2]: *** [exec-mac-classic-dont link] Error 1
    make[2]: linker-mac/dont link/bin/x86/Debug-unified/dont link.app/Contents/MacOS/dont link: No such file or directory
    make[2]: *** [exec-mac-unified-dont link] Error 1
    make[2]: linker-mac/dont link/bin/x86/Debug-unifiedXM45/dont link.app/Contents/MacOS/dont link: No such file or directory
    make[2]: *** [exec-mac-unifiedXM45-dont link] Error 1
    make[2]: linker-mac/dont link/bin/x86/Debug-unified-32/dont link.app/Contents/MacOS/dont link: No such file or directory
    make[2]: *** [exec-mac-unified32-dont link] Error 1
    make[2]: linker-mac/dont link/bin/x86/Debug-unifiedXM45-32/dont link.app/Contents/MacOS/dont link: No such file or directory
    make[2]: *** [exec-mac-unifiedXM4532-dont link] Error 1
    exec-mac-classic-dont\ link failed
    exec-mac-unified-dont\ link failed
    exec-mac-unifiedXM45-dont\ link failed
    exec-mac-unified32-dont\ link failed
    exec-mac-unifiedXM4532-dont\ link failed
    make[1]: *** [exec-mac-dontlink] Error 1
2018-01-23 23:47:53 +01:00
Sebastien Pouliot ca06526793
[tests][monotouch] Remove the ignore on MPVolumeView added in xcode9 beta 3 - it seems to work fine now (#3284) 2018-01-23 08:27:18 -05:00
Rolf Bjarne Kvinge af03020eef
[mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp. (#3242)
* [mtouch/mmp] Give users more control over optimizations, and share more code between mtouch and mmp.

1. Add an --optimize flag to mtouch/mmp that allows users to select which
   optimizations to apply (or not). This makes it easier to add future
   optimizations, and allow users to disable any optimization that causes
   problems without having to disable many other features.

2. Share as much optimization code as possible between mtouch and mmp. This
   immediately gives a benefit to mmp, which has three new optimizations only
   mtouch had: NSObject.IsDirectBinding inlining, IntPtr.Size inlining and
   dead code elimination.

   This results in ~6kb of disk space saved for a linked Xamarin.Mac app:

   * link sdk: [Debug][1], [Release][2]
   * link all: [Debug][3], [Release][4]

Testing also verifies that monotouchtest ([Debug][5], [Release][6]) has not
changed size at all, which means that no default optimizations have changed
inadvertedly.

[1]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--debug
[2]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-sdk-mac--release
[3]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--debug
[4]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#link-all-mac--release
[5]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonedebug64
[6]: https://gist.github.com/rolfbjarne/6b731e3b5ca6170355662e6505c3d492#monotouchtest-iphonerelease64

* [tools] Don't enable the IsDirectBinding optimization by default for Xamarin.Mac apps, it's not safe.

* Fix whitespace issues.

* [doc] Document optimizations.

* Officially support optimizations by adding them to the Versions.plist.

* [linker] Improve IntPtr.Size inliner + dead code eliminatior and add tests.

* Properly handle operands for the ldc_i4_s instruction (they're sbyte).
* Fix less-than condition to actually do a less-than comparison.
* Make sure to look up the bitness in the Target, not the Application, since
  the Application's value will be incorrect when building fat apps (both
  Is32Build and Is64Build will be true).
* Remove unnecessary checks for the IntPtr.Size inliner: this optimization
  does not depend on other instructions than the IntPtr.get_Size call, so
  remove the checks that verify surrounding instructions. This makes the
  IntPtr.Size inliner kick in in more scenarios (such as the new tests).
* Add tests.

* [tests] Add mmp tests for optimizations.

* [tests] Fix XM optimization tests.

* [tests] Fix test build error.
2018-01-23 11:33:48 +01:00
Sebastien Pouliot e8e196673b
[foundation] Fix typo in INSFilePresenter.P[r]esentedItemOperationQueue. Fixes #3272 (#3281)
Sadly that was not enough to trigger the typo detector test. It's also
part of a protocol, which means a .net interface so it cannot be fixed
without a breaking change. As such the fix is under `XAMCORE_4_0`

Fixes https://github.com/xamarin/xamarin-macios/issues/3272
2018-01-22 21:45:28 -05:00