mono.git
7 years ago[msvc] Update csproj files
monojenkins [Sat, 29 Oct 2016 04:24:01 +0000 (04:24 +0000)]
[msvc] Update csproj files

7 years ago[threads] Replace use of W32Handle by MonoOSEvent for MonoThreadInfo exited event...
Ludovic Henry [Fri, 28 Oct 2016 21:00:54 +0000 (17:00 -0400)]
[threads] Replace use of W32Handle by MonoOSEvent for MonoThreadInfo exited event (#3659)

* [mono-threads] Make thread wait platform specific

* [mono-threads] Replace thread w32handle use by event

This allows use to remove the MonoThreadInfo dependency on the w32handle on posix.

* [w32handle] Move them to metadata

w32handle are purely for managed support, and they shouldn't be used in the runtime.

* [mono-threads] Factor open/close thread handle

* [mono-threads] Factor exit thread

* [mono-threads] Factor platform register/unregister thread

* [mono-threads] Use ThreadHandle on all platforms

* [threads] Fix mutex abandonning for main thread

According to the comment, the intent is to abandon the mutex hold by the current thread. This intent was conveyed by the previous code when the threading code was still in the io-layer.

7 years agoMore metadata cleanup (#3792)
Zoltan Varga [Fri, 28 Oct 2016 19:51:35 +0000 (15:51 -0400)]
More metadata cleanup (#3792)

* [runtime] Introduce a new mono_class_init_sizes () function which initializes only the instance fields without initializing fields if possible. Use it in a few places instead of mono_class_init ()/mono_class_setup_fields ().

* [runtime] Simplify mono_class_has_references (), it doesn't have to special case the init_pending case.

* [runtime] Use a TLS list instead of the 'init_pending' flag to detect recursion in mono_class_init ().

* [runtime] Reduce the size of the critical section in mono_class_init () by doing most of the work outside the lock.

* [runtime] Avoid loading cached class info for pointer etc. types.

* [runtime] Reduce the locking inside setup_interface_offsets ().

7 years ago[sre] Remove some dead code.
Zoltan Varga [Fri, 28 Oct 2016 19:29:02 +0000 (15:29 -0400)]
[sre] Remove some dead code.

7 years agoMerge pull request #3847 from rolfbjarne/btls-remove-unused-pinvokes
Alexander Köplinger [Fri, 28 Oct 2016 14:03:36 +0000 (16:03 +0200)]
Merge pull request #3847 from rolfbjarne/btls-remove-unused-pinvokes

[System] Remove unused BTLS P/Invokes.

7 years ago[bcl] Disable BTLS on xammac and xammac_net_4_5 profiles
Alexander Köplinger [Fri, 28 Oct 2016 13:59:00 +0000 (15:59 +0200)]
[bcl] Disable BTLS on xammac and xammac_net_4_5 profiles

7 years ago[btls] Fix library install
Alexander Köplinger [Fri, 28 Oct 2016 13:52:04 +0000 (15:52 +0200)]
[btls] Fix library install

We need to ensure the directory is created and doesn't have an extraneous '/' char.

7 years ago[threads] Fix suspend on watchos
Ludovic Henry [Fri, 28 Oct 2016 13:10:23 +0000 (09:10 -0400)]
[threads] Fix suspend on watchos

Because certain platform (such as WatchOS) do not support syscall abort, we need to ensure that it is supported before we call the `mono_threads_suspend_abort_syscall` function.

7 years agoconfigure.ac: fix incorrect description
Alexander Köplinger [Fri, 28 Oct 2016 13:11:54 +0000 (15:11 +0200)]
configure.ac: fix incorrect description

7 years ago[gc] Remove mono_gc_set_stack_end (#3845)
Ludovic Henry [Fri, 28 Oct 2016 12:49:23 +0000 (08:49 -0400)]
[gc] Remove mono_gc_set_stack_end (#3845)

* [sgen] Add stress test

This hope to suspend a thread while it is in the process of attaching or detaching.

* [sgen] Fix unified suspend

This would cause a crash with unified suspend: if a thread would be suspended at mono-threads.c:1168, the stack_start would be greater than the stack_end, triggering the g_error at sgen-stw.c:351. The stack_end would initially be initialized in `sgen_client_thread_register`, but it would be overriden in start_wrapper at threads.c:893.

7 years agoMerge pull request #3846 from monojenkins/update-csprojs
Alexander Köplinger [Fri, 28 Oct 2016 10:07:12 +0000 (12:07 +0200)]
Merge pull request #3846 from monojenkins/update-csprojs

[msvc] Update csproj files

7 years agoMerge pull request #3844 from tritao/deflate_fixes
João Matos [Fri, 28 Oct 2016 10:06:00 +0000 (11:06 +0100)]
Merge pull request #3844 from tritao/deflate_fixes

[System.IO.Compresion] DeflateStream fixes

7 years ago[System] Remove unused BTLS P/Invokes.
Rolf Bjarne Kvinge [Fri, 28 Oct 2016 05:51:33 +0000 (07:51 +0200)]
[System] Remove unused BTLS P/Invokes.

They point to internal functions that don't exist, causing compilation
problems for Xamarin.Mac apps.

Example test/compile failure: https://gist.github.com/rolfbjarne/43cf2228816bbe8a863f331da3e07c0d

7 years ago[msvc] Update csproj files
monojenkins [Fri, 28 Oct 2016 04:24:51 +0000 (04:24 +0000)]
[msvc] Update csproj files

7 years ago[corlib] Disable a few tests that are not supported on MOBILE_STATIC for now
Alexander Köplinger [Fri, 28 Oct 2016 01:14:48 +0000 (03:14 +0200)]
[corlib] Disable a few tests that are not supported on MOBILE_STATIC for now

They were added in 895f3f5ae8e22c14511baa8c2a5c3f1b17009c02.

7 years ago[llvm] Add the 'notail' flag to non-tailcalls when using the 3.9 based llvm.
Zoltan Varga [Thu, 27 Oct 2016 22:28:46 +0000 (18:28 -0400)]
[llvm] Add the 'notail' flag to non-tailcalls when using the 3.9 based llvm.

7 years ago[System.IO.Compression] Fixed potential bug when keeping track of total read bytes...
Joao Matos [Thu, 27 Oct 2016 19:35:20 +0000 (20:35 +0100)]
[System.IO.Compression] Fixed potential bug when keeping track of total read bytes of input stream.

This didn't manifest as a bug, to to be on the safe side, replicate the behavior
introduced in https://github.com/mono/mono/commit/b4d5016b5e42fec226d93fd13260b6cac80eb384
and use the same approach when calculating the total of the read bytes of the input stream.

7 years ago[System.IO.Compression] Fixed DeflateStream input stream EOF condition.
Joao Matos [Thu, 27 Oct 2016 18:45:34 +0000 (19:45 +0100)]
[System.IO.Compression] Fixed DeflateStream input stream EOF condition.

What was happening is that we set the stream EOF flag to true when we
could not read any more input data, and that made us early out before
fully finishing the processing of the compressed data.

Now the only EOF flag is set to true is if zlib's inflate() has actually
finished processing the data.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.

7 years ago[coop handles] Don't scan null object references
Aleksey Kliger [Fri, 21 Oct 2016 15:00:04 +0000 (11:00 -0400)]
[coop handles] Don't scan null object references

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

7 years ago[System.IO.Compression] Fixed DeflateStream inflate() decompression loop.
Joao Matos [Thu, 27 Oct 2016 18:12:31 +0000 (19:12 +0100)]
[System.IO.Compression] Fixed DeflateStream inflate() decompression loop.

This reworks the fix from https://github.com/mono/mono/commit/7c4d41a518aaf0370b882f9430752ebcd5544c10.

That fix introduced a regression when handling some inputs, which lead us to ignore
some left-over data from zlib's inflate output buffer.

Now we only break from the loop if inflate() returns Z_BUF_ERROR.

This makes sure all data is fully processed before returning to managed code.

Fixes one of the bugs in https://bugzilla.xamarin.com/show_bug.cgi?id=44994#c2.

7 years agoMerge pull request #3769 from evincarofautumn/fix-verify-before-allocs
Vlad Brezae [Thu, 27 Oct 2016 17:49:30 +0000 (20:49 +0300)]
Merge pull request #3769 from evincarofautumn/fix-verify-before-allocs

[sgen] Fix verify-before-allocs.

7 years ago[btls] Remove the statically linked btls code, the dynamic version should work on...
Zoltan Varga [Thu, 27 Oct 2016 17:21:09 +0000 (13:21 -0400)]
[btls] Remove the statically linked btls code, the dynamic version should work on all platforms. (#3829)

7 years ago[bcl]: Fix 'Mono.Btls.Interface' build logic.
Martin Baulig [Thu, 27 Oct 2016 12:19:24 +0000 (14:19 +0200)]
[bcl]: Fix 'Mono.Btls.Interface' build logic.

(cherry picked from commit 43558a209d64e5e91f137df0bfc7caec80fee114)

7 years agoMerge pull request #3800 from madewokherd/mingwbuild
Alexander Köplinger [Thu, 27 Oct 2016 10:37:23 +0000 (12:37 +0200)]
Merge pull request #3800 from madewokherd/mingwbuild

Use lower-case names for Windows headers.

7 years ago[man] Typo fixes for the man pages
Abdur Rehman [Thu, 27 Oct 2016 08:35:03 +0000 (13:35 +0500)]
[man] Typo fixes for the man pages

disco.1: fix typo, closes #3841

csharp.1: fix typos, closes #3840

crlupdate.1: fix minor typo, closes #3839

certmgr.1: fix typos/grammar, closes #3838

ccrewrite.1: fix minor grammatical errors, closes #3837

ccrewrite.1: fix copyright, closes #3836

Following comment changed the copyright:
https://github.com/mono/mono/commit/5a3fb39ca6a46250aec3afef21c85bef30239fc5

Reflect same change in the comments.

7 years agoMerge pull request #3826 from monojenkins/update-csprojs
Alexander Köplinger [Thu, 27 Oct 2016 00:24:09 +0000 (02:24 +0200)]
Merge pull request #3826 from monojenkins/update-csprojs

[msvc] Update csproj files

7 years agoMerge pull request #3831 from rolfbjarne/watchos-fix-defaultproxy-test
Alexander Köplinger [Wed, 26 Oct 2016 22:32:17 +0000 (00:32 +0200)]
Merge pull request #3831 from rolfbjarne/watchos-fix-defaultproxy-test

[System] Tweak define to exclude System.Net.WebProxy.CreateDefaultProxy and update corresponding test.

7 years agoMerge pull request #3832 from microMolvi/patch-2
Alexander Köplinger [Wed, 26 Oct 2016 22:30:23 +0000 (00:30 +0200)]
Merge pull request #3832 from microMolvi/patch-2

cccheck.1: fix a typo

7 years ago[runtime] Fix a test so it works with bitcode, stack traces might contain wrapper...
Zoltan Varga [Wed, 26 Oct 2016 22:10:49 +0000 (18:10 -0400)]
[runtime] Fix a test so it works with bitcode, stack traces might contain wrapper frames.

7 years ago[llvmonly] Add gsharedvt out wrappers for icalls, the icall wrappers have a different...
Zoltan Varga [Wed, 26 Oct 2016 20:36:25 +0000 (16:36 -0400)]
[llvmonly] Add gsharedvt out wrappers for icalls, the icall wrappers have a different signature (this/no this).

7 years agocccheck.1: fix a typo
Abdur Rehman [Wed, 26 Oct 2016 20:00:23 +0000 (01:00 +0500)]
cccheck.1: fix a typo

7 years ago[suspend] Remove sgen specific suspend code (#3640)
Ludovic Henry [Wed, 26 Oct 2016 18:57:17 +0000 (14:57 -0400)]
[suspend] Remove sgen specific suspend code (#3640)

* [suspend] Remove sgen specific suspend code

* [sgen] Remove unused SgenClientThreadInfo->stopped_domain field

* [sgen] Remove unused SgenClientThreadInfo->stopped_ip field

* [threads] Unsplit code for syscall abort

* [threads] Reuse posix suspend signal handler function for abort

* [mono-threads] Move debug printf to separate file

This is to avoid recompiling half of the runtime for every change to these printf.

* [stw] Slightly improve logging

* [mono-threads] Fix unified thread suspend

`mono_threads_suspend_begin_async_suspend` return FALSE iff it coudn't successfully suspend the thread, not if the thread is not in the correct state. The latter is checked by calling `mono_threads_suspend_check_suspend_result` which will return FALSE if we couldn't initialize the state of the suspended thread.

* [mono-threads] Fix unified thread suspend

If we try to suspend a thread that is still attaching, we might suspend it after it allocated the MonoInternalThread and MonoThread, but before it set the current domain or lmf. This would lead us to not scan the thread stack, which would lead to collect the newly allocate MonoInternalThread/MonoThread, leading to a crash. By letting sgen deal with the thread, even if the domain or the lmf is not set, we avoid this bug.

This makes unified suspend have the same behaviour as the previous sgen specific suspend.

* [mono-threads] Fix compilation

7 years ago[System] Tweak define to exclude System.Net.WebProxy.CreateDefaultProxy and update...
Rolf Bjarne Kvinge [Wed, 26 Oct 2016 09:39:30 +0000 (11:39 +0200)]
[System] Tweak define to exclude System.Net.WebProxy.CreateDefaultProxy and update corresponding test.

7 years ago[mono-config] fix warning (#3820)
Bernhard Urban [Wed, 26 Oct 2016 17:05:06 +0000 (19:05 +0200)]
[mono-config] fix warning (#3820)

```
mono-config.c:324:14: warning: passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
                                        g_free (libdir);
                                                ^~~~~~
../../eglib/src/glib.h:125:20: note: passing argument to parameter 'ptr' here
void g_free (void *ptr);
                   ^
1 warning generated.
```

7 years ago[llvm] Use the global llvm context instead of creating a new one for each aot module...
Zoltan Varga [Wed, 26 Oct 2016 16:41:53 +0000 (12:41 -0400)]
[llvm] Use the global llvm context instead of creating a new one for each aot module, since the latter seems to cause random memory corruption/crashes.

7 years ago[btls] Install the btls shared library on make install. (#3825)
Zoltan Varga [Wed, 26 Oct 2016 15:54:52 +0000 (11:54 -0400)]
[btls] Install the btls shared library on make install. (#3825)

7 years ago[mcs] Add pathmap option
Marek Safar [Wed, 26 Oct 2016 09:22:52 +0000 (11:22 +0200)]
[mcs] Add pathmap option

7 years ago[msvc] Update csproj files
monojenkins [Wed, 26 Oct 2016 05:22:19 +0000 (05:22 +0000)]
[msvc] Update csproj files

7 years ago[mobile-static] Increase trampoline limits even more.
Zoltan Varga [Tue, 25 Oct 2016 22:51:17 +0000 (18:51 -0400)]
[mobile-static] Increase trampoline limits even more.

7 years ago[mobile-static] Increase the number of imt trampolines to 2000 to prevent running...
Zoltan Varga [Tue, 25 Oct 2016 22:12:58 +0000 (18:12 -0400)]
[mobile-static] Increase the number of imt trampolines to 2000 to prevent running out of them in the System.Core tests.

7 years ago[runtime] For delegate invoke wrappers, store the generic invoke method in the wrappe...
Zoltan Varga [Tue, 25 Oct 2016 22:05:32 +0000 (18:05 -0400)]
[runtime] For delegate invoke wrappers, store the generic invoke method in the wrapper info and inflate it when inflating the wrapper. Fixes ipy failure. (#3821)

7 years agoMerge pull request #3823 from mono/fix-btls-managed
Alexander Köplinger [Tue, 25 Oct 2016 20:29:23 +0000 (22:29 +0200)]
Merge pull request #3823 from mono/fix-btls-managed

[System] Don't build managed BTLS code on monotouch

7 years ago[bcl] Only build Mono.Btls.Interface and btls tool when BTLS is enabled
Alexander Köplinger [Tue, 25 Oct 2016 17:49:17 +0000 (19:49 +0200)]
[bcl] Only build Mono.Btls.Interface and btls tool when BTLS is enabled

7 years ago[System] Don't build managed BTLS code on monotouch
Alexander Köplinger [Tue, 25 Oct 2016 16:44:33 +0000 (18:44 +0200)]
[System] Don't build managed BTLS code on monotouch

After 2fb07d6c6d5b3915ef4665391febbb7b8be09fb5 BTLS can be used as a shared lib,
but this caused an issue in some monotouch tools which grepped the P/Invokes for `__Internal`
since these icalls wouldn't resolve on monotouch since BTLS is disabled there.

Instead, we now completely leave out building the managed parts of BTLS when
BTLS is not enabled.

7 years agoFix compilation errors in mono/utils/os-event-win32.c with Mingw/GCC (#3818)
Niklas Therning [Tue, 25 Oct 2016 14:49:50 +0000 (16:49 +0200)]
Fix compilation errors in mono/utils/os-event-win32.c with Mingw/GCC (#3818)

This was introduced in 92be5357d12ecf0cc4c51fbcb76fc0514b375d1c. The patch
also adds the os-event-win32.c file to the libmonoutils Visual Studio project.

7 years ago[BTLS]: Fix a ref-counting leak in X509ChainImplBtls. Fixes #45687. (#3811)
Martin Baulig [Tue, 25 Oct 2016 13:42:08 +0000 (15:42 +0200)]
[BTLS]: Fix a ref-counting leak in X509ChainImplBtls.  Fixes #45687. (#3811)

* [BTLS]: Fix a ref-counting leak in X509ChainImplBtls.  Fixes #45687.

* Set 'untrusted = null' in Dispose().

(cherry picked from commit c9a67ffc5addabe74015f7d8f33977f4ab416075)

7 years ago[System] Clean up some warnings
Marek Safar [Tue, 25 Oct 2016 12:28:35 +0000 (14:28 +0200)]
[System] Clean up some warnings

7 years ago[runtime] Ignore bit 14 in typedef export table during verification. It seems to...
Marek Safar [Tue, 25 Oct 2016 10:50:12 +0000 (12:50 +0200)]
[runtime] Ignore bit 14 in typedef export table during verification. It seems to be used by some WinRT predefined types

7 years agoMerge pull request #3817 from monojenkins/update-csprojs
Alexander Köplinger [Tue, 25 Oct 2016 09:58:06 +0000 (11:58 +0200)]
Merge pull request #3817 from monojenkins/update-csprojs

[msvc] Update csproj files

7 years agoMonoLinker: Fix a Typo in the README (#3816)
Swaroop Sridhar [Tue, 25 Oct 2016 05:33:25 +0000 (22:33 -0700)]
MonoLinker: Fix a Typo in the README (#3816)

7 years ago[msvc] Update csproj files
monojenkins [Tue, 25 Oct 2016 04:51:24 +0000 (04:51 +0000)]
[msvc] Update csproj files

7 years agoMerge pull request #3812 from rolfbjarne/watchos-no-cfnetwork
Marek Safar [Mon, 24 Oct 2016 21:27:39 +0000 (23:27 +0200)]
Merge pull request #3812 from rolfbjarne/watchos-no-cfnetwork

[System] Remove any CFNetwork usage from the watchOS profile. Fixes #45847.

7 years agoMerge pull request #3815 from microMolvi/patch-1
Alexander Köplinger [Mon, 24 Oct 2016 21:20:48 +0000 (23:20 +0200)]
Merge pull request #3815 from microMolvi/patch-1

caspol.1: fix minor grammatical errors

7 years ago[x86] Clear the fp stack when exceptions are thrown. Fixes #45841. (#3814)
Zoltan Varga [Mon, 24 Oct 2016 20:42:52 +0000 (16:42 -0400)]
[x86] Clear the fp stack when exceptions are thrown. Fixes #45841. (#3814)

7 years agocaspol.1: fix minor grammatical errors
Abdur Rehman [Mon, 24 Oct 2016 19:15:03 +0000 (00:15 +0500)]
caspol.1: fix minor grammatical errors

7 years ago[runtime] Fix an assert message.
Zoltan Varga [Mon, 24 Oct 2016 18:58:07 +0000 (14:58 -0400)]
[runtime] Fix an assert message.

7 years ago[System] Remove any CFNetwork usage from the watchOS profile. Fixes #45847.
Rolf Bjarne Kvinge [Mon, 24 Oct 2016 17:50:16 +0000 (19:50 +0200)]
[System] Remove any CFNetwork usage from the watchOS profile. Fixes #45847.

The MacProxy class uses CFNetwork, but since CFNetwork is not a public
framework on watchOS, we can't use it.

So remove MacProxy completely (it only contains internal classes), and throw
PlatformNotSupportedException in any API that used it (the managed networking
stack is not supported on watchOS anyway, so this should be safe).

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

7 years ago[runtime] Add MonoOSEvent
Ludovic Henry [Tue, 27 Sep 2016 19:08:27 +0000 (21:08 +0200)]
[runtime] Add MonoOSEvent

7 years agoMake mkbundle use SDKs instead of a single runtime for cross compilation
Miguel de Icaza [Mon, 24 Oct 2016 16:47:31 +0000 (11:47 -0500)]
Make mkbundle use SDKs instead of a single runtime for cross compilation

Make mkbundle use SDKs instead of a single runtime for cross compilation

7 years agoMerge pull request #3801 from akoeplinger/netstandard20-updates
Alexander Köplinger [Mon, 24 Oct 2016 14:36:49 +0000 (16:36 +0200)]
Merge pull request #3801 from akoeplinger/netstandard20-updates

[bcl] Move a few types from the Facades into the framework for netstandard20 compatibility

7 years agoMerge pull request #3810 from lateralusX/jlorenss/add_missing_assert_include
Johan Lorensson [Mon, 24 Oct 2016 14:09:59 +0000 (16:09 +0200)]
Merge pull request #3810 from lateralusX/jlorenss/add_missing_assert_include

Explicit include of assert.h.

7 years agoExplicit include of assert.h.
lateralusX [Mon, 24 Oct 2016 13:39:55 +0000 (15:39 +0200)]
Explicit include of assert.h.

7 years ago[configure.ac] Only disable -Wno-zero-length-array on clang
Alexander Köplinger [Mon, 24 Oct 2016 13:17:54 +0000 (15:17 +0200)]
[configure.ac] Only disable -Wno-zero-length-array on clang

The $GCC variable in autoconf will be yes for clang as well [1].

[1] https://lists.gnu.org/archive/html/autoconf/2014-09/msg00023.html

7 years agoMerge pull request #3442 from lateralusX/jlorenss/win-atexit-commands
Johan Lorensson [Mon, 24 Oct 2016 09:53:15 +0000 (11:53 +0200)]
Merge pull request #3442 from lateralusX/jlorenss/win-atexit-commands

Add support on Windows to install atexit handler(s) early in bootprocess.

7 years agoMerge pull request #3808 from monojenkins/update-csprojs
Alexander Köplinger [Sat, 22 Oct 2016 12:23:00 +0000 (14:23 +0200)]
Merge pull request #3808 from monojenkins/update-csprojs

[msvc] Update csproj files

7 years ago[mono] Add some strong types for a few variables, document some methods (#3777)
Miguel de Icaza [Sat, 22 Oct 2016 04:36:34 +0000 (23:36 -0500)]
[mono] Add some strong types for a few variables, document some methods (#3777)

7 years ago[msvc] Update csproj files
monojenkins [Sat, 22 Oct 2016 04:28:22 +0000 (04:28 +0000)]
[msvc] Update csproj files

7 years ago[btls] Convert BTLS icalls to pinvokes by invoking them using [DllImp… (#3799)
Zoltan Varga [Fri, 21 Oct 2016 21:29:13 +0000 (17:29 -0400)]
[btls] Convert BTLS icalls to pinvokes by invoking them using [DllImp… (#3799)

* [btls] Convert BTLS icalls to pinvokes by invoking them using [DllImport("__Internal")], which will make it easier to redirect them to a separate dylib in the future.

* [btls] Add a --enable-dynamic-btls configure flag to enable compiling btls into a separate shared library instead of embedding it into the runtime.

7 years agoThere's a G_BREAKPOINT in mini-exceptions.c which could be hit during user execution...
Andi McClure [Fri, 21 Oct 2016 21:28:59 +0000 (17:28 -0400)]
There's a G_BREAKPOINT in mini-exceptions.c which could be hit during user execution. This will not be caught by our normal crash reporter, so we should use g_error here instead. (#3791)

7 years ago[runtime] Fix the native-to-managed marshalling of null blittable arrays. Fixes ...
Zoltan Varga [Fri, 21 Oct 2016 20:48:07 +0000 (16:48 -0400)]
[runtime] Fix the native-to-managed marshalling of null blittable arrays. Fixes #45788.

7 years ago[bcl] Move a few types from the Facades into the framework for netstandard20 compatib...
Alexander Köplinger [Fri, 21 Oct 2016 13:38:20 +0000 (15:38 +0200)]
[bcl] Move a few types from the Facades into the framework for netstandard20 compatibility

See https://github.com/dotnet/standard/pull/76.

Also moved IncrementalHash from System.Core.dll to mscorlib.dll as per discussion with Wes.

7 years ago[tests] Disable reference-loader.exe test for now
Alexander Köplinger [Fri, 21 Oct 2016 11:24:27 +0000 (13:24 +0200)]
[tests] Disable reference-loader.exe test for now

The code it's supposed to test was temporarily disabled in 1bf9409629c144dc5400a800e8ab20ed516d5ced

7 years agoChanges in class libraries to enable Windows Runtime event support using Mono's mscor...
TautvydasZilys [Fri, 21 Oct 2016 11:04:49 +0000 (14:04 +0300)]
Changes in class libraries to enable Windows Runtime event support using Mono's mscorlib (#3778)

* Use Windows Runtime event related classes from Reference Source and implement couple missing methods needed for Windows Runtime event suppor

* Add native stubs for newly added icalls.

* Attempt to fix build on non-windows

* Attempt to fix mscorlib build when COM is disabled.

* Revert "Attempt to fix mscorlib build when COM is disabled."

This reverts commit 5befc13b5ee7283fc4f19bd706389496c139790f.

* System.Type::IsWindowsRuntimeObjectProperty is under "FEATURE_COMINTEROP || MONO_COM", so its callers should be under it too.

* Fix build failure due to a semantic merge conflict with b313769878e1d96c2b50fb1c96be229282d74a30

7 years agoFix crash in SafePipeHandle.ReleaseHandle() on Windows (#3797)
Niklas Therning [Fri, 21 Oct 2016 01:52:38 +0000 (03:52 +0200)]
Fix crash in SafePipeHandle.ReleaseHandle() on Windows (#3797)

The ReleaseHandle() methods tries to deallocate the handle as if it was a
pointer to heap memory. But on Windows it's a HANDLE. The call to
Marshal.FreeHGlobal() causes a crash on Windows. It doesn't crash on other
platforms probably due to the emulated handles which are indeed heap allocated
memory objects. But the underlying file descriptor is never closed so there
should be a file descriptor leak on other platforms.

This patch fixes the issue by calling MonoIO.Close() on the handle rather than
Marshal.FreeHGlobal()

7 years agoUse lower-case names for Windows headers.
Vincent Povirk [Thu, 20 Oct 2016 21:36:18 +0000 (16:36 -0500)]
Use lower-case names for Windows headers.

Mingw on Linux is case-sensitive and requires this.

7 years ago[loader] Disable mono_assembly_has_reference_assembly_attribute
Aleksey Kliger [Thu, 20 Oct 2016 17:51:55 +0000 (13:51 -0400)]
[loader] Disable mono_assembly_has_reference_assembly_attribute

It relies on mono_custom_attrs_from_assembly_checked which is not
sufficiently robust to missing assemblies when trying to look for custom
attributes.

7 years ago[System]: Distinguish between empty hostnames and no hostnames for certificate valida...
Martin Baulig [Thu, 20 Oct 2016 00:44:32 +0000 (02:44 +0200)]
[System]: Distinguish between empty hostnames and no hostnames for certificate validation.

SecPolicyCreateSSL() distinguishes between an empty string (validation will fail
if the certificate contains host name constraints) and a null pointer (no host name
checking will be performed) for the hostname.

We incorrectly used `string.IsNullOrEmpty (host)` in a few places.

7 years ago[System]: ChainValidationHelper: always set 'status11' on error.
Martin Baulig [Thu, 20 Oct 2016 00:35:11 +0000 (02:35 +0200)]
[System]: ChainValidationHelper: always set 'status11' on error.

7 years ago[boringssl]: Merge latest chromium-stable branch from Google.
Martin Baulig [Thu, 20 Oct 2016 16:48:04 +0000 (18:48 +0200)]
[boringssl]: Merge latest chromium-stable branch from Google.

7 years agoMerge pull request #3786 from lambdageek/dev-42584-take2
Aleksey Kliger (λgeek) [Thu, 20 Oct 2016 15:33:15 +0000 (11:33 -0400)]
Merge pull request #3786 from lambdageek/dev-42584-take2

Check for ReferenceAssemblyAttribute when loading for execution

7 years agoUtf8 (#3776)
Miguel de Icaza [Thu, 20 Oct 2016 13:19:09 +0000 (08:19 -0500)]
Utf8 (#3776)

* UTF8 Marshaling APIs  (#3736)

Adds support for the new UTF8 marshaling functionality in .NET, there
is support for the new MarshalAs(UnmanagedType.LPUTF8St) as well as a
handful of convenience methods in Marshal.cs

In Mono, this is mostly a pass-through as we have historically only
done UTF8, so this merely adds the constant processing to the runtime.

This fixes a few bugs that the new test suite exhibited: when we
marshaled UTF8 strings, we assumed Chars() == Bytes() and we would end
up chopping when marshaling out, and marshaling in.

There is also an additional behavioral bug that was fixed in
Marshal.cs, unlike the rest of the runtime that treated Ansi as Utf8,
StringToCoTaskMemAnsi behaved as ascii. This brings the API in line
with the rest of the runtime.

The equivalent CoreCLR changes were:

dotnet/coreclr#4793
dotnet/coreclr#6561

This has also surfaced two limitations in Mono's marshaling code,
which is why two sets of tests are disabled: StringBuilder return
types are not handled specially (char * needs to be turned into a new
StringBuilder when present) and StringBuilders with an Out attribute
should update the StringBuilder in place, not make a new copy of it.

7 years agoAdd support on Windows to install atexit handler(s) early in application’s startup.
lateralusX [Thu, 20 Oct 2016 10:48:09 +0000 (12:48 +0200)]
Add support on Windows to install atexit handler(s) early in application’s startup.
This is done by adding a new argument to install specific named custom handlers,
--handlers=. There is also an argument to describe the supported handlers on current
platform, --help-handlers.

The supported handlers can be different depending on implementing platform and currently
only Windows uses this feature to install an atexit handler waiting for a keypress
before exiting process. This is however a generic concept that could be used to run handler
code early in the boot process on any platform for other purposes. Adding the argument first
in command line makes it possible to do the installation very early in the boot process, this
is used by the waitkeypress atexit handler in order to be used in cases where the arguments
itself are unsupported or incorrect formatted causing an exit of the process.

When running under Visual Studio debugger the console window will not be kept
open when the debugee process terminates. Normally this is not a problem, but there are scenarios,
especially when having errors in configuration, when you would like the console to be kept open so
you can read the output in order to detect the error.

Normally there is an option to start the console application from within Visual Studio but
not attaching the debugger (CTRL+F5) and by default Visual Studio will then inject a pause
in the execution of the process holding up the console, but for some reasons, having more
complex solutions like mono, this feature stops working, so it is not possible to keep the console
open in that scenario for more complex solutions.

This makes it a little problematic to hold the process when working within the debugger in order
to look for console output and errors. Since mono can exit the process using exit command and not
only by returning from main, the developer needs to set breakpoints on both end of main and in c-runtime
exit methods. Even if that is a possible workaround this option won't work when running the process outside
the debugger (CTRL+F5).

This commit adds a handler argument that can be used on Windows (potential on other platforms as well), atexit-waitkeypress.
The waitkeypress will hold the console and process open until a key is pressed and is very
useful when running and debugging mono from within Visual Studio. Example of output when running mono’s mono-mini-regression-test
with an assembly not found together with –handlers=atexit-waitkeypress command line argument:

failed to load assembly: gshared-nofound.exe
Overall results: tests: 0, 100% pass, opt combinations: 25
Press any key to continue . . .

Currently this is only implemented for Windows, but could be enabled for other platforms,
if similar need exist elsewhere.

Since this is a standard mono command line option it is possible to inject it using the MONO_ENV_OPTIONS environment variable as well.

7 years ago[runtime] Fix the calculation of the instance size of ptr/var types. (#3790)
Zoltan Varga [Wed, 19 Oct 2016 23:29:55 +0000 (19:29 -0400)]
[runtime] Fix the calculation of the instance size of ptr/var types. (#3790)

7 years agoMerge pull request #3787 from AsamK/fix_listview
Alexander Köplinger [Wed, 19 Oct 2016 13:30:39 +0000 (15:30 +0200)]
Merge pull request #3787 from AsamK/fix_listview

[MWF] Fix two issues in ListView

7 years ago[hybrid-aot] Fix GSharedVT support (#3783)
Ludovic Henry [Wed, 19 Oct 2016 13:14:59 +0000 (09:14 -0400)]
[hybrid-aot] Fix GSharedVT support (#3783)

* [aot-compiler] Cleanup GSharedVT check

* [aot-compiler] Enable partial sharing for hybrid AOT

* [aot] Enable GSharedVT for Android

* [aot] Ensure GSharedVT is supported at runtime as well as compile time

* [aot] Factor aot mode setting

7 years agoMerge pull request #3789 from monojenkins/update-csprojs
Alexander Köplinger [Wed, 19 Oct 2016 11:05:55 +0000 (13:05 +0200)]
Merge pull request #3789 from monojenkins/update-csprojs

[msvc] Update csproj files

7 years ago[msvc] Update csproj files
monojenkins [Wed, 19 Oct 2016 10:17:15 +0000 (10:17 +0000)]
[msvc] Update csproj files

7 years agoAdd unit tests for ListView bugs
Sebastian [Tue, 18 Oct 2016 22:05:23 +0000 (00:05 +0200)]
Add unit tests for ListView bugs

7 years ago[tools] Fix casing of sqlsharp
Alexander Köplinger [Tue, 18 Oct 2016 18:53:28 +0000 (20:53 +0200)]
[tools] Fix casing of sqlsharp

The directory is lowercase on disk.

7 years ago[runtime] Check for ReferenceAssemblyAttribute when loading for execution.
Aleksey Kliger [Tue, 18 Oct 2016 18:45:42 +0000 (14:45 -0400)]
[runtime] Check for ReferenceAssemblyAttribute when loading for execution.

An assembly with a System.Runtime.CompilerServices.ReferenceAssemblyAttribute
may be loaded in a reflection-only context, but not for execution.

When loading assembly refs, or when loading assemblies by name (as
opposed to file path), a reference assembly will be skipped over and
other assemblies from the GAC and the load path will be tried.

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

7 years ago[loader] Tests for RefereceAssemblyAttribute support
Aleksey Kliger [Wed, 12 Oct 2016 19:21:09 +0000 (15:21 -0400)]
[loader] Tests for RefereceAssemblyAttribute support

This reverts commit 8612b548ee110336fe84d74b099359c8a2864459.

Which itself reverted commit 31de4df835d27ec750fc81739bdd84a87a2efaa7.

7 years ago[runtime] Let mono_custom_attrs_has_attr ignore malformed attributes
Aleksey Kliger [Wed, 12 Oct 2016 18:43:07 +0000 (14:43 -0400)]
[runtime] Let mono_custom_attrs_has_attr ignore malformed attributes

7 years ago[runtime] Don't build temporary array in mono_custom_attrs_get_attr_checked
Aleksey Kliger [Wed, 12 Oct 2016 16:02:08 +0000 (12:02 -0400)]
[runtime] Don't build temporary array in mono_custom_attrs_get_attr_checked

Just return the first matching attribute as soon as it's found, don't
build a temporary array and then index into it.

7 years ago[runtime] Mark mono_custom_attrs_get_attr external only
Aleksey Kliger [Wed, 12 Oct 2016 16:01:28 +0000 (12:01 -0400)]
[runtime] Mark mono_custom_attrs_get_attr external only

Runtime should use mono_custom_attrs_get_attr_checked.

7 years ago[runtime] Add assembly name to message in FileNotFoundException
Aleksey Kliger [Wed, 12 Oct 2016 15:49:05 +0000 (11:49 -0400)]
[runtime] Add assembly name to message in FileNotFoundException

when using mono_error_set_assembly_load_simple ()

7 years agoFix ArgumentOutOfRangeException exception when removing a not focused item
Sebastian [Tue, 18 Oct 2016 18:19:45 +0000 (20:19 +0200)]
Fix ArgumentOutOfRangeException exception when removing a not focused item

The code in RemoveAt doesn't update the focused item index, if the focused
item is the last item in the list and another item is removed.
The next time an item is removed, the focused item index is equal to Count
and an ArgumentOutOfRangeException is thrown.

7 years agoFix IndexOutOfBounds exception, when removing and adding an item to another list
Sebastian [Tue, 18 Oct 2016 18:14:50 +0000 (20:14 +0200)]
Fix IndexOutOfBounds exception, when removing and adding an item to another list

Removing a selected item from one ListView and adding the same item to
another ListView, an IndexOutOfBounds exception was thrown, if the second
ListView has fewer elements than the first one. That's because the
DisplayIndex still contained the index from the first ListView.

7 years agoBump boringssl submodule
Alexander Köplinger [Tue, 18 Oct 2016 17:32:52 +0000 (19:32 +0200)]
Bump boringssl submodule

7 years agoFixes System build
Marek Safar [Tue, 18 Oct 2016 15:20:30 +0000 (17:20 +0200)]
Fixes System build

7 years ago[System] Implements Socket::ConnectAsync. Fixes #44406
Marek Safar [Tue, 18 Oct 2016 15:12:54 +0000 (17:12 +0200)]
[System] Implements Socket::ConnectAsync. Fixes #44406