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

2390 Коммитов

Автор SHA1 Сообщение Дата
Sebastien Pouliot 65f39da8e6 [foundation] Fix POST/PUT issues with NSUrlSessionHandler. Fixes #52682 (#1772)
The latest NSUrlSessionHandler implementation switched from loading the
request into memory (NSData) to loading it from a stream (NSInputStream).
The later is more efficient, at least for large POST'ed requests which
could, in theory, not even fit in memory.

Now using a stream means a different API is used. NSMutableUrlRequest
Body and BodyStream properties are exclusive but also a bit different as
the later won't set Content-Length [1] and switch to chunked encoding [2]

Even if the current code is compliant with HTTP/1.1 this breaks some
common POST/PUT usage that worked "as expected" in the previous (C8)
release.

To fix this we ask for the stream's length. We assume that if the length
is known then it's (likely) already (or fitting) in memory and use the
(old, in memory) Body property, which will set Content-Length.

If the length is unknown then we use the BodyStream approach so large
POST will continue to work (well over past/C8 limits).

Finally there might be case where developers will prefer to avoid the
extra memory (of `Body`) so a new property `MaxInputInMemory` is added
to set a maximum. It defaults to `Int64.MaxValue` so `Body` will be
used whenever possible. It can be set to `0` to get back the original C9
(always use a stream) behavior.

