Compare commits

...
306 Commits
Author SHA1 Message Date
monojenkins 3a07bd426d [2018-08] [arm64] Correct exception filter stack frame size (#14769)
[2018-08] [arm64] Correct exception filter stack frame size

Fixes: https://github.com/mono/mono/issues/14170
Fixes: https://github.com/xamarin/xamarin-android/issues/3112

The `call_filter()` function generated by `mono_arch_get_call_filter()`
was overwriting a part of the previous stack frame because it was not
creating a large enough new stack frame for itself.  This had been
working by luck before the switch to building the runtime with Android
NDK r19.

I used a local build of [xamarin/xamarin-android/d16-1@87a80b][0] to
verify that this change resolved both of the issues linked above.  I
also confirmed that I was able to reintroduce the issues in my local
environment by removing the change and rebuilding.

After this change, the generated `call_filter()` function now starts by
reserving sufficient space on the stack to hold a 64-bit value at the
`ctx_offset` location.  The 64-bit `ctx` value is saved to the
`ctx_offset` location (offset 344 in the new stack frame) shortly
afterwards:

    stp	x29, x30, [sp,#-352]!
    mov	x29, sp
    str	x0, [x29,#344]

As expected, the invocation of `call_filter()` now no longer modifies
the top of the previous stack frame.

Top of the stack before `call_filter()`:

    (gdb) x/8x $sp
    0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
    0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

Top of the stack after `call_filter()` (unchanged):

    (gdb) x/8x $sp
    0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
    0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

<details>
<summary>Additional background information</summary>

### The original lucky, "good" behavior for [mono/mono/2018-08@725ba2a built with Android NDK r14][1]

 1. The `resume` parameter for `mono_handle_exception_internal()` is
    held in register `w23`.

 2. That register is saved into the current stack frame at offset 20 by
    a `str` instruction:

           0x00000000000bc1bc <+3012>:	str	w23, [sp,#20]

 3. `handle_exception_first_pass()` invokes `call_filter()` via a `blr`
    instruction:

        2279							filtered = call_filter (ctx, ei->data.filter);
           0x00000000000bc60c <+4116>:	add	x9, x22, x24, lsl #6
           0x00000000000bc610 <+4120>:	ldr	x8, [x8,#3120]
           0x00000000000bc614 <+4124>:	ldr	x1, [x9,#112]
           0x00000000000bc618 <+4128>:	add	x0, sp, #0x110
           0x00000000000bc61c <+4132>:	blr	x8

    Before the `blr` instruction, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0x0a8b31d8	0x00000071
        0x7fcd2774b0:	0x00000000	0x00000000	0x1ef51980	0x00000071

 4. `call_filter()` runs.  This function is generated by
    `mono_arch_get_call_filter()` and starts with:

           stp	x29, x30, [sp,#-336]!
           mov	x29, sp
           str	x0, [x29,#344]

    Note in particular how the first line subtracts 336 from `sp` to
    start a new stack frame, but the third line writes to a position
    that is 344 bytes beyond that, back within the *previous* stack
    frame.

 5. After the invocations of `call_filter()` and
    `handle_exception_first_pass()`, `w23` is restored from the stack:

           0x00000000000bc820 <+4648>:	ldr	w23, [sp,#20]

    At this step, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0xcd2775b0	0x0000007f
        0x7fcd2774b0:	0x00000000	0x00000000	0x1ef51980	0x00000071

    Notice how `call_filter()` has overwritten bytes 8 through 15 of the
    stack frame.  In this original lucky scenario, this does not affect
    the value restored into register `w23` because that value starts at
    byte 20.

 6. `mono_handle_exception_internal()` tests the value of `w23` to
    decide how to set the `ji` local variable:

        2574			if (resume) {
           0x00000000000bb960 <+872>:	cbz	w23, 0xbb9c4 <mono_handle_exception_internal+972>

    Since `w23` is `0`, `mono_handle_exception_internal()` correctly
    continues into the `else` branch.

### The bad behavior for [mono/mono/2018-08@725ba2a built with Android NDK r19][2] works slightly differently

 1. As before, the local `resume` parameter starts in register `w23`.
 2. This time, the register is saved into the stack frame at offset 12
    (instead of 20):

           0x00000000000bed7c <+3200>:	str	w23, [sp,#12]

 3. As before, `handle_exception_first_pass()` invokes `call_filter()`
    via a `blr` instruction.

    At this step, the top of the stack looks like this:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0x2724b700	0x00000000
        0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

 4. `call_filter()` runs as before.  And the first few instructions of
    that function are the same as before:

        stp	x29, x30, [sp,#-336]!
        mov	x29, sp
        str	x0, [x29,#344]

 5. `w23` is again restored from the stack, but this time from offset 12:

           0x00000000000bf2c0 <+4548>:	ldr	w23, [sp,#12]

    The problem is that `call_filter()` has again overwritten bytes 8
    through 15 of the stack frame:

        (gdb) x/8x $sp
        0x7fcd2774a0:	0x7144d250	0x00000000	0xcd2775b0	0x0000007f
        0x7fcd2774b0:	0x1ee19ff0	0x00000071	0x0cc00300	0x00000071

    So after the `ldr` instruction, `w23` has an incorrect value of
    `0x7f` rather than the correct value `0`.

 6. As before, `mono_handle_exception_internal()` tests the value of `w23` to
    decide how to set the `ji` local variable:

        2574			if (resume) {
           0x00000000000be430 <+820>:	cbz	w23, 0xbe834 <mono_handle_exception_internal+1848>

    But this time because `w23` is *not* zero, execution continues
    *incorrectly* into the `if` branch rather than the `else` branch.
    The result is that `ji` is set to `0` rather than a valid
    `(MonoJitInfo *)` value.  This incorrect value for `ji` leads to a
    null pointer dereference, as seen in the bug reports.

[0]: https://github.com/xamarin/xamarin-android/tree/xamarin-android-9.3.0.22
[1]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1432/Azure/
[2]: https://jenkins.xamarin.com/view/Xamarin.Android/job/xamarin-android-freestyle/1436/Azure/

</details>

Backport of #14757.

/cc @lambdageek @brendanzagaeski
2019-06-03 14:26:18 -04:00
monojenkins 223ea7ef92 Bump API snapshot submodule 2019-05-10 11:09:54 +02:00
Marek Safar 913c11def5 [Facades] Include missing enums in System.Memory 2019-05-10 11:09:54 +02:00
Thays Grazia 6843da5c57 A deadlock happens when during a process_suspend there is a pending invoke and then when it's calling the invoke there is another call to process_suspend in the same thread. 2019-05-10 10:29:55 +02:00
Ankit Jain 167f04c902 Bump msbuild to track mono-2018-08 (#14396)
* Bump msbuild to track mono-2018-08

* Update nuget version
   (Thanks for @lewing)
2019-05-08 15:04:30 -04:00
Ankit Jain 082e1a2346 Bump msbuild to track mono-2018-08 2019-04-30 18:19:54 +02:00
Alexander Köplinger 18fde9f8c2 Fix Windows MSI build
(cherry picked from commit 8aaf420efe)
2019-04-29 13:53:21 -04:00
Alexander Köplinger ea8ae3e8e0 More Windows MSI fixes
(cherry picked from commit e0326df7c6)
(cherry picked from commit 04dc2f342c)
2019-04-29 13:53:11 -04:00
Alexander Köplinger d1b7bf2c47 Fix Windows MSI build, msbuild is now in Current instead of 15.0
(cherry picked from commit 0ae04b8e80)
2019-04-29 13:52:55 -04:00
monojenkins 3cb36842fc [corlib] Disable four tests in TypeTest (#14213)
TypeTest.MakeGenericType_BadUserType
TypeTest.MakeGenericType_NestedUserDefinedType
TypeTest.MakeGenericType_UserDefinedType
TypeTest.TestMakeGenericType_UserDefinedType_DotNet20SP1

These tests pass when run with the interpreter on xamarin-macios.
They were disabled on master with https://github.com/mono/mono/commit/dc9bc9e0e6462739872117afc59e46fbc780d981
2019-04-25 11:13:51 +02:00
Zoltan Varga 6c9921e64b [jit] Avoid an assert when gsharedvt enums are boxed.
Fixes https://github.com/mono/mono/issues/13297.
2019-04-24 11:17:17 +02:00
Ankit Jain 4d857ac249 Bump msbuild to track mono-2018-08 (#14068)
To pick up update for the NuGetSdkResolver: https://github.com/mono/msbuild/pull/92
2019-04-17 00:35:05 +02:00
Ankit Jain a2d28226d4 [nuget] Bump to nuget 5.0.0 2019-04-12 08:14:22 +02:00
Ankit Jain 592c75cf1f Bump msbuild to track mono-2018-08-test (#13927)
Bump to get the msbuild 16 update
<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2019-04-12 08:09:15 +02:00
Zoltan Varga 3f5ec6d95c [jit] Make dlmalloc use mono_valloc so it picks up the MAP_JIT flag on osx.
Fixes https://github.com/mono/mono/issues/13878.
2019-04-11 18:02:31 +02:00
monojenkins bf4e8d2ae1 [debugger-agent] Ignore thread_end event if thread is detached (#13937)
The thread_stopped profiler event can be raised by the thread_info_key_dtor tls
key destructor when the thread is already doesn't have a domain set.  In that
case, don't call process_profiler_event since it cannot handle a thread with
null TLS values.

Addresses https://github.com/xamarin/xamarin-android/issues/2920
with the following stack trace

```
* thread #20, name = 'Filter', stop reason = signal SIGSEGV: invalid address (fault address: 0xbc)
  * frame #0: libmonosgen-2.0.so`mono_class_vtable_checked(domain=0x0000000000000000, klass=0x0000007200230648, error=0x00000071e92f9178) at object.c:1890
    frame #1: libmonosgen-2.0.so`get_current_thread_ptr_for_domain(domain=0x0000000000000000, thread=0x00000071ebfec508) at threads.c:595
    frame #2: libmonosgen-2.0.so`mono_thread_current at threads.c:1939
    frame #3: libmonosgen-2.0.so`process_event(event=<unavailable>, arg=<unavailable>, il_offset=<unavailable>, ctx=<unavailable>, events=<unavailable>, suspend_policy=<unavailable>) at debugger-agent.c:3715
    frame #4: libmonosgen-2.0.so`thread_end [inlined] process_profiler_event(event=EVENT_KIND_THREAD_DEATH, arg=0x00000071ebfec508) at debugger-agent.c:3875
    frame #5: libmonosgen-2.0.so`thread_end(prof=<unavailable>, tid=<unavailable>) at debugger-agent.c:3991
    frame #6: libmonosgen-2.0.so`mono_profiler_raise_thread_stopped(tid=<unavailable>) at profiler-events.h:105
    frame #7: libmonosgen-2.0.so`mono_thread_detach_internal(thread=<unavailable>) at threads.c:979
    frame #8: libmonosgen-2.0.so`thread_detach(info=0x00000071e949a000) at threads.c:3215
    frame #9: libmonosgen-2.0.so`unregister_thread(arg=<unavailable>) at mono-threads.c:544
    frame #10: libmonosgen-2.0.so`thread_info_key_dtor(arg=0x00000071e949a000) at mono-threads.c:774
    frame #11: 0x00000072899c58e8 libc.so`pthread_key_clean_all() + 124
    frame #12: 0x00000072899c5374 libc.so`pthread_exit + 76
    frame #13: 0x00000072899c5264 libc.so`__pthread_start(void*) + 44
    frame #14: 0x000000728996617c libc.so`__start_thread + 72
```
2019-04-09 10:37:47 -04:00
Alexander Köplinger ca30169e75 Bump bockbuild to get GTK fix (#13912) (#13919)
https://github.com/mono/bockbuild/pull/93
2019-04-08 15:57:49 +02:00
Alexander Köplinger 7fb1361513 [MacSDK] Bump bockbuild for fix to #13804 2019-04-08 11:52:41 +02:00
Alexander Kyte f236105056 [2018-08] [merp] Fix image size reported (#13886)
Fixes #13834

Backport of #13847.
2019-04-06 02:03:25 +02:00
Maxim Lipnin 4b020ca06d Fix transition offset logic (#13553)
I'm not sure about the correctness of this workaround but it works on macOS for the repro from https://github.com/mono/mono/issues/9664#issuecomment-472260968

Transition bounds used by time zone info represent some local date-time but actually they are of Unspecified date-time kind. 
When we try to get transition offset we compare some current date-time converted to UTC with appropriate transition bounds.
The fix is to use UTC for both current date-time and transition bounds during comparing.

Fixes https://github.com/mono/mono/issues/9664
2019-04-02 19:22:21 +02:00
Zoltan Varga e475d80db3 [llvm] Fix the computation of size of gshared instances in another place.
Fixes https://github.com/mono/mono/issues/13610.
2019-03-29 13:40:12 +01:00
Aleksey Kliger (λgeek) c87a95ea23 [llvm] Fix the computation of size of gshared instances in emit_args_to_vtype (). (#13675)
Fixes https://github.com/mono/mono/issues/13610.
2019-03-26 14:54:01 -04:00
Bernhard Urban 75282c430b [amd64] use 32bit variant of lea_membase for 32bit operations
Consider
```
 xor %r15, %r15       // %r15 = 0x0
 dec %r15d            // %r15 = 0xffff_ffff
 lea 0x1(%r15), %rdx  // %rdx = 0x1_0000_0000 but should be 0x0
```

instead `lea 0x1(%r15), %edx` should be generated.
2019-03-26 14:51:56 +01:00
Thays Grazia 5756d04e1d [debugger] Adding a comment to make it clear for the next debuggers. 2019-03-22 19:59:07 +01:00
Thays Grazia 484ce49a0b [debugger] Fixing two crashes while debugging an Android app.
-> Doing stepping into in VSM in some situation the frame saved in TLS is not synchronised with what is really been executed in the main thread. This makes the debugger-agent crashes because it tries to get variable info in some memory that is not available anymore.
	-> To fix it I forced the update of stack when CMD_THREAD_GET_FRAME_INFO is called.

-> Doing step over in Visual Studio for Windows, if you have the threads debugger window enabled, VSW calls frame_commands for each thread that is showed, and if the thread is not really_suspended it tries to get variable info from a memory that is not available anymore because the thread is not suspended yet.
	-> To fix it I don't send variable info of a frame if the thread is not really_suspended and doesn't have an async_state valid.

#Fixes 12843
2019-03-22 19:59:07 +01:00
Thomas Lehner 6a81d1dd5f [System] Fix a race condition in HttpRequestChannel.
Concurrent request completions could cause following exception:

    FATAL UNHANDLED EXCEPTION: System.ArgumentOutOfRangeException:
        Index was out of range. Must be non-negative and less than
        the size of the collection.
        Parameter name: index
       at System.Collections.Generic.List`1[T].RemoveAt (System.Int32 index) [0x00009] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Collections.Generic.List`1[T].Remove (T item) [0x0000c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Cleanup () [0x00011] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.set_IsCompleted (System.Boolean value) [0x00034] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+HttpChannelRequestAsyncResult.Complete (System.Exception ex) [0x0001a] in <28c4695205ef47378f5370502b066592>:0
       at System.ServiceModel.Channels.HttpRequestChannel+<>c__DisplayClass7_1.<BeginProcessRequest>b__0 (System.IAsyncResult r) [0x000bd] in <28c4695205ef47378f5370502b066592>:0

    This stack was captured after some changes in AwaitTaskContinuation.RunOrScheduleAction.
    Unfortunately the current implementation of AwaitTaskContinuation.RunOrScheduleAction re-throws the above
    exception with a wrong stack:

       at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageTwo () [0x000a1] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.Finish (System.Boolean bUserDelegateExecuted) [0x00003] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.TrySetException (System.Object exceptionObject) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetException (System.Exception exception) [0x00029] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Net.HttpWebRequest+<RunWithTimeoutWorker>d__241`1[T].MoveNext () [0x000e0] in <3e9b3e26c4694baab3f689687ad40612>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run () [0x00024] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction (System.Action action, System.Boolean allowInlining, System.Threading.Tasks.Task& currentTask) [0x00023] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishContinuations () [0x00052] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task.FinishStageThree () [0x0003c] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Threading.Tasks.Task`1[TResult].TrySetResult (TResult result) [0x0004f] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1[TResult].SetResult (TResult result) [0x0003d] in <4a8a0eaa024f41829d3435c07e5c7edb>:0
       at System.Net.ServicePointScheduler+<WaitAsync>d__45.MoveNext () [0x000f7] in <3e9b3e26c4694baab3f689687ad40612>:0
       at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext (System.Object stateMachine) [0x00000] in <4a8a0

    On an Android Xamarin installation this causes an app crash. Since no user code is active the exception cannot be caught.
2019-03-21 11:28:57 +01:00
Alexander Kyte fdb26b0a44 [merp] Fix anon allocation, use MAP_PRIVATE 2019-03-20 13:57:41 +01:00
Alexander Kyte 82547c4a12 [crash] Fallback to MAP_ANONYMOUS for allocator
This is helpful by allowing the crash reporter to work even while
unable to write to the working directory.
2019-03-19 16:34:56 +01:00
Alexander Köplinger 693806ceda Bump bockbuild for GTK fix 2019-03-19 07:58:33 +01:00
Jo Shields 9cb3348c31 Append .1 to version number 2019-03-14 16:18:00 -04:00
Jo Shields 948b450991 Include libgdiplus 5.6.1
(cherry picked from commit 5888bf9acc)
2019-03-14 16:14:40 -04:00
Alexis Christoforides 60e60904ac [MacSDK] Bump Nuget to 4.8.2 2019-03-12 22:37:15 +01:00
Alexander Köplinger 89d7665e28 [2018-08] Bump bockbuild to get GTK fix (#13329)
See https://github.com/mono/bockbuild/pull/90
2019-03-06 23:36:48 +01:00
Zoltan Varga c47ab60cc4 [llvm] Emit target layout/target triple into bitcode files. (#13327)
Fixes https://github.com/mono/mono/issues/12307 for 2018-08.
2019-03-06 13:38:02 -05:00
monojenkins 7ad1871886 [2018-08] Clean up .o files from System.Native during make dist (#13256)
* Clean up .o files from System.Native during `make dist`

Closes: https://github.com/mono/mono/issues/11501

* Delete more useless binary cruft from `make dist`
2019-03-02 03:02:37 +01:00
Alexander Köplinger 56906e2376 Bump api-snapshot submodule
Gets in the API Diff change for https://github.com/mono/mono/commit/5dd1c19b53dd43ba55b6ea649dc3809b0ae4f057
2019-03-01 21:08:40 +01:00
Alexander Köplinger 6ed7152fc8 [sdks] Use throttle() instead of lock()
The former works in freestyle builds.

(cherry picked from commit 98e0f2697d)
2019-03-01 14:49:30 +01:00
Alexander Köplinger 68aad3b0eb [ci] Use dl.internalx.com when building on private Jenkins
(cherry picked from commit 9d4aa950aa)
2019-02-26 11:21:29 +01:00
Martin Baulig 5dd1c19b53 Make System.dll internals visible to Mono.Android. 2019-02-25 14:14:46 +01:00
Alexander Köplinger 29eb176dd9 Bump bockbuild for GTK fix
See https://github.com/mono/bockbuild/pull/84
2019-02-20 17:30:36 +01:00
Maxim Lipnin 45e519e9df use for loop to access item values and avoid InvalidCastException which occurs because VirtualDirectoryMappingCollection enumerator returns key and it's not expected 2019-02-19 23:12:00 +01:00
Alexander Kyte de14ec6c78 [2018-08] Add more detailed reporting for exceptions (#13012)
* [crash] Add more detailed reporting for exceptions

This bumps the crash reporting file format to version 0.0.3.

* [crash] Fix exception stack walker to consider captured_traces

Previously we were missing these frames from the captured_traces fields
of MonoException and MonoStackTrace.
2019-02-15 11:10:55 -05:00
Alexander Köplinger b041669258 [ci] Bump bockbuild to get fontconfig download url fix 2019-02-11 16:47:52 +01:00
monojenkins d2e33f5f5c [2018-08] [interp] Add method to seq_points table after we finish registering it (#12906)
* [interp] Add method to seq_points table after we finish registering it

When adding a breakpoint (mono_de_set_breakpoint) we search in this table for seq_point information for the method. If we find the information we expect that the method is already compiled and has the metadata initialized when actually adding the breakpoint (set_bp_in_method). We were crashing if the jinfo field of the interp method was not yet initialized.

Fixes https://github.com/xamarin/xamarin-macios/issues/5381

* [interp] Move profiler callback when we are actually done

Just in case.
2019-02-11 09:09:00 -05:00
monojenkins 32f1873983 [interp] Fix ldelema (#12930)
The ldelema IL instruction provided the element class while the Address intrinsic provided the array class.

Fixes https://github.com/xamarin/xamarin-macios/issues/5363
2019-02-11 09:08:13 -05:00
Alexander Köplinger bbf2394619 [ci] Support building the OSX .pkg on private Jenkins
(cherry picked from commit 7f5125179d)
2019-02-09 20:22:09 +01:00
monojenkins 98810acba1 [runtime] Fix building older runtimes with newer system Mono (#12574)
What was happening was that this was building with a Mono.Cecil from
the build profile, but was trying to load the system Mono.Cecil.

Those versions mismatch when building 2018-08 with a nightly mono that is 5.23.0.

Rather than messing with the MONO_PATH and risking shadowing something
important there, I chose to copy the Mono.Cecil files into this
"lib/build/tmp" directory that we are using for the emitted executable.
It is loaded by the system Mono as the correct Mono.Cecil to use.

This fixes the build.
2019-02-09 00:10:34 +01:00
monojenkins d946a25079 [2018-08] [runtime] Fix mono_pe_file_map logging (#12897)
Since it's being used when the image is created, it actually doesn't need to be signal safe. This restores the previous behavior. 

Backport of #12588.
2019-02-09 00:06:01 +01:00
Ludovic Henry 4d2b7f8b01 Merge pull request #12858 from monojenkins/backport-pr-12856-to-2018-08
[2018-08] [Registry] Prevent crash due to background thread facing problems in the file system
2019-02-08 15:44:49 -05:00
monojenkins 89fe6abeef [arm64] encode offset within stack slot for r4 in gsharedvt descriptor (#12885)
Follow up fix for https://github.com/mono/mono/pull/11741

Fixes https://github.com/mono/mono/issues/12831
2019-02-08 09:30:02 -05:00
Miguel de Icaza 9d21a2bb15 [Registry] Prevent crash due to background thread facing problems in the file system 2019-02-07 16:59:52 +00:00
Marek Safar 163f45d81c [corlib] Fix GetFrames_AsyncCalls test not to block 2019-02-05 17:45:58 +01:00
Maxim Lipnin 208d5a5f1b Avoid recursive extracting redundant frames from captured traces. 2019-02-04 13:41:24 +01:00
monojenkins bcc1b83e82 Add back missing stack frames to mono MERP reports (#12741)
Changeset https://github.com/mono/mono/commit/e1461ebc855977667f71d1804fd96eed2a155aff
introduced a regression where only the topmost frame of managed crashes are reported.

This change adds back the missing stack frames.
2019-02-01 19:59:48 -05:00
Bernhard Urban 7a3ce9849f Bump corert
Commit list for mono/corert:

* mono/corert@e229c9448 [Number] make double 0.0 cmp more portable (#30)

Diff: https://github.com/mono/corert/compare/6c9c4d9cffe2031acb788718646fbc013632c9ea...e229c9448cb262ceb230dfab64a8237140c1dc2d
2019-02-01 15:07:36 +01:00
Bernhard Urban 13204572a4 [arm/ios] workaround for faulty vcmp.f64 insn
Fixes https://github.com/mono/mono/issues/11965
2019-02-01 15:07:02 +01:00
Vlad Brezae 2359cba40e [coop] Fix deadlock when unwinding
At the moment of a safepoint, the runtime can be holding the loader lock. Fixes gsharing-valuetype-layout.exe timeouts.
2019-01-29 13:06:44 -05:00
Alexander Kyte a4956c837e [2018-08] Native Crash Stability Fix Batch (#12565)
* [crash] Support extra merp params

* [runtime] Make infrastructure for merp tests

* [runtime] Fix dumping when crash happens without sigctx

* [runtime] Disable crashy (886/1000 runs) stacktrace walker

* [crash] Remove usage of allocating build/os info functions

* [crash] Remove often-crashing g_free on native crash path

* [crash] Add crash_reporter checked build

We add a checked build mode that asserts when mono mallocs inside of
the crash reporter. It makes risky allocations into assertions. It's
useful for automated testing because the double-abort often represents
itself as an indefinite hang. If it happens before the thread dumping
supervisor process is started, or after it ends, the crash reporter
hangs.

* [crash] Remove reliance on nested SIGABRT/double-fault (broken on OSX)

* [crash] Fix top-level handling of double faults/assertions

* [runtime] Make fatal unwinding errors return into handled error paths

* [crash] Change dumper logging for better info

* [runtime] Fix handling of segfault on sgen thread

Threads without domains that get segfaults will end up in
this handler. It's not safe to call this function with a NULL domain.

See crash below:

```
* thread #1, name = 'tid_307', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x10eff40f8)
  * frame #0: 0x000000010e1510d9 mono-sgen`mono_threads_summarize_execute(ctx=0x0000000000000000, out=0x0000001000000000, hashes=0x0000100000100000, silent=4096, mem="", provided_size=2199023296512) at threads.c:6414
    frame #1: 0x000000010e152092 mono-sgen`mono_threads_summarize(ctx=0x000000010effda00, out=0x000000010effdba0, hashes=0x000000010effdb90, silent=0, signal_handler_controller=1, mem=0x0000000000000000, provided_size=0) at threads.c:6508
    frame #2: 0x000000010df7c69f mono-sgen`dump_native_stacktrace(signal="SIGSEGV", ctx=0x000000010effef48) at mini-posix.c:1026
    frame #3: 0x000000010df7c37f mono-sgen`mono_dump_native_crash_info(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-posix.c:1147
    frame #4: 0x000000010de720a9 mono-sgen`mono_handle_native_crash(signal="SIGSEGV", ctx=0x000000010effef48, info=0x000000010effeee0) at mini-exceptions.c:3227
    frame #5: 0x000000010dd6ac0d mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48, debug_fault_addr=0xffffffffffffffff) at mini-runtime.c:3574
    frame #6: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000000010effeee0, context=0x000000010effef48) at mini-runtime.c:3612
    frame #7: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
    frame #8: 0x0000000110bb81c1
    frame #9: 0x000000011085ffe1
    frame #10: 0x000000010dd6d4f3 mono-sgen`mono_jit_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x00007ffee1ea9f08, error=0x00007ffee1eaa250) at mini-runtime.c:3215
    frame #11: 0x000000010e11509d mono-sgen`do_runtime_invoke(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, exc=0x0000000000000000, error=0x00007ffee1eaa250) at object.c:2977
    frame #12: 0x000000010e10d961 mono-sgen`mono_runtime_invoke_checked(method=0x00007faae4f01fe8, obj=0x0000000000000000, params=0x00007ffee1eaa180, error=0x00007ffee1eaa250) at object.c:3145
    frame #13: 0x000000010e11aa58 mono-sgen`do_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5042
    frame #14: 0x000000010e118803 mono-sgen`mono_runtime_exec_main_checked(method=0x00007faae4f01fe8, args=0x000000010f0003e8, error=0x00007ffee1eaa250) at object.c:5138
    frame #15: 0x000000010e118856 mono-sgen`mono_runtime_run_main_checked(method=0x00007faae4f01fe8, argc=2, argv=0x00007ffee1eaa760, error=0x00007ffee1eaa250) at object.c:4599
    frame #16: 0x000000010de1db2f mono-sgen`mono_jit_exec_internal(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1298
    frame #17: 0x000000010de1d95d mono-sgen`mono_jit_exec(domain=0x00007faae4f00860, assembly=0x00007faae4c02ab0, argc=2, argv=0x00007ffee1eaa760) at driver.c:1257
    frame #18: 0x000000010de2257f mono-sgen`main_thread_handler(user_data=0x00007ffee1eaa6a0) at driver.c:1375
    frame #19: 0x000000010de20852 mono-sgen`mono_main(argc=3, argv=0x00007ffee1eaa758) at driver.c:2551
    frame #20: 0x000000010dd56d7e mono-sgen`mono_main_with_options(argc=3, argv=0x00007ffee1eaa758) at main.c:50
    frame #21: 0x000000010dd5638d mono-sgen`main(argc=3, argv=0x00007ffee1eaa758) at main.c:406
    frame #22: 0x00007fff73aaf015 libdyld.dylib`start + 1
    frame #23: 0x00007fff73aaf015 libdyld.dylib`start + 1
  thread #2, name = 'SGen worker'
    frame #0: 0x000000010e2afd77 mono-sgen`mono_get_hazardous_pointer(pp=0x0000000000000178, hp=0x000000010ef87618, hazard_index=0) at hazard-pointer.c:208
    frame #1: 0x000000010e0b28e1 mono-sgen`mono_jit_info_table_find_internal(domain=0x0000000000000000, addr=0x00007fff73bffa16, try_aot=1, allow_trampolines=1) at jit-info.c:304
    frame #2: 0x000000010dd6aa5f mono-sgen`mono_sigsegv_signal_handler_debug(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0, debug_fault_addr=0x000000010e28fb20) at mini-runtime.c:3540
    frame #3: 0x000000010dd6a8d3 mono-sgen`mono_sigsegv_signal_handler(_dummy=11, _info=0x000070000fb81c58, context=0x000070000fb81cc0) at mini-runtime.c:3612
    frame #4: 0x00007fff73dbdf5a libsystem_platform.dylib`_sigtramp + 26
    frame #5: 0x00007fff73bffa17 libsystem_kernel.dylib`__psynch_cvwait + 11
    frame #6: 0x00007fff73dc8589 libsystem_pthread.dylib`_pthread_cond_wait + 732
    frame #7: 0x000000010e28d76d mono-sgen`mono_os_cond_wait(cond=0x000000010e44c9d8, mutex=0x000000010e44c998) at mono-os-mutex.h:168
    frame #8: 0x000000010e28df4f mono-sgen`get_work(worker_index=0, work_context=0x000070000fb81ee0, do_idle=0x000070000fb81ed4, job=0x000070000fb81ec8) at sgen-thread-pool.c:165
    frame #9: 0x000000010e28d2cb mono-sgen`thread_func(data=0x0000000000000000) at sgen-thread-pool.c:196
    frame #10: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
    frame #11: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
    frame #12: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
  thread #3, name = 'Finalizer'
    frame #0: 0x00007fff73bf6246 libsystem_kernel.dylib`semaphore_wait_trap + 10
    frame #1: 0x000000010e1d9c0a mono-sgen`mono_os_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-os-semaphore.h:84
    frame #2: 0x000000010e1d832d mono-sgen`mono_coop_sem_wait(sem=0x000000010e43e400, flags=MONO_SEM_FLAGS_ALERTABLE) at mono-coop-semaphore.h:41
    frame #3: 0x000000010e1da787 mono-sgen`finalizer_thread(unused=0x0000000000000000) at gc.c:920
    frame #4: 0x000000010e152919 mono-sgen`start_wrapper_internal(start_info=0x0000000000000000, stack_ptr=0x000070000fd85000) at threads.c:1178
    frame #5: 0x000000010e1525b6 mono-sgen`start_wrapper(data=0x00007faae4f31bd0) at threads.c:1238
    frame #6: 0x00007fff73dc7661 libsystem_pthread.dylib`_pthread_body + 340
    frame #7: 0x00007fff73dc750d libsystem_pthread.dylib`_pthread_start + 377
    frame #8: 0x00007fff73dc6bf9 libsystem_pthread.dylib`thread_start + 13
  thread #4
    frame #0: 0x00007fff73c0028a libsystem_kernel.dylib`__workq_kernreturn + 10
    frame #1: 0x00007fff73dc7009 libsystem_pthread.dylib`_pthread_wqthread + 1035
    frame #2: 0x00007fff73dc6be9 libsystem_pthread.dylib`start_wqthread + 13
(lldb)
```

* [crash] Add signal-safe mmap/file "allocator"

* [crash] Remove use of static memory from dumper

* [runtime] Reduce print buffer size for lockless printer.

Each frame that prints ends up increased by the size of buff.
In practice, clang often fails to deduplicate some of these buffers,
leading to 30k-big stackframes.

It was noticed by a series of hard-to-diagnose segfaults on stacks that
looked otherwise fine during the crash reporting stress test.

This change fixes this, making stacks a 1/10th of the size. It doesn't
seem to break the crash reporter messages anywhere (may need to shrink
other "max name length" fields), and it's not mission-critical anywhere
else.

* [crash] Use async-safe file memory for dumper internals

* [crash] Add memory barriers around merp configuration

* [crash] Use signal-safe printers on all native crash paths

* [crash] Move gdb/lldb lookup to startup

* [runtime] Move MOSTLY_ASYNC_SAFE_FPRINTF to eglib

* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_PRINTF

* [runtime] Fix all callsites of MOSTLY_ASYNC_SAFE_FPRINTF

* [crash] Switch to signal-safe exit function

* [crash] Make dumper enum in managed

* [runtime] Add more information to managed frame

* [crash] Make async_safe printers inlined

* [runtime] Move basic pe_file functionality into proclib

* [crash] Fix handling of thread attributes

* [crash] Place hashes into the json file for all threads

* [crash] Fix 2018-08 CI, disable test
2019-01-25 14:17:41 +01:00
Martin Baulig d4d4fb7987 [eglib]Fix memory leak in g_find_program_in_path(). #11615. 2019-01-24 20:01:44 +01:00
Martin Baulig 9939c1a656 [System]Fix race condition in SystemDependencyProvider.Initialize(). #12538. 2019-01-22 09:48:25 +01:00
Alexander Kyte b0c4390d60 [runtime] Don't probe aot cache on android 2019-01-18 08:42:13 +01:00
Kirill Osenkov 725ba2a252 Fix https://github.com/mono/mono/issues/12461.
After .NET 4.5 .NET Framework has changed the System.ComponentModel.Composition ReflectionModelServices.IsExportFactoryImportDefinition to not throw.

Updating this to match the .NET Framework behavior.
2019-01-17 16:14:09 +01:00
Marek Habersack 1dee62626d [2018-08 Android,AOT] Support dumping AOT offsets with Android NDK r17+ (#12454) (#12465)
Backport of: https://github.com/mono/mono/commit/eebe4b52857140ba9dea872c6249960273d222f2 from https://github.com/mono/mono/pull/12454

The latest Android NDK releases no longer ship with per-platform C headers.
Instead they ship with a set of unified headers and require the presence of the
`__ANDROID_API__` macro in order to select the target platform.
The AOT offset dumper doesn't support this new layout and this commit changes
that by adding support for the unified headers (without removing support for the
older NDKs) thus fixing the following error when trying to dump the offsets with
newer NDK:

    Processing triple: aarch64-v8a-linux-android
    Error parsing '[...]/mono/mono/metadata/metadata-cross-helpers.c'
    [...]/mono/mono/metadata/metadata-cross-helpers.c(5,10): fatal: 'stdio.h' file not found
    Error parsing '[...]/mono/mono/mini/mini-cross-helpers.c'
    [...]/mono/mono/mini/mini-cross-helpers.c(7,10): fatal: 'stdio.h' file not found
2019-01-17 13:32:43 +01:00
Zoltan Varga 146c8191fb [x86] Set the LLVM data layout. 2019-01-16 13:03:07 +01:00
Zoltan Varga 5d3077c7bc [arm] Set the LLVM data layout, without it, opt seems to make incorrect optimizations.
Fixes https://github.com/mono/mono/issues/12307.
2019-01-16 13:03:07 +01:00
Thays Grazia 5266e6a8f1 [2018-08][debugger][backport] Fix crash when there is a generic struct with a field that is an enumerator (#12410)
* [Debugger] Fix crash when there is a generic struct with a field that is an enumerator. (#12368)

* [Debugger]  Debugger crashes when inside a class, there is an internal struct, with a field that is an enumerator.
files.myBucket.GetEnumerator().get_Current().Key
Fixes #10735

* [Debugger] Debugger crashes when there is a generic struct with a field that is an enumerator.
Example: files.get_Current().Key
A unit test that reproduces this crash was added too.
Fixes #10735

* Removing the extra space.

* Merging changes from dtest-app.cs

* Adding extra line.
2019-01-15 18:23:01 +01:00
monojenkins 0d988bc696 Bump API snapshot submodule 2019-01-14 18:21:36 +01:00
Maxim Lipnin e6285d015b Bump corefx 2019-01-14 18:21:36 +01:00
Alexander Kyte 51c4f45402 [2018-08] [merp] Batch of fixes (#12095)
This contains the fixes and tests I'm going to call "service pack 1" for ease of grouping

#11884
#11855
#11636
#11909
#12036
2019-01-11 12:08:37 +01:00
Bernhard Urban 3bf37058fd [interp] use interp_lmf wrapper for interp2native on platforms with wonky sigcontext (#12348)
On some platforms (e.g. AppleTV) SigContext is available, but isn't as
precise as we would like to have it. For example, it doesn't save
callee-saved registers and thus aren't restored properly.

Unfortunately, this also means we can't use the fastpath for
interp2native, so we disable it on those platforms.
2019-01-11 11:40:21 +01:00
Marek Safar 25a8be9111 Bump CoreFX to bring a fix for #12093 2019-01-10 14:55:46 +01:00
Marek Habersack 29e0e642da [Android] Fix build with NDK r18 (#11016) (#12291)
Xamarin.Android is looking to switch to using the latest Android NDK, r18.
However, there are a few build issues in Mono and BTLS which need to be
addressed before that happens.

  * BTLS fails to build some ARM assembly sources with NDK r18's clang.
    https://github.com/mono/boringssl/pull/12 fixes this issue

  * BTLS uses obsolete Android cmake toolchain file.
    Add a configure option to set alternative toolchain file.

  * NDK r18 minimu supported API level is 16.
    This commit makes the API level configurable and sets the minimum platform
    to API 16

  * NDK r18 makes changes to declaration of `mmap` which break Mono build.
    Detect NDK version in `mono-compiler.h` and act accordingly (do not
    redeclare `mmap`)

  * NDK r18 doesn't have `cpp` and SDKs build assumes it's present.
    Detect whether `cpp` is present and, if not, use `compiler -E` instead.

  * NDK r18 uses unified headers exclusively and requires __ANDROID_API__ to be
    set in order to present the correct set of native APIs.
    SDKs now define the macro when the `ANDROID_NEW_NDK` Make variable is set to
    anything else than `no`.
2019-01-07 14:31:07 +01:00
Alexis Christoforides 7b44d5719e [tests] Remove an invalid assertion on System.IO.DriveInfo
All fixed drives are not guaranteed to be ready
2019-01-07 08:22:51 -05:00
Egor Bogatov 3fad9a7a1c Update DateTimeTest.cs 2019-01-07 10:19:42 +01:00
Egor Bogatov 6b6fd890ee Update mono/metadata/culture-info-tables.h 2019-01-07 10:19:42 +01:00
EgorBo 8f50f96e8f Add tests 2019-01-07 10:19:42 +01:00
EgorBo 1edf795ae0 ko-* specific AM/PM designators 2019-01-07 10:19:42 +01:00
monojenkins 9671417e21 [2018-08] [Network] Fix CVE 2018-8292 on Mac OS X. (#12153)
* [Network] Fix CVE 2018-8292 on Mac OS X.

This commit ensures that CVE 2018-8292 is fixed by not setting
auto-redirect in the first request done by CFNetwork. CFNetwork has the
same bug, but we can work around it by performing the first request,
checking the response and, if it is a rediret, follow it without the
Authorization headers.

* No need to close the obc, it can be reused.

* Small typo.

* Fix error while chaging the request :/

* Minor style changes.
2019-01-03 15:41:54 +01:00
Zoltan Varga 047d0abd5c [llvm] Add support for OP_RCNEQ.
Fixes https://github.com/mono/mono/issues/12131.
2018-12-22 11:31:39 +01:00
Cody Russell 237c5fedc7 [2018-08] [GTK] Bump bockbuild for VSTS #737323 fix to GtkNSView. (#12164)
* [GTK] Bump bockbuild for VSTS #737323 fix to GtkNSView.

This is a 2018-08 backport of #11972
2018-12-21 16:27:00 +01:00
Ankit Jain bac9fc1f88 [2018-08] Bump msbuild to track xplat-master (#12115)
Backport of #12071.
2018-12-21 15:05:23 +01:00
monojenkins 88eafb72e4 [2018-08] Bump to latest SQLite for Mac bundle (#12159)
Bump Mac bundle from SQLite 3.9.2 to 3.26.0

Backport of #12118.
2018-12-20 16:11:23 +01:00
monojenkins 3f799cc3c7 [exceptions] Verbose logging for cfa_reg assertion (#11916)
[2018-08] [exceptions] Verbose logging for cfa_reg assertion

Historically very common and hard to reproduce assertion, which, in some cases, could be fixed just from this logging. Log example :

```
Unset cfa_reg in method <0x40011220 - (null) trampoline>. Memory around ip (0x40011220):
0x40011210  41 89 07 4c 8b 3c 24 48 83 c4 08 c3 00 00 00 00  A..L.<$H........
0x40011220  48 83 c7 10 b8 00 12 01 40 ff e0 00 00 00 00 00  H.......@.......
0x40011230  00 00 00 00 e8 c7 ef fe ff 08 f8 34 e0 55 55 55  ...........4.UUU
0x40011240  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
* Assertion: should not be reached at unwind.c:664
```




Backport of #11888.

/cc @BrzVlad
2018-12-19 20:45:40 -05:00
Zoltan Varga 0d9e781cb6 [jit] Fix a buffer overflow in mini_get_gsharedvt_out_sig_wrapper_signature ().
Fixes https://github.com/mono/mono/issues/12130.
2018-12-19 21:53:18 +01:00
Maxim Lipnin 35a1ed626d Fix IndexOutOfRangeException in MethodInfo.ReturnParameter.IsDefined(type) 2018-12-19 21:47:27 +01:00
Ankit Jain 03b9354ed9 [MacSDK] Bump NuGet to 4.8.1 2018-12-19 14:02:20 +01:00
monojenkins f919fb58c4 Fix https://github.com/mono/mono/issues/11898 (#11904)
There are two identical sounding functions:

mono_string_handle_to_utf8:
  What we usually use. Sounds reasonable. Usually is reasonable.
  Allocates with malloc.

mono_string_to_utf8str_handle:
  What should be used here. Allocates with CoTaskMemAlloc.
  So it can be freed with marshal_free => CoTaskMemFree.

i.e. The allocator and the freeer need to agree.
2018-12-03 19:39:56 -05:00
monojenkins 95fbc22436 Fix race condition in XmlCharType.Instance (#11828) 2018-12-03 19:19:31 -05:00
Zoltan Varga bcda004855 [aot] Emit runtime invoke wrappers for up to 40 parameters for bitcode, newly added tests depend on it.
Fixes https://github.com/mono/mono/issues/11874.
2018-12-03 14:50:04 +01:00
monojenkins f0e466618d [crash] Add managed exception class name (#11821) 2018-11-30 13:28:10 -08:00
Egor Bogatov 23f2024af8 [2018-08] Fix Encoding serialization issue (#11807)
Manual backport of https://github.com/mono/mono/pull/11661
2018-11-28 13:21:17 +01:00
Bernhard Urban 414cafac93 [interp] Don't include internal frames in stack trace (#11793)
For handled exceptions. On unhandled exceptions we leave them for debugging purposes.

Fixes exception18.cs
2018-11-27 14:33:07 -08:00
Alexander Köplinger 68746a81f2 [ci] Disable log compression in pipeline builds for now - second attempt
(cherry picked from commit 94d4055773)
2018-11-26 22:05:59 +01:00
monojenkins 1f62222fa6 [mini] use AOT trampolines in interp mixed mode (#11781)
[2018-08] [mini] use AOT trampolines in interp mixed mode

Fixes this on mscorlib/mixed mode on Xamarin.iOS:
```
[FAIL] NonExceptional.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] NonExceptional.Serialize_Deserialize_FixedDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] NonExceptional.Serialize_Deserialize_FloatingDateRule : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] SerializationTests.Serialization_Deserialization : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
[FAIL] TimeZoneTest.CurrentTimeZone_SerializationRoundtrip : System.Runtime.Serialization.SerializationException : An error occurred while deserializing the object. The serialized data is corrupt. 
```


Backport of #11767.

/cc @lewurm
2018-11-26 13:55:55 -05:00
Alexander Köplinger d0184b6970 [ci] Disable log compression in pipeline builds for now
It is incompatible with JEP-210 at the moment.

(cherry picked from commit fb4b611636)
2018-11-26 17:49:44 +01:00
Aleksey Kliger a4c0912ecf [loader] ignore 'internalcall' impl attribute on 'abstract' methods
Otherwise we emit a noisy warning when doing a lookup of the method.

Fixes https://github.com/mono/mono/issues/11479
2018-11-26 10:38:22 -05:00
Zoltan Varga 7b9d9b3f1b [arm64] Fix passing r4/r8 arguments on the stack in the gsharedvt trampoline.
Fixes https://github.com/mono/mono/issues/11613.
2018-11-20 12:00:04 +01:00
Alexander Köplinger e3a4484af7 [2018-08] Add .NET 4.7.2 reference assemblies (#11733)
Backport of https://github.com/mono/mono/pull/11391 to 2018-08
2018-11-19 16:58:34 +01:00
monojenkins 99b6da7944 [interp] attempt to intrinsify again after a method is resolved regarding generics (#11717)
[2018-08] [interp] attempt to intrinsify again after a method is resolved regarding generics

discovered when running https://github.com/Clancey/gMusic



Backport of #11712.

/cc @luhenry @lewurm
2018-11-16 14:05:43 -05:00
monojenkins 2f57669e30 [2018-08] [aot] image is usable without debug flag when interpreter is used (#11709)
Backport of #11705.
2018-11-16 12:10:05 +01:00
monojenkins 0206338c1e [2018-08] [crash] Remove duplicated il_offset (#11702)
This code is duplicated completely from the code directly above it (github doesn't show in this diff)

Backport of #11700.
2018-11-15 23:23:30 +01:00
monojenkins b20dad6656 [runtime] Fix the size calculation in mono_debug_add_method (). (#11687)
Backport of #11672.
2018-11-15 16:11:52 +01:00
Bernhard Urban 0f81533ae3 [arm64] Pass small stack args correctly on linux. Fixes pinvoke.exe with llvm+full aot. (#11682)
Backport of #10674. LLVM is already properly bumped on this branch.
2018-11-15 16:09:09 +01:00
monojenkins 81f3c4763e [2018-08] Fix starting process with empty environment incorrectly inherits all variables (#11645)
This pull request fixes starting a process with an empty environment variable collection in `ProcessStartInfo`. As per the issue it fixes a regression that it used to work but currently an empty environment variable collection works like it was never touched.

I also made a minor fix to remove the `StringBuilder` because a simple `string.Concat` does the job without the `StringBuilder` allocation and overhead.

I've included unit tests. Please let me know if you'd like any changes.

Fixes #8766

Backport of #11630.
2018-11-15 16:05:33 +01:00
Alexander Köplinger 6a9ee132c1 [ci] Clean acceptance-tests/external before build
Otherwise it might have left-over files from previous builds since it
uses our custom submodule system which isn't catched by Jenkins cleaning.

(cherry picked from commit 49a5af74f7)
(cherry picked from commit b429e290e8)
2018-11-15 16:03:56 +01:00
monojenkins b8ebc791fc [ios] cosmetic fix for WatchOS Makefile (#11668)
It's not really used, and the directory `[...]/SDKs/WatchOS.sdk` always
exists.
2018-11-14 16:42:06 -05:00
Bernhard Urban 32d4b6f22a [llvm] bump for armhf callingconv fix (#11609)
Commit list for mono/llvm:

* mono/llvm@c97510286a [mono] respect hardfloat/softloat setting in ARM ABI (#16)
@ mono/llvm@8415fd85ce Fix the mono calling convention on arm64+linux.
@ mono/llvm@117a508c0c Merge pull request #15 from mono/android-eh
@ mono/llvm@7dd82303e5 Emit .fnstart/.fnend directives on arm ELF platforms in the mono EH writer since the ARM backends depends on ARMException doing it, and ARMException is not ran when --disable-gnu-eh-frame is given.

Diff: https://github.com/mono/llvm/compare/81376d161cb6c2230834b2dc096ccbdae8d93020...c97510286a58f9aaa116fcfdb8b693d5f61910d2


Backport of https://github.com/mono/mono/pull/11607
2018-11-08 13:38:01 -05:00
monojenkins 925e0c0d0c [ios] remove DISABLE_POLICY_EVIDENCE (#11581)
[2018-08] [ios] remove DISABLE_POLICY_EVIDENCE

Originally it was introduced with db3591b
It seems like only the icall definitions were disabled for device
runtimes (which aren't shipped there anyway), however the icalls
themselves are _included_ in the device runtime. Not sure what the
rationale was behind this. Since the original change is very old, I
think it just happened to be like that today.  When running with the
interpreter we need the definitions at runtime too (via the optional
icall table that is linked in, so no additional cost for the fullAOT
runtime due to this change).

Backport of https://github.com/mono/mono/pull/11565

/cc @lewurm
2018-11-06 19:55:30 -05:00
Alex Earl 65cd16c227 Bump roslyn-binaries submodule to pull in System.Xml.dll file name fix in vbc.rsp (#11573)
(cherry picked from commit 5d5d8fc7ea)
2018-11-06 21:42:36 +01:00
Alexander Köplinger b5891e25ac [ci] Fix Windows .msi build
(cherry picked from commit c8d59d1d1d)
2018-11-06 10:41:13 +01:00
monojenkins d4d1d1ec24 [bcl] avoid false pinning in GCTest (#11536)
[2018-08] [bcl] avoid false pinning in GCTest

Backport of #11521.

/cc @luhenry @lewurm

Description:
needed for mscorlibtests on Xamarin.iOS with interpreter
2018-11-05 21:45:33 -05:00
monojenkins 3837f0c276 [interp] accept typed-by-ref as return type from a JIT call (#11533) 2018-11-05 21:01:12 -05:00
monojenkins 2e5c0d8f1e [interp] transform delegate invoke in method body too (#11551) 2018-11-05 20:58:29 -05:00
Alexander Köplinger 60c21beaeb [ci] Switch to new syntax of Azure Storage plugin
(cherry picked from commit de2cb5fdde)
2018-11-05 18:20:31 +01:00
Martin Baulig 3c2b25ce23 [System]lock protect SystemCertificateProvider.EnsureInitialized(). 2018-11-01 23:05:27 +01:00
Bernhard Urban 5fedefe43e [tests] reduce recursion depth
so it doesn't trigger a stack overflow on Xamarin.iOS with interpreter on a debug build (`CFLAGS=-O0`).
2018-10-31 11:56:58 +01:00
Alexander Kyte 53a21a0e84 [crash] Fix async setting for crash reporter
We were previously only setting it from the icall. The icall was
therefore fine, while invocations associated with actual dumps
caused crashes like this:

```

thread #10, name = 'Thread Pool Worker'
    frame #0: 0x00007fff978dac22 libsystem_kernel.dylib`__psynch_mutexwait + 10
    frame #1: 0x00007fff979c5dfa libsystem_pthread.dylib`_pthread_mutex_lock_wait + 100
    frame #2: 0x00007fff979c3519 libsystem_pthread.dylib`_pthread_mutex_lock_slow + 285
    frame #3: 0x0000000108e0d4a9 mono`mono_loader_lock + 73
    frame #4: 0x0000000108dc9106 mono`mono_class_create_from_typedef + 182
    frame #5: 0x0000000108dc1f2c mono`mono_class_get_checked + 92
    frame #6: 0x0000000108e21da2 mono`mono_metadata_parse_type_internal + 1378
    frame #7: 0x0000000108e25e11 mono`mono_metadata_parse_mh_full + 1233
    frame #8: 0x0000000108ca4f79 mono`mono_debug_add_aot_method + 121
    frame #9: 0x0000000108cc6b1e mono`decode_exception_debug_info + 5918
    frame #10: 0x0000000108cc5047 mono`mono_aot_find_jit_info + 1367
    frame #11: 0x0000000108e082cc mono`mono_jit_info_table_find_internal + 204
    frame #12: 0x0000000108cdb035 mono`mini_jit_info_table_find_ext + 69
    frame #13: 0x0000000108cdad5c mono`mono_find_jit_info_ext + 124
    frame #14: 0x0000000108cdc3a5 mono`unwinder_unwind_frame + 229
    frame #15: 0x0000000108cdbade mono`mono_walk_stack_full + 798
    frame #16: 0x0000000108cda1a4 mono`mono_summarize_managed_stack + 100
    frame #17: 0x0000000108e6dc03 mono`mono_threads_summarize_execute + 1347
    frame #18: 0x0000000108e6df88 mono`mono_threads_summarize + 360

```
2018-10-31 08:30:16 +01:00
monojenkins 04bdf8852b [2018-08] [crash] Fix merp invocation (#11468)
Backport of #11435.

/cc @alexanderkyte 

Description:
The change which made the handler return (rather than crashing the
runtime) did not consider this control flow path that causes the sigterm
signal handler to trigger the merp dumper if we return.

We now always return.

This was previously so that a random sigterm could be used to trigger a
dump. This isn't really used, and won't work right now anyways
(we don't register it until right before we dump). My fix is to remove
it, and to make the signal handler only work as part of the dumper
machinery.

@monojenkins skip
2018-10-30 22:53:24 +01:00
monojenkins 8df60a29bf [delegates] do not use CEE_CALLVIRT for non-virtual methods (#11451)
[2018-08] [delegates] do not use CEE_CALLVIRT for non-virtual methods

Backport of #11433.

/cc @lewurm 

Description:
2018-10-30 12:45:19 -04:00
monojenkins d90fbe3a0a [llvm] Fix passing vtypes received by value as arguments, they need to be copied. Fixes https://github.com/mono/mono/issues/11378. (#11429) 2018-10-30 11:13:29 -04:00
Aleksey Kliger ea740d2bc8 Disable hybrid suspend default for 2018-08
Earlier in the 2018-08 branch, Mono on desktop Linux, OSX and Windows would
default to hybrid suspend.  Turn that off for now (revert to preemptive suspend
by default).

Continue hybrid suspend work on 2018-10 and master.
2018-10-30 10:09:47 +01:00
monojenkins 0522076f0b [interp] throw overflow exception when {float,double}.NaN is converted to an int type (#11411)
A comparison with NaN is always `false`.
2018-10-28 18:05:05 -04:00
monojenkins 6034c589df [interp] enable more BCL tests (#11399)
[2018-08] [interp] enable more BCL tests

Backport of #11381.

/cc @lewurm 

Description:
probably won't pass on all configurations, I wanna find out on which.
2018-10-26 17:55:10 -04:00
Marek Habersack aebff6ce01 [SDKS, LLVM] Disable detection and use of libxml2 (#11340)
Mono doesn't use libxml2 and neither do the LLVM bits used by Mono when building
the AOT cross-compilers. Presence of `-lxml2` on the command line breaks 32-bit
builds on 64-bit Linux hosts:

    libtool: link: cc -shared  -fPIC -DPIC  -Wl,--whole-archive ./.libs/libmini.a ./.libs/libmono-ee-interp.a ./.libs/libmono-dbg.a ../../mono/metadata/.libs/libmonoruntimesgen.a ../../mono/sgen/.libs/libmonosgen.a ../../mono/utils/.libs/libmonoutils.a ../../mono/eglib/.libs/libeglib.a -Wl,--no-whole-archive  -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle -L$HOME/xamarin-android/external/mono/sdks/out/llvm-llvm32/lib -lz -ltinfo -lxml2 -lstdc++ -lm -lrt -ldl -lpthread  -O0 -ggdb3 -m32 -g -mno-tls-direct-seg-refs -Wl,-export-dynamic   -Wl,-soname -Wl,libmonosgen-2.0.so.1 -o .libs/libmonosgen-2.0.so.1.0.0
    mv -f .deps/libmini_la-aot-runtime-wasm.Tpo .deps/libmini_la-aot-runtime-wasm.Plo
    /usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.so when searching for -lxml2
    /usr/bin/ld: skipping incompatible //usr/lib/x86_64-linux-gnu/libxml2.a when searching for -lxml2
    /usr/bin/ld: cannot find -lxml2
    collect2: error: ld returned 1 exit status
    make[7]: *** [Makefile:1495: libmonosgen-2.0.la] Error 1

Installation of `libxml2-dev` (on Ubuntu/Debian + friends) for the x86
architecture (or x86_64 architecture on 32-bit host) would be possible but then
it would break the 64-bit build because the 64-bit version of the library would
be absent. It would be a problem if Mono+LLVM actually used xml2, but since it
doesn't we can just disable the feature completely.

(cherry picked from commit 0d68ffd1ce)
2018-10-26 00:00:12 +02:00
Bernhard Urban 818a27a386 [2018-08] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode (#11363)
[2018-08] [aot] add unbox_arbitrary_trampoline for fullaot/interp mixed mode

Backport of https://github.com/mono/mono/pull/11321
2018-10-25 16:35:25 -04:00
Marek Safar b5e8de9182 [2018-08][corlib] Adds back accidentaly removed legacy COM API to Binder (#11368)
* [corlib] Adds back accidentaly removed legacy COM API to Binder

* Bump API snapshot submodule

* [csproj] Update project files
2018-10-25 15:03:49 +02:00
monojenkins 205b8129d5 [tests] lower recursion depth of PerformNoPinAction (#11323)
[2018-08] [tests] lower recursion depth of PerformNoPinAction

Backport of #11065.

/cc @lewurm 

Description:
so it doesn't overflow the stack when running on macOS with `clang -O0`.
2018-10-24 05:55:33 -04:00
Jay Krell c2c764dfc6 [2018-08] Replace mono_object_get_class with mono_object_class to avoid gc transitions. (#11338)
Replacement for #11104.
Backport of #11077.
2018-10-24 03:56:57 -04:00
Aleksey Kliger (λgeek) b778499454 [wasm] Add missing include (#11337)
Fixup for
https://github.com/mono/mono/commit/5756ba4b46f43d4f1c61c0d7dbbcf27a271f24ab
2018-10-24 02:11:20 -04:00
Marek Safar b7ad1c6923 Bump corefx 2018-10-23 20:34:45 +02:00
Aleksey Kliger (λgeek) 7a7768ff51 [marshal] Fixup missed mono_class_is_assignable_from (#11313)
Backport PR https://github.com/mono/mono/pull/11106 missed a call
2018-10-22 23:44:31 +02:00
Jay Krell fb7328e644 mono_class_is_assignable_from to mono_class_is_assignable_from_internal to skip GC mode machinery FIXME mono_class_is_assignable_from_checked 2018-10-22 18:29:03 +02:00
Jay Krell d88635a373 mono_class_enum_basetype to mono_class_enum_basetype_internal to skip GC mode machinery. 2018-10-22 18:28:07 +02:00
Aleksey Kliger (λgeek) 465b71e99d [runtime] Don't init classes in ves_icall_RuntimeTypeHandle_is_subclass_of
We must not get a TLE if referenced types are in an assembly that can't be
loaded.

Backported fix of https://github.com/mono/mono/issues/11123
2018-10-22 18:25:32 +02:00
Aleksey Kliger (λgeek) 5756ba4b46 [2018-08][marshal] Emit GC Safe transitions around foreign internal calls. (#11180)
* [threads] Make mono_add_internal_call external only

The runtime should use mono_add_internal_call_internal or
mono_add_internal_call_with_flags.

The thread suspend mechanism needs to know if an icall is added via the legacy
mono_add_internal_call API (which is not coop-aware, and so the registered
icalls must run in GC Safe mode), or if it is added by the runtime or by a
cooperative client (currently either the profiler or the System.Native PAL)
which knows to add GC transitions and safepoints and not to block indefinitely.

* [marshal] Factor out GCSafeTransitionBuilder

Make a local builder for creating the GC Safe transition calls for a method wraper.

* [sgen] Add coop GC transitions in mono_gc_toggleref_add

Also mark it external only. It's not used inside the runtime.

* [marshal] Emit GC Safe transitions around foreign icalls.

A foreign icall is added using mono_add_internal_call and that is not coop GC
aware.  (The runtime uses mono_add_internal_call_with_flags or
mono_add_internal_call_internal)

Under hybrid suspend, foreign icalls will run in GC Safe mode and transition to
GC Unsafe only when the call back into the runtime or invoke managed code.

Fixes https://github.com/mono/mono/issues/11138

* [runtime] Add new API call mono_dangerous_add_raw_internal_call

Under hybrid suspend, this adds an icall that is assumed to run in GC Unsafe
mode.  As such it has additional requirements for correct operation: it must
not run loops without periodically polling the runtime, and it must not perform
blocking operations such as blocking I/O or taking locks without manually
switching to GC Safe mode.
2018-10-22 18:17:50 +02:00
monojenkins d7dcd456b3 [interp] use unsigned conversion for nuint (#11284)
[2018-08] [interp] use unsigned conversion for nuint

Backport of #11259.

/cc @lewurm 

Description:
Fixes `MutableDataTest.Constructor` on Xamarin.iOS with interpreter.

monotouch tests are looking good now with interp-only:
<img width="906" alt="screenshot 2018-10-19 at 11 22 07" src="https://user-images.githubusercontent.com/75403/47209686-3d7b2780-d391-11e8-887f-9e1f39de2026.png">
😬
2018-10-21 08:25:34 -04:00
monojenkins 145155d8cf [aot] Reenable recursion checking when initing shared got entries (#11296)
[2018-08] [aot] Reenable recursion checking when initing shared got entries

Backport of #11258.

/cc @BrzVlad 

Description:
Broken in https://github.com/mono/mono/pull/11190
<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-10-20 20:35:28 -04:00
Marek Safar 423928c21d Bump mcs boostrap version 2018-10-20 09:25:17 +01:00
monojenkins b83fc43c32 [2018-08] [arm64] Remove the limitation on the number of nullable arguments for dyncalls. (#11241)
* [arm64] Remove the limitation on the number of nullable arguments for dyncalls.

Fixes https://github.com/xamarin/xamarin-macios/issues/4984.

* [amd64] Remove the limitation on the number of nullable arguments for dyncalls.

* [jit] Add tests for dyncalls with lots of nullable arguments.

* fix merge conflict
2018-10-19 23:49:49 +02:00
Ludovic Henry 9bc88897b7 [corlib] Make sure necessary resources are alongside the test assembly (#11270) 2018-10-19 15:38:58 -04:00
monojenkins 74788c7505 [2018-08] [llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm. (#11264)
* [llvm] Make sure OP_LSHL_IMM is transformed to a 64 bit shift even if the input is 32 bit, which can happen because the JIT IR is not regular. Fixes bug-17590.exe on arm64+fullaot+llvm.

* [llvm] Fix a crash when trying to pass a vtype of size 0 on arm64. Fixes generic-constrained.2.exe.
2018-10-19 18:25:18 +02:00
Alexander Köplinger a4b6322c4f [2018-08] Bump corefx 2018-10-19 18:21:52 +02:00
monojenkins 934cf3c65a [WinForms] Propagate the flags from DrawTextInternal to MeasureTextInternal (#11261)
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes #6352
2018-10-19 18:08:51 +02:00
Ludovic Henry bc9d709e70 [sdks] Package what's missing for XA (#11256)
They require the additional files:
 - mono/eglib/eglib-config.h: that's to build `libmonodroid`
 - mcs/build/Consts.cs: that's to build `Mono.Posix` and `Mono.Data.Sqlite`
2018-10-19 06:57:56 -04:00
monojenkins 31a6b877f6 [pipeline] Ensure only 1 build per-product is executed per-node (#11249) 2018-10-18 22:09:45 +02:00
Vlad Brezae 4b343e98f3 [interp] Implement interpreter entry trampolines on amd64 (#10978) (#11164)
* [interp] Avoid unnecessary allocations when pinvoke void functions

* [amd64] Refactor interp pinvoke context computation

* [amd64] Interp trampoline for interpreter entry

* [aot] Don't include interp_in_wrapper when we use entry trampoline

These wrappers take a lot of space in the image.
2018-10-18 15:55:01 -04:00
monojenkins 2bc1ed09a3 [aot] Ensure shared got entries are initialized before loading methods (#11226)
Executing aot code that uses them would crash. Fixes random csc crashes.
2018-10-18 15:48:32 -04:00
Alexander Kyte 010e741bac [2018-08] Crash Reporter V2 (#11161)
* [runtime] Add icall to format crashes to disk in uniform way

* [crash] More gentle error handling around stack walking

* [crash] Make self-summarizier not need managed thread state

* [crash] Remove reliance on sgen/gchandles

* [crash] Refactor dumper mechanism

* [crash] Make threads not die during thread dump

* [crash] Add support for registering/dumping native libraries

* [crash] Add silent option to dumper

* [crash] Print error when unable to dump thread

* [crash] Add icalls to directly trigger telemetry-style walks

* [crash] Increase maximum frame depth

* [crash] Add managed method names when privacy disabled

* [crash] Add tests for concurrent dumping

* [crash] Add support for concurrent global dump requests

* [crash] Switch from CAS+Sleep to semaphore for dumper

Locks and GC-Safe regions are both unsafe in a signal handler
context. CAS primitives and the sleep syscall was used before.
Semaphores appear to be safe, enabling the following cleanup.

* [runtime] Make find_method use stack memory for dumper-facing entry point

* [crash] Enable install_state_summarizer on all platforms

* [crash] Dump managed stacks from controlling thread

* [crash] Don't use allocating method name formatter

* [crash] Copy safer strings with crash privacy disabled

* [crash] Fix string races with DumpTotal icall

* [crash] Fix space in crash file name

* [crash] Fix lifetime and size checks on mono-state memory

* [crash] Fix icall declarations for new style

* [runtime] Make sequence point lookup lockless

* [crash] Fix managed exception dumper icall format

* [crash] Print half-completed dump when space runs out

* [crash] Bump static memory for crash string to 500k

Note:
- This memory isn't accessed until we're crashing
- On any modern machine, unused static memory is lazily allocated. When
we access it, the fault will trigger the MMU to map memory for us.
- This is guaranteed to be reentrant and safe. mmap (the alternative) is
surely fairly stable on many systems, but this is not guaranteed. The
documentation pages for mmap specifically claim it as not safe in these async
contexts.

* [crash] Make whitelist lookup lockless

* [crash] Split unmanaged ptrs into method ip + offset
2018-10-18 20:23:40 +02:00
Alexis Christoforides ec1a736266 [corlib] Ensure that Console Streams are thread-safe
The Console class wraps the standard system stream reader/writers on construction so as to expose them as thread-safe. However, the Set-Out/In/Err methods in referencesource do not do the same when they replace default targets.

CoreFX code does: https://github.com/mono/corefx/blob/1748f6492e8b96842f76e1a9e7b5d7e8ccfca480/src/System.Console/src/System/Console.cs\#L412-L444

Possible fix for https://github.com/mono/mono/issues/11146
2018-10-18 10:58:03 -04:00
EgorBo a9b1acbee1 bump corefx 2018-10-18 10:53:26 -04:00
EgorBo 81326b8896 [2018-08] bump mono 2018-10-18 10:53:26 -04:00
Alexander Köplinger 04bde6eb75 [ci] Move OSX .pkg build to a separate bot pool
Allows us to better utilize the bockbuild cache.

(cherry picked from commit 229a4673d4)
2018-10-18 16:43:17 +02:00
monojenkins 2653d3eeda [pkg] Add preinstall which removes existing Mono of the same version (#11208)
Fixes https://github.com/mono/mono/issues/11202
2018-10-17 22:38:24 +02:00
Martin Baulig 47e556d4cf [2018-08][System]: Reenable native Apple Certificate support on WatchOS. (#11173) (#11199)
* [System]: Reenable native Apple Certificate support on WatchOS. (#11173)

During the code refactoring this summer, support for native apple certificates
has been dropped on watchOS.

* add `apple-certificates.sources` and move all certificate-related code from
  `appletls.sources`.

* move non-network related code from `MacProxy` into a new `AppleTypes`.

* add the `MONO_FEATURE_APPLE_X509` magic to `System/Makefile` where it was missing from.

(cherry picked from commit b61a3ffb02)

* [csproj] Update project files
2018-10-17 21:07:12 +02:00
Ludovic Henry 9f72a46b41 [sdks] Fix Archive Jenkins job (#11217) 2018-10-17 14:42:42 -04:00
Ludovic Henry 2712292c56 [sdks] Add Groovy script to build the SDKs archives for the products (#11192) 2018-10-16 12:25:51 -04:00
Ludovic Henry 839f49d3b2 [sdks] futimens and futimes symbols are missing on anything earlier than 10.13 (#11176)
This breaks when LLVM is built on 10.13+ and the runtimes are built on 10.12.
2018-10-16 08:14:41 -04:00
Ludovic Henry 657f915eb6 [2018-08] [sdks] Create archive targets for pre-building on CI (#10932)
* [sdks] Remove redundant --enable-cxx

* [sdks] Shorten `-m32`/`-m64` parameters detection for runtimes

* [sdks] Build BCL profiles without configure flags

* [sdks] Add BclTemplate to build BCL profiles

This is to avoid building all the profiles in a single `sdks/out/bcl` directory which will be shared between android, ios and wasm.

* [sdks] Add download/pack capabilities for LLVM

* [sdks] Create archive targets for pre-building on CI

* [sdks] Use archive-{android,ios,wasm} on CI

* [sdks] Run archive-llvm-llvm{,win}{32,64} on CI

* [sdks] Ensure LLVM is cloned before trying to download

* [sdks] Simplify call to BclTemplate

* [mcs] Make directory dependency as order-only

We would otherwise always rebuild the target since the directory is updated whenever something is added to the directory. This is a common Makefile technique.

* [sdks] Build tests for BCL targets
2018-10-12 16:13:26 -04:00
Ludovic Henry bd1f64acc3 [sdks] Add cmake toolchain file for LLVM MXE builds (#11055)
We couldn't compile llvmwin{32,64} on Linux because we would try to use {i686,x86_64}-w64-mingw-cmake but it wouldn't exist.
2018-10-12 10:55:12 -04:00
Ludovic Henry 7805ccc43d [sdks] Fix llvm-llvm32 build (#11117) 2018-10-12 10:10:33 -04:00
Alexander Köplinger 04a6e8294e [2018-08] Bump xunit (#11085) 2018-10-11 11:09:31 -04:00
Alexander Köplinger f001e691ca [2018-08] Bump msbuild (#11087) 2018-10-11 09:39:58 -04:00
Aleksey Kliger 7001d39bb2 Always use InvariantCulture calendars in X509Certificate on Mobile
Allow the linker to remove UmAlQuraCalendar and HijriCalendar on mobile devices

Match the CoreFX X509Certificate changes: https://github.com/mono/corefx/commit/4eb1fc2abd2ffa70e402d22415d0209b21725a10

Fixes https://github.com/mono/mono/issues/10448
2018-10-09 15:46:15 -07:00
Zoltan Varga e257971d3c [llvm] Remove an incorrect assert. 2018-10-08 14:20:23 -04:00
monojenkins 4d41b0560f [2018-08] [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes. (#10955)
* [jit] Fix a constant propagation problem on 32 bit with iconst+conv.i8, we would be setting inst_imm even for long opcodes.

* [llvm] Fix the special casing of OP_LCOMPARE_IMM, its not needed.

* Use TARGET_SIZEOF_VOID_P.
2018-10-08 10:12:53 +02:00
Martin Baulig 8ecede131d Use 'OnlyFaulted' only. 2018-10-08 10:12:16 +02:00
Martin Baulig 577ac4fd91 Add TaskContinuationOptions.OnlyOnFaulted | TaskContinuationOptions.OnlyOnCanceled as suggested by Marek. 2018-10-08 10:12:16 +02:00
Martin Baulig dfd13979ad [System]Make sure HttpWebRequest observes exceptions on timeout. #10488.
`HttpWebRequest.RunWithTimeoutWorker()` needs to observe the worker task's exception
on timeout to prevent it from being thrown via the `TaskScheduler.UnobservedTaskException`
event.  Fixes #10488.
2018-10-08 10:12:16 +02:00
Marek Safar cae86185c2 Bump corefx 2018-10-07 14:00:04 +02:00
Bernhard Urban 05c480e635 [2018-08] [interp] fixes for native type (#10998)
* [interp] fix op_implicit/op_explicit conversions for native types

Conversion operators have been mostly broken in the interpreter, for
example conversion from nint to float didn't work. While some
conversions are easy to intrinsify (like nint -> I8), there are harder
cases like nint -> decimal. The JIT actually falls back to the managed
implementation, so let's do this in the interpreter as well.

However the managed implementation expects a pointer to the value type,
i.e. the container type System.nfloat instead of float/double primitives.
In such cases the value is going to be stored in a local and then the
address of its storage is pushed on the stack before invoking the
managed implementation of the conversion.

Added test cases for scenarios observed in Xamarin.iOS.

* [interp] support ntype.CompareTo ()

* [interp] support ntype.Equals ()

* [interp] support nfloat.*Infinity

* [interp] support ntype.ToString ()

* [interp] introduce float R4 stack type
2018-10-05 11:27:42 -04:00
Egor Bogatov 5c70d5b946 [2018-08] Bump corefx (#10979)
* bump corefx

* bump corefx
2018-10-05 15:44:25 +02:00
Alexander Köplinger 2b620cc54b [ci] Always pass sha1 from Mac to Windows packaging build
Before we only did this for PR builds but it turns out it's needed for
normal master/branch builds too.

In situations where there are two Mac builds at roughly the same time
the downstream Windows builds would otherwise both refer to the same/latest
commit since they just checkout the latest ref on the branch.

Now we reset the Windows build to the sha1 which is passed to it.

(cherry picked from commit b13145bb12)
2018-10-05 00:28:25 +02:00
Alexander Köplinger 8d220f3913 [corlib] Simplify confusing "SSPI" error message and align with corefx (#10976)
Right now if anything goes wrong in the security stack you get a message like this:

```
System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> Mono.Btls.MonoBtlsException: Ssl error:1000007d:SSL routines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED
```

This is confusing since SSPI is a Windows-only thing and is not used on Mono.
We inherited this error message string from referencesource.

Change the string to something more generic which also aligns us with CoreFX:
https://github.com/dotnet/corefx/blob/a10890f4ffe0fadf090c922578ba0e606ebdd16c/src/System.Net.Security/src/Resources/Strings.resx#L210-L212

(cherry picked from commit 42e347ee47)
2018-10-05 00:22:37 +02:00
Rolf Bjarne Kvinge 54700cf89f [sdks/ios] Build libMonoPosixHelper for device architectures, so that zlib-helper.o is created. (#10921) (#10971)
xamarin-macios currently builds zlib-helper.o using mono's source code.

It would be preferrable to use a version built by mono, and since
zlib-helper.o is a byproduct of building libMonoPosixHelper, we need to build
libMonoPosixHelper (we already build it for simulator architectures), even
though we don't need/use libMonoPosixHelper itself.
2018-10-04 11:23:47 -04:00
monojenkins d7ff201b56 Put xunit tests in mcs/class/lib/PROFILE/tests too (#10966)
So they are next to their NUnit counterparts.

Move xunit remote executor app to tests dir too and compile it when
compiling the test assembly instead of doing it before running the test.

We need to use an absolute path for the xunit remote executor and it
needs to be in Windows format on Windows since we pass it as an env var
to the xunit tests.
2018-10-04 11:06:09 -04:00
monojenkins 0a27b0f72d [2018-08] Use Mono.Android as a reference for netstandard facade (#10973)
Backport of #10849.

/cc @marek-safar @EgorBo

Description:
see https://github.com/mono/mono/pull/10835
2018-10-04 13:07:49 +02:00
Marek Safar 1644a1a01d Bump linker 2018-10-03 18:07:21 +02:00
monojenkins 3e89a56e50 Merge pull request #10906 from monojenkins/backport-pr-10899-to-2018-08
[2018-08] [runtime] Disable stack guard for main thread on osx

Backport of #10899.

/cc @luhenry @BrzVlad

Description of #10899:
On macOS Mojave, it seems that changing the mapping of stack pages for main thread can lead to corruption bugs.

https://github.com/mono/mono/issues/10802



<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2018-10-03 18:05:34 +02:00
Vlad Brezae 9f01ca1a9f [runtime] Fix undefined pthread_main_np (#10930)
It is exported only when _DARWIN_C_SOURCE is defined.
2018-10-03 10:37:45 +03:00
Maxim Lipnin 8b099949ad [Reflection] Fix issue with finding types in module using an asterisk as filter criteria 2018-10-03 08:45:15 +02:00
Aleksey Kliger f21a48dad5 [w32handle] Add coop state transitions in mono_w32handle_lock_handles
If another thread locked at least one of the other handles, and there is a
cooperative GC STW happening, this function will loop forever.

Add GC Safe transitions around the call to sleep to give this thread a chance
to suspend.

Fixes https://github.com/mono/mono/issues/10863
2018-10-02 17:17:07 -04:00
Martin Baulig 2cc940be99 Use passwordless import in the X509Certificate(byte[]) constructor.
The `X509Certificate(byte[])` constructor should call `CertificateProvider.Import(byte[])`
to use the native apple implementation if possible.

(cherry picked from commit 8b3ca0dbbe0af1436d33d74bb2ca00b3cbfc28b8)
2018-10-02 17:21:18 +02:00
Alexander Köplinger 25cfd22997 [packaging] Remove installation of openssl via brew on macOS (#10874)
We're now using an msbuild version which uses .NET Core 2.x which no longer needs openssl.

(cherry picked from commit 634e726bdf)
2018-10-02 13:13:52 +02:00
Vlad Brezae 03a769f787 [runtime] Disable stack guard for main thread on osx
On macOS Mojave, it seems that changing the mapping of stack pages for main thread can lead to corruption bugs.

https://github.com/mono/mono/issues/10802
2018-10-01 20:30:02 +00:00
Ankit Jain ced11fba7b Bump msbuild to track xplat-master (#10668)
* Bump msbuild to track xplat-master

* Print mono version, to debug CI failures
2018-09-28 11:56:19 +02:00
monojenkins aed3298ae2 [sdks] One more update to get XA PR builds working on Linux (#10856)
It turns out some Debian versions identify themselves as `Debian GNU/Linux`, add
this string to the list of distributions which have mingw. This *should* fix the
PR builds (fingers crossed)
2018-09-27 21:31:45 -04:00
monojenkins 425b46eca7 [csproj] Update project files 2018-09-27 19:21:14 -04:00
Marek Safar d507bd8929 [System.Core] Removes no longer needed reference 2018-09-27 19:21:14 -04:00
monojenkins bc97d1e742 [merp] Fix return value handling of posix_spawn (#10843) 2018-09-27 10:32:35 -04:00
monojenkins d2ae599e2c [sdks] Debian Linux doesn't need to build MXE (#10820)
Debian and its derivatives include full mingw chain (both 64 and 32-bit) and so
they don't need to build the toolchain at all. However, the current detection of
Linux flavor takes into account only Ubuntu and all other distros are configured
to *require* MXE but they do *not* build them.

This commit fixes detection of distros which provide the mingw toolchain in a
way that makes it easy to extend the set of compatible distributions as needed.
In order to mark a distribution as one with MinGW one has to add the `:Distro:`
string to the `LINUX_WITH_MINGW` make variable in `mxe.mk`. The `Distro` string
is whatever the `determine-linux-flavor.sh` script returns.
2018-09-27 10:30:12 -04:00
monojenkins 005c804cb2 [SDKS] Build host runtime with correct bitness (#10741)
When building 32-bit binaries on a 64-bit system and vice versa, it is necessary
to pass the `-m32` or `-m64` compiler flags, respectively. Failure to do so will
result not only in linking problems (different binary architecture) but also in
problems when using some system headers which are sensitive to the architecture.
For instance, `ucontext.h` contains register set definitions for different
architectures and building Mono runtime with a 64-bit compiler targetting 32-bit
architecture results in this error:

   .../mono/mono/utils/mono-sigcontext.h:173:74: error: ‘REG_EIP’ undeclared (first use in this function); did you mean ‘REG_RIP’?
      #define UCONTEXT_REG_EIP(ctx) (((ucontext_t*)(ctx))->uc_mcontext.gregs [REG_EIP])

The issue here is that the compiler defines the `__x86_64__` macro which causes
`ucontext.h` to choose declarations for amd64 (which does not use `REG_EIP` but
has `REG_RIP` instead) while Mono runtime assumes its building for a 32-bit host
and uses 32-bit register names. Passing `-m32` to the compiler will fix the
issue as now the compiler will define the `__i386__` macro and all parties will
agree where they are and what they want.

This commit uses a rather baroque statement when constructing compiler flags to
build the Mono runtime to check whether the host triple targets 32 or 64-bit
host and adds the appropriate flag.
2018-09-25 12:49:30 -04:00
Marek Safar 96d8a05b06 [System.Net.Http] Allow empty value in ProductHeaderValue
Fixes #10227
2018-09-24 14:31:04 +02:00
monojenkins 5df25e7d88 [crash] Fix summarize_frame assertion (#10728) 2018-09-21 10:33:34 -04:00
Marek Safar 65c1b941f9 [corlib] Makes remoting test more robust (and disable it on mobile) 2018-09-20 19:54:10 +02:00
EgorBo e6be71c516 bump corefx 2018-09-20 15:42:26 +02:00
monojenkins a65b4f5548 [mono-api-html] Render something for fields with marshalling info. (#10699)
Fixes this warning when comparing Xamarin.iOS.dll:

    Comparison resulting in no changes (src: Public, HasFieldMarshal dst: Public) :
    <field name="EdgeTessellationFactor" attrib="4102" fieldtype="System.UInt16[]" />
    <field name="EdgeTessellationFactor" attrib="6" fieldtype="System.UInt16[]" />
2018-09-19 17:16:35 -04:00
monojenkins 0a85488fde [offset-tool] Error out when parsing fails. (#10695) 2018-09-19 17:15:45 -04:00
monojenkins b4b0d0fa35 [System]Fix WebResponseStream.ReadAllAsyncInner() return value. (#10587)
We need to call `ToArray()` instead of `GetBuffer()` to truncate the buffer
to the amount of bytes that we actually read.
2018-09-19 17:15:30 -04:00
monojenkins 2a9ad9b4d4 [mono-api-html] Fix rendering of nuint. (#10665) 2018-09-19 12:17:41 -04:00
monojenkins 1a309a7b45 Implement IEnumerable for ConditionalWeakTable (#10656) 2018-09-19 12:16:41 -04:00
monojenkins 49b5001dfd [2018-08] [interp] add safepoints and enable hybrid suspend as default (#10685)
* [interp] add safepoints and enable hybrid suspend as default

* [interp] consolidate checkpoint and safepoint into one opcode
2018-09-19 12:14:29 -04:00
Zoltan Varga 2bceefe4e6 [sdb] Avoid calling into the debuggee from VirtualMachine.GetObject () while holding the objects_lock. 2018-09-19 10:01:47 +02:00
monojenkins 56bed71f11 Merge pull request #10621 from lewurm/2018-08-interp-remove-coop-attach-insn
[2018-08] [interp] move thread attach to interpreter entry

Backport of https://github.com/mono/mono/pull/10579
2018-09-18 05:45:11 -04:00
Bernhard Urban 62412a804c [ci] disable System.Core-xunit for interp, does not work on this branch yet 2018-09-17 20:12:29 +02:00
Vlad Brezae ef105562be [interp] Fix missing InvalidProgramException (#10095)
* [interp] Throw proper exception instead of warning

Fix code causing wrong stack state.

* [interp] Compile method for errors when needed

Delegate creation doesn't require compiling the method.

* [interp] Enable System.Core xunit tests
2018-09-17 14:44:46 +02:00
monojenkins 2510fd9253 [2018-08] Fix MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy (Linux/amd64/FullAOT/LLVM). (#10633)
mono_aot_get_unbox_trampoline: amd64 hardcode unbox trampoline size to 5 at compile-time.
This fixes: MonoTests.System.Linq.ParallelEnumerableTests.TestGroupBy frequently crashing on FullAOT/LLVM/Linux/amd64 CI.

https://github.com/mono/mono/issues/10441
https://github.com/mono/mono/issues/9554
https://github.com/mono/mono/issues/9046

The actual size varies between 6 and 9 but we can just pretend the last instruction has size 1 (it is 2 or 5; calling it 5 can be fatal, calling it 2 is no better than 1).

Otherwise, a trampoline can overlap the next function, jit info lookup of the next function can fail, then gsharedvt wrapper omited, and crash.

The afflicted function in this case was
System_Linq_Parallel_WrapperEqualityComparer_1_T_GSHAREDVT_GetHashCode_System_Linq_Parallel_Wrapper_1_T_GSHAREDVT.

You can see it with debugprint: https://github.com/mono/mono/pull/10582.

There are many other possible fixes.
Such as runtime disassembly, hardcode in runtime instead of compiler, produce static trampinfo, omit trampinfo entirely, compute minimum size.

See https://github.com/mono/mono/commit/d589f3b64fca77c5c8bb5a8582eea5c0670312d7.
2018-09-16 13:10:49 -07:00
Marek Safar b76a034c12 [2018-06][Facades] Removes duplicate entry 2018-09-14 16:48:29 +02:00
Bernhard Urban d4f52d1116 [interp/jit] fix memory leak in pinvoke wrapper allocation 2018-09-14 15:32:26 +02:00
Bernhard Urban c3f4e28057 [interp] fix memory corruption around pinvoke wrapper allocation 2018-09-14 15:32:20 +02:00
Bernhard Urban b402c5bcf3 [interp] do not propagate uninitialized ThreadContext to JIT TLS 2018-09-14 15:31:28 +02:00
Bernhard Urban 4504185ee9 [interp] move thread attach to interpreter entry
We want to attach a thread before any TLS operation is done by the
interpreter. In the JIT this happens inside the native-to-managed
wrapper via `mono_threads_attach_coop ()`. Unfortunately, this is too
late for the interpreter as it already requires a working TLS before
even calling into the wrapper.

Also, fixup naming of locals in the native-to-managed wrapper.
2018-09-14 15:31:25 +02:00
monojenkins 63de341bb8 [arm64] Fix the alignment of valuetypes passed after small primitive types on IOS. (#10590)
Fixes https://github.com/xamarin/xamarin-macios/issues/4347.
2018-09-14 08:23:31 -04:00
monojenkins 9946fef5a3 [runtime] Fix Marshal.SizeOf (typeof (void)). (#10600)
Fixes https://github.com/mono/mono/issues/10303.
2018-09-14 08:21:34 -04:00
monojenkins 2e3c7693c9 [2018-08] Drop JIT attach: use coop attach in mini, aot and interp (#10551)
* [metadata] Hack - get mono_use_interpreter from metadata

Don't use this, it's a mistake.  The granularity is all wrong, for one: in the
future the interpreter may not be an all-or-nothing deal.

* [marshal] Don't emit CEE_MONO_JIT_ATTACH except for interpreter

Always use the mono_threads_coop_attach/mono_threads_coop_detach pair.

* [aot] Drop MONO_PATCH_INFO_JIT_THREAD_ATTACH

We always emit the mono_threads_attach_coop icalls now.

Bump MONO_AOT_FILE_VERSION

* [mini] mark mono_jit_thread_attach external only

It's used by Xamarin.Mac and possibly other embedders.

Interpreter still used mono_jit_thread_attach_interp until it's fixed to work
with coop.

There shouldn't be any other callers.

* [interp] Add a thread attach EE callback

Use it to set the interpreter thread context on the JIT tls value

* [marshal] Always emit mono_threads_attach_coop instead of CEE_MONO_JIT_ATTACH

Use the coop icall for the interpreter, too.

* [interp] Drop MINT_MONO_JIT_ATTACH and detach opcodes

* [metadata] Drop CEE_MONO_JIT_ATTACH and detach opcodes

* Revert "[metadata] Hack - get mono_use_interpreter from metadata"

This reverts commit c3d2f488b824dcdfa261f8292013c805740f353f.

* [mini] Drop unused mini_jit_thread_attach_interp

It was a temporary workaround for the interpreter; no longer needed.

* [coop] Switch to GC Safe in mono_jit_thread_attach.

It's an external-only function that's not called by the runtime on any
threads.  So the only calls are explicit uses by Mono API clients.  Leave the
thread in GC Safe mode and leave it to the n2m invoke wrappers or MONO_API
entry points to switch to GC Unsafe.

* [interp] Add MINT_MONO_THREADS_ATTACH_COOP opcode

Because this icall can be called from detached threads, don't go through
do_icall () which needs initialized tls keys

* fixup for c++ build

* fixup indentation and comments

* fixup C++ a bit more

* [mini] Bump MONO_EE_API_VERSION

* Revert "[interp] Add a thread attach EE callback"

This reverts commit 8a343d6ce15f0475a62936f28264f638ebf0344f.

* [interp] sync jittls context before entering EH machinery

* [interp] get context refactor (#10561)

* [interp] Add declaration for set_context (#10575)
2018-09-13 10:00:35 +02:00
monojenkins 228cab7601 [csproj] Update project files 2018-09-13 09:37:40 +02:00
monojenkins c12aa07fd7 Bump API snapshot submodule 2018-09-13 09:37:40 +02:00
Marek Safar ee57ffc058 [Facades] Adds System.Buffers mobile facade
and sets up facades without corresponding nuget _._ for conflict
resolution done by msbuild
2018-09-13 09:37:40 +02:00
monojenkins 7298849995 Treat EXDEV from clonefile the same way as ENOTSUP. (#10529)
Backport of #10528.

/cc @akoeplinger
2018-09-12 13:56:39 -04:00
Zoltan Varga eac547723c [arm64] Add dyncall support for ArgVtypeByRefOnStack arguments.
Fixes https://github.com/mono/mono/issues/10483.
2018-09-11 08:56:42 +02:00
Johan Lorensson 947193b9e2 Fix Mono Windows cross compiler using mono LLVM release_60 branch. (#10413) (#10503)
* Fix Mono Windows cross compiler using mono LLVM release_60 branch.

For scenario where llvm-config.exe can't be run (none WSL/CygWin build target)
Build will fallback to hard coded libraries not working with mono LLVM release_60
branch.

Added an exact mirror of what llvm-config.exe is returning for different components
on mono LLVM master and mono LLVM release_60 branch.

The selected codegen libraries (passed in as extra_libs) was not handled in any cases
so added them into the build script as well.

* Split parameter between lvm codegen libs and llvm extra libs.

Need to explicit pass -lz in case where configure have detected zlib availability
and llvm-config.exe can't be executed. In cases where zlib is not available, default
in mingw installs, this check make sure link step won't fail due to missing library.

* Fix inversion of aarch64codegen libs.

* Enable package-android-cross-{arm,arm64,x86,x86_64}-win builds on CI.
2018-09-07 16:38:40 -04:00
monojenkins 522cd7ce2a [corlib] Don't decrement ConditionalWeakTable::size on remove. (#10494)
We can't decrement the size on removal as we use tombstones.
When using tombstones, the invariant to keep is on the number of null entries as those
are used as search stop-marks.

Without this change, it's possible that a long series of add/remove operations could leave the array with no null entries,
just tombstones and filled entries. In that case, search would degenerate into a linear search that would look into all array elements.

This change fixes worst-case perf of not-found searches to be bound to the load factor.

Additionally, clear the array to null entries, otherwise we fall into the above trap even more easily.
2018-09-07 16:37:38 -04:00
Alexander Köplinger 1bdb478a71 [ci] Fix run-test-mac-sdk.sh build
0dbcdd5 added CFLAGS etc in front of the command but that's not something the TESTCMD can execute.
We shouldn't pass CFLAGS etc at all for this since that is handled by bockbuild.
2018-09-07 17:22:58 +02:00
monojenkins 1518670974 Fix DeflateStream handling of zero-length reads from underlying stream. (#10493) 2018-09-07 12:08:16 +02:00
monojenkins b5f8508f6f [llvmonly] Fix a regression caused by 55950a0608. (#9976) 2018-09-06 18:56:27 -04:00
monojenkins ea17477aac [2018-08] Ensure the finalization in DeflateStream is performed in the correct order. (#10492)
* Ensure the finalization of SafeHandle and GCHandle in DeflateStreamNative is performed in the correct order.

* Do not access BaseStream from finalizer.
2018-09-06 18:54:18 -04:00
monojenkins ed5b463839 [interp] white list nfloat::IsNaN () (#10385) 2018-09-06 18:49:18 -04:00
monojenkins 60f295e675 [2018-08] [exceptions] ftnptr_eh_callback test that stresses n2m transitions (#10387)
* [exceptions] ftnptr_eh_callback test that stresses n2m transitions

on Xamarin.iOS it happens that the ftnptr_eh_callback calls into managed
code, that is yet another native-to-managed transition.

* [coop] Use unbalanced transition to GC Unsafe in mono_raise_exception

Since `mono_raise_exception_deprecated` never returns, the transition won't be
balanced.  This fixes a cookie-counting problem (assert on mono shutdown) in
coop and hybrid checked builds using the new test case:

    MONO_THREADS_SUSPEND=coop MONO_CHECK_MODE=thread,gc mono mono/tests/install_eh_callback.exe
2018-09-06 18:48:58 -04:00
monojenkins 0ab763464d [2018-08] Truncate MachineName (and UserDomainName) at first period (#10418)
Backport of #9843.

* Truncate MachineName (and UserDomainName) at first period

Unix machines often put their FQDN as the host name, and domain
name is used for things such as yp. As such, truncate the FQDN to
just the hostname, as other Unix utilities seem to do.

Matches the .NET Core and .NET Framework behaviour, and MS seems to
require this for a future project. Fixes #9839.

* Add a unit test for bug

* Formatting tweaks
2018-09-04 13:20:20 +02:00
monojenkins 2ef3349e76 Update framework assemblies list in assembly.c (#10233)
Backport of #10214.
Fixes https://github.com/mono/mono/issues/9973
2018-09-04 13:16:39 +02:00
monojenkins bf580871f2 [2018-08] [corlib] Bring back String.Concat with __arglist (#10459)
Backport of #10452.
Fixes #9996
Tested repro project from the link on a local PostgresSQL server and EntityFramework packages.

See https://github.com/aspnet/EntityFramework6/blob/master/src/EntityFramework/Core/Objects/ELinq/MethodCallTranslator.cs#L1482-L1497
2018-09-04 13:14:38 +02:00
Ludovic Henry c19ca0ded5 [2018-08] [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA + Unify provisioning of LLVM for both Android and iOS. (#10427)
* [sdks] Add CrossRuntimeTemplate

* [sdks] Add cross-{arm,arm64,x86,x86_64}{,-win} runtimes for XA

* [sdks] Factor various variables for RuntimeTemplate

* [sdks] Use CrossRuntimeTemplate for iOS

* [sdks] Unify provisioning of LLVM for both Android and iOS.

A global CFLAGS would be set in `run-jenkins.sh`, and that would screw up with LLVM. The global CFLAGS makes sense as long as we are only building Mono, but that's not the case with LLVM anymore.

* [sdks] Use MonoRuntime template for desktop-x86_64

* [sdks] Remove android-armeabi, it's been removed from XA already and the target has been deprecated in the NDK
2018-09-02 07:05:51 -04:00
monojenkins 51ea240a35 [sdb] Disable an assert to avoid breaking debugging. (#9983)
Fixes https://github.com/mono/mono/issues/8848.
Fixes https://github.com/mono/mono/issues/9262.
Fixes https://github.com/mono/mono/issues/8627.
2018-09-01 09:54:27 -04:00
monojenkins 3e238c836c [2018-08] Use clonefile instead of copyfile on macOS. (#10119)
* Use clonefile instead of copyfile on macOS.

* Address PR review comments.

* Address PR review comments (if -> assert).

* RTLD_DEFAULT - > libc_handle
2018-09-01 09:54:07 -04:00
monojenkins 802091af08 [coop] Fixup dump_threads () legend to match thread state enum values (#10386) 2018-09-01 09:52:41 -04:00
monojenkins 4dbe2ced4e [sgen] Fix string size inconsistency between alloc/scan (#10408)
This could lead to crashes when having strings with size at the LOS boundary.

https://github.com/mono/mono/issues/10309
2018-09-01 09:52:21 -04:00
monojenkins 2d50ef119b [MacSDK] Go back to incluging opt/llc after change in LLVM install process (#10433)
Fixes https://github.com/mono/mono/issues/10243
2018-09-01 10:27:23 +03:00
monojenkins eae59de800 [System]Fix MonoBtlsProvider.CheckValidationResult () logic. (#10397)
Backport of #10396.
2018-08-31 17:12:29 +02:00
monojenkins ad0854917e [System]Make `MobileAuthenticatedStream's read buffer large enough to hold a full TLS record. (#10394) 2018-08-31 16:56:50 +02:00
monojenkins 0e91bc8dd9 Merge pull request #10346 from monojenkins/backport-pr-10224-to-2018-08
[2018-08] [interp] fix ftnptr_eh_callback

Backport of #10224.

/cc @lewurm
2018-08-30 20:05:03 -04:00
monojenkins 6d2a0eb4aa [2018-08] [mini] fix memory dumping on devices (#10349)
[2018-08] [mini] fix memory dumping on devices

Backport of #10316.

/cc @lewurm
2018-08-30 09:40:23 -04:00
Johan Lorensson 80ade74200 Merge pull request #10358 from monojenkins/backport-pr-10321-to-2018-08
[2018-08] Fix Windows LLVM mono cross compiler build.
2018-08-30 13:36:53 +02:00
Alexander Köplinger 9d6252eb65 Follow up to bump target requirement to OSX 10.9 Mavericks
After another grep with different search terms I found a few more matches.
2018-08-30 12:44:44 +03:00
Alexander Köplinger b5f8d09d91 Bump target requirement to OSX 10.9 Mavericks
Fixes #9581
2018-08-30 12:44:44 +03:00
Ludovic Henry a2649d5d40 [sdks] Allow for overwriting llvm-{llvm32,llvm64} CC, CXX, CFLAGS and CXXFLAGS (#10362) 2018-08-29 22:12:39 -04:00
lateralusX 44a01472b1 Fix Windows LLVM mono cross compiler build.
This commit re-enables Windows LLVM mono cross compiler build + adjust to
new changes done in mono LLVM build system.
2018-08-29 13:28:07 +00:00
monojenkins 75f66645c4 [2018-08] [System]: MonoTlsStream is now IDisposable and cleans up on error. (#10335)
Backport of #10254.

/cc @marek-safar
2018-08-29 14:01:25 +02:00
monojenkins 756f617d2b [2018-08] Disable tailcall of gsharedvt. (#10324)
Backport of #10323.

/cc @marek-safar
2018-08-29 13:06:02 +02:00
Bernhard Urban 9256a02e8d [interp] turn off optimizations for callers of INTERP_PUSH_LMF_WITH_CTX 2018-08-29 09:03:28 +00:00
Bernhard Urban 207b7b6525 [interp] attach LMF with MonoContext in interp2native transition
this is needed so that EH can resume into the interpreter when the
exception was raised via mono_raise_exception from native code.
2018-08-29 09:03:28 +00:00
Bernhard Urban 10b2571905 [exceptions] pop lmf stack before executing ftnptr_eh_callback 2018-08-29 09:03:28 +00:00
Filip Navara e8415ffe23 Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine. 2018-08-27 21:32:04 +02:00
Filip Navara 805dfec75d Add test case. 2018-08-27 21:32:04 +02:00
Filip Navara b7635aed96 Fix changing TextBox font before the Control handle has been created. 2018-08-27 21:32:04 +02:00
Filip Navara f99f8aeacd Fix TextBox height fixup to work properly inside TableLayout. 2018-08-27 21:32:04 +02:00
Filip Navara 2a71a71c7b Fix layout of scrollbars in combobox. 2018-08-27 21:32:04 +02:00
Zoltan Varga eedc49b402 [llvm] Emit volatile loads in emit_volatile_load (), otherwise llvm might optimize the loads away.
Fixes https://github.com/mono/mono/issues/10035.
2018-08-27 14:20:18 +02:00
monojenkins 4151ad78f1 [llvm] Use curl as fallback for wget (#10265) 2018-08-24 11:38:23 +03:00
Marek Habersack 056528177e [eglib] Fix URI to file name conversion
Hexadecimal ASCII to decimal integer conversion must be 10-based.
2018-08-24 09:22:12 +02:00
Alexander Kyte c1910c80f4 Merge pull request #10241 from alexanderkyte/2018-08-merp
[2018-08] Add pipeline to convert managed exception into telemetry format
2018-08-23 23:26:10 -04:00
Aleksey Kliger 1054aba62a [mini] Don't regen Makefile.am if llvm/llvm_config.mk changes
The llvm/llvm_config.mk makefile fragment just includes make (not automake)
variable definitions.  So there is no need to regenerate the mini/Makefile.am
file if the fragment updates - the include will pick it up.
2018-08-23 17:47:03 +02:00
monojenkins d0fed2af14 [sdks] Use separate temporary dirs for llvm36/llvm. (#9975) 2018-08-23 15:59:05 +03:00
Alexander Kyte 85a7f7aca1 [runtime] Add interpreter support for walking Exception stacks 2018-08-22 15:05:00 -04:00
Alexander Kyte 6a783bb78c [runtime] Stub out exception summarizer when crash reporting is disabled 2018-08-22 15:04:31 -04:00
Alexander Kyte dd97b32959 [runtime] Consistently zero summarizer state memory 2018-08-22 15:04:22 -04:00
Alexander Kyte 67ed6f3152 [runtime] Create more ergonomic API for Exc to Telemetry 2018-08-22 15:04:11 -04:00
Alexander Kyte 22738e7d30 [runtime] Add test for managed telemetry reporting
To test the proprietary bits, you must first have a copy of MERP
installed somewhere.

Then run the following test:

using System;
using System.Reflection;

public class MinimalTelemetry {

	static MinimalTelemetry ()
	{
		var merp_path = "/xxx/xxx/xxx/Microsoft Error Reporting.app";
		var monoType = Type.GetType ("Mono.Runtime", false);
		var m = monoType.GetMethod("EnableMicrosoftTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
		var m_params = new object[] {"com.xamarin.MinimalTelemetry", "Test.Xam.MinimalTelemetry", "1337001", merp_path, "AppleAppCrash", "/Library/Frameworks/Mono.framework/Versions/Current/bin/mono"};
		m.Invoke(null, m_params);

		AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(HandleException);
	}

	public static void HandleException (object sender, UnhandledExceptionEventArgs e)
	{
		var exc = e.ExceptionObject as Exception;

		var monoType = Type.GetType ("Mono.Runtime", false);
		var send = monoType.GetMethod("SendExceptionToTelemetry", BindingFlags.NonPublic | BindingFlags.Static);
		var send_params = new object[] {exc};
		send.Invoke(null, send_params);

		// Now the MERP GUI should pop up
		// Click "More Information"
		// You should see something like this:
		// {
		//  "payload" : {
		//  "protocol_version" : "0.0.1",
		//  "configuration" : {
		//    "version" : "5.19.0 (managed_telemetry_pipeline/d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
		//    "tlc" : "normal",
		//    "sigsgev" : "altstack",
		//    "notifications" : "kqueue",
		//    "architecture" : "amd64",
		//    "disabled_features" : "none",
		//    "smallconfig" : "disabled",
		//    "bigarrays" : "disabled",
		//    "softdebug" : "enabled",
		//    "interpreter" : "enabled",
		//    "llvm_support" : "disabled",
		//    "suspend" : "hybrid"
		//  },
		//  "memory" : {
		//    "Resident Size" : "16306176",
		//    "Virtual Size" : "4491988992",
		//    "minor_gc_time" : "0",
		//    "major_gc_time" : "0",
		//    "minor_gc_count" : "0",
		//    "major_gc_count" : "0",
		//    "major_gc_time_concurrent" : "0"
		//  },
		//  "threads" : [
		//    {
		//      "is_managed" : false,
		//      "managed_thread_ptr" : "0x0",
		//      "thread_info_addr" : "0x0",
		//      "native_thread_id" : "0x0",
		//      "managed_frames" : [
		//        {
		//          "is_managed" : "true",
		//          "guid" : "4F72FB1B-1E99-47BA-91CE-9515783DC174",
		//          "token" : "0x6000004",
		//          "native_offset" : "0x6a",
		//          "il_offset" : "0x00000"
		//        }
		//      ]
		//    }
		//  ]},
		//  "parameters" : {
		//    "ApplicationBundleId:" : "Test.Xam.MinimalTelemetry",
		//    "ApplicationVersion:" : "1337001",
		//    "ApplicationBitness:" : "x64",
		//    "ApplicationName:" : "com.xamarin.MinimalTelemetry",
		//    "BlameModuleName:" : "Mono Exception",
		//    "BlameModuleVersion:" : "5.19.0 (managed_telemetry_pipeline/d342c73e320 Wed Aug 15 14:40:40 EDT 2018)",
		//    "BlameModuleOffset:" : "0x0",
		//    "ExceptionType:" : "0x02000000",
		//    "StackChecksum:" : "0x60114aa",
		//    "StackHash:" : "0x6011514",
		//    "OSVersion:" : "17.4.0",
		//    "LanguageID:" : "0x7f",
		//    "SystemManufacturer:" : "apple",
		//    "SystemModel:" : "MacBookPro14,3",
		//    "EventType:" : "AppleAppCrash"
		//    }
		//  }

	}

	public static void Main (string[] args)
	{
		//AppDomain.CurrentDomain.LoadFrom ("something that's not a valid path")
		throw new Exception ("MinimalTelemetrybar MinimalTelemetrybar");
	}
}
2018-08-22 15:04:00 -04:00
Alexander Kyte ffae0deeba [runtime] Zero out stack memory for mono-state dumper 2018-08-22 15:03:45 -04:00
Alexander Kyte b072bc6749 [runtime] Add initial support for Exc -> Telemetry
In order to allow managed crash reporting using the existing telemetry
format, I have added initial support for converting a MonoException into
a json blob for telemetry.
2018-08-22 15:03:28 -04:00
Alexander Kyte 82ac95b94e [runtime] Expose merp sender to icall 2018-08-22 14:25:53 -04:00
monojenkins faac90015c An implementation of the ChainStatus property for Btls. (#10215)
When we execute the certificate verification callback we just don't test for success and set status11. Now we get the error (if any) and map the error code to those defined by ChainStatusFlags and add it to a list of X509ChainStatus objects for that chain. Now when get_ChainStatus is called we convert that list to an array of X509ChainStatus and return it.
2018-08-22 11:45:37 +02:00
monojenkins 4368bb5d0a [2018-08] [hybrid-suspend] Two phase STW (#10221)
* [threads] Add enums for suspend phases and for begin-suspend results

* [coop] Two phase suspend

If we're using hybrid suspend, initially request suspension for threads, but
don't preemptively suspend blocking threads.  In the mop-up phase, peek at the
state and if they are still blocking_suspend_requested, preemptively suspend
them.

In full coop and in full preemptive, just use a single phase.

This should fix hybrid suspension deadlocks due to preemptively-suspending
threads taking locks that prevent cooperatively-suspending threads from
reaching a safepoint by leaving all threads running until all
cooperatively-suspending threads come to a safepoint. At that point we can
preemptively suspend the remaining threads.

Fixes https://github.com/mono/mono/issues/9921

* [tests] renable flaky hybrid suspend tests on PRs

* [coop] Thread state machine helper peek_blocking_suspend_requested
2018-08-22 11:13:20 +02:00
monojenkins 101736c438 [2018-08] [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case (#10162)
* [coop] Check async suspend status in ReqSuspendInitSuspendBlocking case

So the issue is that calling begin_suspend_for_blocking_thread under hybrid
suspend will perform a preemptive suspension of the victim thread.

The preemptive suspend doesn't always succeed.
In particular, thread_state_init_from_sigctx or thread_state_init_from_handle
could return FALSE and into->suspend_can_continue will be set to FALSE.
When the thread_state_init_* functions return FALSE, they also set the
MonoThreadUnwindState:valid to FALSE.

So it is important to check the value of MonoThreadInfo:suspend_can_continue
before proceeding with a suspension.

As a result in suspend_sync in the ReqSuspendInitSuspendRunning case we call
check_async_suspend which checks (for preemptively suspended threads) whethere
suspend_can_continue is true.  If it isn't, we resume the victim thread and
loop once more in suspend_sync_nolock and try again.

We didn't have a check_async_suspend call in the ReqSuspendInitSuspendBlocking
case, so a thread could be considered suspended even if we couldn't capture a
valid MonoThreadUnwindState for it.

That breaks the assertion the call to mono_thread_info_get_last_managed in
async_suspend_critical which needs a valid MonoThreadUnwindState.

Fixes https://github.com/mono/mono/issues/10031

* fixup - remove coop assertion in check_async_suspend

result for coop could be iether BeginSuspendOkCooperative or
BeginSuspendOkNoWait depending on whether the thread was running (Ok) or
blocking (OkNoWait)

* [coop] suspend_can_continue if async raced with self-suspend (osx + win32)

Companion to 006d6ce097 from earlier this year
which applied this fix for POSIX signal based suspend.  This is the
corresponding OSX and Win32 fix.

In hybrid suspend, in the case where a suspend initiator needs to preemptively
suspend a thread, but the thread self-suspended while after the suspend
initiator put it into the blocking_suspend_requested state, we want to allow
the suspend to continue.  We do have to call the syscall to undo the native
async suspend, but after that, we can leave the victim to continue waiting for
a resume.

This should not have any effect on full cooperative or full preemptive suspend
- in the full coop case we never call async suspend, in the full preemptive
case the thread never self-suspends in blocking.
2018-08-21 14:14:41 -04:00
monojenkins bd20434769 Properly inflate pointer types in inflate_generic_type. Generic pointer types are encountered with 'unmanaged' constraint. (#10195)
Backport of #10145.
2018-08-21 00:57:56 +02:00
monojenkins 84a848a68f [2018-08] Enable mono-state-based telemetry for crashing on CI (#9963)
[2018-08] Enable mono-state-based telemetry for crashing on CI

Backport of #8654.

/cc @marek-safar
2018-08-20 18:55:52 +02:00
Alexander Köplinger 91eaa0832c Bump nunitlite to get NUnit2 xml output fix and failure on file not found fix (#10188)
See mono/NUnitLite#11 and mono/NUnitLite#12

(cherry picked from commit 8f67fb9fb1)
2018-08-20 16:56:49 +02:00
monojenkins 94bb56808f Fix process leak in process enumeration. Dispose rejected ones. (#10186)
This https://github.com/mono/mono/issues/10143 and fix is from there.

I considered nulling the array elements as I go, and then the tail,
to help the GC, but does it help actually? I suspect not.
2018-08-20 14:39:04 +02:00
monojenkins f236586422 [System.Xml.Linq] Fix namespace conflict with new Xamarin.Mac namespace in test code. (#10182)
macOS 10.14 introduces a Network framework, which means Xamarin.Mac now has a Network namespace.

This conflicts with 'using Network = System.Net':

> mono/mcs/class/System.Xml.Linq/Test/System.Xml.Schema/ExtensionsTest.cs(97,27): error CS0576: Namespace '<global namespace>' contains a definition conflicting with alias 'Network'

so just remove the using and use the full 'System.Net' namespace instead.
2018-08-20 12:08:54 +02:00
monojenkins 2a490e383b [sdks] Fix local testing for Android (#10176) 2018-08-19 12:11:19 -04:00
monojenkins 59277c72b7 [2018-08] [reflection] Assembly.LoadFile should throw ArgumentException for relative paths (#10082)
* [reflection] Assembly.LoadFile should throw ArgumentException for relative paths

Fixes https://github.com/mono/mono/issues/9943

* [mcs/tests] Use full path in the compiler-tester

Otherwise the call to LoadFile will fail

* [mono/tests] Use full path in LoadFile in test-multi-netmodule-4-exe

* [mono/tests] Use the test runner for a couple of tests

* [fullaot] Disable test-multi-netmodule-4-exe and custom-attr-errors.exe

* [tests] Use Path.GetFullPath and Path.Combine in AssemblyTest

Fix windows test failures
2018-08-17 09:27:05 -04:00
monojenkins d0e57fbac4 [sdks] Fix typo in ios template (#10131)
[2018-08] [sdks] Fix typo in ios template

Backport of #10130.

/cc @lambdageek
2018-08-16 14:10:17 +02:00
monojenkins 226c6a8b54 [cxx] One more MONO_API ahead of MONO_RT_EXTERNAL_ONLY. (#9965) 2018-08-15 10:39:52 -07:00
monojenkins b11c4232fd [2018-08] [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192. (#9966)
* [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192.

* [cxx] MONO_API before MONO_RT_EXTERNAL_ONLY per 58efe94192.
2018-08-15 09:37:50 -07:00
monojenkins 29d91bd6cf [2018-08] [reflection] Implement RuntimeType.IsSubclassOf in native (#10073)
* [reflection] Implement RuntimeType.IsSubclassOf in native

Fixes a performance regression https://github.com/mono/mono/issues/10000

* fixup - byref and reflexive IsSubclassOf
2018-08-15 18:36:37 +02:00
monojenkins 3e8a282bc3 [bcl] Disable a test which fails with linking. (#10107)
Fixes https://github.com/xamarin/xamarin-macios/issues/4617.
2018-08-15 01:08:55 +02:00
Alexander Köplinger ba38f97879 Add .gitignore for mono/tests/assembly-load-reference 2018-08-14 13:51:28 +02:00
monojenkins 64e9b1a983 [mini] Don't assert on MONO_PATCH_INFO_GC_SAFE_POINT_FLAG if coop is disabled (#9979)
If an AOT library is loaded that was compiled with safepoints, but currently
we're running with preemptive suspend (e.g. MONO_THREADS_SUSPEND=preemptive is
set), don't assert.  `mono_polling_required` will always be false, so the
safepoint will be ignored.

Fixes https://github.com/mono/mono/issues/9947
2018-08-13 16:23:55 +02:00
monojenkins 2e16537134 [ci] Disable sgen-new-threads-collect.exe until #9959 is addressed (#10029)
The test times out due to an issue in hyrbid suspend.  Turn off the test
temporarily while we work on a solution.

https://github.com/mono/mono/issues/9959
https://github.com/mono/mono/issues/9921
2018-08-10 22:35:12 +02:00
monojenkins 6a844e7677 [w32file] Fix typo (#10003) 2018-08-09 18:01:20 -04:00
monojenkins cc3d5f0374 [coop] Thread.JoinInternal should not call mono_error_set_pending_exception (#9971)
[2018-08] [coop] Thread.JoinInternal should not call mono_error_set_pending_exception

Backport of #9948.

/cc @lambdageek
2018-08-09 19:25:19 +02:00
monojenkins 2245249f6d [2018-08] [Facades] Adds System.Threading.Tasks.Extensions for mobile profiles (#9978)
* [Facades] Adds System.Threading.Tasks.Extensions for mobile profile

* Bump API snapshot submodule

* [csproj] Update project files
2018-08-09 00:20:09 +02:00
Alexander Köplinger f123d67e04 Merge pull request #9923 from monojenkins/backport-pr-9858-to-2018-08
[2018-08] [loader] Determine assembly load context from path
2018-08-08 11:45:30 +02:00
monojenkins d551bcc1f2 Remove extern "C" from MONO_LLVM_INTERNAL. Consider also putting it at start of prototype instead of end, like MONO_API. (#9957) 2018-08-08 11:40:44 +02:00
monojenkins b606864198 [2018-08] [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority (#9917)
* [threads] switch to GC Safe around pthread calls in mono_thread_internal_set_priority

   Observed pthread_getschedparam taking a lock on OSX

* [win32] Capture GetLastError before MONO_EXIT_GC_SAFE
2018-08-07 21:46:02 -04:00
monojenkins 0242e31892 Add missing return from the function. (#9932)
Was accidentally removed in 3780114620.
2018-08-07 12:54:05 +02:00
monojenkins 5de08e1822 [sdks] Rename LLVM_VERSION make var to LLVM_RELEASE, LLVM_VERSION is already used by versions.mk. (#9933) 2018-08-07 12:53:47 +02:00
Aleksey Kliger 55ff5b426f [tests] AOT assembly-load-reference tests 2018-08-06 23:03:42 +00:00
Aleksey Kliger 9c01d63b45 [tests] Test loading references from LoadFrom and LoadFile contexts
The LoadFrom assembly loading context and the individual assembly loading
context (aka LoadFile aka "no context") behave differently when requesting a
referenced assembly - for LoadFile we expect the runtime to probe the appdomain
base, the GAC + MONO_PATH but not the basedir of the requesting assembly.  For
LoadFrom the basedir of the requesting assembly _is_ included.  So the tests
here try all the possible variations.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 031968ad2e [loader] Use appdomain base dir and loadfrom asmctx hooks
1. If an assembly filename is in the GAC, always open the assembly in default
context.
2. If an assembly filename is in the appdomain search path (base directory or
private bin path) always open the assembly in default context.
3. If an assembly filename is in the base dir of the requesting assembly and
the requesting assembly was in LoadFrom context, always open the assembly in
LoadFrom context.

Fixes https://github.com/mono/mono/issues/9753
and Fixes https://github.com/mono/mono/issues/9542
2018-08-06 23:03:42 +00:00
Aleksey Kliger 079aff5529 [loader] Add mono_install_asmctx_from_path_hook
Add a hook that can be used to check whether a given path belongs to some
assembly load context.

For example if a given path is in the application base of the current
appdomain, an appdomain hook would set out_asmctx to MONO_ASMCTX_DEFAULT and
return TRUE.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 721092cc06 [utils] Add mono_path_filename_in_basedir 2018-08-06 23:03:42 +00:00
Aleksey Kliger 9f65ed3311 [loader] Pass requesting assembly to mono_assembly_open_predicate
In LoadFrom and LoadFile icalls, pass the currently executing assembly as the
requesting assembly.
2018-08-06 23:03:42 +00:00
Aleksey Kliger cf4eb293da [loader] Assemblies in individual asmctx can reference assemblies in application base
If an assembly was loaded with LoadFile, it can reference assemblies from the
application base, the GAC or MONO_PATH.

Fixes https://github.com/mono/mono/issues/8575
2018-08-06 23:03:42 +00:00
Aleksey Kliger 1f44a5e5a0 [loader] Consult asmctx of executing assembly for Assembly.Load
if an assembly in LoadFrom context calls Assembly.Load, the given assembly name
should be tried in the basedir of the executing assembly, and the resulting
loaded assembly should be in LoadFrom context.
2018-08-06 23:03:42 +00:00
Aleksey Kliger 6f31677959 [runtime] Add mono_runtime_get_caller_no_system_or_reflection
Exposes an already existing stackwalk that we use to find out who called a
corlib API.
2018-08-06 23:03:42 +00:00
Jo Shields 42e523a21e Merge pull request #9905 from directhex/2018-08
Bump version to 5.18.0
2018-08-06 14:36:24 -04:00
Jo Shields 1c5f8bc400 Bump version to 5.18.0 2018-08-06 11:07:36 -04:00
407 changed files with 14435 additions and 5887 deletions

No files matched your search

+1
View File
@@ -49,6 +49,7 @@
[submodule "external/corert"]
path = external/corert
url = git://github.com/mono/corert.git
branch = mono-2018-08
[submodule "external/xunit-binaries"]
path = external/xunit-binaries
url = git://github.com/mono/xunit-binaries.git
+7
View File
@@ -42,6 +42,13 @@ dist-hook:
test -d $(distdir)/mcs || mkdir $(distdir)/mcs
d=`cd $(distdir)/mcs && pwd`; cd $(mcs_topdir) && $(MAKE) distdir=$$d dist-recursive
rm -rf `find $(top_distdir)/external -path '*\.git'`
rm -rf `find $(top_distdir)/external -path '*\.libs'`
rm -rf `find $(top_distdir)/external -path '*\.deps'`
rm -f `find $(top_distdir)/external -path '*\.o'`
rm -f `find $(top_distdir)/external -path '*\.so'`
rm -f `find $(top_distdir)/external -path '*\.lo'`
rm -f `find $(top_distdir)/external -path '*\.Plo'`
rm -f `find $(top_distdir)/external -name '\.dirstamp'`
rm -f `find $(top_distdir)/external -path '*\.exe' -not -path '*/roslyn-binaries/*'`
rm -f `find $(top_distdir)/external -path '*\.dll' -not -path '*/binary-reference-assemblies/*' -not -path '*/roslyn-binaries/*'`
rm -rf "$(top_distdir)/external/linker/linker/Tests"
+102 -45
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [5.17.0],
AC_INIT(mono, [5.18.1],
[https://github.com/mono/mono/issues/new])
AC_CONFIG_SRCDIR([README.md])
@@ -46,7 +46,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
# There is no ordering of corlib versions, no old or new,
# the runtime expects an exact match.
#
MONO_CORLIB_VERSION=40525B4A-F860-49BF-936E-6B29CBBF357C
MONO_CORLIB_VERSION=179F7FD7-9CE8-424E-84AF-0DF5B0B8B469
#
# Put a quoted #define in config.h.
@@ -532,6 +532,8 @@ AC_PROG_LD_GNU
AC_CHECK_HEADERS(sys/filio.h sys/sockio.h netdb.h utime.h sys/utime.h semaphore.h sys/un.h linux/rtc.h sys/syscall.h sys/mkdev.h sys/uio.h sys/param.h sys/sysctl.h libproc.h sys/prctl.h copyfile.h)
AC_CHECK_HEADERS(sys/param.h sys/socket.h sys/ipc.h sys/utsname.h alloca.h ucontext.h pwd.h sys/select.h netinet/tcp.h netinet/in.h unistd.h sys/types.h link.h asm/sigcontext.h sys/inotify.h arpa/inet.h complex.h unwind.h)
AC_CHECK_HEADER(unistd.h, [HAVE_UNISTD_H=1], [HAVE_UNISTD_H=0])
AC_SUBST(HAVE_UNISTD_H)
AC_CHECK_HEADERS([linux/netlink.h linux/rtnetlink.h],
[], [], [#include <stddef.h>
#include <sys/socket.h>
@@ -605,6 +607,7 @@ AC_CHECK_HEADERS(linux/magic.h)
if test x$platform_android = xyes; then
AC_CHECK_HEADERS(machine/endian.h sys/endian.h)
AC_CHECK_HEADERS(android/legacy_signal_inlines.h, [have_android_signal_inlines=yes], [have_android_signal_inlines=no])
AC_CHECK_HEADERS(android/ndk-version.h)
# Make sure SIGRT{MIN,MAX} work - they will fail to work with unified headers if building for
# API level < 21 *and* android/legacy_signal_inlines.h doesn't declare (and define) the required
@@ -614,7 +617,8 @@ if test x$platform_android = xyes; then
if test x$have_android_signal_inlines = xyes; then
AC_MSG_CHECKING([Whether Android SIGRTMIN/SGRTMAX macros are valid])
AC_COMPILE_IFELSE([
AC_LANG_PROGRAM([#include <android/legacy_signal_inlines.h>],[
AC_LANG_PROGRAM([#include <signal.h>
#include <android/legacy_signal_inlines.h>],[
int i;
for (i = SIGRTMIN + 1; i < SIGRTMAX; ++i) {
}
@@ -1002,6 +1006,7 @@ fi
AC_ARG_WITH(crash-privacy, [ --with-crash_privacy=yes,no If you want your crashes to not include names of symbols present in the binary. ], [], [with_crash_privacy=no])
AC_ARG_WITH(structured-crashes, [ --with-structured_crashes=yes,no If you want your unmanaged crashes to result in a small crash dump file. ], [], [with_structured_crashes=yes])
AC_ARG_ENABLE(crash-reporting, [ --disable-crash-reporting Enable or Disable crash reporting subsystem], [crash_reporting=$enableval], [crash_reporting=yes])
if test "x$with_crash_privacy" = "xno"; then
AC_DEFINE(MONO_PRIVATE_CRASHES,1,[Do not include names of unmanaged functions in the crash dump])
@@ -1011,6 +1016,15 @@ if test "x$with_structured_crashes" = "xno"; then
AC_DEFINE(DISABLE_STRUCTURED_CRASH,1,[Do not create structured crash files during unmanaged crashes])
fi
if test "x$host_win32" = "xyes"; then
crash_reporting=no
fi
if test "x$crash_reporting" != "xyes"; then
CFLAGS="$CFLAGS -DDISABLE_CRASH_REPORTING=1"
CXXFLAGS="$CXXFLAGS -DDISABLE_CRASH_REPORTING=1"
fi
AC_ARG_ENABLE(monodroid, [ --enable-monodroid Enable runtime support for Monodroid (Xamarin.Android)], enable_monodroid=$enableval, enable_monodroid=no)
AM_CONDITIONAL(ENABLE_MONODROID, test x$enable_monodroid = xyes)
@@ -2378,7 +2392,7 @@ if test x$host_win32 = xno; then
AC_CHECK_HEADERS(pthread.h)
AC_CHECK_HEADERS(pthread_np.h)
AC_CHECK_FUNCS(pthread_mutex_timedlock)
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np pthread_setname_np pthread_cond_timedwait_relative_np)
AC_CHECK_FUNCS(pthread_getattr_np pthread_attr_get_np pthread_getname_np pthread_setname_np pthread_cond_timedwait_relative_np)
AC_CHECK_FUNCS(pthread_kill)
AC_MSG_CHECKING(for PTHREAD_MUTEX_RECURSIVE)
AC_TRY_COMPILE([ #include <pthread.h>], [
@@ -2844,6 +2858,7 @@ if test x$host_win32 = xno; then
AC_CHECK_FUNCS(setpgid)
AC_CHECK_FUNCS(system)
AC_CHECK_FUNCS(fork execv execve)
AC_CHECK_FUNCS(waitpid)
AC_CHECK_FUNCS(accept4)
AC_CHECK_FUNCS(localtime_r)
AC_CHECK_FUNCS(mkdtemp)
@@ -3787,41 +3802,42 @@ internal_llvm="no"
if test "x$enable_llvm" = "xyes"; then
if test "x$with_llvm" != "x"; then
EXTERNAL_LLVM_CONFIG=$with_llvm/bin/llvm-config
if test x$host_win32 = xyes; then
EXTERNAL_LLVM_CONFIG=$EXTERNAL_LLVM_CONFIG.exe
fi
if test ! -x $EXTERNAL_LLVM_CONFIG; then
AC_MSG_ERROR([LLVM executable $EXTERNAL_LLVM_CONFIG not found.])
fi
else
AC_PATH_PROG(EXTERNAL_LLVM_CONFIG, llvm-config, no)
if test x$host_win32 = xyes; then
AC_PATH_PROG(EXTERNAL_LLVM_CONFIG, llvm-config.exe, no)
else
AC_PATH_PROG(EXTERNAL_LLVM_CONFIG, llvm-config, no)
fi
if test "x$EXTERNAL_LLVM_CONFIG" = "xno"; then
internal_llvm=yes
else
with_llvm=`$EXTERNAL_LLVM_CONFIG --prefix`
fi
fi
if test "x$host_win32" != "xyes"; then
LLVM_CODEGEN_LIBS="x86codegen"
case "$target" in
arm*)
LLVM_CODEGEN_LIBS="armcodegen"
;;
aarch64*)
LLVM_CODEGEN_LIBS="aarch64codegen"
;;
powerpc*)
LLVM_CODEGEN_LIBS="powerpccodegen"
;;
esac
if test "x$host" != "x$target"; then
# No need for jit libs
LLVM_CODEGEN_LIBS=
fi
AC_SUBST(LLVM_CODEGEN_LIBS)
AC_SUBST(EXTERNAL_LLVM_CONFIG)
else # is win32
AC_MSG_ERROR([LLVM for Windows only supported using Visual Studio build mono runtime, see http://www.mono-project.com/docs/advanced/mono-llvm/ for more details.])
fi # win32
LLVM_CODEGEN_LIBS="x86codegen"
case "$target" in
arm*)
LLVM_CODEGEN_LIBS="armcodegen"
;;
aarch64*)
LLVM_CODEGEN_LIBS="aarch64codegen"
;;
powerpc*)
LLVM_CODEGEN_LIBS="powerpccodegen"
;;
esac
if test "x$host" != "x$target"; then
# No need for jit libs
LLVM_CODEGEN_LIBS=
fi
AC_SUBST(LLVM_CODEGEN_LIBS)
AC_SUBST(EXTERNAL_LLVM_CONFIG)
AC_DEFINE(ENABLE_LLVM, 1, [Enable the LLVM back end])
fi # ENABLE_LLVM
@@ -4539,6 +4555,7 @@ AC_DEFINE(HAVE_UWP_WINAPI_SUPPORT, 0, [Don't use UWP Windows API support])
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
AC_CHECK_FUNCS(getrlimit)
AC_CHECK_FUNCS(fork execv execve)
AC_CHECK_FUNCS(waitpid)
AC_ARG_WITH([overridable-allocators], [ --with-overridable-allocators allow g_*alloc/g_free to call custom allocators set via g_mem_set_vtable])
@@ -4562,8 +4579,6 @@ elif test x$target_ios = xno; then
AC_CHECK_FUNCS(strndup getpwuid_r)
fi
AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
AC_SEARCH_LIBS(sqrtf, m)
# nanosleep may not be part of libc, also search it in other libraries
@@ -5011,11 +5026,12 @@ if test x$enable_cooperative_suspend_default != xyes; then
X86 | AMD64)
dnl Some host/target confusion, there's no host_osx (and
dnl host_darwin would be true on iOS not just macOS).
if test x$target_osx = xyes; then
enable_hybrid_suspend_default=yes
elif test x$host_linux = xyes -o x$host_win32 = xyes; then
enable_hybrid_suspend_default=yes
fi
dnl if test x$target_osx = xyes; then
dnl enable_hybrid_suspend_default=yes
dnl elif test x$host_linux = xyes -o x$host_win32 = xyes; then
dnl enable_hybrid_suspend_default=yes
dnl fi
true
;;
esac
fi
@@ -5061,7 +5077,7 @@ dnl **********************
dnl *** checked builds ***
dnl **********************
AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable checked build (expensive asserts), configure with a comma-separated LIST of checked build modules and then include that same list in the environment variable MONO_CHECK_MODE at runtime. Recognized checked build modules: all, gc, metadata, thread, private_types],[
AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable checked build (expensive asserts), configure with a comma-separated LIST of checked build modules and then include that same list in the environment variable MONO_CHECK_MODE at runtime. Recognized checked build modules: all, gc, metadata, thread, private_types, crash_reporting],[
if test x$enable_checked_build != x ; then
AC_DEFINE(ENABLE_CHECKED_BUILD,1,[Enable checked build])
@@ -5075,6 +5091,7 @@ AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable check
eval "mono_checked_build_test_enable_metadata='yes'"
eval "mono_checked_build_test_enable_thread='yes'"
eval "mono_checked_build_test_enable_private_types='yes'"
eval "mono_checked_build_test_enable_crash_reporting='yes'"
fi
if test "x$mono_checked_build_test_enable_gc" = "xyes"; then
@@ -5092,10 +5109,20 @@ AC_ARG_ENABLE(checked_build, [ --enable-checked-build=LIST To enable check
if test "x$mono_checked_build_test_enable_private_types" = "xyes"; then
AC_DEFINE(ENABLE_CHECKED_BUILD_PRIVATE_TYPES, 1, [Enable private types checked build])
fi
if test "x$mono_checked_build_test_enable_crash_reporting" = "xyes"; then
# Required
with_overridable_allocators=yes
AC_DEFINE(ENABLE_OVERRIDABLE_ALLOCATORS,1,[Overridable allocator support enabled])
AC_DEFINE(ENABLE_CHECKED_BUILD_CRASH_REPORTING, 1, [Enable private types checked build])
fi
], [])
dnl End of checked builds
AM_CONDITIONAL(NEED_VASPRINTF, test x$ac_cv_func_vasprintf = xno || test x$with_overridable_allocators = xyes)
AC_CHECK_HEADER([malloc.h],
[AC_DEFINE([HAVE_USR_INCLUDE_MALLOC_H], [1],
[Define to 1 if you have /usr/include/malloc.h.])],,)
@@ -5128,6 +5155,26 @@ dnl **************
AC_ARG_ENABLE(btls, [ --disable-btls Disable the BoringTls provider], enable_btls=$enableval, enable_btls=$BTLS_SUPPORTED)
AC_ARG_ENABLE(btls-lib, [ --disable-btls-lib Disable building the BTLS native library], enable_btls_lib=$enableval, enable_btls_lib=$BTLS_SUPPORTED)
AC_ARG_WITH(btls_android_ndk, [ --with-btls-android-ndk Android NDK for BoringTls])
AC_ARG_WITH(btls_android_api, [ --with-btls-android-api Android NDK API level for BTLS build])
AC_ARG_WITH(btls_android_cmake_toolchain, [ --with-btls-android-cmake-toolchain Path to the cmake toolchain file for Android])
AC_ARG_WITH(btls_android_ndk_asm_workaround, [ --with-btls-android-ndk-asm-workaround Work around a problem with NDK r18+ clang compiler when compiling some AES assembly for ARM])
if test "x$with_btls_android_api" = "x" ; then
case "$BTLS_PLATFORM" in
android-armv5)
with_btls_android_api=16" ;;
android-armv6)
with_btls_android_api=16" ;;
android-armv7)
with_btls_android_api=16 ;;
android-v8a)
with_btls_android_api=21 ;;
android-x86)
with_btls_android_api=16 ;;
android-x64)
with_btls_android_api=21 ;;
esac
fi
if test "x$enable_btls" = "xno"; then
enable_btls_lib=no
@@ -5185,30 +5232,38 @@ if test "x$enable_btls" = "xyes"; then
esac
;;
android-armv5)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=14"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-armv6)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=14"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-armv7)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi-v7a\" -DANDROID_NATIVE_API_LEVEL=14"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"armeabi-v7a\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-v8a)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=21"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"arm64-v8a\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-x86)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86\" -DANDROID_NATIVE_API_LEVEL=14"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
android-x64)
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=21"
BTLS_CMAKE_ARGS="-DANDROID_ABI=\"x86_64\" -DANDROID_NATIVE_API_LEVEL=$with_btls_android_api"
;;
*)
AC_MSG_ERROR(Invalid BTLS platform)
esac
if test "x$platform_android" = "xyes"; then
if test "x$with_btls_android_cmake_toolchain" = "x"; then
with_btls_android_cmake_toolchain="$BTLS_ROOT/util/android-cmake/android.toolchain.cmake"
fi
if test "x$with_btls_android_ndk_asm_workaround" != "x"; then
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DENABLE_NDK_ARM_WORKAROUND=ON"
fi
btls_android=yes
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=$BTLS_ROOT/util/android-cmake/android.toolchain.cmake"
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=$with_btls_android_cmake_toolchain"
if test "x$with_btls_android_ndk" != "x"; then
BTLS_CMAKE_ARGS="$BTLS_CMAKE_ARGS -DANDROID_NDK=\"$with_btls_android_ndk\""
else
@@ -5525,6 +5580,7 @@ mono/arch/arm64/Makefile
mono/arch/mips/Makefile
mono/sgen/Makefile
mono/tests/Makefile
mono/tests/assembly-load-reference/Makefile
mono/tests/tests-config
mono/tests/gc-descriptors/Makefile
mono/tests/testing_gac/Makefile
@@ -5763,6 +5819,7 @@ echo "
zlib: $zlib_msg
BTLS: $enable_btls$btls_platform_string
jemalloc: $with_jemalloc (always use: $with_jemalloc_always)
crash reporting: $crash_reporting (private crashes: $with_crash_privacy)
$disabled
"
if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then
+1 -1
+1 -1
+1 -1
+15 -2
View File
@@ -2,6 +2,19 @@
EXTRA_DIST=SUBMODULES.json build.mk build_llvm_config.sh
if ENABLE_LLVM
if HOST_WIN32
llvm_config=llvm-config.exe
else
llvm_config=llvm-config
endif
if HAVE_ZLIB
llvm_extra_libs=-lz
else
llvm_extra_libs=
endif
if INTERNAL_LLVM
all-local: configure-llvm build-llvm install-llvm llvm_config.mk
@@ -9,7 +22,7 @@ all-local: configure-llvm build-llvm install-llvm llvm_config.mk
clean-local: clean-llvm clean-llvm-config
$(mono_build_root)/llvm/llvm_config.mk: install-llvm
$(top_srcdir)/llvm/build_llvm_config.sh $(top_srcdir)/llvm/usr/bin/llvm-config $(LLVM_CODEGEN_LIBS) > $@
$(top_srcdir)/llvm/build_llvm_config.sh "$(top_srcdir)/llvm/usr/bin/$(llvm_config)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
else
all-local: llvm_config.mk
@@ -17,7 +30,7 @@ all-local: llvm_config.mk
clean-local: clean-llvm-config
$(mono_build_root)/llvm/llvm_config.mk: $(top_srcdir)/llvm/Makefile.am
$(top_srcdir)/llvm/build_llvm_config.sh $(EXTERNAL_LLVM_CONFIG) $(LLVM_CODEGEN_LIBS) > $@
$(top_srcdir)/llvm/build_llvm_config.sh "$(EXTERNAL_LLVM_CONFIG)" "$(LLVM_CODEGEN_LIBS)" "$(llvm_extra_libs)" > $@
endif
llvm_config.mk: $(mono_build_root)/llvm/llvm_config.mk
+1 -9
View File
@@ -2,17 +2,9 @@
{
"name": "llvm",
"url": "git://github.com/mono/llvm.git",
"rev": "fc854b8ec5873d294b80afa3e6cf6a88c5c48886",
"rev": "c97510286a58f9aaa116fcfdb8b693d5f61910d2",
"remote-branch": "origin/release_60",
"branch": "release_60",
"directory": "llvm"
},
{
"name": "llvm36",
"url": "git://github.com/mono/llvm.git",
"rev": "0b3cb8ac12cd839f8110775d4085e822e8af4d7b",
"remote-branch": "origin/master",
"branch": "master",
"directory": "llvm36"
}
]
+11 -9
View File
@@ -10,7 +10,9 @@ top_srcdir ?= $(abspath $(CURDIR)/..)
LLVM_PATH ?= $(abspath $(top_srcdir)/external/llvm)
LLVM_BUILD ?= $(abspath $(top_srcdir)/llvm/build)
LLVM_PREFIX ?= $(abspath $(top_srcdir)/llvm/usr)
LLVM_VERSION ?= llvm
# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz
LLVM_DOWNLOAD_LOCATION = "http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz"
CMAKE := $(or $(CMAKE),$(shell which cmake))
NINJA := $(shell which ninja)
@@ -19,7 +21,6 @@ SUBMODULES_CONFIG_FILE = $(top_srcdir)/llvm/SUBMODULES.json
include $(top_srcdir)/scripts/submodules/versions.mk
$(eval $(call ValidateVersionTemplate,llvm,LLVM))
$(eval $(call ValidateVersionTemplate,llvm36,LLVM36))
# Bump the given submodule to the revision given by the REV make variable
# If COMMIT is 1, commit the change
@@ -36,8 +37,12 @@ bump-current-llvm: __bump-current-version-llvm
$(LLVM_BUILD) $(LLVM_PREFIX):
mkdir -p $@
$(LLVM_PATH)/CMakeLists.txt: | reset-$(LLVM_VERSION)
$(LLVM_PATH):
$(MAKE) -f build.mk reset-llvm
$(LLVM_PATH)/CMakeLists.txt: | $(LLVM_PATH)
# -DLLVM_ENABLE_LIBXML2=Off is needed because xml2 is not used and it breaks 32-bit builds on 64-bit Linux hosts
$(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt | $(LLVM_BUILD)
cd $(LLVM_BUILD) && $(CMAKE) \
$(if $(NINJA),-G Ninja) \
@@ -50,6 +55,8 @@ $(LLVM_BUILD)/$(if $(NINJA),build.ninja,Makefile): $(LLVM_PATH)/CMakeLists.txt |
-DLLVM_TOOLS_TO_BUILD="opt;llc;llvm-config;llvm-dis" \
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
-DLLVM_ENABLE_ASSERTIONS=$(if $(INTERNAL_LLVM_ASSERTS),On,Off) \
-DLLVM_ENABLE_LIBXML2=Off \
-DHAVE_FUTIMENS=0 \
$(LLVM_CMAKE_ARGS) \
$(dir $<)
@@ -67,14 +74,9 @@ build-llvm: configure-llvm
install-llvm: build-llvm | $(LLVM_PREFIX)
DESTDIR="" $(if $(NINJA),$(NINJA),$(MAKE)) -C $(LLVM_BUILD) install
# FIXME: URL should be http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-$(NEEDED_LLVM_BRANCH)/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz
.PHONY: download-llvm
download-llvm:
wget --no-verbose -O - http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm-release60/llvm-osx64-$(NEEDED_LLVM_VERSION).tar.gz | tar xzf -
.PHONY: download-llvm36
download-llvm36:
wget --no-verbose -O - http://xamjenkinsartifact.blob.core.windows.net/build-package-osx-llvm/llvm-osx64-$(NEEDED_LLVM36_VERSION).tar.gz | tar xzf -
(wget --no-verbose -O - $(LLVM_DOWNLOAD_LOCATION) || curl -L $(LLVM_DOWNLOAD_LOCATION)) | tar -xzf - -C $(dir $(LLVM_PREFIX))
.PHONY: clean-llvm
clean-llvm:
+155 -30
View File
@@ -1,47 +1,172 @@
#!/bin/bash
llvm_config=$1
extra_libs="${@:2}"
llvm_codegen_libs="$2"
llvm_extra_libs="${@:3}"
llvm_api_version=`$llvm_config --mono-api-version` || "0"
with_llvm=`$llvm_config --prefix`
use_llvm_config=1
llvm_host_win32=0
llvm_host_win32_wsl=0
llvm_host_win32_cygwin=0
llvm_config_cflags=`$llvm_config --cflags`
function win32_format_path {
local formatted_path=$1
if [[ $llvm_host_win32_wsl = 1 ]] && [[ $1 != "/mnt/"* ]]; then
# if path is not starting with /mnt under WSL it could be a windows path, convert using wslpath.
formatted_path="$(wslpath -a "$1")"
elif [[ $llvm_host_win32_cygwin = 1 ]] && [[ $1 != "/cygdrive/"* ]]; then
# if path is not starting with /cygdrive under CygWin it could be a windows path, convert using cygpath.
formatted_path="$(cygpath -a "$1")"
fi
echo "$formatted_path"
}
if [[ $llvm_config = *".exe" ]]; then
llvm_host_win32=1
# llvm-config is a windows binary. Check if we are running CygWin or WSL since then we might still be able to run llvm-config.exe
host_uname="$(uname -a)"
case "$host_uname" in
*Microsoft*)
use_llvm_config=1
llvm_host_win32_wsl=1
;;
CYGWIN*)
use_llvm_config=1
llvm_host_win32_cygwin=1
;;
*)
use_llvm_config=0
esac
fi
if [[ $llvm_host_win32 = 1 ]]; then
llvm_config=$(win32_format_path "$llvm_config")
fi
if [[ $use_llvm_config = 1 ]]; then
llvm_api_version=`$llvm_config --mono-api-version` || "0"
with_llvm=`$llvm_config --prefix`
llvm_config_cflags=`$llvm_config --cflags`
llvm_system=`$llvm_config --system-libs`
llvm_core_components=`$llvm_config --libs analysis core bitwriter`
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null`
else
llvm_old_jit=`$llvm_config --libs mcjit 2>>/dev/null`
fi
llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null`
if [[ ! -z $llvm_codegen_libs ]]; then
llvm_extra=`$llvm_config --libs $llvm_codegen_libs`
fi
# When building for Windows subsystem using WSL or CygWin the path returned from llvm-config.exe
# could be a Windows style path, make sure to format it into a path usable for WSL/CygWin.
if [[ $llvm_host_win32 = 1 ]]; then
with_llvm=$(win32_format_path "$with_llvm")
fi
fi
# When cross compiling for Windows on system not capable of running Windows binaries, llvm-config.exe can't be used to query for
# LLVM parameters. In that scenario we will need to fallback to default values.
if [[ $llvm_host_win32 = 1 ]] && [[ $use_llvm_config = 0 ]]; then
# Assume we have llvm-config sitting in llvm-install-root/bin directory, get llvm-install-root directory.
with_llvm="$(dirname $llvm_config)"
with_llvm="$(dirname $with_llvm)"
llvm_config_path=$with_llvm/include/llvm/Config/llvm-config.h
# llvm-config.exe --mono-api-version
llvm_api_version=`awk '/MONO_API_VERSION/ { print $3 }' $llvm_config_path`
# llvm-config.exe --cflags, returned information currently not used.
llvm_config_cflags=
# llvm-config.exe --system-libs
if [[ $llvm_api_version -lt 600 ]]; then
llvm_system="-limagehlp -lpsapi -lshell32"
else
llvm_system="-lpsapi -lshell32 -lole32 -luuid -ladvapi32"
fi
# llvm-config.exe --libs analysis core bitwriter
if [[ $llvm_api_version -lt 600 ]]; then
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_core_components="-lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
# llvm-config.exe --libs mcjit jit
if [[ $llvm_api_version -lt 600 ]]; then
llvm_old_jit="-lLLVMJIT -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMMCJIT -lLLVMTarget -lLLVMRuntimeDyld -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMExecutionEngine -lLLVMMC -lLLVMCore -lLLVMSupport"
else
# Current build of LLVM 60 for cross Windows builds doesn't support LLVM JIT.
llvm_old_jit=
fi
# LLVM 36 doesn't support new JIT and LLVM 60 is build without LLVM JIT support for cross Windows builds.
llvm_new_jit=
# Check codegen libs and add needed libraries.
case "$llvm_codegen_libs" in
*x86codegen*)
# llvm-config.exe --libs x86codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMX86CodeGen -lLLVMX86Desc -lLLVMX86Info -lLLVMObject -lLLVMBitReader -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport"
else
llvm_extra="-lLLVMX86CodeGen -lLLVMGlobalISel -lLLVMX86Desc -lLLVMX86Info -lLLVMMCDisassembler -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMMC -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMSupport -lLLVMDemangle"
fi
;;
*armcodegen*)
# llvm-config.exe --libs armcodegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMARMCodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMMC -lLLVMSupport"
else
llvm_extra="-lLLVMARMCodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMARMDesc -lLLVMMCDisassembler -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMARMUtils -lLLVMMC -lLLVMSupport -lLLVMDemangle"
fi
;;
*aarch64codegen*)
# llvm-config.exe --libs aarch64codegen
if [[ $llvm_api_version -lt 600 ]]; then
llvm_extra="-lLLVMAArch64CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMMCParser -lLLVMCodeGen -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMCore -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport"
else
llvm_extra="-lLLVMAArch64CodeGen -lLLVMGlobalISel -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMDebugInfoCodeView -lLLVMDebugInfoMSF -lLLVMCodeGen -lLLVMTarget -lLLVMScalarOpts -lLLVMInstCombine -lLLVMTransformUtils -lLLVMBitWriter -lLLVMAnalysis -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMCore -lLLVMBinaryFormat -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMMC -lLLVMAArch64Utils -lLLVMSupport -lLLVMDemangle"
fi
;;
*)
llvm_extra=$llvm_codegen_libs
esac
fi
if [[ $llvm_config_cflags = *"stdlib=libc++"* ]]; then
llvm_libc_c="-stdlib=libc++"
llvm_libc_link="-lc++"
llvm_libc_c="-stdlib=libc++"
llvm_libc_link="-lc++"
else
llvm_libc_c=""
llvm_libc_link="-lstdc++"
llvm_libc_c=""
llvm_libc_link="-lstdc++"
fi
if [[ $llvm_host_win32 = 1 ]]; then
host_cxxflag_additions="-std=gnu++11"
host_cflag_additions="-DNDEBUG"
else
host_cxxflag_additions="-std=c++11"
host_cflag_additions=""
fi
if [[ ! -z $llvm_extra_libs ]]; then
llvm_extra="$llvm_extra $llvm_extra_libs"
fi
# llvm-config --clfags adds warning and optimization flags we don't want
shared_llvm_cflags="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c"
cxxflag_additions="-std=c++11 -fno-rtti -fexceptions"
cflags_additions="-I$with_llvm/include -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -DLLVM_API_VERSION=$llvm_api_version $llvm_libc_c $host_cflag_additions"
cxxflag_additions="-fno-rtti -fexceptions $host_cxxflag_additions"
ldflags="-L$with_llvm/lib"
llvm_system=`$llvm_config --system-libs`
llvm_core_components=`$llvm_config --libs analysis core bitwriter`
llvm_old_jit=`$llvm_config --libs mcjit jit 2>>/dev/null`
llvm_new_jit=`$llvm_config --libs orcjit 2>>/dev/null`
llvm_extra=`$llvm_config --libs $extra_libs`
llvm_lib_components="$llvm_core_components $llvm_old_jit $llvm_new_jit $llvm_extra"
echo "LLVM_CFLAGS_INTERNAL=$shared_llvm_cflags"
echo "LLVM_CXXFLAGS_INTERNAL=$shared_llvm_cflags $cxxflag_additions"
echo "LLVM_CFLAGS_INTERNAL=$cflags_additions"
echo "LLVM_CXXFLAGS_INTERNAL=$cflags_additions $cxxflag_additions"
echo "LLVM_LDFLAGS_INTERNAL=$ldflags"
echo "LLVM_LIBS_INTERNAL=$llvm_lib_components $ldflags $llvm_system $llvm_libc_link"
+5 -2
View File
@@ -2,7 +2,7 @@ thisdir = build
SUBDIRS =
include ../build/rules.make
BUILT_FILES = common/Consts.cs
BUILT_FILES = common/Consts.cs $(topdir)/class/lib/$(PROFILE_DIRECTORY)/Consts.cs
all-local install-local test-local run-test-local csproj-local run-test-ondotnet-local uninstall-local doc-update-local: $(BUILT_FILES)
@:
@@ -10,7 +10,10 @@ all-local install-local test-local run-test-local csproj-local run-test-ondotnet
clean-local:
-rm -f $(BUILT_FILES) deps/*
common/Consts.cs: common/Consts.cs.in $(wildcard config.make)
$(topdir)/class/lib/$(PROFILE_DIRECTORY):
mkdir -p $@
common/Consts.cs $(topdir)/class/lib/$(PROFILE_DIRECTORY)/Consts.cs: common/Consts.cs.in $(wildcard config.make) | $(topdir)/class/lib/$(PROFILE_DIRECTORY)
test -n '$(MONO_VERSION)'
test -n '$(MONO_CORLIB_VERSION)'
sed -e 's,@''MONO_VERSION@,$(MONO_VERSION),' -e 's,@''MONO_CORLIB_VERSION@,$(MONO_CORLIB_VERSION),' $< > $@
+1 -1
View File
@@ -41,7 +41,7 @@ class X
Version min_mono_version;
#if __MonoCS__
min_mono_version = new Version (5, 16);
min_mono_version = new Version (5, 18);
#else
min_mono_version = new Version (5, 10);
#endif
+3 -3
View File
@@ -32,10 +32,10 @@ mono_libdir = $(exec_prefix)/lib
sysconfdir = $(prefix)/etc
#RUNTIME = mono
RUNTIME = false
MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)/
MONO_PATH_TOP = $(topdir)/class/lib/$(PROFILE_DIRECTORY)
MONO_PATH_TESTS = $(MONO_PATH_TOP)/tests
TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)
TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR).$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
TEST_MONO_PATH = $(MONO_PATH_TOP)$(PLATFORM_PATH_SEPARATOR)$(MONO_PATH_TESTS)$(PLATFORM_PATH_SEPARATOR).
TEST_RUNTIME = MONO_PATH="$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
# In case you want to add MCS_FLAGS, this lets you not have to
# keep track of the default value
+24 -17
View File
@@ -19,13 +19,22 @@ TEST_RUNTIME_WRAPPERS_PATH = $(shell dirname $(RUNTIME))/_tmpinst/bin
## Unit test support
ifndef NO_TEST
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
test_nunit_lib = nunitlite.dll
xunit_core := xunit.core xunit.execution.dotnet xunit.abstractions xunit.assert Xunit.NetCore.Extensions
xunit_deps := netstandard System.Runtime
xunit_deps := System.Runtime
xunit_src := $(patsubst %,$(topdir)/../external/xunit-binaries/%,BenchmarkAttribute.cs BenchmarkDiscover.cs) $(topdir)/../mcs/class/test-helpers/PlatformDetection.cs
ifeq ($(USE_XTEST_REMOTE_EXECUTOR), YES)
XTEST_REMOTE_EXECUTOR = $(topdir)/class/lib/$(PROFILE)/RemoteExecutorConsoleApp.exe
XTEST_REMOTE_EXECUTOR = $(test_lib_dir)/RemoteExecutorConsoleApp.exe
ifeq ($(BUILD_PLATFORM), win32)
XTEST_REMOTE_EXECUTOR_ABSPATH = $(shell cygpath -w $(abspath $(XTEST_REMOTE_EXECUTOR)))
else
XTEST_REMOTE_EXECUTOR_ABSPATH = $(abspath $(XTEST_REMOTE_EXECUTOR))
endif
xunit_src += $(topdir)/../mcs/class/test-helpers/AdminHelper.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/IO/FileCleanupTestBase.cs \
$(topdir)/../external/corefx/src/CoreFx.Private.TestUtilities/src/System/Diagnostics/RemoteExecutorTestBase.cs \
@@ -62,6 +71,7 @@ test_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
endif
test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
test_lib_output = $(test_lib_dir)/$(test_lib)
test_sourcefile_excludes = $(test_lib).exclude.sources
@@ -73,12 +83,13 @@ ifndef NO_BUILD
test_flags += -r:$(the_assembly)
test_assembly_dep = $(the_assembly)
endif
tests_CLEAN_FILES += $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.dll) $(ASSEMBLY:$(ASSEMBLY_EXT)=_test*.pdb) $(test_response) $(test_makefrag)
tests_CLEAN_FILES += $(test_lib_output) $(test_lib_output:$(ASSEMBLY_EXT)=.pdb) $(test_response) $(test_makefrag)
xtest_sourcefile = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
xtest_sourcefile_excludes = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.exclude.sources)
xunit_test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_xunit-test.dll)
xtest_lib_output = $(test_lib_dir)/$(xunit_test_lib)
xtest_response = $(depsdir)/$(xunit_test_lib).response
xtest_makefrag = $(depsdir)/$(xunit_test_lib).makefrag
@@ -86,7 +97,7 @@ xtest_flags = -r:$(the_assembly) $(xunit_libs_ref) $(XTEST_MCS_FLAGS) $(XTEST_LI
ifeq ($(wildcard $(xtest_sourcefile)),)
xtest_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_xtest.dll.sources)
tests_CLEAN_FILES += $(xunit_test_lib) $(xtest_response) $(xtest_makefrag)
tests_CLEAN_FILES += $(xtest_lib_output) $(xtest_response) $(xtest_makefrag)
endif
ifndef HAVE_CS_TESTS
@@ -113,10 +124,6 @@ endif
test_assemblies :=
test_lib_dir = $(topdir)/class/lib/$(PROFILE)/tests
test_lib_output = $(topdir)/class/lib/$(PROFILE)/tests/$(test_lib)
ifdef HAVE_CS_TESTS
test_assemblies += $(test_lib_output)
@@ -242,7 +249,7 @@ ifdef HAVE_CS_TESTS
$(test_lib_dir):
mkdir -p $@
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) $(test_lib_dir)
$(test_lib_output): $(test_assembly_dep) $(test_response) $(test_nunit_dep) | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
test_response_preprocessed = $(test_response)_preprocessed
@@ -305,23 +312,23 @@ XTEST_COVERAGE_FLAGS = -O=-aot --profile=coverage:output=$(topdir)/class/lib/$(P
endif
check: run-xunit-test-local
xunit-test-local: $(xunit_test_lib)
xunit-test-local: $(xtest_lib_output)
run-xunit-test-local: run-xunit-test-lib
# cp -rf is a HACK for xunit runner to require xunit.execution.dOTNET.dll file in local folder on .net only
run-xunit-test-lib: xunit-test-local $(XTEST_REMOTE_EXECUTOR)
@cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.dotnet.dll xunit.execution.dotnet.dll
run-xunit-test-lib: xunit-test-local
@cp -rf $(XTEST_HARNESS_PATH)/xunit.execution.dotnet.dll $(test_lib_dir)/xunit.execution.dotnet.dll
ok=:; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR=$(XTEST_REMOTE_EXECUTOR) $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xunit_test_lib) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" REMOTE_EXECUTOR="$(XTEST_REMOTE_EXECUTOR_ABSPATH)" $(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) $(XTEST_COVERAGE_FLAGS) $(AOT_RUN_FLAGS) $(XTEST_HARNESS) $(xtest_lib_output) $(XTEST_HARNESS_FLAGS) $(XTEST_TRAIT) $(XTEST_TRAIT_PLATFORM) || ok=false; \
if [ -n "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE" ]; then echo "$(abspath $(XTEST_RESULT_FILE))" >> "$$MONO_BABYSITTER_NUNIT_XML_LIST_FILE"; fi; \
$$ok
@rm -f xunit.execution.dotnet.dll
@rm -f $(test_lib_dir)/xunit.execution.dotnet.dll
# Some xunit tests want to be executed in a separate process (see RemoteExecutorTestBase)
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs
$(XTEST_REMOTE_EXECUTOR): $(topdir)/../external/corefx/src/Common/tests/System/Diagnostics/RemoteExecutorConsoleApp/RemoteExecutorConsoleApp.cs | $(test_lib_dir)
$(TEST_COMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll $< -out:$@
$(xunit_test_lib): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src)
$(xtest_lib_output): $(the_assembly) $(xtest_response) $(xunit_libs_dep) $(xunit_src) $(XTEST_REMOTE_EXECUTOR) | $(test_lib_dir)
$(TEST_COMPILE) $(LIBRARY_FLAGS) $(XTEST_LIB_FLAGS) -target:library -out:$@ $(xtest_flags) @$(xtest_response) $(xunit_src)
xtest_response_preprocessed = $(xtest_response)_preprocessed
@@ -333,7 +340,7 @@ $(xtest_response): $(xtest_sourcefile) $(wildcard $(xtest_sourcefile_excludes))
$(xtest_makefrag): $(xtest_response)
@echo Creating $@ ...
@sed 's,^,$(xunit_test_lib): ,' $< >$@
@sed 's,^,$(xtest_lib_output): ,' $< >$@
-include $(xtest_makefrag)
@@ -0,0 +1,35 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Buffers")]
[assembly: AssemblyDescription ("System.Buffers")]
[assembly: AssemblyDefaultAlias ("System.Buffers")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.99.0")]
[assembly: AssemblyInformationalVersion ("4.0.99.0")]
[assembly: AssemblyFileVersion ("4.0.99.0")]
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
<ProjectGuid>{6C744E56-CCB3-4F4F-BAA8-5993D42DFF48}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1616,1699</NoWarn>
<LangVersion>latest</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AssemblyName>System.Buffers</AssemblyName>
<TargetFrameworkVersion>v2.1</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>../../Open.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
<OutputPath>./../../../class/lib/monodroid/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
<OutputPath>./../../../class/lib/monotouch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch' ">
<OutputPath>./../../../class/lib/monotouch_watch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_tv' ">
<OutputPath>./../../../class/lib/monotouch_tv/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;MONOTOUCH_TV</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
<OutputPath>./../../../class/lib/testing_aot_full/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_REMOTING;DISABLE_COM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'winaot' ">
<OutputPath>./../../../class/lib/winaot/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_REMOTING;DISABLE_COM;WIN_PLATFORM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'xammac' ">
<OutputPath>./../../../class/lib/xammac/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_DYNAMIC;XAMMAC;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;XAMARIN_MODERN</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'orbis' ">
<OutputPath>./../../../class/lib/orbis/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;ORBIS;DISABLE_REMOTING;DISABLE_COM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'unreal' ">
<OutputPath>./../../../class/lib/unreal/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;MOBILE;MOBILE_DYNAMIC;NET_3_5;NET_4_0;NET_4_5;MONO</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'wasm' ">
<OutputPath>./../../../class/lib/wasm/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_REMOTING;DISABLE_COM;FEATURE_NO_BSD_SOCKETS</DefineConstants>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- @BUILT_SOURCES@ -->
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="TypeForwarders.cs" />
</ItemGroup>
<ItemGroup></ItemGroup>
<!-- @ALL_SOURCES@ -->
<ItemGroup>
<ProjectReference Include="../../corlib/corlib.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
<Reference Include="nunitlite">
<HintPath>..\lib\testing_aot_full\nunitlite.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
</Project>
+24
View File
@@ -0,0 +1,24 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Buffers
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Buffers.dll
KEYFILE = ../../Open.snk
LIBRARY_SNK = $(KEYFILE)
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS =
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,3 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,23 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ArrayPool<>))]
@@ -36,6 +36,11 @@
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
<OutputPath>./../../../class/lib/monodroid/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
<OutputPath>./../../../class/lib/monotouch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
@@ -123,9 +128,16 @@
<ProjectReference Include="../../System.Drawing/System.Drawing.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'monodroid' ">
<Reference Include="$(EXTERNAL_FACADE_DRAWING_REFERENCE)">
<Reference Include="./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(EXTERNAL_FACADE_DRAWING_REFERENCE)</HintPath>
<HintPath>./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'monodroid' ">
<Reference Include="./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
@@ -20,6 +20,11 @@ LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
# TODO: find a better solution.
EMBEDDED_DRAWING_DEP := $(filter xammac_net_4_5 testing_aot_full testing_aot_hybrid, $(PROFILE))
ifeq ($(PROFILE),monodroid)
# XA implements System.Drawing API inside Mono.Android
API_BIN_REFS := Mono.Android
else
ifndef EMBEDDED_DRAWING_DEP
# profiles which build a System.Drawing.dll in the repo
@@ -29,12 +34,12 @@ ifdef REPO_DRAWING_DEP
LIB_REFS += System.Drawing
else
# When System.Drawing.dll is not built in the Mono repo but in
# the product repo like in the XI/XA case we need to pass in a reference
# the product repo like in the XI case we need to pass in a reference
# to the assembly containing drawing types like Rectangle etc. from there.
# This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE.
LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE)
endif
endif
endif
PLATFORM_DEBUG_FLAGS =
@@ -30,6 +30,6 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyVersion ("4.0.99.0")]
[assembly: AssemblyInformationalVersion ("4.0.99.0")]
[assembly: AssemblyFileVersion ("4.0.99.0")]
@@ -33,8 +33,10 @@
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryManager<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryHandle))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryPool<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.OperationStatus))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequenceSegment<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequence<>))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Base64))]
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Formatter))]
@@ -0,0 +1,36 @@
//
// Copyright (C) 2018 Microsoft Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDescription ("System.Threading.Tasks.Extensions")]
[assembly: AssemblyDefaultAlias ("System.Threading.Tasks.Extensions")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.2.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
<ProjectGuid>{9586C064-AF1F-4F6D-BD4F-6BE7C8AEAF44}</ProjectGuid>
<OutputType>Library</OutputType>
<NoWarn>1699,1616,1699</NoWarn>
<LangVersion>latest</LangVersion>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">darwin</HostPlatform>
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
<NoStdLib>True</NoStdLib>
<NoConfig>True</NoConfig>
<AssemblyName>System.Threading.Tasks.Extensions</AssemblyName>
<TargetFrameworkVersion>v2.1</TargetFrameworkVersion>
<SignAssembly>true</SignAssembly>
<DelaySign>true</DelaySign>
<AssemblyOriginatorKeyFile>../../Open.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
is a problem to compile the Mono mscorlib.dll -->
<PropertyGroup>
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
<OutputPath>./../../../class/lib/monodroid/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
<OutputPath>./../../../class/lib/monotouch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch' ">
<OutputPath>./../../../class/lib/monotouch_watch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_tv' ">
<OutputPath>./../../../class/lib/monotouch_tv/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;MONOTOUCH_TV</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
<OutputPath>./../../../class/lib/testing_aot_full/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_REMOTING;DISABLE_COM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'winaot' ">
<OutputPath>./../../../class/lib/winaot/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_REMOTING;DISABLE_COM;WIN_PLATFORM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'xammac' ">
<OutputPath>./../../../class/lib/xammac/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_DYNAMIC;XAMMAC;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;XAMARIN_MODERN</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'orbis' ">
<OutputPath>./../../../class/lib/orbis/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;ORBIS;DISABLE_REMOTING;DISABLE_COM</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'unreal' ">
<OutputPath>./../../../class/lib/unreal/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;MOBILE;MOBILE_DYNAMIC;NET_3_5;NET_4_0;NET_4_5;MONO</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'wasm' ">
<OutputPath>./../../../class/lib/wasm/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_REMOTING;DISABLE_COM;FEATURE_NO_BSD_SOCKETS</DefineConstants>
</PropertyGroup>
<!-- @ALL_PROFILE_PROPERTIES@ -->
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
</PropertyGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- @BUILT_SOURCES@ -->
<ItemGroup>
<Compile Include="AssemblyInfo.cs" />
<Compile Include="TypeForwarders.cs" />
</ItemGroup>
<ItemGroup></ItemGroup>
<!-- @ALL_SOURCES@ -->
<ItemGroup>
<ProjectReference Include="../../corlib/corlib.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
<Reference Include="nunitlite">
<HintPath>..\lib\testing_aot_full\nunitlite.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
</Project>
@@ -0,0 +1,24 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Threading.Tasks.Extensions
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Threading.Tasks.Extensions.dll
KEYFILE = ../../Open.snk
LIBRARY_SNK = $(KEYFILE)
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS =
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,2 @@
AssemblyInfo.cs
TypeForwarders.cs
@@ -0,0 +1,39 @@
//
// Copyright (C) 2018 Microsoft Corporation
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncMethodBuilderAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.AsyncValueTaskMethodBuilder<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ConfiguredValueTaskAwaitable<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ValueTaskAwaiter))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ValueTaskAwaiter<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ValueTask))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.ValueTask<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Sources.IValueTaskSource))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Sources.IValueTaskSource<>))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Sources.ValueTaskSourceOnCompletedFlags))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Threading.Tasks.Sources.ValueTaskSourceStatus))]
@@ -36,6 +36,11 @@
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
<OutputPath>./../../../class/lib/monodroid/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
<OutputPath>./../../../class/lib/monotouch/Facades</OutputPath>
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
@@ -137,9 +142,17 @@
<ProjectReference Include="../../System.Drawing/System.Drawing.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'monodroid' ">
<Reference Include="$(EXTERNAL_FACADE_DRAWING_REFERENCE)">
<Reference Include="./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>$(EXTERNAL_FACADE_DRAWING_REFERENCE)</HintPath>
<HintPath>./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="../../System.Web.Services/System.Web.Services.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'monodroid' ">
<Reference Include="./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll">
<SpecificVersion>False</SpecificVersion>
<HintPath>./../../../../external/binary-reference-assemblies/build/monodroid/Mono.Android.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="../../System.Web.Services/System.Web.Services.csproj" />
+6 -1
View File
@@ -28,6 +28,11 @@ else
LIB_REFS += System.Web
endif
ifeq ($(PROFILE),monodroid)
# XA implements System.Drawing API inside Mono.Android
API_BIN_REFS := Mono.Android
else
# profiles which build a System.Drawing.dll in the repo
REPO_DRAWING_DEP := $(filter net_4_x orbis winaot unreal wasm, $(PROFILE))
@@ -51,7 +56,7 @@ else
# This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE.
LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE)
endif
endif
endif
PLATFORM_DEBUG_FLAGS =
+5 -5
View File
@@ -40,6 +40,9 @@ netstandard_drawing_SUBDIRS = System.Drawing.Primitives netstandard
monotouch_SUBDIRS = $(common_DEPS_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
monotouch_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
monodroid_SUBDIRS = $(monotouch_SUBDIRS) $(netstandard_drawing_SUBDIRS)
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
# We don't build netstandard/System.Drawing.Primitives on monotouch etc. profiles by default,
# except when EXTERNAL_FACADE_DRAWING_REFERENCE is defined which allows us to build it in Mono CI
# (since the dependent drawing types are normally built in the product repos).
@@ -63,9 +66,6 @@ System.Text.Encoding.CodePages
build_PARALLEL_SUBDIRS = $(basic_PARALLEL_SUBDIRS) System.Text.RegularExpressions System.Diagnostics.Contracts
monodroid_SUBDIRS = $(monotouch_SUBDIRS)
monodroid_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
xammac_SUBDIRS = $(monotouch_SUBDIRS)
xammac_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
@@ -90,8 +90,8 @@ unreal_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
wasm_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
wasm_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
mobile_only_SUBDIRS = System.Security.Cryptography.Pkcs \
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy System.Memory System.Drawing.Common
mobile_only_SUBDIRS = System.Security.Cryptography.Pkcs System.Threading.Tasks.Extensions System.Memory System.Buffers \
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy System.Drawing.Common
mobile_only_DEPS_SUBDIRS = System.Security.Cryptography.OpenSsl
+1 -1
View File
@@ -30,4 +30,4 @@ CLEAN_FILES += $(TEST_RESX_RESOURCES)
$(TEST_RESX_RESOURCES): %.resources: %.resx
$(RESGEN) $< || cp $@.prebuilt $@
$(test_lib_output): $(TEST_RESX_RESOURCES) $(test_lib_dir)
$(test_lib_output): $(TEST_RESX_RESOURCES) | $(test_lib_dir)
@@ -0,0 +1 @@
../../../external/corefx/src/Microsoft.CSharp/tests/AccessTests.netcoreapp.cs
@@ -0,0 +1 @@
../../../external/corefx/src/Microsoft.CSharp/tests/AccessTests.netcoreapp.cs
@@ -0,0 +1 @@
Bug27864.cs
@@ -535,42 +535,52 @@ namespace Mono.Debugger.Soft
}
internal T GetObject<T> (long id, long domain_id, long type_id) where T : ObjectMirror {
ObjectMirror obj = null;
lock (objects_lock) {
if (objects == null)
objects = new Dictionary <long, ObjectMirror> ();
ObjectMirror obj;
if (!objects.TryGetValue (id, out obj)) {
/*
* Obtain the domain/type of the object to determine the type of
* object we need to create.
*/
if (domain_id == 0 || type_id == 0) {
if (conn.Version.AtLeast (2, 5)) {
var info = conn.Object_GetInfo (id);
domain_id = info.domain_id;
type_id = info.type_id;
} else {
if (domain_id == 0)
domain_id = conn.Object_GetDomain (id);
if (type_id == 0)
type_id = conn.Object_GetType (id);
}
}
AppDomainMirror d = GetDomain (domain_id);
TypeMirror t = GetType (type_id);
if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread")
obj = new ThreadMirror (this, id, t, d);
else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String")
obj = new StringMirror (this, id, t, d);
else if (typeof (T) == typeof (ArrayMirror))
obj = new ArrayMirror (this, id, t, d);
else
obj = new ObjectMirror (this, id, t, d);
objects [id] = obj;
}
return (T)obj;
objects.TryGetValue (id, out obj);
}
if (obj == null) {
/*
* Obtain the domain/type of the object to determine the type of
* object we need to create. Do this outside the lock.
*/
if (domain_id == 0 || type_id == 0) {
if (conn.Version.AtLeast (2, 5)) {
var info = conn.Object_GetInfo (id);
domain_id = info.domain_id;
type_id = info.type_id;
} else {
if (domain_id == 0)
domain_id = conn.Object_GetDomain (id);
if (type_id == 0)
type_id = conn.Object_GetType (id);
}
}
AppDomainMirror d = GetDomain (domain_id);
TypeMirror t = GetType (type_id);
if (t.Assembly == d.Corlib && t.Namespace == "System.Threading" && t.Name == "Thread")
obj = new ThreadMirror (this, id, t, d);
else if (t.Assembly == d.Corlib && t.Namespace == "System" && t.Name == "String")
obj = new StringMirror (this, id, t, d);
else if (typeof (T) == typeof (ArrayMirror))
obj = new ArrayMirror (this, id, t, d);
else
obj = new ObjectMirror (this, id, t, d);
// Publish
lock (objects_lock) {
ObjectMirror prev_obj;
if (objects.TryGetValue (id, out prev_obj))
obj = prev_obj;
else
objects [id] = obj;
}
}
return (T)obj;
}
internal T GetObject<T> (long id) where T : ObjectMirror {
@@ -85,6 +85,31 @@ public class Tests2 {
}
}
public struct TestEnumeratorInsideGenericStruct<TKey, TValue>
{
private KeyValuePair<TKey, TValue> _bucket;
private Position _currentPosition;
internal TestEnumeratorInsideGenericStruct(KeyValuePair<TKey, TValue> bucket)
{
_bucket = bucket;
_currentPosition = Position.BeforeFirst;
}
public KeyValuePair<TKey, TValue> Current
{
get
{
if (_currentPosition == Position.BeforeFirst)
return _bucket;
return _bucket;
}
}
private enum Position
{
BeforeFirst
}
}
public struct AStruct : ITest2 {
public int i;
public string s;
@@ -384,6 +409,7 @@ public class Tests : TestsBase, ITest2
new Tests ().invoke_abort ();
new Tests ().evaluate_method ();
Bug59649 ();
inspect_enumerator_in_generic_struct();
return 3;
}
@@ -576,6 +602,11 @@ public class Tests : TestsBase, ITest2
ss_nested_with_two_args(ss_nested_arg (), ss_nested_arg ());
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void inspect_enumerator_in_generic_struct() {
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static int ss_nested_with_two_args (int a1, int a2) {
return a1 + a2;
@@ -4461,6 +4461,25 @@ public class DebuggerTests
assert_location(e, "ss_nested_arg");
}
[Test]
public void InspectEnumeratorInGenericStruct() {
//files.myBucket.GetEnumerator().get_Current().Key watching this generates an exception in Debugger
Event e = run_until("inspect_enumerator_in_generic_struct");
var req = create_step(e);
req.Enable();
e = step_once();
e = step_over();
StackFrame frame = e.Thread.GetFrames () [0];
var ginst = frame.Method.GetLocal ("generic_struct");
Value variable = frame.GetValue (ginst);
StructMirror thisObj = (StructMirror)variable;
TypeMirror thisType = thisObj.Type;
variable = thisObj.InvokeMethod(e.Thread, thisType.GetMethod("get_Current"), null);
thisObj = (StructMirror)variable;
thisType = thisObj.Type;
AssertValue ("f1", thisObj["value"]);
}
[Test]
// Uses a fixed port
[Category("NotWorking")]
+6 -5
View File
@@ -11,17 +11,18 @@ LIB_MCS_FLAGS = /unsafe /publicsign /nowarn:0618
XTEST_LIB_REFS = System System.Core Facades/System.Threading.Tasks
xunit-test-local: log-profiler-test.exe
xunit-test-local: $(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe
log-profiler-test.exe: Test/log-profiler-test.cs
$(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe: Test/log-profiler-test.cs
mkdir -p $(dir $@)
$(CSCOMPILE) $(PLATFORM_DEBUG_FLAGS) /unsafe $(if $(MCS_MODE),,/warnaserror) /r:$(build_libdir)/mscorlib.dll /r:$(build_lib) /out:$@ $<
EXTRA_DISTFILES = \
Test/log-profiler-test.cs
CLEAN_FILES = \
log-profiler-test.exe \
log-profiler-test.exe.mdb \
log-profiler-test.pdb
$(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe \
$(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.exe.mdb \
$(topdir)/class/lib/$(PROFILE_DIRECTORY)/tests/log-profiler-test.pdb
include ../../build/library.make
@@ -37,8 +37,13 @@ namespace MonoTests.Mono.Profiler.Log {
static volatile int _id;
static string _testAssemblyPath;
static Process _currentProcess;
public ProfilerTestRun (string name, string options)
{
_testAssemblyPath = Path.Combine (Path.GetDirectoryName (System.Reflection.Assembly.GetExecutingAssembly ().Location), "log-profiler-test.exe");
_currentProcess = Process.GetCurrentProcess();
Name = name;
Options = options;
_output = $"test-{_id++}.mlpd";
@@ -57,8 +62,8 @@ namespace MonoTests.Mono.Profiler.Log {
using (var proc = new Process ()) {
proc.StartInfo = new ProcessStartInfo {
UseShellExecute = false,
FileName = Path.GetFullPath (Path.Combine ("..", "..", "..", "runtime", "mono-wrapper")),
Arguments = $"--debug --profile=log:nodefaults,output={_output},{Options} log-profiler-test.exe {Name}",
FileName = _currentProcess.MainModule.FileName,
Arguments = $"--debug --profile=log:nodefaults,output=\"{_output}\",{Options} {_testAssemblyPath} {Name}",
};
proc.Start ();
@@ -0,0 +1,11 @@
../../../external/corefx/src/System.ComponentModel.Composition/tests/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Diagnostics/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Factories/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Primitives/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/Integration/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/UnitTesting/*.cs
@@ -0,0 +1,9 @@
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Diagnostics/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Factories/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Primitives/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/Integration/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/UnitTesting/*.cs
@@ -110,14 +110,6 @@ namespace System.ComponentModel.Composition.ReflectionModel
{
Requires.NotNull(importDefinition, "importDefinition");
ReflectionImportDefinition reflectionImportDefinition = importDefinition as ReflectionImportDefinition;
if (reflectionImportDefinition == null)
{
throw new ArgumentException(
string.Format(CultureInfo.CurrentCulture, Strings.ReflectionModel_InvalidImportDefinition, importDefinition.GetType()),
"importDefinition");
}
return (importDefinition is IPartCreatorImportDefinition);
}
@@ -0,0 +1,9 @@
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/AttributedModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Diagnostics/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Factories/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/Primitives/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/ComponentModel/Composition/ReflectionModel/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/Integration/*.cs
../../../external/corefx/src/System.ComponentModel.Composition/tests/System/UnitTesting/*.cs
-6
View File
@@ -42,12 +42,6 @@ ifeq (monotouch_runtime, $(PROFILE))
LIB_MCS_FLAGS += -d:FULL_AOT_RUNTIME
endif
ifneq (basic, $(PROFILE))
ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_REFS += Mono.Posix
endif
endif
CC_PROFILE := $(filter monotouch% xammac, $(PROFILE))
ifdef CC_PROFILE
BUILT_SOURCES = \
-6
View File
@@ -1315,9 +1315,6 @@
<ProjectReference Include="../System/System.csproj" />
<ProjectReference Include="../corlib/corlib.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
<ProjectReference Include="../Mono.Posix/Mono.Posix.csproj" />
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_hybrid' ">
<Reference Include="nunitlite">
<HintPath>..\lib\testing_aot_hybrid\nunitlite.dll</HintPath>
@@ -1330,9 +1327,6 @@
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup Condition=" '$(Platform)' == 'xammac_net_4_5' ">
<ProjectReference Include="../Mono.Posix/Mono.Posix.csproj" />
</ItemGroup>
<!-- @ALL_REFERENCES@ -->
<!-- @ALL_RESOURCES@ -->
</Project>
@@ -0,0 +1 @@
../../../external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs
@@ -0,0 +1 @@
../../../external/corefx/src/System.Linq.Expressions/tests/Dynamic/InvokeMemberBindingTests.cs
+5 -1
View File
@@ -17,7 +17,11 @@ ifndef MOBILE_PROFILE
LIB_MCS_FLAGS += -d:FEATURE_TYPECONVERTER,SUPPORTS_WINDOWS_COLORS
endif
TEST_LIB_REFS = System.Drawing System.Runtime.Serialization.Formatters.Soap System.Xml
TEST_LIB_REFS = System.Drawing System.Xml
ifneq ($(PROFILE),wasm)
TEST_LIB_REFS += System.Runtime.Serialization.Formatters.Soap
endif
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -define:TEST -resource:Test/resources/indexed.png,indexed.png \
-nowarn:0618 -nowarn:219 -nowarn:169
@@ -0,0 +1,7 @@
System.Drawing/GDIPlusTest.cs
System.Drawing/TestBitmap.cs
System.Drawing/TestGraphics.cs
System.Drawing/TestIcon.cs
System.Drawing/TestIconConverter.cs
System.Drawing/TestImage.cs
System.Drawing/TestImageConverter.cs
+54 -4
View File
@@ -57,13 +57,35 @@ namespace System.Net.Http
public HttpRequestMessage Request;
public CancellationTokenRegistration CancellationTokenRegistration;
public CFContentStream ContentStream;
public bool StreamCanBeDisposed;
public void Close ()
{
CancellationTokenRegistration.Dispose ();
if (ContentStream != null) {
ContentStream.Close ();
}
if (ContentStream != null) {
// The Close method of the CFContentStream blocks as you can see:
// public void Close ()
// {
// data_read_event.WaitOne (); // make sure there's no pending data
//
// data_mutex.WaitOne ();
// data = null;
// this.http_stream.ErrorEvent -= HandleErrorEvent;
// data_mutex.ReleaseMutex ();
//
// data_event.Set ();
// }
// This means. that when we want to ignore the data of the content, which happens
// in the first request of a redirect, if we want to close, ignoring the content
// we will have a deadlock.
// Dispose will clean all the data, without waiting for the read, which by design in the
// CFContentStream, blocks the thread. This happens ONLY after the first request that gets
// a redirect status code. All other cases should call close.
if (StreamCanBeDisposed)
ContentStream.Dispose ();
else
ContentStream.Close ();
}
}
}
@@ -173,6 +195,11 @@ namespace System.Net.Http
}
protected internal override async Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, CancellationToken cancellationToken)
{
return await SendAsync (request, cancellationToken, true).ConfigureAwait (false);
}
internal async Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, CancellationToken cancellationToken, bool isFirstRequest)
{
sentRequest = true;
@@ -194,7 +221,8 @@ namespace System.Net.Http
}
}
stream.ShouldAutoredirect = allowAutoRedirect;
if (!isFirstRequest && allowAutoRedirect)
stream.ShouldAutoredirect = allowAutoRedirect;
stream.HasBytesAvailableEvent += HandleHasBytesAvailableEvent;
stream.ErrorEvent += HandleErrorEvent;
stream.ClosedEvent += HandleClosedEvent;
@@ -234,9 +262,31 @@ namespace System.Net.Http
CloseStream (stream);
});
if (isFirstRequest) {
var initialRequest = await response.Task;
var status = initialRequest.StatusCode;
if (IsRedirect (status) && allowAutoRedirect) {
bucket.StreamCanBeDisposed = true;
// remove headers in a redirect for Authentication.
request.Headers.Authorization = null;
return await SendAsync (request, cancellationToken, false).ConfigureAwait (false);
}
return initialRequest;
}
return await response.Task;
}
// Decide if we redirect or not, similar to what is done in the managed handler
// https://github.com/mono/mono/blob/eca15996c7163f331c9f2cd0a17b63e8f92b1d55/mcs/class/referencesource/System/net/System/Net/HttpWebRequest.cs#L5681
static bool IsRedirect (HttpStatusCode status)
{
return status == HttpStatusCode.Ambiguous || // 300
status == HttpStatusCode.Moved || // 301
status == HttpStatusCode.Redirect || // 302
status == HttpStatusCode.RedirectMethod || // 303
status == HttpStatusCode.RedirectKeepVerb; // 307
}
void HandleErrorEvent (object sender, CFStream.StreamEventArgs e)
{
var stream = (CFHTTPStream)sender;
@@ -41,7 +41,7 @@ namespace System.Net.Http.Headers
public ProductHeaderValue (string name, string version)
: this (name)
{
if (version != null)
if (!string.IsNullOrEmpty (version))
Parser.Token.Check (version);
Version = version;
@@ -63,6 +63,7 @@ namespace MonoTests.System.Net.Http.Headers
public void Ctor ()
{
new ProductHeaderValue ("aa", null);
new ProductHeaderValue ("aa", "");
}
[Test]
@@ -13,7 +13,13 @@ LIB_MCS_FLAGS = \
$(RESOURCE_FILES:%=/resource:%)
TXT_RESOURCE_STRINGS = ../referencesource/System.Runtime.Serialization/System.Runtime.Serialization.txt
XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq System.Drawing Facades/System.Threading.Tasks
XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq Facades/System.Threading.Tasks
ifneq ($(PROFILE),monodroid)
ifneq ($(PROFILE),monotouch)
XTEST_LIB_REFS += System.Drawing
endif
endif
ifneq (2.1, $(FRAMEWORK_VERSION))
LIB_REFS += System.Data System.Configuration SMDiagnostics
@@ -0,0 +1 @@
../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs
@@ -0,0 +1 @@
../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs
@@ -0,0 +1 @@
../../../external/corefx/src/System.Runtime.Serialization.Xml/tests/SerializationTypes.RuntimeOnly.cs
@@ -0,0 +1 @@
System.Security.Permissions/DataProtectionPermissionAttributeTest.cs
@@ -41,7 +41,8 @@ namespace System.ServiceModel.Channels
{
HttpChannelFactory<IRequestChannel> source;
List<WebRequest> web_requests = new List<WebRequest> ();
object locker = new object();
List<WebRequest> web_requests = new List<WebRequest> (); //synced by locker
// Constructor
@@ -86,7 +87,12 @@ namespace System.ServiceModel.Channels
}
var web_request = (HttpWebRequest) HttpWebRequest.Create (destination);
web_requests.Add (web_request);
lock (locker)
{
web_requests.Add (web_request);
}
result.WebRequest = web_request;
web_request.Method = "POST";
web_request.ContentType = Encoder.ContentType;
@@ -350,9 +356,20 @@ namespace System.ServiceModel.Channels
protected override void OnAbort ()
{
foreach (var web_request in web_requests.ToArray ())
WebRequest[] current_web_requests;
lock (locker)
{
current_web_requests = web_requests.ToArray();
}
foreach (var web_request in current_web_requests)
web_request.Abort ();
web_requests.Clear ();
lock(locker)
{
web_requests.Clear ();
}
}
// Close
@@ -497,7 +514,10 @@ namespace System.ServiceModel.Channels
void Cleanup ()
{
owner.web_requests.Remove (WebRequest);
lock (owner.locker)
{
owner.web_requests.Remove (WebRequest);
}
}
}
}
@@ -0,0 +1,8 @@
System.Web.Services.Configuration/DiagnosticsElementTest.cs
System.Web.Services.Configuration/ProtocolElementTest.cs
System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs
System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs
System.Web.Services.Configuration/TypeElementTest.cs
System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs
System.Web.Services.Configuration/WsiProfilesElementTest.cs
@@ -0,0 +1,8 @@
System.Web.Services.Configuration/DiagnosticsElementTest.cs
System.Web.Services.Configuration/ProtocolElementTest.cs
System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs
System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs
System.Web.Services.Configuration/TypeElementTest.cs
System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs
System.Web.Services.Configuration/WsiProfilesElementTest.cs
@@ -272,7 +272,8 @@ namespace System.Web.Configuration
{
string path = NormalizeVirtualPath (virtualPath);
foreach (VirtualDirectoryMapping mapping in map.VirtualDirectories) {
for (int j = 0; j < map.VirtualDirectories.Count; j++) {
VirtualDirectoryMapping mapping = map.VirtualDirectories.Get(j);
if (path.StartsWith (mapping.VirtualDirectory)) {
int i = mapping.VirtualDirectory.Length;
if (path.Length == i) {
+6
View File
@@ -142,3 +142,9 @@ notepad.exe: samples/notepad.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Fo
test-notepad: notepad.exe
$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) notepad.exe
issue10235.exe: samples/issue10235.cs $(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll $(topdir)/class/lib/$(PROFILE)/System.Drawing.dll $(topdir)/class/lib/$(PROFILE)/System.dll $(topdir)/class/lib/$(PROFILE)/mscorlib.dll
$(CSCOMPILE) -out:$@ samples/issue10235.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Drawing.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll
test-issue10235: issue10235.exe
$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) issue10235.exe
@@ -195,8 +195,13 @@ namespace System.Windows.Forms.Layout
{
IArrangedContainer parent = (IArrangedContainer)container;
LayoutDockedChildren (parent, parent.Controls);
LayoutAnchoredChildren (parent, parent.Controls);
if (parent.Controls is Control.ControlCollection controlCollection) {
LayoutDockedChildren (parent, controlCollection.GetAllControls());
LayoutAnchoredChildren (parent, controlCollection.GetAllControls());
} else {
LayoutDockedChildren (parent, parent.Controls);
LayoutAnchoredChildren (parent, parent.Controls);
}
return parent.AutoSize;
}
@@ -73,6 +73,9 @@ namespace System.Windows.Forms
internal bool has_been_focused;
private bool delayed_font_or_color_change;
private int requested_height;
internal int selection_length = -1; // set to the user-specified selection length, or -1 if none
internal bool show_caret_w_selection; // TextBox shows the caret when the selection is visible
internal int canvas_width;
@@ -163,6 +166,8 @@ namespace System.Windows.Forms
Cursor = Cursors.IBeam;
requested_height = Height;
can_cache_preferred_size = true;
}
#endregion // Internal Constructor
@@ -1008,6 +1013,9 @@ namespace System.Windows.Forms
protected override void OnHandleCreated (EventArgs e)
{
base.OnHandleCreated (e);
if (delayed_font_or_color_change) {
TextBoxBase_FontOrColorChanged (this, e);
}
FixupHeight ();
}
@@ -1467,20 +1475,13 @@ namespace System.Windows.Forms
{
// Make sure we don't get sized bigger than we want to be
if ((specified & BoundsSpecified.Height) != 0) {
requested_height = height;
}
if (!richtext) {
if (!document.multiline) {
if (height != PreferredHeight) {
// If the specified has Height, we need to store that in the
// ExplicitBounds because we are going to override it
if ((specified & BoundsSpecified.Height) != 0) {
Rectangle r = ExplicitBounds;
r.Height = height;
ExplicitBounds = r;
specified &= ~BoundsSpecified.Height;
}
height = PreferredHeight;
}
height = PreferredHeight;
}
}
@@ -1763,13 +1764,15 @@ namespace System.Windows.Forms
private void FixupHeight ()
{
if (!richtext) {
int saved_requested_height = requested_height;
if (!document.multiline) {
if (PreferredHeight != Height) {
SetBoundsCore (Left, Top, Width, PreferredHeight, BoundsSpecified.None);
SetBoundsCore (Left, Top, Width, PreferredHeight, BoundsSpecified.Height);
}
} else {
SetBoundsCore (Left, Top, Width, Math.Max(PreferredHeight, ExplicitBounds.Height), BoundsSpecified.None);
SetBoundsCore (Left, Top, Width, Math.Max(PreferredHeight, requested_height), BoundsSpecified.Height);
}
requested_height = saved_requested_height;
}
}
@@ -2238,8 +2241,10 @@ namespace System.Windows.Forms
{
Line line;
if (!IsHandleCreated)
if (!IsHandleCreated) {
delayed_font_or_color_change = true;
return;
}
document.SuspendRecalc ();
// Font changes apply to the whole document
@@ -318,10 +318,15 @@ namespace System.Windows.Forms
internal static void DrawTextInternal (IDeviceContext dc, string text, Font font, Point pt, Color foreColor, Color backColor, TextFormatFlags flags, bool useDrawString)
{
Size sz = MeasureTextInternal (dc, text, font, useDrawString);
Size sz = MeasureTextInternal (dc, text, font, flags, useDrawString);
DrawTextInternal (dc, text, font, new Rectangle (pt, sz), foreColor, backColor, flags, useDrawString);
}
internal static Size MeasureTextInternal (IDeviceContext dc, string text, Font font, TextFormatFlags flags, bool useMeasureString)
{
return MeasureTextInternal (dc, text, font, Size.Empty, flags, useMeasureString);
}
internal static Size MeasureTextInternal (IDeviceContext dc, string text, Font font, bool useMeasureString)
{
return MeasureTextInternal (dc, text, font, Size.Empty, TextFormatFlags.Default, useMeasureString);
@@ -0,0 +1,172 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Test
{
static class Program
{
/// <summary>
/// Der Haupteinstiegspunkt für die Anwendung.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
this.comboBox1.AutoSize = true; // necessary in Windows .Net to avoid wrong behaviour in TableLayout in particular wrong positioning
this.comboBox1.DataSource = new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen" };
this.Font = new Font(DefaultFont.FontFamily.Name, DefaultFont.Size * 2.0f); // double font size for the whole form i.e. including all controls
}
/// <summary>
/// Erforderliche Designervariable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Verwendete Ressourcen bereinigen.
/// </summary>
/// <param name="disposing">True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Vom Windows Form-Designer generierter Code
/// <summary>
/// Erforderliche Methode für die Designerunterstützung.
/// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.textBox1 = new System.Windows.Forms.TextBox();
this.tableLayoutPanel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.comboBox1, 1, 1);
this.tableLayoutPanel1.Controls.Add(this.numericUpDown1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.textBox1, 1, 2);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(184, 162);
this.tableLayoutPanel1.TabIndex = 0;
//
// label1
//
this.label1.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 20);
this.label1.Margin = new System.Windows.Forms.Padding(3);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(35, 13);
this.label1.TabIndex = 0;
this.label1.Text = "label1";
//
// label2
//
this.label2.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 74);
this.label2.Margin = new System.Windows.Forms.Padding(3);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(35, 13);
this.label2.TabIndex = 1;
this.label2.Text = "label2";
//
// label3
//
this.label3.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 128);
this.label3.Margin = new System.Windows.Forms.Padding(3);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 2;
this.label3.Text = "label3";
//
// comboBox1
//
this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox1.Location = new System.Drawing.Point(44, 70);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(137, 21);
this.comboBox1.TabIndex = 4;
//
// numericUpDown1
//
this.numericUpDown1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.numericUpDown1.Location = new System.Drawing.Point(44, 17);
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(137, 20);
this.numericUpDown1.TabIndex = 5;
//
// textBox1
//
this.textBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.textBox1.Location = new System.Drawing.Point(44, 125);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(137, 20);
this.textBox1.TabIndex = 6;
this.textBox1.Text = "test";
//
// Form1
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.ClientSize = new System.Drawing.Size(184, 162);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "Form1";
this.Text = "Form1";
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.TextBox textBox1;
}
}
+7 -1
View File
@@ -18,7 +18,13 @@ endif
TEST_LIB_REFS = System.Data System.Core
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:0618 -nowarn:219 -nowarn:169
XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq System.Drawing Facades/System.Threading.Tasks System.Runtime.Serialization Facades/System.Text.Encoding.CodePages
XTEST_LIB_REFS = System System.Core System.Xml System.Xml.Linq Facades/System.Threading.Tasks System.Runtime.Serialization Facades/System.Text.Encoding.CodePages
ifneq ($(PROFILE),monodroid)
ifneq ($(PROFILE),monotouch)
XTEST_LIB_REFS += System.Drawing
endif
endif
LIBRARY_WARN_AS_ERROR = yes
@@ -15,7 +15,6 @@ using NUnit.Framework;
using System;
using System.Xml;
using System.IO;
using Network = System.Net;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Collections.Generic;
@@ -94,7 +93,7 @@ namespace MonoTests.System.Xml.Schema
{
// Create a resolver with default credentials.
XmlUrlResolver resolver = new XmlUrlResolver ();
resolver.Credentials = Network.CredentialCache.DefaultCredentials;
resolver.Credentials = global::System.Net.CredentialCache.DefaultCredentials;
// Set the reader settings object to use the resolver.
XmlReaderSettings settings = new XmlReaderSettings ();
settings.XmlResolver = resolver;
@@ -82,3 +82,7 @@ using System.Runtime.InteropServices;
#if XAMMAC || XAMMAC_4_5
[assembly: InternalsVisibleTo ("Xamarin.Mac, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
#if MONODROID
[assembly: InternalsVisibleTo ("Mono.Android, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
#endif
+5 -1
View File
@@ -85,6 +85,10 @@ ifdef ONLY_APPLETLS
LIB_MCS_FLAGS += -d:ONLY_APPLETLS
endif
ifdef MONO_FEATURE_APPLE_X509
LIB_MCS_FLAGS += -d:MONO_FEATURE_APPLE_X509
endif
ifndef PROFILE_DISABLE_BTLS
ifdef HAVE_BTLS
@@ -128,7 +132,7 @@ EXTRA_DISTFILES = \
include ../../build/library.make
$(test_lib_output): $(TEST_RESOURCES) $(test_lib_dir)
$(test_lib_output): $(TEST_RESOURCES) | $(test_lib_dir)
# Helper target to run the perl regex test suite
regex-check:
@@ -33,7 +33,6 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography.Apple;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Win32.SafeHandles;
using Mono.Net;
namespace Mono.AppleTls
{
@@ -56,7 +55,7 @@ namespace Mono.AppleTls
if (Interlocked.CompareExchange (ref initialized, 1, 0) != 0)
return;
var handle = CFObject.dlopen (AppleTlsContext.SecurityLibrary, 0);
var handle = CFObject.dlopen (SecurityLibrary, 0);
if (handle == IntPtr.Zero)
return;
@@ -93,7 +92,7 @@ namespace Mono.AppleTls
}
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static SecStatusCode SecPKCS12Import (IntPtr pkcs12_data, IntPtr options, out IntPtr items);
static SecStatusCode ImportPkcs12 (byte[] buffer, CFDictionary options, out CFDictionary[] array)
@@ -134,7 +133,7 @@ namespace Mono.AppleTls
return identity ?? new SafeSecIdentityHandle ();
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static SecStatusCode SecItemCopyMatching (/* CFDictionaryRef */ IntPtr query, /* CFTypeRef* */ out IntPtr result);
public static SafeSecIdentityHandle FindIdentity (SafeSecCertificateHandle certificate, bool throwOnError = false)
@@ -33,13 +33,14 @@ using System.Runtime.InteropServices;
using System.Security.Cryptography.Apple;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Win32.SafeHandles;
using Mono.Net;
namespace Mono.AppleTls
{
static partial class MonoCertificatePal
{
[DllImport (AppleTlsContext.SecurityLibrary)]
const string SecurityLibrary = OSX509Certificates.SecurityLibrary;
[DllImport (SecurityLibrary)]
extern static IntPtr SecCertificateCreateWithData (IntPtr allocator, IntPtr cfData);
public static SafeSecCertificateHandle FromOtherCertificate (X509Certificate certificate)
@@ -66,7 +67,7 @@ namespace Mono.AppleTls
}
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static IntPtr SecIdentityGetTypeID ();
public static bool IsSecIdentity (IntPtr ptr)
@@ -76,7 +77,7 @@ namespace Mono.AppleTls
return CFType.GetTypeID (ptr) == SecIdentityGetTypeID ();
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
public extern static IntPtr SecKeyGetTypeID ();
public static bool IsSecKey (IntPtr ptr)
@@ -86,7 +87,7 @@ namespace Mono.AppleTls
return CFType.GetTypeID (ptr) == SecKeyGetTypeID ();
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static /* OSStatus */ SecStatusCode SecIdentityCopyCertificate (/* SecIdentityRef */ IntPtr identityRef, /* SecCertificateRef* */ out IntPtr certificateRef);
public static SafeSecCertificateHandle GetCertificate (SafeSecIdentityHandle identity)
@@ -99,7 +100,7 @@ namespace Mono.AppleTls
return new SafeSecCertificateHandle (cert, true);
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static IntPtr SecCertificateCopySubjectSummary (IntPtr cert);
public static string GetSubjectSummary (SafeSecCertificateHandle certificate)
@@ -117,7 +118,7 @@ namespace Mono.AppleTls
}
}
[DllImport (AppleTlsContext.SecurityLibrary)]
[DllImport (SecurityLibrary)]
extern static /* CFDataRef */ IntPtr SecCertificateCopyData (/* SecCertificateRef */ IntPtr cert);
public static byte[] GetRawData (SafeSecCertificateHandle certificate)
@@ -26,7 +26,7 @@
using System.Runtime.InteropServices;
using System.Security.Cryptography.Apple;
using Microsoft.Win32.SafeHandles;
using Mono.Net;
using Mono;
namespace System.Security.Cryptography.X509Certificates
{
@@ -26,7 +26,7 @@
using System.Runtime.InteropServices;
using System.Security.Cryptography.Apple;
using Microsoft.Win32.SafeHandles;
using Mono.Net;
using Mono;
namespace System.Security.Cryptography.X509Certificates
{
+94 -2
View File
@@ -33,6 +33,7 @@ using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Net.Security;
using System.Security.Cryptography;
using System.Security.Cryptography.X509Certificates;
using System.Security.Authentication;
using Microsoft.Win32.SafeHandles;
@@ -221,9 +222,100 @@ namespace Mono.Btls
X509Chain chain, MonoBtlsX509StoreCtx storeCtx,
bool success, ref MonoSslPolicyErrors errors, ref int status11)
{
if (!success) {
errors = MonoSslPolicyErrors.RemoteCertificateChainErrors;
status11 = unchecked((int)0);
if (success)
return;
errors = MonoSslPolicyErrors.RemoteCertificateChainErrors;
if (!wantsChain || storeCtx == null || chain == null) {
status11 = unchecked((int)0x800B010B);
return;
}
var error = storeCtx.GetError();
if (error != Mono.Btls.MonoBtlsX509Error.OK &
error != Mono.Btls.MonoBtlsX509Error.CRL_NOT_YET_VALID) {
chain.Impl.AddStatus(MapVerifyErrorToChainStatus(error));
status11 = unchecked((int)0x800B010B);
}
}
internal static X509ChainStatusFlags MapVerifyErrorToChainStatus (MonoBtlsX509Error code)
{
switch (code) {
case MonoBtlsX509Error.OK :
return X509ChainStatusFlags.NoError;
case MonoBtlsX509Error.CERT_NOT_YET_VALID :
case MonoBtlsX509Error.CERT_HAS_EXPIRED:
case MonoBtlsX509Error.ERROR_IN_CERT_NOT_BEFORE_FIELD:
case MonoBtlsX509Error.ERROR_IN_CERT_NOT_AFTER_FIELD:
return X509ChainStatusFlags.NotTimeValid;
case MonoBtlsX509Error.CERT_REVOKED:
return X509ChainStatusFlags.Revoked;
case MonoBtlsX509Error.UNABLE_TO_DECODE_ISSUER_PUBLIC_KEY:
case MonoBtlsX509Error.CERT_SIGNATURE_FAILURE:
return X509ChainStatusFlags.NotSignatureValid;
case MonoBtlsX509Error.CERT_UNTRUSTED:
case MonoBtlsX509Error.DEPTH_ZERO_SELF_SIGNED_CERT:
case MonoBtlsX509Error.SELF_SIGNED_CERT_IN_CHAIN:
return X509ChainStatusFlags.UntrustedRoot;
case MonoBtlsX509Error.CRL_HAS_EXPIRED:
return X509ChainStatusFlags.OfflineRevocation;
case MonoBtlsX509Error.CRL_NOT_YET_VALID:
case MonoBtlsX509Error.CRL_SIGNATURE_FAILURE:
case MonoBtlsX509Error.ERROR_IN_CRL_LAST_UPDATE_FIELD:
case MonoBtlsX509Error.ERROR_IN_CRL_NEXT_UPDATE_FIELD:
case MonoBtlsX509Error.KEYUSAGE_NO_CRL_SIGN:
case MonoBtlsX509Error.UNABLE_TO_DECRYPT_CRL_SIGNATURE:
case MonoBtlsX509Error.UNABLE_TO_GET_CRL:
case MonoBtlsX509Error.UNABLE_TO_GET_CRL_ISSUER:
case MonoBtlsX509Error.UNHANDLED_CRITICAL_CRL_EXTENSION:
return X509ChainStatusFlags.RevocationStatusUnknown;
case MonoBtlsX509Error.INVALID_EXTENSION:
return X509ChainStatusFlags.InvalidExtension;
case MonoBtlsX509Error.UNABLE_TO_GET_ISSUER_CERT:
case MonoBtlsX509Error.UNABLE_TO_GET_ISSUER_CERT_LOCALLY:
case MonoBtlsX509Error.UNABLE_TO_VERIFY_LEAF_SIGNATURE:
return X509ChainStatusFlags.PartialChain;
case MonoBtlsX509Error.INVALID_PURPOSE:
return X509ChainStatusFlags.NotValidForUsage;
case MonoBtlsX509Error.INVALID_CA:
case MonoBtlsX509Error.INVALID_NON_CA:
case MonoBtlsX509Error.PATH_LENGTH_EXCEEDED:
case MonoBtlsX509Error.KEYUSAGE_NO_CERTSIGN:
case MonoBtlsX509Error.KEYUSAGE_NO_DIGITAL_SIGNATURE:
return X509ChainStatusFlags.InvalidBasicConstraints;
case MonoBtlsX509Error.INVALID_POLICY_EXTENSION:
case MonoBtlsX509Error.NO_EXPLICIT_POLICY:
return X509ChainStatusFlags.InvalidPolicyConstraints;
case MonoBtlsX509Error.CERT_REJECTED:
return X509ChainStatusFlags.ExplicitDistrust;
case MonoBtlsX509Error.UNHANDLED_CRITICAL_EXTENSION:
return X509ChainStatusFlags.HasNotSupportedCriticalExtension;
case MonoBtlsX509Error.HOSTNAME_MISMATCH:
// FIXME: we should have a better error flag for this.
return X509ChainStatusFlags.UntrustedRoot;
case MonoBtlsX509Error.CERT_CHAIN_TOO_LONG:
throw new CryptographicException ();
case MonoBtlsX509Error.OUT_OF_MEM:
throw new OutOfMemoryException ();
default:
throw new CryptographicException ("Unrecognized X509VerifyStatusCode:" + code);
}
}
@@ -142,6 +142,11 @@ namespace Mono.Btls
return mono_btls_x509_store_ctx_get_error (Handle.DangerousGetHandle (), out error_string_ptr);
}
public int GetErrorDepth ()
{
return mono_btls_x509_store_ctx_get_error_depth (Handle.DangerousGetHandle ());
}
public MonoBtlsX509Exception GetException ()
{
IntPtr error_string_ptr;
@@ -25,6 +25,7 @@
// THE SOFTWARE.
#if SECURITY_DEP && MONO_FEATURE_BTLS
using System;
using System.Collections.Generic;
using System.Text;
using System.Security;
using System.Security.Cryptography;
@@ -42,6 +43,7 @@ namespace Mono.Btls
X509Certificate2Collection untrusted;
X509Certificate2[] certificates;
X509ChainPolicy policy;
List<X509ChainStatus> chainStatusList;
internal X509ChainImplBtls (MonoBtlsX509Chain chain)
{
@@ -124,7 +126,16 @@ namespace Mono.Btls
}
public override X509ChainStatus[] ChainStatus {
get { throw new NotImplementedException (); }
get {
return chainStatusList.ToArray();
}
}
public override void AddStatus (X509ChainStatusFlags errorCode)
{
if (chainStatusList == null)
chainStatusList = new List<X509ChainStatus>();
chainStatusList.Add (new X509ChainStatus(errorCode));
}
public override bool Build (X509Certificate2 certificate)
@@ -77,7 +77,7 @@ namespace Mono.Net.Security
Settings = settings;
Provider = provider;
readBuffer = new BufferOffsetSize2 (16834);
readBuffer = new BufferOffsetSize2 (16500);
writeBuffer = new BufferOffsetSize2 (16384);
operation = Operation.None;
}
@@ -50,7 +50,7 @@ using System.Security.Cryptography;
namespace Mono.Net.Security
{
class MonoTlsStream
class MonoTlsStream : IDisposable
{
#if SECURITY_DEP
readonly MonoTlsProvider provider;
@@ -136,6 +136,7 @@ namespace Mono.Net.Security
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
else {
request.ServicePoint.UpdateClientCertificate (null);
sslStream.Dispose ();
sslStream = null;
}
}
@@ -154,5 +155,13 @@ namespace Mono.Net.Security
throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
#endif
}
public void Dispose ()
{
if (sslStream != null) {
sslStream.Dispose ();
sslStream = null;
}
}
}
}
+673
View File
@@ -0,0 +1,673 @@
//
// MacProxy.cs
//
// Author: Jeffrey Stedfast <[email protected]>
//
// Copyright (c) 2012-2014 Xamarin Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Threading;
using ObjCRuntimeInternal;
namespace Mono
{
internal class CFType {
[DllImport (CFObject.CoreFoundationLibrary, EntryPoint="CFGetTypeID")]
public static extern IntPtr GetTypeID (IntPtr typeRef);
}
internal class CFObject : IDisposable, INativeObject
{
public const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
const string SystemLibrary = "/usr/lib/libSystem.dylib";
[DllImport (SystemLibrary)]
public static extern IntPtr dlopen (string path, int mode);
[DllImport (SystemLibrary)]
static extern IntPtr dlsym (IntPtr handle, string symbol);
[DllImport (SystemLibrary)]
public static extern void dlclose (IntPtr handle);
public static IntPtr GetIndirect (IntPtr handle, string symbol)
{
return dlsym (handle, symbol);
}
public static CFString GetStringConstant (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return null;
var actual = Marshal.ReadIntPtr (indirect);
if (actual == IntPtr.Zero)
return null;
return new CFString (actual, false);
}
public static IntPtr GetIntPtr (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return IntPtr.Zero;
return Marshal.ReadIntPtr (indirect);
}
public static IntPtr GetCFObjectHandle (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return IntPtr.Zero;
return Marshal.ReadIntPtr (indirect);
}
public CFObject (IntPtr handle, bool own)
{
Handle = handle;
if (!own)
Retain ();
}
~CFObject ()
{
Dispose (false);
}
public IntPtr Handle { get; private set; }
[DllImport (CoreFoundationLibrary)]
internal extern static IntPtr CFRetain (IntPtr handle);
void Retain ()
{
CFRetain (Handle);
}
[DllImport (CoreFoundationLibrary)]
internal extern static void CFRelease (IntPtr handle);
void Release ()
{
CFRelease (Handle);
}
protected virtual void Dispose (bool disposing)
{
if (Handle != IntPtr.Zero) {
Release ();
Handle = IntPtr.Zero;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
}
internal class CFArray : CFObject
{
public CFArray (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFArrayCreate (IntPtr allocator, IntPtr values, /* CFIndex */ IntPtr numValues, IntPtr callbacks);
static readonly IntPtr kCFTypeArrayCallbacks;
static CFArray ()
{
var handle = dlopen (CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
kCFTypeArrayCallbacks = GetIndirect (handle, "kCFTypeArrayCallBacks");
} finally {
dlclose (handle);
}
}
public static CFArray FromNativeObjects (params INativeObject[] values)
{
return new CFArray (Create (values), true);
}
public static unsafe IntPtr Create (params IntPtr[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
fixed (IntPtr* pv = values) {
return CFArrayCreate (IntPtr.Zero, (IntPtr) pv, (IntPtr)values.Length, kCFTypeArrayCallbacks);
}
}
internal static unsafe CFArray CreateArray (params IntPtr[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
fixed (IntPtr *pv = values) {
IntPtr handle = CFArrayCreate (IntPtr.Zero, (IntPtr) pv, (IntPtr) values.Length, kCFTypeArrayCallbacks);
return new CFArray (handle, false);
}
}
public static CFArray CreateArray (params INativeObject[] values)
{
return new CFArray (Create (values), true);
}
public static IntPtr Create (params INativeObject[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
IntPtr[] _values = new IntPtr [values.Length];
for (int i = 0; i < _values.Length; ++i)
_values [i] = values [i].Handle;
return Create (_values);
}
[DllImport (CoreFoundationLibrary)]
extern static /* CFIndex */ IntPtr CFArrayGetCount (IntPtr handle);
public int Count {
get { return (int) CFArrayGetCount (Handle); }
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFArrayGetValueAtIndex (IntPtr handle, /* CFIndex */ IntPtr index);
public IntPtr this[int index] {
get {
return CFArrayGetValueAtIndex (Handle, (IntPtr) index);
}
}
static public T [] ArrayFromHandle<T> (IntPtr handle, Func<IntPtr, T> creation) where T : class, INativeObject
{
if (handle == IntPtr.Zero)
return null;
var c = CFArrayGetCount (handle);
T [] ret = new T [(int)c];
for (uint i = 0; i < (uint)c; i++) {
ret [i] = creation (CFArrayGetValueAtIndex (handle, (IntPtr)i));
}
return ret;
}
}
internal class CFNumber : CFObject
{
public CFNumber (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CFNumberGetValue (IntPtr handle, /* CFNumberType */ IntPtr type, [MarshalAs (UnmanagedType.I1)] out bool value);
public static bool AsBool (IntPtr handle)
{
bool value;
if (handle == IntPtr.Zero)
return false;
CFNumberGetValue (handle, (IntPtr) 1, out value);
return value;
}
public static implicit operator bool (CFNumber number)
{
return AsBool (number.Handle);
}
[DllImport (CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CFNumberGetValue (IntPtr handle, /* CFNumberType */ IntPtr type, out int value);
public static int AsInt32 (IntPtr handle)
{
int value;
if (handle == IntPtr.Zero)
return 0;
// 9 == kCFNumberIntType == C int
CFNumberGetValue (handle, (IntPtr) 9, out value);
return value;
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFNumberCreate (IntPtr allocator, IntPtr theType, IntPtr valuePtr);
public static CFNumber FromInt32 (int number)
{
// 9 == kCFNumberIntType == C int
return new CFNumber (CFNumberCreate (IntPtr.Zero, (IntPtr)9, (IntPtr)number), true);
}
public static implicit operator int (CFNumber number)
{
return AsInt32 (number.Handle);
}
}
internal struct CFRange {
public IntPtr Location, Length;
public CFRange (int loc, int len)
{
Location = (IntPtr) loc;
Length = (IntPtr) len;
}
}
internal class CFString : CFObject
{
string str;
public CFString (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringCreateWithCharacters (IntPtr alloc, IntPtr chars, /* CFIndex */ IntPtr length);
public static CFString Create (string value)
{
IntPtr handle;
unsafe {
fixed (char *ptr = value) {
handle = CFStringCreateWithCharacters (IntPtr.Zero, (IntPtr) ptr, (IntPtr) value.Length);
}
}
if (handle == IntPtr.Zero)
return null;
return new CFString (handle, true);
}
[DllImport (CoreFoundationLibrary)]
extern static /* CFIndex */ IntPtr CFStringGetLength (IntPtr handle);
public int Length {
get {
if (str != null)
return str.Length;
return (int) CFStringGetLength (Handle);
}
}
[DllImport (CoreFoundationLibrary)]
extern static int CFStringCompare (IntPtr theString1, IntPtr theString2, int compareOptions);
public static int Compare (IntPtr string1, IntPtr string2, int compareOptions = 0)
{
return CFStringCompare (string1, string2, compareOptions);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringGetCharactersPtr (IntPtr handle);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringGetCharacters (IntPtr handle, CFRange range, IntPtr buffer);
public static string AsString (IntPtr handle)
{
if (handle == IntPtr.Zero)
return null;
int len = (int) CFStringGetLength (handle);
if (len == 0)
return string.Empty;
IntPtr chars = CFStringGetCharactersPtr (handle);
IntPtr buffer = IntPtr.Zero;
if (chars == IntPtr.Zero) {
CFRange range = new CFRange (0, len);
buffer = Marshal.AllocHGlobal (len * 2);
CFStringGetCharacters (handle, range, buffer);
chars = buffer;
}
string str;
unsafe {
str = new string ((char *) chars, 0, len);
}
if (buffer != IntPtr.Zero)
Marshal.FreeHGlobal (buffer);
return str;
}
public override string ToString ()
{
if (str == null)
str = AsString (Handle);
return str;
}
public static implicit operator string (CFString str)
{
return str.ToString ();
}
public static implicit operator CFString (string str)
{
return Create (str);
}
}
internal class CFData : CFObject
{
public CFData (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static /* CFDataRef */ IntPtr CFDataCreate (/* CFAllocatorRef */ IntPtr allocator, /* UInt8* */ IntPtr bytes, /* CFIndex */ IntPtr length);
public unsafe static CFData FromData (byte [] buffer)
{
fixed (byte* p = buffer)
{
return FromData ((IntPtr)p, (IntPtr)buffer.Length);
}
}
public static CFData FromData (IntPtr buffer, IntPtr length)
{
return new CFData (CFDataCreate (IntPtr.Zero, buffer, length), true);
}
public IntPtr Length {
get { return CFDataGetLength (Handle); }
}
[DllImport (CoreFoundationLibrary)]
internal extern static /* CFIndex */ IntPtr CFDataGetLength (/* CFDataRef */ IntPtr theData);
[DllImport (CoreFoundationLibrary)]
internal extern static /* UInt8* */ IntPtr CFDataGetBytePtr (/* CFDataRef */ IntPtr theData);
/*
* Exposes a read-only pointer to the underlying storage.
*/
public IntPtr Bytes {
get { return CFDataGetBytePtr (Handle); }
}
public byte this [long idx] {
get {
if (idx < 0 || (ulong) idx > (ulong) Length)
throw new ArgumentException ("idx");
return Marshal.ReadByte (new IntPtr (Bytes.ToInt64 () + idx));
}
set {
throw new NotImplementedException ("NSData arrays can not be modified, use an NSMutableData instead");
}
}
}
internal class CFDictionary : CFObject
{
static readonly IntPtr KeyCallbacks;
static readonly IntPtr ValueCallbacks;
static CFDictionary ()
{
var handle = dlopen (CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
KeyCallbacks = GetIndirect (handle, "kCFTypeDictionaryKeyCallBacks");
ValueCallbacks = GetIndirect (handle, "kCFTypeDictionaryValueCallBacks");
} finally {
dlclose (handle);
}
}
public CFDictionary (IntPtr handle, bool own) : base (handle, own) { }
public static CFDictionary FromObjectAndKey (IntPtr obj, IntPtr key)
{
return new CFDictionary (CFDictionaryCreate (IntPtr.Zero, new IntPtr[] { key }, new IntPtr [] { obj }, (IntPtr)1, KeyCallbacks, ValueCallbacks), true);
}
public static CFDictionary FromKeysAndObjects (IList<Tuple<IntPtr,IntPtr>> items)
{
var keys = new IntPtr [items.Count];
var values = new IntPtr [items.Count];
for (int i = 0; i < items.Count; i++) {
keys [i] = items [i].Item1;
values [i] = items [i].Item2;
}
return new CFDictionary (CFDictionaryCreate (IntPtr.Zero, keys, values, (IntPtr)items.Count, KeyCallbacks, ValueCallbacks), true);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreate (IntPtr allocator, IntPtr[] keys, IntPtr[] vals, IntPtr len, IntPtr keyCallbacks, IntPtr valCallbacks);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryGetValue (IntPtr handle, IntPtr key);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateCopy (IntPtr allocator, IntPtr handle);
public CFDictionary Copy ()
{
return new CFDictionary (CFDictionaryCreateCopy (IntPtr.Zero, Handle), true);
}
public CFMutableDictionary MutableCopy ()
{
return new CFMutableDictionary (CFDictionaryCreateMutableCopy (IntPtr.Zero, IntPtr.Zero, Handle), true);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateMutableCopy (IntPtr allocator, IntPtr capacity, IntPtr theDict);
public IntPtr GetValue (IntPtr key)
{
return CFDictionaryGetValue (Handle, key);
}
public IntPtr this[IntPtr key] {
get {
return GetValue (key);
}
}
}
internal class CFMutableDictionary : CFDictionary
{
public CFMutableDictionary (IntPtr handle, bool own) : base (handle, own) { }
public void SetValue (IntPtr key, IntPtr val)
{
CFDictionarySetValue (Handle, key, val);
}
public static CFMutableDictionary Create ()
{
var handle = CFDictionaryCreateMutable (IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (handle == IntPtr.Zero)
throw new InvalidOperationException ();
return new CFMutableDictionary (handle, true);
}
[DllImport (CoreFoundationLibrary)]
extern static void CFDictionarySetValue (IntPtr handle, IntPtr key, IntPtr val);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateMutable (IntPtr allocator, IntPtr capacity, IntPtr keyCallback, IntPtr valueCallbacks);
}
class CFBoolean : INativeObject, IDisposable {
IntPtr handle;
public static readonly CFBoolean True;
public static readonly CFBoolean False;
static CFBoolean ()
{
var handle = CFObject.dlopen (CFObject.CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
True = new CFBoolean (CFObject.GetCFObjectHandle (handle, "kCFBooleanTrue"), false);
False = new CFBoolean (CFObject.GetCFObjectHandle (handle, "kCFBooleanFalse"), false);
}
finally {
CFObject.dlclose (handle);
}
}
internal CFBoolean (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CFBoolean ()
{
Dispose (false);
}
public IntPtr Handle {
get {
return handle;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero){
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
public static implicit operator bool (CFBoolean value)
{
return value.Value;
}
public static explicit operator CFBoolean (bool value)
{
return FromBoolean (value);
}
public static CFBoolean FromBoolean (bool value)
{
return value ? True : False;
}
[DllImport (CFObject.CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static /* Boolean */ bool CFBooleanGetValue (/* CFBooleanRef */ IntPtr boolean);
public bool Value {
get {return CFBooleanGetValue (handle);}
}
public static bool GetValue (IntPtr boolean)
{
return CFBooleanGetValue (boolean);
}
}
internal class CFDate : INativeObject, IDisposable {
IntPtr handle;
internal CFDate (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CFDate ()
{
Dispose (false);
}
[DllImport (CFObject.CoreFoundationLibrary)]
extern static IntPtr CFDateCreate (IntPtr allocator, /* CFAbsoluteTime */ double at);
public static CFDate Create (DateTime date)
{
var referenceTime = new DateTime (2001, 1, 1);
var difference = (date - referenceTime).TotalSeconds;
var handle = CFDateCreate (IntPtr.Zero, difference);
if (handle == IntPtr.Zero)
throw new NotSupportedException ();
return new CFDate (handle, true);
}
public IntPtr Handle {
get {
return handle;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero) {
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
}
}
@@ -75,6 +75,7 @@ namespace Mono
static int initialized;
static X509PalImpl x509pal;
static object syncRoot = new object ();
static void EnsureInitialized ()
{
@@ -83,13 +84,15 @@ namespace Mono
* MonoTlsProviderFactory.InitializeInternal().
*
*/
if (Interlocked.CompareExchange (ref initialized, 1, 0) != 0)
return;
lock (syncRoot) {
if (Interlocked.CompareExchange (ref initialized, 1, 0) != 0)
return;
#if MONO_FEATURE_BTLS || MONO_FEATURE_APPLETLS
provider = MonoTlsProviderFactory.GetProvider ();
#endif
x509pal = GetX509Pal ();
x509pal = GetX509Pal ();
}
}
public X509PalImpl X509Pal {
@@ -34,6 +34,7 @@ namespace Mono
class SystemDependencyProvider : ISystemDependencyProvider
{
static SystemDependencyProvider instance;
static object syncRoot = new object ();
public static SystemDependencyProvider Instance {
get {
@@ -44,8 +45,12 @@ namespace Mono
internal static void Initialize ()
{
if (instance == null)
Interlocked.CompareExchange (ref instance, new SystemDependencyProvider (), null);
lock (syncRoot) {
if (instance != null)
return;
instance = new SystemDependencyProvider ();
}
}
ISystemCertificateProvider ISystemDependencyProvider.CertificateProvider => CertificateProvider;
+11 -18
View File
@@ -508,9 +508,12 @@ namespace System.Diagnostics
int size = 0;
for (int i = 0; i < processes.Length; i++) {
var process = processes[i];
try {
if (String.Compare (processName, processes[i].ProcessName, true) == 0)
processes [size++] = processes[i];
if (String.Compare (processName, process.ProcessName, true) == 0)
processes [size++] = process;
else
process.Dispose();
} catch (SystemException) {
/* The process might exit between GetProcesses_internal and GetProcessById */
}
@@ -687,29 +690,19 @@ namespace System.Diagnostics
var procInfo = new ProcInfo ();
if (startInfo.HaveEnvVars) {
List<string> envVariables = null;
StringBuilder sb = null;
List<string> envVariables = new List<string> ();
foreach (DictionaryEntry de in startInfo.EnvironmentVariables) {
if (de.Value == null)
continue;
if (envVariables == null)
envVariables = new List<string> ();
if (sb == null)
sb = new StringBuilder ();
else
sb.Clear ();
sb.Append ((string) de.Key);
sb.Append ('=');
sb.Append ((string) de.Value);
envVariables.Add (sb.ToString ());
envVariables.Add (string.Concat (
(string) de.Key,
"=",
(string) de.Value));
}
procInfo.envVariables = envVariables?.ToArray ();
procInfo.envVariables = envVariables.ToArray ();
}
MonoIOError error;
@@ -380,7 +380,12 @@ namespace System.IO.Compression
GC.SuppressFinalize (this);
io_buffer = null;
} else {
// When we are in the finalizer we don't want to access the underlying stream anymore
base_stream = Stream.Null;
}
if (z_stream != null) {
z_stream.Dispose();
}
@@ -946,6 +946,11 @@ namespace System.Net
} catch {
// Ignore; we report the timeout.
}
#pragma warning disable 4014
// Make sure the workerTask's Exception is actually observed.
// Fixes https://github.com/mono/mono/issues/10488.
workerTask.ContinueWith (t => t.Exception?.GetHashCode (), TaskContinuationOptions.OnlyOnFaulted);
#pragma warning restore 4014
throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout);
} catch (Exception ex) {
throw GetWebException (ex, aborted ());
-638
View File
@@ -33,264 +33,6 @@ using ObjCRuntimeInternal;
namespace Mono.Net
{
internal class CFType {
[DllImport (CFObject.CoreFoundationLibrary, EntryPoint="CFGetTypeID")]
public static extern IntPtr GetTypeID (IntPtr typeRef);
}
internal class CFObject : IDisposable, INativeObject
{
public const string CoreFoundationLibrary = "/System/Library/Frameworks/CoreFoundation.framework/CoreFoundation";
const string SystemLibrary = "/usr/lib/libSystem.dylib";
[DllImport (SystemLibrary)]
public static extern IntPtr dlopen (string path, int mode);
[DllImport (SystemLibrary)]
static extern IntPtr dlsym (IntPtr handle, string symbol);
[DllImport (SystemLibrary)]
public static extern void dlclose (IntPtr handle);
public static IntPtr GetIndirect (IntPtr handle, string symbol)
{
return dlsym (handle, symbol);
}
public static CFString GetStringConstant (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return null;
var actual = Marshal.ReadIntPtr (indirect);
if (actual == IntPtr.Zero)
return null;
return new CFString (actual, false);
}
public static IntPtr GetIntPtr (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return IntPtr.Zero;
return Marshal.ReadIntPtr (indirect);
}
public static IntPtr GetCFObjectHandle (IntPtr handle, string symbol)
{
var indirect = dlsym (handle, symbol);
if (indirect == IntPtr.Zero)
return IntPtr.Zero;
return Marshal.ReadIntPtr (indirect);
}
public CFObject (IntPtr handle, bool own)
{
Handle = handle;
if (!own)
Retain ();
}
~CFObject ()
{
Dispose (false);
}
public IntPtr Handle { get; private set; }
[DllImport (CoreFoundationLibrary)]
internal extern static IntPtr CFRetain (IntPtr handle);
void Retain ()
{
CFRetain (Handle);
}
[DllImport (CoreFoundationLibrary)]
internal extern static void CFRelease (IntPtr handle);
void Release ()
{
CFRelease (Handle);
}
protected virtual void Dispose (bool disposing)
{
if (Handle != IntPtr.Zero) {
Release ();
Handle = IntPtr.Zero;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
}
internal class CFArray : CFObject
{
public CFArray (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFArrayCreate (IntPtr allocator, IntPtr values, /* CFIndex */ IntPtr numValues, IntPtr callbacks);
static readonly IntPtr kCFTypeArrayCallbacks;
static CFArray ()
{
var handle = dlopen (CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
kCFTypeArrayCallbacks = GetIndirect (handle, "kCFTypeArrayCallBacks");
} finally {
dlclose (handle);
}
}
public static CFArray FromNativeObjects (params INativeObject[] values)
{
return new CFArray (Create (values), true);
}
public static unsafe IntPtr Create (params IntPtr[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
fixed (IntPtr* pv = values) {
return CFArrayCreate (IntPtr.Zero, (IntPtr) pv, (IntPtr)values.Length, kCFTypeArrayCallbacks);
}
}
internal static unsafe CFArray CreateArray (params IntPtr[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
fixed (IntPtr *pv = values) {
IntPtr handle = CFArrayCreate (IntPtr.Zero, (IntPtr) pv, (IntPtr) values.Length, kCFTypeArrayCallbacks);
return new CFArray (handle, false);
}
}
public static CFArray CreateArray (params INativeObject[] values)
{
return new CFArray (Create (values), true);
}
public static IntPtr Create (params INativeObject[] values)
{
if (values == null)
throw new ArgumentNullException ("values");
IntPtr[] _values = new IntPtr [values.Length];
for (int i = 0; i < _values.Length; ++i)
_values [i] = values [i].Handle;
return Create (_values);
}
[DllImport (CoreFoundationLibrary)]
extern static /* CFIndex */ IntPtr CFArrayGetCount (IntPtr handle);
public int Count {
get { return (int) CFArrayGetCount (Handle); }
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFArrayGetValueAtIndex (IntPtr handle, /* CFIndex */ IntPtr index);
public IntPtr this[int index] {
get {
return CFArrayGetValueAtIndex (Handle, (IntPtr) index);
}
}
static public T [] ArrayFromHandle<T> (IntPtr handle, Func<IntPtr, T> creation) where T : class, INativeObject
{
if (handle == IntPtr.Zero)
return null;
var c = CFArrayGetCount (handle);
T [] ret = new T [(int)c];
for (uint i = 0; i < (uint)c; i++) {
ret [i] = creation (CFArrayGetValueAtIndex (handle, (IntPtr)i));
}
return ret;
}
}
internal class CFNumber : CFObject
{
public CFNumber (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CFNumberGetValue (IntPtr handle, /* CFNumberType */ IntPtr type, [MarshalAs (UnmanagedType.I1)] out bool value);
public static bool AsBool (IntPtr handle)
{
bool value;
if (handle == IntPtr.Zero)
return false;
CFNumberGetValue (handle, (IntPtr) 1, out value);
return value;
}
public static implicit operator bool (CFNumber number)
{
return AsBool (number.Handle);
}
[DllImport (CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static bool CFNumberGetValue (IntPtr handle, /* CFNumberType */ IntPtr type, out int value);
public static int AsInt32 (IntPtr handle)
{
int value;
if (handle == IntPtr.Zero)
return 0;
// 9 == kCFNumberIntType == C int
CFNumberGetValue (handle, (IntPtr) 9, out value);
return value;
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFNumberCreate (IntPtr allocator, IntPtr theType, IntPtr valuePtr);
public static CFNumber FromInt32 (int number)
{
// 9 == kCFNumberIntType == C int
return new CFNumber (CFNumberCreate (IntPtr.Zero, (IntPtr)9, (IntPtr)number), true);
}
public static implicit operator int (CFNumber number)
{
return AsInt32 (number.Handle);
}
}
internal struct CFRange {
public IntPtr Location, Length;
public CFRange (int loc, int len)
{
Location = (IntPtr) loc;
Length = (IntPtr) len;
}
}
internal struct CFStreamClientContext {
public IntPtr Version;
public IntPtr Info;
@@ -299,255 +41,6 @@ namespace Mono.Net
public IntPtr CopyDescription;
}
internal class CFString : CFObject
{
string str;
public CFString (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringCreateWithCharacters (IntPtr alloc, IntPtr chars, /* CFIndex */ IntPtr length);
public static CFString Create (string value)
{
IntPtr handle;
unsafe {
fixed (char *ptr = value) {
handle = CFStringCreateWithCharacters (IntPtr.Zero, (IntPtr) ptr, (IntPtr) value.Length);
}
}
if (handle == IntPtr.Zero)
return null;
return new CFString (handle, true);
}
[DllImport (CoreFoundationLibrary)]
extern static /* CFIndex */ IntPtr CFStringGetLength (IntPtr handle);
public int Length {
get {
if (str != null)
return str.Length;
return (int) CFStringGetLength (Handle);
}
}
[DllImport (CoreFoundationLibrary)]
extern static int CFStringCompare (IntPtr theString1, IntPtr theString2, int compareOptions);
public static int Compare (IntPtr string1, IntPtr string2, int compareOptions = 0)
{
return CFStringCompare (string1, string2, compareOptions);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringGetCharactersPtr (IntPtr handle);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFStringGetCharacters (IntPtr handle, CFRange range, IntPtr buffer);
public static string AsString (IntPtr handle)
{
if (handle == IntPtr.Zero)
return null;
int len = (int) CFStringGetLength (handle);
if (len == 0)
return string.Empty;
IntPtr chars = CFStringGetCharactersPtr (handle);
IntPtr buffer = IntPtr.Zero;
if (chars == IntPtr.Zero) {
CFRange range = new CFRange (0, len);
buffer = Marshal.AllocHGlobal (len * 2);
CFStringGetCharacters (handle, range, buffer);
chars = buffer;
}
string str;
unsafe {
str = new string ((char *) chars, 0, len);
}
if (buffer != IntPtr.Zero)
Marshal.FreeHGlobal (buffer);
return str;
}
public override string ToString ()
{
if (str == null)
str = AsString (Handle);
return str;
}
public static implicit operator string (CFString str)
{
return str.ToString ();
}
public static implicit operator CFString (string str)
{
return Create (str);
}
}
internal class CFData : CFObject
{
public CFData (IntPtr handle, bool own) : base (handle, own) { }
[DllImport (CoreFoundationLibrary)]
extern static /* CFDataRef */ IntPtr CFDataCreate (/* CFAllocatorRef */ IntPtr allocator, /* UInt8* */ IntPtr bytes, /* CFIndex */ IntPtr length);
public unsafe static CFData FromData (byte [] buffer)
{
fixed (byte* p = buffer)
{
return FromData ((IntPtr)p, (IntPtr)buffer.Length);
}
}
public static CFData FromData (IntPtr buffer, IntPtr length)
{
return new CFData (CFDataCreate (IntPtr.Zero, buffer, length), true);
}
public IntPtr Length {
get { return CFDataGetLength (Handle); }
}
[DllImport (CoreFoundationLibrary)]
internal extern static /* CFIndex */ IntPtr CFDataGetLength (/* CFDataRef */ IntPtr theData);
[DllImport (CoreFoundationLibrary)]
internal extern static /* UInt8* */ IntPtr CFDataGetBytePtr (/* CFDataRef */ IntPtr theData);
/*
* Exposes a read-only pointer to the underlying storage.
*/
public IntPtr Bytes {
get { return CFDataGetBytePtr (Handle); }
}
public byte this [long idx] {
get {
if (idx < 0 || (ulong) idx > (ulong) Length)
throw new ArgumentException ("idx");
return Marshal.ReadByte (new IntPtr (Bytes.ToInt64 () + idx));
}
set {
throw new NotImplementedException ("NSData arrays can not be modified, use an NSMutableData instead");
}
}
}
internal class CFDictionary : CFObject
{
static readonly IntPtr KeyCallbacks;
static readonly IntPtr ValueCallbacks;
static CFDictionary ()
{
var handle = dlopen (CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
KeyCallbacks = GetIndirect (handle, "kCFTypeDictionaryKeyCallBacks");
ValueCallbacks = GetIndirect (handle, "kCFTypeDictionaryValueCallBacks");
} finally {
dlclose (handle);
}
}
public CFDictionary (IntPtr handle, bool own) : base (handle, own) { }
public static CFDictionary FromObjectAndKey (IntPtr obj, IntPtr key)
{
return new CFDictionary (CFDictionaryCreate (IntPtr.Zero, new IntPtr[] { key }, new IntPtr [] { obj }, (IntPtr)1, KeyCallbacks, ValueCallbacks), true);
}
public static CFDictionary FromKeysAndObjects (IList<Tuple<IntPtr,IntPtr>> items)
{
var keys = new IntPtr [items.Count];
var values = new IntPtr [items.Count];
for (int i = 0; i < items.Count; i++) {
keys [i] = items [i].Item1;
values [i] = items [i].Item2;
}
return new CFDictionary (CFDictionaryCreate (IntPtr.Zero, keys, values, (IntPtr)items.Count, KeyCallbacks, ValueCallbacks), true);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreate (IntPtr allocator, IntPtr[] keys, IntPtr[] vals, IntPtr len, IntPtr keyCallbacks, IntPtr valCallbacks);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryGetValue (IntPtr handle, IntPtr key);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateCopy (IntPtr allocator, IntPtr handle);
public CFDictionary Copy ()
{
return new CFDictionary (CFDictionaryCreateCopy (IntPtr.Zero, Handle), true);
}
public CFMutableDictionary MutableCopy ()
{
return new CFMutableDictionary (CFDictionaryCreateMutableCopy (IntPtr.Zero, IntPtr.Zero, Handle), true);
}
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateMutableCopy (IntPtr allocator, IntPtr capacity, IntPtr theDict);
public IntPtr GetValue (IntPtr key)
{
return CFDictionaryGetValue (Handle, key);
}
public IntPtr this[IntPtr key] {
get {
return GetValue (key);
}
}
}
internal class CFMutableDictionary : CFDictionary
{
public CFMutableDictionary (IntPtr handle, bool own) : base (handle, own) { }
public void SetValue (IntPtr key, IntPtr val)
{
CFDictionarySetValue (Handle, key, val);
}
public static CFMutableDictionary Create ()
{
var handle = CFDictionaryCreateMutable (IntPtr.Zero, IntPtr.Zero, IntPtr.Zero, IntPtr.Zero);
if (handle == IntPtr.Zero)
throw new InvalidOperationException ();
return new CFMutableDictionary (handle, true);
}
[DllImport (CoreFoundationLibrary)]
extern static void CFDictionarySetValue (IntPtr handle, IntPtr key, IntPtr val);
[DllImport (CoreFoundationLibrary)]
extern static IntPtr CFDictionaryCreateMutable (IntPtr allocator, IntPtr capacity, IntPtr keyCallback, IntPtr valueCallbacks);
}
internal class CFUrl : CFObject
{
public CFUrl (IntPtr handle, bool own) : base (handle, own) { }
@@ -1287,135 +780,4 @@ namespace Mono.Net
}
}
class CFBoolean : INativeObject, IDisposable {
IntPtr handle;
public static readonly CFBoolean True;
public static readonly CFBoolean False;
static CFBoolean ()
{
var handle = CFObject.dlopen (CFObject.CoreFoundationLibrary, 0);
if (handle == IntPtr.Zero)
return;
try {
True = new CFBoolean (CFObject.GetCFObjectHandle (handle, "kCFBooleanTrue"), false);
False = new CFBoolean (CFObject.GetCFObjectHandle (handle, "kCFBooleanFalse"), false);
}
finally {
CFObject.dlclose (handle);
}
}
internal CFBoolean (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CFBoolean ()
{
Dispose (false);
}
public IntPtr Handle {
get {
return handle;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero){
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
public static implicit operator bool (CFBoolean value)
{
return value.Value;
}
public static explicit operator CFBoolean (bool value)
{
return FromBoolean (value);
}
public static CFBoolean FromBoolean (bool value)
{
return value ? True : False;
}
[DllImport (CFObject.CoreFoundationLibrary)]
[return: MarshalAs (UnmanagedType.I1)]
extern static /* Boolean */ bool CFBooleanGetValue (/* CFBooleanRef */ IntPtr boolean);
public bool Value {
get {return CFBooleanGetValue (handle);}
}
public static bool GetValue (IntPtr boolean)
{
return CFBooleanGetValue (boolean);
}
}
internal class CFDate : INativeObject, IDisposable {
IntPtr handle;
internal CFDate (IntPtr handle, bool owns)
{
this.handle = handle;
if (!owns)
CFObject.CFRetain (handle);
}
~CFDate ()
{
Dispose (false);
}
[DllImport (CFObject.CoreFoundationLibrary)]
extern static IntPtr CFDateCreate (IntPtr allocator, /* CFAbsoluteTime */ double at);
public static CFDate Create (DateTime date)
{
var referenceTime = new DateTime (2001, 1, 1);
var difference = (date - referenceTime).TotalSeconds;
var handle = CFDateCreate (IntPtr.Zero, difference);
if (handle == IntPtr.Zero)
throw new NotSupportedException ();
return new CFDate (handle, true);
}
public IntPtr Handle {
get {
return handle;
}
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
if (handle != IntPtr.Zero) {
CFObject.CFRelease (handle);
handle = IntPtr.Zero;
}
}
}
}
@@ -405,6 +405,7 @@ namespace System.Net
void CloseSocket ()
{
lock (this) {
Debug ($"WC CLOSE SOCKET: Cnc={ID} NS={networkStream} TLS={monoTlsStream}");
if (networkStream != null) {
try {
networkStream.Dispose ();
@@ -412,6 +413,13 @@ namespace System.Net
networkStream = null;
}
if (monoTlsStream != null) {
try {
monoTlsStream.Dispose ();
} catch { }
monoTlsStream = null;
}
if (socket != null) {
try {
socket.Dispose ();
+1 -1
View File
@@ -41,7 +41,7 @@ namespace System.Net
}
#if MONO_WEB_DEBUG
internal string ME => $"WRS({GetType ().Name}:Op={operation.ID})";
internal string ME => $"WRS({GetType ().Name}:Op={Operation.ID})";
#else
internal string ME => null;
#endif
@@ -309,7 +309,7 @@ namespace System.Net
break;
ms.Write (buffer, 0, ret);
}
return ms.GetBuffer ();
return ms.ToArray ();
}
}
@@ -59,6 +59,8 @@ namespace System.Security.Cryptography.X509Certificates
public abstract bool Build (X509Certificate2 certificate);
public abstract void AddStatus (X509ChainStatusFlags errorCode);
public abstract void Reset ();
public void Dispose ()
@@ -110,6 +110,10 @@ namespace System.Security.Cryptography.X509Certificates {
// methods
public override void AddStatus (X509ChainStatusFlags error)
{
}
[MonoTODO ("Not totally RFC3280 compliant, but neither is MS implementation...")]
public override bool Build (X509Certificate2 certificate)
{
+10 -2
View File
@@ -47,12 +47,12 @@
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch' ">
<OutputPath>./../../class/lib/monotouch_watch</OutputPath>
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monotouch_watch</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;COREFX;CONFIGURATION_2_0;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;INSIDE_SYSTEM</DefineConstants>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;COREFX;CONFIGURATION_2_0;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;INSIDE_SYSTEM;MONO_FEATURE_APPLE_X509</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch_runtime' ">
<OutputPath>./../../class/lib/monotouch_watch_runtime</OutputPath>
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monotouch_watch_runtime</IntermediateOutputPath>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;COREFX;CONFIGURATION_2_0;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_MULTIPLE_APPDOMAINS;INSIDE_SYSTEM</DefineConstants>
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_REMOTING;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;COREFX;CONFIGURATION_2_0;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_MULTIPLE_APPDOMAINS;INSIDE_SYSTEM;MONO_FEATURE_APPLE_X509</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_tv' ">
<OutputPath>./../../class/lib/monotouch_tv</OutputPath>
@@ -802,6 +802,7 @@
<Compile Include="Mono.Btls\X509PalImpl.Btls.cs" />
<Compile Include="Mono.Util\MonoPInvokeCallbackAttribute.cs" />
<Compile Include="MonoTouch\Dummy.cs" />
<Compile Include="Mono\AppleTypes.cs" />
<Compile Include="Mono\SystemCertificateProvider.cs" />
<Compile Include="Mono\SystemDependencyProvider.cs" />
<Compile Include="Mono\X509Pal.cs" />
@@ -1324,6 +1325,13 @@
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\FileSystemWatcher.UnknownUnix.cs" />
<Compile Include="..\Mono.Security\Mono.Security.X509.Extensions\AuthorityKeyIdentifierExtension.cs" />
<Compile Include="Internal.Cryptography\OidLookup.Managed.cs" />
<Compile Include="Mono.AppleTls\Enums.cs" />
<Compile Include="Mono.AppleTls\MonoCertificatePal.Mobile.cs" />
<Compile Include="Mono.AppleTls\MonoCertificatePal.cs" />
<Compile Include="Mono.AppleTls\SafeHandles.Mono.cs" />
<Compile Include="Mono.AppleTls\SafeHandles.cs" />
<Compile Include="Mono.AppleTls\X509CertificateImplApple.cs" />
<Compile Include="Mono.AppleTls\X509PalImpl.Apple.cs" />
<Compile Include="System.Net.Mail\SmtpClient.platformnotsupported.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
Loaded 100 of 407 files, more files were not shown because too many files have changed in this diff. Show more