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

1313 Коммитов

Автор SHA1 Сообщение Дата
Martin Baulig 032e2482e4 [AppleTls]: Make 'OldTlsProvider' derive from 'LegacyTlsProvider'.
Ideally, we should just simply use 'Mono.Net.Security.LegacyTlsProvider',
but that would require some tweaks to the linker code.
2016-10-03 18:31:04 +02:00
Rolf Bjarne Kvinge 0fa4235097 [mtouch] Don't do any TLS processing in the linker for watchOS.
Don't do any TLS processing in the linker for watchOS, because on watchOS we
don't have (managed) TLS.
2016-10-03 18:31:04 +02:00
Manuel de la Pena da1478a680 New url session handler (#932)
* Added rewritten NSUrlSessionHandler that handles memory better

This is a rewrite of the ModernHttpClient version of NSUrlSessionHandler, it has better handling for memory that provides a more consistant memory footprint. It accomplishes this by using NSInputStream for requests, and reading and disposing directly from NSData instead of transitioning the NSData to a byte[] array.

* Try to fix build of PR #31

* [foundation] Restore compatibility with the new NSUrlSessionHandler

Mostly my comments in PR #174

* Add support for redirection [1]
* Add support for credentials [1]
* Add support for caching [2]
* Remove 2nd dictionary lookup in GetHeaderSeparator
* Avoid extraneous cast for credentialsToUse

PR 177 [3] adds tests that ensure no commits can remove, or change
default values, for handlers.

[1] breaking changes (feature, not API)
[2] breaking change (API removal)
[3] https://github.com/xamarin/xamarin-macios/pull/177

* [foundation] Restore compatibility with the new NSUrlSessionHandler

Mostly my comments in PR #174

* Add support for redirection [1]
* Add support for credentials [1]
* Add support for caching [2]
* Remove 2nd dictionary lookup in GetHeaderSeparator
* Avoid extraneous cast for credentialsToUse

PR 177 [3] adds tests that ensure no commits can remove, or change
default values, for handlers.

[1] breaking changes (feature, not API)
[2] breaking change (API removal)
[3] https://github.com/xamarin/xamarin-macios/pull/177

* Try to fix build of PR #31

* prevent DEADLOCK in UI code

* Added ConfigureAwait(false) to Task.Delay to prevent DEADLOCK when the stream is being awaited on the UI thread

* added a few more ConfigureAwait(false) statments that were missed on first pass

* Fix some small style issues.

* Set the default value of AllowAutoRedirect to true.
2016-10-03 18:25:16 +02:00
Martin Baulig eb516cbcd8 [AppleTls]: Ignore port number when validating certificates.
Fix for:
https://bugzilla.xamarin.com/show_bug.cgi?id=44708
2016-10-01 20:20:37 -04:00
Vincent Dondain fff489e3c0 Update reference to maccore 2016-10-01 23:11:23 +02:00
Vincent Dondain ecf5b1abe6 Update reference to maccore 2016-09-30 23:35:53 +02:00
Chris Hamons 110fc4cb5b [XM] Remove TODO from LaunchServices.cs because LSOpenFromURLSpec is deprecated (#930) 2016-09-30 17:13:33 -04:00
Rolf Bjarne Kvinge 460d41e9e3 Bump mono to get System test fixes. (#919) 2016-09-30 16:14:43 -04:00
Sebastien Pouliot 3c000ff67b [CoreVideo] Add CVPlanarPixelBufferInfo_YCbCrBiPlanar, fixes #28817 (#927) 2016-09-30 15:47:01 -04:00
Rolf Bjarne Kvinge 3f74be5a80 [system-dependencies] Add CMake dependency. (#920) 2016-09-30 15:46:40 -04:00
Rolf Bjarne Kvinge 0863e412b4 Remove XI/Classic support (#926)
* [tests] Remove Classic SDK tests.

* Remove XI/Classic support.

This also means we can remove support for the legacy registrars.

* [monotouch-test] Remove legacy registrar tests.

* [tests/mtouch] Remove Classic tests (and legacy registrar logic).

* [tests/scripted] Fix tests to reference Xamarin.iOS.dll.
2016-09-30 15:02:17 -04:00
Chris Hamons b7b970588a [XM] Add NSTooltipOwner to NSObject (#904)
* [XM] Add NSTooltipOwner to NSObject

- https://bugzilla.xamarin.com/show_bug.cgi?id=27349
- Designed to be implemented by any NSObject you pass into AddToolTip.
2016-09-30 11:57:28 -05:00
Chris Hamons 97dfc6e972 [XM] Add missing NSNotification bits (#925)
- https://bugzilla.xamarin.com/show_bug.cgi?id=40494
2016-09-30 12:51:11 -04:00
Sebastien Pouliot d0773a9ffc [avfoundation] Add overloads to AVCaptureDevice that accept an enum. Fixes #32535 (#922)
The current API use `string`, not `NSString` is added as a step forward.
The `NSString` is more correct but it does not ease discoverability (e.g.
code completion) so an enum-based overload is added (as the preferred API).

https://bugzilla.xamarin.com/show_bug.cgi?id=32535
2016-09-30 12:49:45 -04:00
Timothy Risi 7d14a4b94f [Mac] Activate gamekit bindings shared with iOS (#924) 2016-09-30 09:13:17 -05:00
Alex Soto 1d828e9e5e [CoreFoundation] Fix bug 44399 - ArgumentNullException in AddObserver (#921)
https://bugzilla.xamarin.com/show_bug.cgi?id=44399

We did not fully support passing null to name and objectToObserve in
CFNotificationCenter::AddObserver an  ArgumentNullException was thrown

The use case of sending null to both name and objectToObserve is to
observe all notifications posted to the notification center, this
won't work using darwing notification center, it is restricted
by apple.
2016-09-29 13:35:29 -04:00
Rolf Bjarne Kvinge 4d06d05cc0 [mtouch] Add workaround for file descriptor leak in System.Diagnostics.Process. (#917) 2016-09-29 17:45:23 +02:00
Rolf Bjarne Kvinge b58b36178b Update list of Facade assemblies. (#916)
These assemblies were added here: 919b89954a
2016-09-29 16:12:31 +02:00
Sebastien Pouliot 9fda816230 [mtouch][linker] Use correct error code for CoreOptimizeGeneratedCode (#915)
Previous PR [1] has the right documentation but the wrong source code.

[1] https://github.com/xamarin/xamarin-macios/pull/903
2016-09-28 23:16:03 -04:00
Rolf Bjarne Kvinge 46b9a5bfbf [builds] Apply magic to make us build on Sierra. (#911)
* Pass -Wl,-no_weak_imports to the linker so that   we don't accidentally use
  symbols weakly. This would   cause problems on older OSes where the symbol
  isn't there, because our code is not prepared to deal with weakly linked
  symbols.

* Manually disable fstatat and readlinkat (introduced with Xcode 7 in iOS 8 /
  macOS 10.10), found by the above.

* Manually disable __thread support for a few targets, since mono's configure
  script doesn't properly detect it's not supported.

* Manually disable clock_nanosleep, since mono's configure script doesn't
  properly detect it's not supported.
2016-09-28 20:27:10 -04:00
Martin Baulig 860704ddb4 [AppleTls]: API cleanups in preparation of the BTLS integration.
* Bump Mono to mono-4.8.0-branch commit 9437553e545f57443ccc33fe4129cbb6ac94f832.

* Rename MobileCertificateHelper -> AppleCertificateHelper.

  All the non-Apple-specific functionality now lives in System.dll's
  MobileTlsContext, so it can be shared with BTLS.

* Remove old src/Security/Tls sources which have been moved into System.dll
  a couple of weeks ago.
2016-09-29 00:59:15 +02:00
Ankit Jain 6f37730293 [msbuild] Set $(CscDebugFileExt) also, whenever overriding $(CscToolExe) (#896)
* [msbuild] Set $(CscDebugFileExt) also, whenever overriding $(CscToolExe)

- This property was introduced in mono's msbuild, but will be upstream
  also
- This *must* be set before Microsoft.CSharp.targets file is imported.
- Even though the msbuild targets will automatically select `.mdb` if
  the `$(CscToolExe)` is `mcs` or `mcs.exe`, it would be a good
  practice to set both the properties together.

- This came up in cases where we use `smcs`, because in that case the
  msbuild targets end up using `.pdb`.

* [msbuild] Set `$(CscDebugFileExt)` == `.mdb`

Xamarin.ObjcBinding.CSharp.targets: Set the debug file extension also,
since we are overriding the compiler via `$(CscToolExe)`. Also, move
the property definition around to ensure that they are set *before*
importing `Microsoft.CSharp.targets`.
2016-09-28 14:37:44 -04:00
Sebastien Pouliot 5b80e7f85c [mtouch][linker] Provide a more specific error code when OptimizeGeneratedCodeSubStep fails (#903)
The MT2001 error is a general, something went bad, in the linker code
base. The stack trace is often enough to track down issues but in some
cases it would be easier to ask customers for a specific assembly
(rather than their complete project) to investigate an issue.

Example:

error MT2103: Binding Optimizer failed processing `System.Void GoogleConversionTracking.Unified.GoogleConversionPing::.ctor()`.
--- inner exception
System.NullReferenceException: Object reference not set to an instance of an object
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessIsDirectBinding (Mono.Cecil.MethodDefinition caller, Mono.Cecil.Cil.Instruction ins) [0x00026] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:264
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.ProcessCalls (Mono.Cecil.MethodDefinition caller, Int32 i) [0x00337] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:197
  at MonoTouch.Tuner.OptimizeGeneratedCodeSubStep.Process (Mono.Cecil.MethodDefinition method) [0x0007b] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/MonoTouch.Tuner/OptimizeGeneratedCodeSubStep.cs:81
  at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00004] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:48
---
  at Xamarin.Linker.StateSubStep.ProcessMethod (Mono.Cecil.MethodDefinition method) [0x00014] in /Users/poupou/git/xamarin/xamarin-macios/tools/linker/CoreOptimizeGeneratedCode.cs:50
  at Mono.Tuner.SubStepDispatcher.DispatchMethod (Mono.Cecil.MethodDefinition method) [0x0001d] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:215
  at Mono.Tuner.SubStepDispatcher.BrowseMethods (ICollection methods) [0x0001c] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:167
  at Mono.Tuner.SubStepDispatcher.BrowseTypes (ICollection types) [0x0006b] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:145
  at Mono.Tuner.SubStepDispatcher.BrowseAssemblies (IEnumerable`1 assemblies) [0x00050] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:123
  at Mono.Tuner.SubStepDispatcher.Process (Mono.Linker.LinkContext context) [0x0000f] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/tuner/Mono.Tuner/Dispatcher.cs:104
  at Mono.Linker.Pipeline.Process (Mono.Linker.LinkContext context) [0x00027] in /Users/poupou/git/xamarin/xamarin-macios/external/mono/mcs/tools/linker/Mono.Linker/Pipeline.cs:118
  at MonoTouch.Tuner.Linker.Process (MonoTouch.Tuner.LinkerOptions options, MonoTouch.Tuner.MonoTouchLinkContext& context, System.Collections.Generic.List`1& assemblies) [0x000ac] in /Users/poupou/git/xamarin/xamarin-macios/tools/mtouch/Tuning.cs:79

Right now the MT2001 would only include the inner exception, which does
not include any clue to which assembly caused the exception.

Note: The same pattern to be applied to other BaseSubStep subclasses in
separate commits.

Related to (but not the fix for) https://bugzilla.xamarin.com/show_bug.cgi?id=44701
2016-09-28 11:46:14 -04:00
Rolf Bjarne Kvinge 876698ce25 [xharness] Define FEATURE_NO_BSD_SOCKETS for watchOS test projects. (#909) 2016-09-28 11:26:36 -04:00
Alex Soto b8bd71c7b5 [Security] Add convenience Certificate, Key and Identity ctors to SecRecord (#905) 2016-09-28 08:17:39 -04:00
Alex Soto 5c10b87637 [CoreImage] Add missing property ColorSpace to CIImage (#906)
https://bugzilla.xamarin.com/show_bug.cgi?id=44438

The ColorSpace property is decorated with the CF_RETURNS_NOT_RETAINED
macro, this means it returns an object that follows the CoreFoundation
[Ownership Policy](1) but it does not follow the naming convention
documented in the policy.

The [CF_RETURNS_NOT_RETAINED](2) indicates that the object reference
returned is not owned by the caller, so we should definitely call
CGColorSpaceRetain when obtaining a handle.

Since CGColorSpace is considered into the [MarshalType list](3) the
generated code ends up calling the IntPtr ctor which does the right
thing, [calling CGColorSpaceRetain](4) in the given ptr.

And last but not least, we already bind another property decorated
with [CF_RETURNS_NOT_RETAINED](2) in [CIColor::ColorSpace](5).

[1]: https://developer.apple.com/library/content/documentation/CoreFoundation/Conceptual/CFMemoryMgmt/Concepts/Ownership.html
[2]: http://clang-analyzer.llvm.org/annotations.html#attr_cf_returns_not_retained
[3]: 0bc23b379a/src/generator.cs (L2642)
[4]: https://github.com/xamarin/xamarin-macios/blob/xcode8/src/CoreGraphics/CGColorSpace.cs#L77-L80
[5]: https://github.com/xamarin/xamarin-macios/blob/xcode8/src/coreimage.cs#L112-L113
2016-09-28 12:33:51 +02:00
Sebastien Pouliot 0bc23b379a Bump mono for an (pre C9/master) alpha refresh (#902)
* mono revision at fc99fc4313e7afd75a4605a48b47e7d1273aefe4

* watch-mono revision is more recent to include the BCL adjustments
  for types not available on that platform

* Update two linksdk  test cases that won't work _normally_ for watchOS
2016-09-27 23:45:13 -04:00
Sebastien Pouliot da60263a0a [mtouch] Fix NRE when optimizing bindings. Fixes #44701 (#900)
Some binding assemblies contains extra, unneeded code, generated by the C# compiler, e.g.

IL_002f: stloc.0
IL_0030: ldloc.0

which the binding optimizer did not expect.

https://bugzilla.xamarin.com/show_bug.cgi?id=44701
2016-09-27 16:09:42 -04:00
Chris Hamons c46f5d4793 [XM] Add ThreadSafe to API that gets called on background thread by Cocoa (#901) 2016-09-27 14:51:00 -05:00
Rolf Bjarne Kvinge 19d237473e [runtime] Fix support for debugging on watch device with multiple IP addresses. Fixes #44568. (#898)
At startup we send a request to all the IP addresses we have,
so we must make sure to not get confused if we get responses
from more than one of them.

This fix also requires an updated mlaunch.

https://bugzilla.xamarin.com/show_bug.cgi?id=44568
2016-09-27 08:07:31 -04:00
Rolf Bjarne Kvinge c8993a3597 [tests/mscorlib] Fix template. (#897) 2016-09-27 11:20:32 +02:00
Alex Soto 912ab01d1e Merge pull request #891 from dalexsoto/generator
[generator] Fix bug 37175 and bug 44322
2016-09-26 11:26:33 -05:00
Rolf Bjarne Kvinge 86e1e0e882 [mtouch] Show more information about LinkWith attributes. (#895)
* [mtouch] Fix source analysis warning about culture-aware string comparison.

* [mtouch] Show more information about LinkWith attributes.
2016-09-26 16:23:28 +02:00
Rolf Bjarne Kvinge ab14b432d2 [generator] Order the list of generated files to ease diffs. (#894) 2016-09-26 08:54:12 -04:00
Alex Soto ff326bdfdb [generator] ForcedType is now only valid on parameters, properties and return value
https://bugzilla.xamarin.com/show_bug.cgi?id=37175
https://bugzilla.xamarin.com/show_bug.cgi?id=44322

* ForcedType is now only valid on parameters, properties and return value
* Added generator test
* Fixed bindings accordingly
* Fixed docs
2016-09-26 03:57:57 -05:00
Alexander Köplinger 32e87b3f9a Bump MAX_MONO_VERSION (#893)
We're using 4.9.x in mono master now.
2016-09-26 10:33:26 +02:00
Chris Hamons 4d299f35ae [XM] Add missing Javascript bindings in webkit.cs (#890)
- https://bugzilla.xamarin.com/show_bug.cgi?id=32975
2016-09-24 10:32:22 -04:00
Martin Baulig a7676cd373 Merge pull request #892 from xamarin/appletls-finish-write
[AppleTls]: Disallow calling SSLHandshake() again after the handshake has finished
2016-09-24 11:10:08 +02:00
Martin Baulig 6ed46cc6a1 [AppleTls]: Disallow calling SSLHandshake() again after the handshake has finished.
Bump Mono to pickup the BCL part of the fix.

commit 2a3e4002ead94aae6796c7eb7af9a850398beb51
Author: Martin Baulig <martin.baulig@xamarin.com>
Date:   Fri Sep 23 17:42:05 2016 +0200

    [AppleTls]: Flush the write queue before finishing the handshake.

    It is possible for SSLHandshake() to return SslStatus.Success while we're still
    having a pending write (AsyncOperationStatus.WantWrite).

    This is because our managed write callback must never return 'WouldBlock', so
    SSLHandshake() things that all data have been sent while we still have them in
    our write queue.

    When this happens, we currently flush the write queue then call SSLHandshake()
    again via AsyncOperationStatus.WantWrite -> AsyncOperationStatus.Continue.

    This returns SslStatus.Protocol on iOS 10.

    (cherry picked from commit 2cc1b887c1c6e86b6844116c8010bac3305c84f9)
2016-09-24 07:41:28 +02:00
Alex Soto 72f6d0a232 [Foundation] NSUrlSession's Create*Task methods may return a base class of the type the headers claim. Fixes #37175.
https://bugzilla.xamarin.com/show_bug.cgi?id=37175

NSUrlSession's Create*Task methods may return an object of the wrong
type (NSUrlSessionTask instead of NSUrl[Data|Download|Upload]SessionTask),
so we need to bypass our type check when creating the managed object,
otherwise we end up throwing InvalidCastExceptions randomly. We will
return the type that is declared on the headers so if the native side
returns a cat and headers says it barks we'll we make it bark :).
2016-09-23 21:37:33 -05:00
Alex Soto 7845caa577 [AVFoundaation] Fix bug 44322 - AVAssetDownloadUrlSession.CreateSession throws a System.InvalidCastException: Specified cast is not valid.
https://bugzilla.xamarin.com/show_bug.cgi?id=44322

AVAssetDownloadUrlSession.CreateSession according to headers it
should return an AVAssetDownloadUrlSession but it is returning
an apple internal type NSURLBackgroundSession so with our
current bindings it throws an InvalidCastException, adding
ForcedTypeAttribute will create the managed type wihout
the actual typecheck. Added test verifing that the API
no longer throws.
2016-09-23 19:17:57 -05:00
Alex Soto bcbe813ab1 [generator] Fix bug 37175 and bug 44322
https://bugzilla.xamarin.com/show_bug.cgi?id=37175
https://bugzilla.xamarin.com/show_bug.cgi?id=44322

Sometimes iOS API is returning objects of the wrong type for example

- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request

It clearly states that it will return an NSURLSessionDownloadTask
instance, but yet it returns a NSURLSessionTask and we throw an
InvalidCastException when creating the managed object. This is
fine in ObjC but for us in a type-safety context is not.

Introducing ForcedTypeAttribute when applying this attribute
we will use GetINativeObject instead of GetNSObject which
the former does not perfom a type check on the underlying object
2016-09-23 17:53:22 -05:00
Rolf Bjarne Kvinge 85cead2337 [mtouch] Don't use nested Parallel.ForEach loops. (#888)
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.

So refactor the code to have one static list of tasks, which each subtask adds
to.
2016-09-23 16:03:23 -04:00
Chris Hamons fa18df5710 Fix build warning (#889) 2016-09-23 14:27:53 -05:00
Sebastien Pouliot eb91e692a6 [mtouch] Update script to use mono64. Fixes #44122 and others (#887)
Our move to open source and the mtouch/mlaunch split changed mtouch from
a 64bits to a 32bits application (because mono is, by default, still
32bits on OSX).

That's the cause for several recent bugs

* https://bugzilla.xamarin.com/show_bug.cgi?id=44122
* https://bugzilla.xamarin.com/show_bug.cgi?id=44521
* https://bugzilla.xamarin.com/show_bug.cgi?id=44518
* https://bugzilla.xamarin.com/show_bug.cgi?id=44516
2016-09-23 12:55:11 -04:00
Rolf Bjarne Kvinge e598db9621 [xharness] Add Jenkins support for watchOS Series 2 simulators. (#885) 2016-09-23 09:06:05 -04:00
Rolf Bjarne Kvinge 7656a92756 Revert "[mtouch] Don't use nested Parallel.ForEach loops." (#886) 2016-09-23 14:35:43 +02:00
Rolf Bjarne Kvinge fc55e4306f [mtouch] Don't use nested Parallel.ForEach loops. (#881)
The nested Parallel.ForEach loops don't take into account the outer
MaxDegreeOfParallelism value, causing us to spawn more concurrent tasks than
we want to.

So refactor the code to have one static list of tasks, which each subtask adds
to.
2016-09-23 07:02:11 +02:00
Rolf Bjarne Kvinge 02818182f1 [Foundation] Add a few missing NSAttributedString methods to watchOS. Fixes #44455. (#880)
https://bugzilla.xamarin.com/show_bug.cgi?id=44455
2016-09-22 13:11:50 -04:00
Jeffrey Stedfast 5922215e72 [msbuild] Add watch-companion to UIRequiredDeviceCapabilities for watchOS1 extensions (#868)
Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44257
2016-09-22 19:09:10 +02:00