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

7380 Коммитов

Автор SHA1 Сообщение Дата
Rolf Bjarne Kvinge 0f8bb77320
[xharness] Make sure to always stop log and system capture. (#7499)
This will hopefully stop the runaway mlaunch processes we've seen on the bots.

Ref: https://github.com/xamarin/maccore/issues/1965.
2019-11-27 11:44:26 -05:00
Pramit Mallick faf1275c74
[Foundation] Add bindings for NSBackgroundActivityScheduler (#7496)
* Added NSBackgroundActivityScheduler binding

* DisableDefaultCtor + xtro
2019-11-27 09:55:54 -05:00
Rolf Bjarne Kvinge e86a76e6c7
[xharness] Add a timeout to the periodic command. (#7500)
This will hopefully prevent the periodic command from keeping xharness alive longer than it should.
2019-11-27 09:09:44 -05:00
Marius Ungureanu 38a3c4ed87 [CFNetwork] Fix ownership rules of CFHTTPAuthentication (#6088)
`Create` methods give ownership of the object, so in this case, owns=true. Prevents leak of CFHTTPAuthentication

Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
Co-Authored-By: Manuel de la Pena <mandel@microsoft.com>
2019-11-26 16:28:41 -05:00
Sebastien Pouliot 611d6f37fb
[runtime] Comment two special cases that triggers static analysis tools (#7491) 2019-11-26 08:30:05 -05:00
Pramit Mallick 532059daf6
Added mappings to AVMetadataObject.EnumToObject (#7492) 2019-11-25 16:46:04 -05:00
Manuel de la Pena cb815ecd39
[Runtime] Update cflags and fix warnings accordingly. (#7478)
Update flags:

* Add -Werror so that warnings are errors.
* Move to -Wconversion that adds:
  * -Wbitfield-enum-conversion
  * -Wbool-conversion
  * -Wconstant-conversion
  * -Wenum-conversion
  * -Wfloat-conversion
  * -Wimplicit-float-conversion
  * -Wimplicit-int-conversion
  * -Wint-conversion
  * -Wliteral-conversion
  * -Wnon-literal-null-conversion
  * -Wnull-conversion
  * -Wobjc-literal-conversion
  * -Wshorten-64-to-32
  * -Wsign-conversion
  * -Wstring-conversion
Last work related to: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-25 16:00:24 -05:00
Manuel de la Pena 245fdf96aa
[Tests] Reuse NetworkResources in the linker tests. (#7451)
The linking tests do use a number of endpoints.
As with PR https://github.com/xamarin/xamarin-macios/pull/7418 we want
to have all the endpoints in a single place to update them if the server
side does give us problems.
2019-11-25 04:54:56 -05:00
Rolf Bjarne Kvinge 884c13775a [docs] Add links to explain what native code sharing is. (#3009) 2019-11-22 15:06:06 -05:00
Sebastien Pouliot 58d325746a
[linker] Do not mark NSObject subclasses from Xamarin.Forms.Platform.iOS.dll assembly (#7473)
Turn older #7165 prototype into an experimental feature. It can be
enabled by adding `--optimize=experimental-xforms-product-type` to the
**Additional mtouch arguments** of the project.

ref: https://github.com/xamarin/xamarin-macios/pull/7165
2019-11-22 15:38:46 +01:00
Manuel de la Pena 2de737ef98
[Tests] Update tests.sln to include all the BCL tests. (#7479)
Update the UUIDs of the projects to ensure that they are all present
in the sln for developers to use.

Fixes: https://github.com/xamarin/xamarin-macios/issues/7475
Fixes: https://github.com/xamarin/xamarin-macios/issues/7476
2019-11-21 14:51:31 -05:00
Manuel de la Pena 6a702cb7b9
[Runtime] Enable the -Wsign-conversion on runtime.m files. (#7474)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-21 09:42:17 -05:00
Manuel de la Pena 8f6a10f3bd
[Runtime] Enable the -Wsign-conversion on monotouch-debug files. (#7459)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-20 13:42:51 -05:00
Marius Ungureanu 5913bd1807 Add IComparable<T> to NSString (#7468)
Fixes #5522
2019-11-20 07:45:13 -05:00
Manuel de la Pena 4aa269bbdb
[Runtime] Enable the -Wsign-conversion on monotouch-main.m files. (#7457)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-18 08:36:47 -05:00
Manuel de la Pena 481d5ef9ab
[Runtime] Enable the -Wsign-conversion on trampolines-x86_64.m files. (#7455)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 14:34:36 -05:00
Manuel de la Pena af196f1c72
[Runtime] Enable the -Wsign-conversion on trampolines.m files. (#7447)
Enable the flag that was disabled via pragmas and fix warnings.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-15 10:39:38 -05:00
Rolf Bjarne Kvinge 7caf1fbb04
[generator] If forcing a managed type, we must do so even if there's another managed instance of an incompatible type. Fixes #7441. (#7445)
If forcing a managed type for a particular native handle, we must ensure we're
always successful.

This means creating another managed instance even if there already is an
existing instance for the native handle. This is not optimal, but the
alternative is worse: some functionality can be completely broken otherwise
(such as NSSavePanel⁄NSOpenPanel may stop working).

If creating multiple managed instances for the same native handle ends up
being too problematic, we'll probably have to add full support for this
scenario (see #7442).

Fixes https://github.com/xamarin/xamarin-macios/issues/7441.
2019-11-15 08:16:06 +01:00
Manuel de la Pena 5e2231d533
[Runtime] Enable the -Wsign-conversion on trampolines-varargs files. (#7428)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 14:35:27 -05:00
Sebastien Pouliot 387730516f
[runtime] Clarify size in marshal_return_value calls (#7439)
Static analysis (and any manual review) is easily confused by
`sizeof (id)`, `sizeof (self)` and `sizeof (*self)` when another
argument is `self` and can report false positives (or be missed
or misinterpreted by humans).

This simply clarify that `|` is an encoded pointer and will
be the size of the pointer (varying by architectures)
2019-11-14 14:50:34 +01:00
Manuel de la Pena d83e9687a6
[Tests] Centralized the endpoints for the different network tests. (#7418)
Use a single point where the different enpoints can be found so that
if they need to be updated (server issues or other) it is a simple
change that will affect all tests in monotouch-tests
2019-11-14 05:45:33 -05:00
Manuel de la Pena dc0a877fed
[Runtime] Enable the -Wsign-conversion on trampolines-invoke.m (#7429)
Enable the flag that was disabled via pragmas.

Continuation of PR: https://github.com/xamarin/xamarin-macios/pull/7405
2019-11-14 05:44:51 -05:00
Manuel de la Pena eedf342abb
[Runtime] Add extra flags from preventing us to add code with warnings. (#7432) 2019-11-14 05:44:13 -05:00
Sebastien Pouliot 089ca17e5a
[runtime] Catch and log exceptions in ObjC++ destructor (#7421)
`xamarin_notify_dealloc` can throw an exception (depending on the mode
used).

Throwing exception in a destructor is problematic in [Obj]C++ and can
abort the application. That might be fine in some cases but there's
not much point in doing so when we're about to forget everything about
that specific object.
2019-11-14 09:30:48 +01:00
Manuel de la Pena de14b5a583
[CoreFoundation] CFBundle.GetAll better thread safe. (#7425)
The initial solution fixed the rance condition in which the index
changed, but that did not guarantee that we would get the correct
bundles. We now clone the CFArray (which also clones the callbacks set
to the array) and iterate over it to make sure Apple does not do evil
tings while we are iteraing.

Better Fixes: https://github.com/xamarin/maccore/issues/940
2019-11-13 17:19:16 -05:00
Rolf Bjarne Kvinge d94d2f1ae6
[Jenkins] Make it possible to trigger device tests from PRs built on internal Jenkins. (#7424) 2019-11-13 22:07:20 +01:00
Sebastien Pouliot c46d9857a4
[runtime] Filter isblank input to 8 bits values (#7420)
Help static analyzer by clarifying that only `char` will be given to
`isblank` so it does not look like it could be used to index an array
and gets out of bounds (important since this is user supplied values).

Digging down into `isblank` will get you to
> Using tainted variable _c as an index to array _DefaultRuneLocale.__runetype.
2019-11-13 20:46:20 +01:00
Manuel de la Pena f613021a3f
[CoreFoundation] Add Clone method for CFArray. (#7403)
When working on https://github.com/xamarin/maccore/issues/940 we noticed
that clone the array would be a better approach.

The CFArrayCreateCopy add some nice things:

* The pointer values from theArray are copied into the new array.
* The values are also retained by the new array.
* The count of the new array is the same as theArray
* The new array uses the same callbacks as theArray. [IMPORTANT]

Whith this in, we can have a better fix for https://github.com/xamarin/maccore/issues/940
2019-11-13 06:06:23 -05:00
Manuel de la Pena 8a63932245
[Tests] GetGlobalQueue_QualityOfService is only supported on Mac OS X 10.10 and later (#7419)
Ensure that the test does not fail in earlier versions of the os.

Fixes: https://github.com/xamarin/maccore/issues/2062
2019-11-13 06:03:23 -05:00
Manuel de la Pena 63ab48e679
[Runtime] Enable the -Wsign-conversion warnings flag and fix some of the warnings. (#7405)
The flag adds a lot (A LOT) of warnings. The diff would be huge and
dangerous to review. We enable the flag and fix file by file.
2019-11-12 15:10:16 -05:00
Sebastien Pouliot f0f06c1338
[runtime] Zeroize dummy member of structure in binding-generator (#7411)
This is not exposed so it should never be an issue - but just in
case something else goes wrong then it will only be 0 (and not
random values).
2019-11-12 21:03:56 +01:00
Manuel de la Pena ca98880277
[Tests] If we have server errors. Mark test as inconclusive. (#7401)
If we are getting errors (500,401..) do not mark a link all test as a
failure, but as inconclusive. Update the urls since msdn is giving always a 500.

Fixes: https://github.com/xamarin/maccore/issues/2056
2019-11-12 13:34:58 -05:00
Rolf Bjarne Kvinge 268f9e8c23
Bump maccore to get mlaunch fix. (#7412)
Diff: f56575dcc2..92433b7757
2019-11-12 18:51:27 +01:00
michizhou e9b18d4c2f [CoreFoundation] [tests] Add new DispatchQueue overloaded method (#7343)
* [CoreFoundation] [tests] Add new DispatchQueue overloaded method with unit tests. Fixes #6783

* [CoreFoundation] [tests] Add new variant method to DispatchQueue

* [CoreFoundation] [tests] Remove nonexistent DispatchQueue methods

* [CoreFoundation] [tests] Restore existing methods and tests
2019-11-12 14:56:45 +01:00
Sebastien Pouliot 0b323ca4cd
[runtime] Clarify redirect_io behaviour (#7409)
Change `redirect_io` to be easier to re-use correctly, i.e. returning the
file descriptor (instead of `0`).

Comment why the file descriptor are never released. It makes sense but
it's not obvious (even less in `redirect_io`) without comments.

Using static fields also makes it easier for static analysis (locals are
easier to process).

Finally reuse, mostly, the same string for the error message, i.e.

```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect %s to `%s': %s
```
versus
```
$ strings runtime//.libs/mac/libxammac.x86_64.dylib | grep "Could not redirect"
Xamarin.Mac: Could not redirect stdout to `%s': %s
Xamarin.Mac: Could not redirect stderr to `%s': %s
```
2019-11-12 12:34:49 +01:00
Manuel de la Pena e639470892
[Packaging] Ensure that when we build from source, the srcs go to the correct place. (#7394)
* [Packaging] Ensure that when we build from source,  the srcs go to the correct plance.

When building from source, the install-sources command was not moving
the files correctly. This change makes sure that, if we build from
source, we do add the mono sources in the correct location.

Fixes: https://github.com/xamarin/xamarin-macios/issues/7393
2019-11-11 18:18:28 -05:00
Manuel de la Pena 452f4dcf7d
[CoreFoundation] Ensure that we are thread safe. (#7391)
CFBundleGetAllBundles as per Apple docs is not thread safe, this means
that when we loop over the bundles, and use a property, the value is
updated by a different thread. This means that in some weird cases we
get an IndexOutOfBounds exception. We now store the count and use it in
the loop.

Fixes: https://github.com/xamarin/maccore/issues/940
2019-11-08 18:07:59 -05:00
Manuel de la Pena cf6280b305
[Install] Ensure that sources from mono are included when building from source. (#7385)
The PathManglerFactory was getting confused when building mono from
source again and since it did not find the sources in the download
directory it considered that the path to modify was part of Xamarin.

Now the factory tests first if we are getting a path from the mono
external submodule, if that is the case we know is a mono path and do
the right thing.

Fixes https://github.com/xamarin/maccore/issues/2053
2019-11-08 10:33:20 -05:00
Rolf Bjarne Kvinge e23362854e
[tests] Add make target to manually launch a device test run for the current commit. (#7282)
* [tests] Add make target to manually launch a device test run for the current commit.

* Upload a manifest that can be found using only the hash, and use it to find the packages.
2019-11-07 22:41:24 +01:00
monojenkins 2d28504961 Update APIDIFF_REFERENCES to current stable (#7373) 2019-11-06 17:08:06 -05:00
Manuel de la Pena 566e5a8d12
[Install] Do not crash when the directory is not found. (#7378)
This is NOT a fix for https://github.com/xamarin/maccore/issues/2053 but
a nice thing to have to make sure that when the file cannot be copied we
have a useful debugging message. Fixing
https://github.com/xamarin/maccore/issues/2053 should be done in the
path mangler that is doing something wrong with the paths.
2019-11-06 16:09:02 -05:00
Pramit Mallick 0c1b9b9b03 [UIKit] Added Static to UITraitCollection.FromPreferredContentSizeCategory (#7350)
Add a new static method to be used and obsolete the old wrong bound code.
2019-11-06 15:22:52 -05:00
monojenkins 1926eaecee [Tests] Fix introspection failing due to a typo. (#7376)
Fixes: https://github.com/xamarin/maccore/issues/2052
2019-11-06 14:52:13 -05:00
Vincent Dondain 63d092d526
Merge pull request #7368 from VincentDondain/master-merge-xcode11.2
Merge xcode11.2 into master
2019-11-06 10:43:45 -05:00
Vincent Dondain a558d84457 Merge branch 'xcode11.2' into master-merge-xcode11.2 2019-11-05 15:25:49 -05:00
Manuel de la Pena 2e5b64893f
[Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings. (#7353)
* [Runtime] Enable the -Wshorten-64-to-32 flag and fix all warnings.

We want to enable the -Wconversion but that will raise too many warning
for a single commit. We are enabiling one by one the flags included in
-Wconversion so that we have smaller diffs.

-Wshorten-64-to-32 adds warnings when there is a implicit conversion that
loses integer precision. We are moving all the 32 to 64 conversions to
use 64. Expecially since most of the code changed is related with sizes,
legths and params counts that are never going to be negative.


Co-Authored-By: Rolf Bjarne Kvinge <rolf@xamarin.com>
2019-11-05 11:00:14 -05:00
Marius Ungureanu f079db990b Remove redundant class_ptr initialization (#7357)
This is already done by the generated code, as seen below.

```csharp
		selWindowWithWindowNumber_Handle = Selector.GetHandle ("windowWithWindowNumber:");
		selWindowsHandle = Selector.GetHandle ("windows");
		selWindowsMenuHandle = Selector.GetHandle ("windowsMenu");
		class_ptr = Class.GetHandle ("NSApplication");
		class_ptr = Class.GetHandle ("NSApplication");
	}
```

With this change, we've also removed the static constructor, therefore all the fields are going to be initialized when they are used, as opposed to being forcefully loaded on the first access. This may improve startup times
2019-11-04 21:46:30 +01:00
michizhou 00f7069b23 [mmp] [mtouch] Expand error message for MM4162 and MT4162. Fixes #4286 (#7313) 2019-11-04 11:09:28 -05:00
Sebastien Pouliot e55e434213
[runtime] Free `env-argv` in `xamarin-main` (#7352)
`get_mono_env_options` allocate memory so it must [1] be freed.

[1] to be polite since it will be freed when the app exit, which
will free everything anyway
2019-11-04 08:56:59 -05:00
Sebastien Pouliot 8f92c3dcdd
[runtime] Merge two identical code paths (#7351) 2019-11-04 08:55:02 -05:00