references:
[1] https://bugzilla.xamarin.com/show_bug.cgi?id=52682
[2] https://bugzilla.xamarin.com/show_bug.cgi?id=52711
[3] https://devforums.apple.com/message/919330#919330
2017-02-27 11:19:29 -05:00
Chris Hamons 38058debbe [xm] Update help text for AOT (#1767) 2017-02-27 08:39:12 -06:00
Sebastien Pouliot 55bd2b9f54 [uikit] Add == and != operators on UIEdgeInsets. Fixes #33504 (#1773)
https://bugzilla.xamarin.com/show_bug.cgi?id=33504
2017-02-27 08:50:31 -05:00
Sebastien Pouliot 63850b6c69 [build] Bump XI version to 10.9.x and XM to 3.3.x (#1770)
`15.1` has branched, time to bump again!
2017-02-24 23:37:04 -05:00
Chris Hamons bf47f0f1e2 Fixes for XM 4.5 and netstandard13 and updated comments (#1758)
- Update comments on XM45.targets file
- Remove unnecessary AssemblySearchPaths hack causing issues using nugets with same name as Facades
- Note: MSBuild with XM 4.5 is still broken for now
2017-02-24 17:45:38 -06:00
Rolf Bjarne Kvinge ee5cc41c54 [mtouch] Disable fastdev for projects with more than one binding library. Works around bug #52727. (#1765)
https://bugzilla.xamarin.com/show_bug.cgi?id=52727
2017-02-24 13:34:47 -05:00
Rolf Bjarne Kvinge 1821ff86f3 [tests][mtouch] Simplify code a bit. (#1763) 2017-02-24 14:59:46 +01:00
Sebastien Pouliot dfc6e7b73f [build] Bump maccore to pickup the revert on how we build mlaunch (#1762)
reference:
https://bugzilla.xamarin.com/show_bug.cgi?id=52732
2017-02-23 23:13:47 -05:00
Timothy Risi 6ef756a063 Revert API breaking changes for non-XAMCORE_4_0 (#1747)
* Move NSTouch ctor to code-behind and obsolete

* Remove XAMCORE_4_0 check for NSTouch DisableDefaultCtor

* Add NSTouch.cs to frameworks.sources

* Skip NSSpellCheckerCanidates in typo test
2017-02-23 21:22:25 -05:00
Timothy Risi b5a72d7faa [Mac] Fix DefaultCtorAllowed test for NSKeyedArchiver (#1748) 2017-02-23 21:10:58 -05:00
Timothy Risi 8a6cfbe544 [appkit] Add helper properties for the NSPrintInfo PrintCore methods. Fixes #52501 (#1740)
* Add helper properties for the PrintCore methods that return the correct types instead of IntPtrs

* NSPrintInfo make bindings internal and change manual properties to getter methods

https://bugzilla.xamarin.com/show_bug.cgi?id=52501
2017-02-23 21:03:58 -05:00
Rolf Bjarne Kvinge 87b2e73248 Bump maccore to get fix for bug #51700. (#1756)
https://bugzilla.xamarin.com/show_bug.cgi?id=51700
2017-02-23 13:01:31 -05:00
Rolf Bjarne Kvinge ffc8dad1ec [tests][intro] Add mapping for SecAccessControl on macOS (#1754)
Wrench is not happy, but jenkins bots are fine. This is likely something
internal to macOS which varies per version.
2017-02-23 09:56:26 -05:00
Rolf Bjarne Kvinge 5482110b5f Fix a few culture-aware string comparisons to be culture-unaware. (#1753)
Generator diff for the generator changes: https://gist.github.com/rolfbjarne/ac7b166a308dc5b04bae29487114e9b8 (no relevant changes).
2017-02-23 09:56:14 -05:00
Rolf Bjarne Kvinge 2b4f30c40d Bump mono to get fix for #47343. (#1752)
https://bugzilla.xamarin.com/show_bug.cgi?id=47343
2017-02-23 09:56:00 -05:00
Sebastien Pouliot 797f417758 [build] Bump XI version to 10.7.x (#1750)
Cycle 9 (10.4) is now out and I'm fairly certain we'll see Xcode8.3 out
in March, so that will become 10.6 (once stable), making our `15.1`
target to be 10.8, again when stable.

XM is not affected as it gets the API updates on the next cycle/train.
2017-02-22 23:08:11 -05:00
Rolf Bjarne Kvinge 88c276e0aa [tests][generator] Port XI/Classic tests to XI/Unified. (#1745)
* [tests][generator] Port XI/Classic tests to XI/Unified.

* [tests][generator] Comment out code triggering previously unknown bugs.

These tests makes the generator fail:

    error BI0000: Unexpected error - Please file a bug report at http://bugzilla.xamarin.com
    System.NullReferenceException: Object reference not set to an instance of an object
      at Generator.GetSetterExportAttribute (System.Reflection.PropertyInfo pinfo) [0x0002e] in /work/maccore/master/xamarin-macios/src/generator.cs:1981
      at Generator.Go () [0x007e3] in /work/maccore/master/xamarin-macios/src/generator.cs:2162
      at BindingTouch.Main2 (System.String[] args) [0x010b2] in /work/maccore/master/xamarin-macios/src/btouch.cs:435
      at BindingTouch.Main (System.String[] args) [0x0001d] in /work/maccore/master/xamarin-macios/src/btouch.cs:77
      at System.Environment.get_StackTrace () [0x00000] in /work/maccore/master/xamarin-macios/_ios-build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/mcs/class/corlib/System/Environment.cs:321
      at ErrorHelper.ShowInternal (System.Exception e) [0x000dc] in /work/maccore/master/xamarin-macios/src/error.cs:200
      at ErrorHelper.Show (System.Exception e) [0x00027] in /work/maccore/master/xamarin-macios/src/error.cs:151
      at BindingTouch.Main (System.String[] args) [0x0002b] in /work/maccore/master/xamarin-macios/src/btouch.cs:79

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52664.

* [tests][generator] Comment out code triggering previously unknown bugs.

This has been filed as https://bugzilla.xamarin.com/show_bug.cgi?id=52665.
2017-02-22 16:47:11 +01:00
Alan McGovern 0963ba1e75 [XM] Add the option to ignore missing files during registration (#1709)
Not all assemblies referenced at compile time are necessary
at runtime. Allow XamMac to ignore missing assemblies just
like iOS does.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=51746
2017-02-22 09:18:22 -06:00
Rolf Bjarne Kvinge af667d1665 [generator] Properly determine if selectors are inlined. Fixes #52646. (#1744)
Properly determine if selectors are inlined by not deciding anything until we
have the information required to make a correct decision. Since we're now
determining the target platform using the command-line argument, we can't use
the corresponding variables until after the command-line arguments have been
parsed.

This fixes several generator tests when those tests are built using XI/Unified
(so new new tests are needed for this).

https://bugzilla.xamarin.com/show_bug.cgi?id=52646
2017-02-22 14:57:35 +01:00
Rolf Bjarne Kvinge 467cedc47c [generator] Don't generate calls to internal methods. (#1742)
Don't generate calls to [UIApplication|NSApplication].[EnsureEventAndDelegateA
reNotMismatched|EnsureDelegateAssignIsNotOverwritingInternalDelegate] from
third-party binding code, since those methods are internal.

This fixes the bug24078-ignore-methods-events test when run using XI/Unified.
2017-02-22 14:23:56 +01:00
Rolf Bjarne Kvinge 00874dc1e7 [tests][generator] 'virtualwrap' is a custom test, so put it in the corresponding variable. (#1743)
Fixes this warning:

    Makefile:163: warning: overriding commands for target `virtualwrap'
    Makefile:40: warning: ignoring old commands for target `virtualwrap'
2017-02-22 14:23:45 +01:00
Sebastien Pouliot ba623e8efa [apidiff] Update XML references to C9 (#1738) 2017-02-21 18:42:29 -05:00
Rolf Bjarne Kvinge 87de3d0e23 [generator] Don't specify platform-specific conditional compilation symbols. (#1735)
All the platform-specific conditional compilation symbols are unusued, so we
don't need to define them anymore.

Generator diff: https://gist.github.com/rolfbjarne/865b4ed20648614ceff04a870a3d0786
2017-02-21 15:54:26 -05:00
Rolf Bjarne Kvinge 7a60206841 Bump maccore to get fix for bug #52381. (#1734)
https://bugzilla.xamarin.com/show_bug.cgi?id=52381
2017-02-21 14:03:03 -05:00
Chris Hamons 3663ab57c8 Add C8->C9 objc_msgSend fixes for XM classic (#1697) (#1700) 2017-02-21 12:56:08 -06:00
Rolf Bjarne Kvinge d212b97b1a Merge remote-tracking branch 'origin/master' into framework-sdk 2017-02-21 18:14:29 +01:00
Rolf Bjarne Kvinge c5e3b61a4c Bump mono to get fix for #52300. (#1729)
https://bugzilla.xamarin.com/show_bug.cgi?id=52300
2017-02-21 17:27:39 +01:00
Rolf Bjarne Kvinge dfed29a8e7 [generator] Remove any platform-specific ifdefs for the generator stret detection code. (#1731)
Remove any platform-specific ifdefs for the generator's stret detection code.
There are still ifdefs in this file, because it's shared with the platform
assemblies.

Generator diff: https://gist.github.com/rolfbjarne/3034666fb99278eb2486da8579271488
2017-02-21 08:59:12 -05:00
Rolf Bjarne Kvinge a9c6ecb5dc [generator] Remove unnecessary code. (#1730)
Generator diff: https://gist.github.com/rolfbjarne/f6c0e32960eacbafd38238e623d3321a
2017-02-21 08:58:51 -05:00
Rolf Bjarne Kvinge 8ff0bc93e5 [generator] No more typeof. (#1726)
Replace all `typeof` expressions with equivalent TypeManager fields, since
`typeof` expressions won't work correctly when we switch to IKVM instead of
reflection.

Generator diff: https://gist.github.com/rolfbjarne/066dbf08eaf0ece56bc9256c5e12c5b9
2017-02-21 10:12:40 +01:00
Rolf Bjarne Kvinge 1d9e377adf [runtime] Fix potential memory leak in error conditions. (#1723)
This was found by clang's static analyzer:

    trampolines.m:94:16: warning: Potential leak of memory pointed to by 'buf'
                                                             return NULL;
                                                                    ^~~~
2017-02-20 19:35:40 +01:00
Rolf Bjarne Kvinge 1992b667ec [runtime] Plug a leak in http debugging. (#1720)
Clang's static analyzer tought me something new today: 'copy' properties are
not automatically deallocated 😒:

    monotouch-debug.m:237:1: warning: 'XamarinHttpConnection' lacks a 'dealloc' instance method but must release '_completion_handler' and others
    @implementation XamarinHttpConnection
    ^
2017-02-20 19:35:17 +01:00
Rolf Bjarne Kvinge 679b981b66 [runtime] Work around static analyzer warning about incorrect refcount decrement. (#1718)
This warning:

    shared.m:216:3: warning: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
                    [pool release];
                    ^~~~~~~~~~~~~~

is somewhat incorrect, because we're using NSAutoreleasePools in uncommon ways
(at the same time it's not entirely incorrect either, because we're not
following Apple's documentation about how to use NSAutoreleasePools).

Luckily calling [NSAutoreleasePool drain] is equivalent to [NSAutoreleasePool
release], so just replace the latter with the former to silence the warning,
since clang doesn't know those two are equivalent.
2017-02-20 19:30:23 +01:00
Rolf Bjarne Kvinge e5d601c8a5 [runtime] Remove unused return value from the *_connect_* debug functions. (#1719)
At the beginning of dawn, not long after the big bang, we used to vibrate the
phone if there was a problem when connecting to the debugger in the IDE, and
the number of times the phone vibrated indicated a certain error condition.

This innovative debugging technique was at some point replaced with more
intuitive (albeit less innovative) error reporting, however the *_connect_*
family of functions continued returning the number of times the phone should
vibrate, even if the caller was now soundlessly ignoring this information.

After many years someone had the wonderful idea of running a static analyzer
on the code, and now the unused return value is not so silent anymore:

    monotouch-debug.m:663:5: warning: Value stored to 'rv' is never read
                                    rv = monotouch_connect_usb ();
                                    ^    ~~~~~~~~~~~~~~~~~~~~~~~~
    monotouch-debug.m:665:5: warning: Value stored to 'rv' is never read
                                    rv = monotouch_connect_wifi (hosts);
                                    ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    monotouch-debug.m:667:5: warning: Value stored to 'rv' is never read
                                    rv = xamarin_connect_http (hosts);
                                    ^    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~

So fix the warning by removing the return value.
2017-02-20 19:30:09 +01:00
Rolf Bjarne Kvinge 0f59d51536 [runtime] Make sure to always dispose objects that should be disposed, even if things go wrong. (#1725)
This fixes an issue clang's static analyzer found: if an exception occured in
a call to managed code, we wouldn't process the list of objects to dispose:

    trampolines-invoke.m:549:2: warning: Potential leak of memory pointed to by 'dispose_list'
            MONO_THREAD_DETACH; // COOP: This will switch to GC_SAFE
            ^~~~~~~~~~~~~~~~~~
    ./xamarin/runtime.h:306:11: note: expanded from macro 'MONO_THREAD_DETACH'
            } while (0)
                     ^

Fix this by always processing the list of objects to dispose, even if
exceptions occur.
2017-02-20 19:29:56 +01:00
Rolf Bjarne Kvinge a4d2998e5b [runtime] Allocate memory correctly to make clang's static analyzer happy. (#1724)
trampolines.m:75:22: warning: Result of 'malloc' is converted to a pointer of type 'id', which is incompatible with sizeof operand type 'void *'
                                    id *buf = (id *) malloc (sizeof (void *) * length);
                                    ~~~~             ^~~~~~  ~~~~~~~~~~~~~~~
2017-02-20 19:29:13 +01:00
Rolf Bjarne Kvinge bf36860c1e [runtime] Make the clang's static analyzer happy. (#1722)
trampolines-i386.m:126:19: warning: Assigned value is garbage or undefined
                            it->state->edx = v[1];
                                           ^ ~~~~
    trampolines-x86_64.m:410:16: warning: Assigned value is garbage or undefined
                                                    *reg_ptr = v [stores];
                                                             ^ ~~~~~~~~~~
    trampolines-x86_64.m:447:14: warning: Assigned value is garbage or undefined
                                    *reg_ptr = v [stores++];
                                             ^ ~~~~~~~~~~~~
2017-02-20 17:20:13 +01:00
Rolf Bjarne Kvinge a868ab2a3f [runtime] Fix an extraneous timezone release. (#1721)
Getting a time zone instance in two different code paths, one allocating the
time zone instance, and the other not allocating, is problematic when we're
unconditionally freeing the time zone at the end.

    xamarin-support.m:58:2: warning: Incorrect decrement of the reference count of an object that is not owned at this point by the caller
            [tz release];
            ^~~~~~~~~~~~

So fix this by autoreleasing the allocated timezone.
2017-02-20 17:19:38 +01:00
Rolf Bjarne Kvinge 732718e78c [tests][linkall] Fix detection of fat executable.
Fix detection of fat executable to only return true if we have both a 32-bit
and a 64-bit architecture (which is what the `IntPtrSizeOptimization` test
needs to know), and not more than one architectures (since that can be
`armv7`+`armv7s`, i.e. two 32-bit architectures).
2017-02-20 17:14:14 +01:00
Rolf Bjarne Kvinge 6f3fcd795a [mtouch] Correct (and simplify) AssemblyCollection.AddRange. 2017-02-20 17:14:14 +01:00
Rolf Bjarne Kvinge 91f96c3611 [tests] Simplify code a bit. 2017-02-20 17:14:14 +01:00
Rolf Bjarne Kvinge 0fc9c35f90 [docs] Clearify wording a bit about code sharing occuring once per architecture. 2017-02-20 17:14:14 +01:00
Rolf Bjarne Kvinge 8f65836e4d [xharness] Make 64-bits.
Avoids any problems with 32-bit OOM conditions (which can take a while to
diagnose, because random things start happening).
2017-02-20 17:14:13 +01:00
Rolf Bjarne Kvinge 4f5ad3517c [xharness] Minor improvements to the html report. 2017-02-20 17:14:10 +01:00
Rolf Bjarne Kvinge d288364127 [xharness] Refactor a little bit to work around mcs bug #52599.
mcs will miscompile using statements that has a catch clause that returns
early (by using 'return;') and a finally clause with await (the using's
variable won't be disposed).

So refactor a little bit to avoid returning early from inside a using
statement.
2017-02-20 17:13:24 +01:00
Rolf Bjarne Kvinge a70180ecf5 [xharness] Ensure we're always cleaned up, by moving the cleanup to the finally clause. 2017-02-20 17:13:23 +01:00
Rolf Bjarne Kvinge ca6b073fc1 [tools] Detect ARMv7k. (#1716) 2017-02-20 16:03:41 +01:00
Rolf Bjarne Kvinge 42c4941cef [src] Don't compare code generated/processed by pmcs. (#1717)
Comparing pmcs-processed/generatedo code is redundant, because we're already
comparing the original code. Also the filenames aren't stable (they change
every time pmcs is executed), which makes any diff contain unwanted noise.
2017-02-20 16:03:30 +01:00
Sebastien Pouliot c43b735bab [corefoundation] Fix CallbackDelegate signature to be 32bits safe (enum). Fixes #52279 (#1714)
The `CFStreamEventType` enum is based on `NSUInteger`. The native delegate
CallbackDelegate was using it directly and that made it incorrect on 32
bits platforms.

We have introspection tests to check enums on p/invoke, but it seems they
don't cover native delegates - decorated with [MonoNativeFunctionWrapper]
That's to be added in a different PR.

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

* [tests][intro] Validate signatures of delegates decorated with [MonoNativeFunctionWrapper]
2017-02-20 08:14:04 -05:00
Rolf Bjarne Kvinge 88e0eb5fc8 [generator] Use target framework to determine the platform. (#1690)
This cuts down another group of conditional compilation sections, paving the
way for an IKVM-based generator.

This makes it required to pass --target-framework for to generator executables
(previously only required for Xamarin.Mac/Unified to distinguish between the
different Xamarin.Mac/Unified variants), but it should be invisible to users
since we'll automatically pass the correct --target-framework argument from
the corresponding scripts (btouch/btv/bwatch/bmac) and the MSBuild targets.
This will only break somebody who is executing the managed executables
directly, but nobody should do that in the first place (it's not a supported
scenario).

Generated diff: https://gist.github.com/rolfbjarne/1674be6625632446dba774a305951981
2017-02-17 14:53:58 -05:00