Compare commits

...
Author SHA1 Message Date
Zoltan Varga efae6a06ef [runtime] Make sure ptr-to-structure and structure-and-ptr wrappers are unique, this is needed by full aot. Fixes #20186. 2016-01-15 14:49:54 -05:00
Aaron Bockover b8ca425234 XmlObjectSerialier: fix ISerializable (bxc#37171)
The shim/bridge between Mono and the RS implementation of
XmlObjectSerializer, DataContractSerializer, etc. did not properly
invoke the constructor required by ISerializable, as it completely
omitted passing the populated SerializationInfo object.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=37171
2016-01-14 15:24:11 -05:00
Ludovic Henry 121891d923 [delegate] Fix multicast remove behaviour
The .NET delegate removal semantic is a bit unpredictable. For example, the following (d1 + d2 + d3) - (d1 + d3) is going to return the d123 delegate, and not the d2 delegate as we could have guessed. This is because removal will remove the `list' of delegates as a whole, and not the elements in the list.

The previous implementation would then have a different behavior than the one observed on .NET.

Fixes bug #36646
2016-01-14 15:24:08 -05:00
Ludovic Henry 0d2cf35faf [threadpool] Fix get min and available threads icalls
Fix bug #36414
2016-01-14 15:24:00 -05:00
Alexis Christoforides 9236711689 Bump winconfig.h -> 4.2.2 2016-01-12 18:03:44 -05:00
Vlad Brezae dd5748b0f9 [aot] Don't hardcode the nursery size in aot write barriers
It can be passed at runtime in the nursery-size option of MONO_GC_PARAMS environment variable.

Fixes #35414

Conflicts:
	mono/mini/aot-compiler.c
	mono/mini/aot-runtime.c
	mono/mini/patch-info.h
2016-01-05 15:19:14 -05:00
Zoltan Varga d5c464969e Fix the build. 2016-01-04 16:46:49 -05:00
Zoltan Varga bfa905ce53 [jit] Avoid a verification error in gsharedvt code with ldarga + gshared types. Fixes #36292. 2016-01-04 14:50:09 -05:00
Rodrigo Kumpera 6696d9dfd9 [verifier] Fix the verifiers to handle Roslyn style fixed blocks.
Roslyn used byref vars whenever possible to store fixed statements. This leads to confusion in
both the full verifier and the JIT built-in one.

Now we skip it in the JIT one and allow it when not in strict mode for the full verifier.
2016-01-04 14:31:10 -05:00
Zoltan Varga 07675094c0 [aot] Cache inflated methods loaded from aot images to avoid repeating an expensive search. Fixes #36256. 2015-12-17 17:34:55 -05:00
Alexis Christoforides 216d50527d Merge pull request #2348 from ludovic-henry/4.2.0-fix-threadpool-overflow
[4.2.0][threadpool] Fix overflow of max number of worker threads
2015-12-17 16:27:45 -05:00
Alexis Christoforides d35418ca2a Bump to include packaging change (F# bump to 4.0.1.1) 2015-12-16 11:54:13 -05:00
Zoltan Varga 2e19bf113b [runtime] Implement native-to-managed marshalling of byref delegate arguments. Fixes #35545. 2015-12-15 12:54:41 -06:00
Miguel de Icaza 0b95069fd4 [System.Runtime.Serialization] Static serializer calls directly into internal APIs to fix C6 regression
With C6 we introduced a regression
https://bugzilla.xamarin.com/show_bug.cgi?id=36100, which is caused by
the new static serialization code that we wrote to reuse Microsoft's
serializer.

The code uses Invoke on a series of MethodInfos, and this obscures the
actual code that will be invoked at runtime to serialize certain
objects, causing the following exception:

Attempting to JIT compile method '(wrapper runtime-invoke) <Module>:runtime_invoke_bool_Nullable`1<Decimal> (object,intptr,intptr,intptr)' while running with --aot-only.

This patch makes the simple code work, but a more thorough review of
the code would allow us to remove many of the slow dynamic codepaths
in the serializer.

We opted for that approach to keep the code as similar as possible to the
original.

But the code basically does this:

* Use the XmlFormatGeneratorStatics property InternalSerializeMethod,
  whose sole purpose is to delay computing the MethodInfo for the
  XmlFormatWriterGenerator's InternalSerialize.

* Use the resulting method in a few places to call the MethodInfo.

The MethodInfo was used because the original code uses Reflection.Emit
to create fast serializers and it needs handles to internal methods,
but our static rewriter does not need it.

We should replace all of those uses, but for now, this patch at least
deals with the 36100 bug.
2015-12-15 08:17:22 -05:00
Zoltan Varga 8237bc9af6 Remove some tests added by 43b9ad0a72 by mistake. 2015-12-15 00:53:01 -05:00
Alexis Christoforides 046cd23b40 Merge pull request #2303 from kumpera/remove_fsw_limit
[System] Remove arbitrary debugging limit from FileSystemWatcher on OSX, fixes #28693
2015-12-14 15:45:19 -05:00
Zoltan Varga 4732507d62 [gsharedvt] Fix support for constrained calls on interfaces. Fixes #36383. 2015-12-14 15:35:58 -05:00
Marek Habersack 640b9d0741 Fix endless recursion in XmlCompiledTransform on mobile
One of the XmlCompiledTransform overloads called itself recursively,
leading to either a stack overflow or segfault

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=36436
2015-12-14 15:25:05 -05:00
Miguel de Icaza 7b877872dd [mono/driver] On OSX, increase the number of file handles available.
We just reverted a patch that prevented the FileSystemWatcher from
opening too many file descriptors (200).  That was a band-aid at one
of the spots that opened too many file, as we would exhaust the number
of files, and later abort when some other operation needed files.

The problem is that OSX defaults to 256 file descriptors, and .NET
applications are file descriptor hungry, in fact, many applications
increase their file handled limit before starting.

This patch on OSX will attempt to increase the number of handles
available to 1024 if the number of handles avaialble is less than
that.

The commit that removed the limit was:

2af882232c

And it was closed to fix:

Conflicts:
	mono/mini/driver.c
2015-12-14 15:14:26 -05:00
Alexis Christoforides 7ad84f7adc Merge pull request #2283 from lambdageek/dev/bug-36418-backport-4.2
Bug 36418 backport 4.2
2015-12-14 15:02:09 -05:00
Zoltan Varga 923059c639 [runtime] Fix Thread.CurrentThread in non-root appdomains by setting the tls slot in start_wrapper, otherwise Thread.CurrentThread would create a new Thread object so there would be two. Fixes #35828. 2015-12-14 14:58:58 -05:00
Alexis Christoforides 2b911f11ed Merge pull request #2320 from ludovic-henry/4.2.0-fix-delegate-36640
[4.2.0][delegate] Fix multicast Method property implementation
2015-12-14 14:57:23 -05:00
Alexis Christoforides 11c13515c4 Merge pull request #2328 from BrzVlad/fix-sgen-c6
[sgen] Backport sgen fixes for c6
2015-12-14 14:55:59 -05:00
Alexis Christoforides c043855ce2 Bump version to 4.2.2 2015-12-10 18:44:35 -05:00
Vlad Brezae c70aa59fc2 [sgen] Make sure we scan aligned memory regions
When we suspend a thread, the stack pointer might not be aligned.

Conflicts:
	mono/sgen/sgen-gc.c
2015-12-11 00:34:49 +02:00
Vlad Brezae 21fbd4eeb8 [sgen] Fix marking of cards on 64bit 2015-12-11 00:22:42 +02:00
Zoltan Varga 43b9ad0a72 [jit] Increase the buffer size used by the dyncall data structures to 512, add a test for #36566. 2015-12-10 14:42:05 -05:00
Ludovic Henry e5fad40671 [delegate] Fix multicast Method property implementation
.NET returns the method for the last delegate of the multicast delegate.
2015-12-10 11:04:54 +00:00
Zoltan Varga e409334f88 [profiler] Avoid a crash at shutdown by installing the assembly unload hook for the 'start_unload' event instead of the 'end_unload' event, the latter receives a mostly freed assembly. 2015-12-09 13:01:28 +01:00
Marek Safar 146b74df48 Bump reference source to merge a fix for #36003 2015-12-09 10:00:34 +01:00
Miguel de Icaza c11e75e8e0 [System] Remove arbitrary debugging limit from FileSystemWatcher on OSX, fixes #28693 2015-12-08 12:42:24 -05:00
Alexis Christoforides 3ddba85dc9 Merge pull request #2293 from mono/revert-2292-revert-2230-4.2.0-threadpool-exit-worker
[threadpool-ms] Exit worker thread after 5 to 60 seconds
2015-12-07 15:48:25 -05:00
Marek Safar 65fad4874c [mcs] Set null operator barrier between invocation instance and its arguments. Fixes #33341 2015-12-07 17:28:28 +01:00
Marek Safar 9e29889f02 [System.Data] Implement CommandBehavior.SequentialAccess support for GetValues method. Fixes #35857 2015-12-07 17:25:13 +01:00
Alan McGovern 125833a11d Revert "Revert "[threadpool-ms] Exit worker thread after 5 to 60 seconds"" 2015-12-07 10:48:01 +00:00
Alan McGovern 71a3d43327 Merge pull request #2292 from mono/revert-2230-4.2.0-threadpool-exit-worker
Revert "[threadpool-ms] Exit worker thread after 5 to 60 seconds"
2015-12-07 10:47:58 +00:00
Alan McGovern 91d47d27c8 Revert "[threadpool-ms] Exit worker thread after 5 to 60 seconds" 2015-12-07 10:47:44 +00:00
Alan McGovern a433b69a80 Merge pull request #2230 from ludovic-henry/4.2.0-threadpool-exit-worker
[threadpool-ms] Exit worker thread after 5 to 60 seconds
2015-12-07 10:35:09 +00:00
Zoltan Varga 9e61c73cb0 [profiler] Create a static version of libmono-profiler-log which doesn't link against eglib, to prevent duplicate symbols errors when its linked with the runtime. Fixes part of #29745. 2015-12-04 15:40:37 -05:00
Sebastien Pouliot 39edf24948 [linker] Both the TypeSpecification (T) along with the GenericArguments (G) must be preserved from custom attributes, e.g. T<G> 2015-12-04 15:28:42 -05:00
Alexis Christoforides 02bfbe0481 Merge mono-4.2.0-branch-c6sr0 into mono-4.2.0-branch 2015-12-04 15:04:48 -05:00
Alexander Köplinger 1c09a56dc5 Merge pull request #2211 from akoeplinger/bug-30018-c6sr1
Port fix for Bug 30018 to C6SR1
2015-12-03 14:05:53 -05:00
Alexander Köplinger 11bf512481 Merge pull request #2167 from akoeplinger/bug-34675-c6sr1
Fix for Bug 34675 - mono-4.2.0-branch
2015-12-02 18:22:34 -05:00
Aleksey Kliger 9caf0258a8 Make System.DefaultBinder.CanConvertPrimitive reflexive (Closes #36418) 2015-12-02 17:07:10 -05:00
Aleksey Kliger cf84931d51 Test case for #36418 2015-12-02 17:07:10 -05:00
Radek Doulik 24e1d03575 [linker] match type pattern with nested types
- cherry-picked for C6 SR1

 - this way the following xml will match all the types in the assembly
   MyAssembly

    <linker>
        <assembly fullname="MyAssembly">
            <type fullname="*" />
        </assembly>
    </linker>

   before this change it will only match the types defined in main
   module and none of the nested types
2015-12-01 21:52:17 +01:00
Radek Doulik bb6d8b94e6 [linker] do not try to iterate thru null array
- cherry-picked for C6 SR1

 - fixes the case when custom attribute instance constructor contains
   null value for System.Type[] array
2015-12-01 21:31:39 +01:00
Jonathan Mitchell 70ef083e21 Let Mono live with Xcode on EL Capitan. This was merged into master as 3adcd34f78. 2015-12-01 12:45:58 -05:00
Marcos Henrich 58731e1bbb Merge pull request #2235 from esdrubal/mono-4.2.0-branch
C6 SR1 [corlib] Fixes TimeZoneInfo.ParseTZBuffer abbrevs.
2015-12-01 10:57:53 -05:00
João Matos b0736716ee Merge pull request #2251 from directhex/mono-4.2.0-branch-msvc
MSVC fixes for Cycle 6 branch
2015-12-01 10:27:45 -05:00
Alexis Christoforides a7605b3ba7 Merge pull request #2257 from kumpera/bug_36000
[jit] Fix memory leaks in the generic sharing code by making sure tha…
2015-11-23 11:07:10 -05:00
Zoltan Varga 30015f1127 [jit] Fix memory leaks in the generic sharing code by making sure that values stored into an rgctx slot are never NULL, since otherwise the runtime would recompute them on every access. Fixes #36000. 2015-11-20 13:43:36 -05:00
Jo Shields 599d21e79a [msvc] Fix path to ml64.exe in masm.fixed.props
(cherry picked from commit e3fa11a369)
2015-11-19 14:23:36 +00:00
Marcos Henrich 677ccd3670 [corlib] Fixes TimeZoneInfo.ParseTZBuffer abbrevs.
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=31432

In a few android devices TimeZoneInfo.ParseTZBuffer was failing ito
parse Europe/Moscow with:
at System.ThrowHelper.ThrowKeyNotFoundException ()
at System.Collections.Generic.Dictionary`2[System.Int32,System.String].get_Item (Int32 key)mscorlib/system/collections/generic/dictionary.cs:176
at System.TimeZoneInfo.ParseTimesTypes (System.Byte[] buffer, Int32 index, Int32 count, System.Collections.Generic.Dictionary`2 abbreviations) [0x0002f] in mcs/class/corlib/System/TimeZoneInfo.cs:1293
at System.TimeZoneInfo.ParseTZBuffer (System.String id, System.Byte[] buffer, Int32 length)

It was failing while getting the third index [3] from] from abbrevs.

abbrevs added values were the following:
[0, MMT]
[1, MT]
[2, T]
[4, MST]
[5, ST]
[6, T]
[8, MDST]
[9, DST]
[10, ST]
[11, T]
[13, S]
[15, M]
[17, MSK]
[18, SK]
[19, K]
[21, EET]
[22, ET]
[23, T]
[25, MSD]
[26, SD]
[27, D]
[29, EEST]
[30, EST]
[31, ST]
[32, T]

Index 3 was not added because its values is an empty string, as indexes
with empty values are used in this case we are now adding them to the
abbrevs dictionary.

Fixes #31432
2015-11-16 15:37:41 +00:00
Marcos Henrich a3170c6652 [corlib] Tests TimeZoneInfo.ParseTZBuffer
Context: https://bugzilla.xamarin.com/show_bug.cgi?id=31432

Tests TimeZoneInfo.ParseTZBuffer with Europe/Moscow data that thrown
at System.ThrowHelper.ThrowKeyNotFoundException ()
at System.Collections.Generic.Dictionary`2[System.Int32,System.String].get_Item (Int32 key)mscorlib/system/collections/generic/dictionary.cs:176
at System.TimeZoneInfo.ParseTimesTypes (System.Byte[] buffer, Int32 index, Int32 count, System.Collections.Generic.Dictionary`2 abbreviations) [0x0002f] in mcs/class/corlib/System/TimeZoneInfo.cs:1293
at System.TimeZoneInfo.ParseTZBuffer (System.String id, System.Byte[] buffer, Int32 length)
2015-11-16 15:37:41 +00:00
Alexander Köplinger 90ae50f236 [msvc] Remove left over project guid from mono.sln
The project was removed from the solution in 735fc51cc0, but one instance was missed.
This should fix the Windows build on Jenkins.

(cherry picked from commit a353efb8bb)
2015-11-13 12:25:26 +00:00
Alexis Christoforides 5ded2191cd Fix MSVC build after 1657026514
(cherry picked from commit 735fc51cc0)
2015-11-13 12:25:19 +00:00
Jo Shields b2a9512d01 Remove obsolete mono_install_threadpool* from msvc/mono*.def 2015-11-13 11:16:59 +00:00
Jo Shields b370336cd5 Fix version string for MSVC 2015-11-13 10:18:45 +00:00
triton 87e626328a [msvc] Update Visual Studio project files.
(cherry picked from commit ff141cf1ee)
2015-11-12 16:51:39 +00:00
Jo Shields 7be29019a8 Bundle modified masm.props with fully qualified ml.exe call.
In some more esoteric environments (say bash.exe spawned by
jenkins-slave.exe), the _MASM target's attempts to call ml.exe fail
due to ml.exe missing from $PATH (even when it appears to be fine).

The ClCompile target doesn't suffer this issue, since it uses the
full path to CL.exe rather than assuming CL.exe is in $PATH.
Bundle a lightly patched masm.props to duplicate the ClCompile
target behaviour.

This should have no impact on you unless for some reason you're
using a different MASM to the one provided with MSVC.

(cherry picked from commit 900552b7d3)
2015-11-12 16:51:28 +00:00
BrennanConroy da922677a8 More robust get_address_info
We have been running into this issue: https://bugzilla.xamarin.com/show_bug.cgi?id=30018 a lot recently, after digging into getaddrinfo a bit we saw that the linked list of addrinfo structs had 1 or more valid ones which can be used and 1 bad one which should just be discarded.
2015-11-09 21:15:02 +01:00
pjbeaman 6dd2d0d52b Merge pull request #2202 from mono/revert-2090-mono-4.2.0-branch-bug25480
Revert 8862921b86
2015-11-05 14:28:06 -05:00
David Karlaš e39caabfc4 Revert 8862921b86 2015-11-05 16:45:45 +01:00
Rodrigo Kumpera ce72e1ff24 Merge pull request #2164 from alexrp/mono-4.2.0-branch-profiler-crash
[profiler] Disable the hack to attempt to get code start/size info. (4.2.0)
2015-11-03 14:16:57 -05:00
Alexander Köplinger 5a86dd3421 [System.Core] Make sure DateTime.AddDays() is preserved by the linker in a test
We use the method in the code instead of just via reflection.
This allows the test to work on iOS device builds.
2015-11-02 19:54:24 -05:00
Alexis Christoforides cb99470f97 Revert "[System] Test Socket TCP double bind."
This reverts commit c22742e3f8, and removes the 'TcpDoubleBind' test.
2015-11-02 14:52:47 -05:00
Marcos Henrich a997e5af7f Merge pull request #2146 from esdrubal/mono-4.2.0-branch
Fixes mono-symbolicate in Mono 4.2
2015-11-02 14:26:21 +00:00
Alexis Christoforides 4576dc8594 Bump for another part of #32317 fix 2015-10-30 14:03:52 -04:00
Alexis Christoforides 110fdd8baa Bump to test a Bockbuild-side fix for #32317 2015-10-29 21:44:25 -04:00
David Karlaš 8862921b86 Merge pull request #2090 from DavidKarlas/mono-4.2.0-branch-bug25480
[C6SR1] Bug 25480 - OutputPath property is not set for this project
2015-10-29 20:53:58 +01:00
Marek Safar 7c0dc31b21 [mcs] Support auto-property with private setter with member definition from external assembly. Fixes #35236 2015-10-29 08:52:10 +01:00
Zoltan Varga d41309c59d [llvm] Fix the handling of r4 arguments during calls. Fixes #35044. 2015-10-28 08:57:25 -04:00
Rodrigo Kumpera ebe6609165 Merge pull request #2133 from kumpera/linux-debugger-fix
[sdb] Fix state initialization of suspended threads to work when the debugger thread is not attached. Fixes #34750
2015-10-26 16:55:06 -04:00
Ludovic Henry 158c7da277 [threadpool-ms] Exit worker thread after 5 to 60 seconds
The timeout before exiting a worker thread is random to limit the worst
case scenario where, if the timeout is set to N seconds, the user would
launch a lot of work item simultaneously, at an interval of N + 1
seconds. In this case, we would have to kill all the threads at once,
and starts them all over again 1 second later. The randomization makes
the creation and destruction more linear in time, and avoid burst.
2015-10-26 17:41:29 +00:00
Alexander Köplinger fda525b873 [runtime] Remove explicit support for v4.0.30128 and v4.0.20506
These versions were still binding to the 4.0 mscorlib, which is a reference-only assembly now
and isn't intended for being used at runtime.

This issue manifested itself when someone used e.g. <supportedRuntime version="v4.0.20506"/> in
the app.config, causing the runtime to try loading that version and then bailing out with
"Corlib not in sync with this runtime: expected corlib version 117, found 111." (with 111 being
the corlib version at the time the reference assemblies were generated).

The fix is to remove the specific versions from the supported_runtimes array, causing programs
to automatically use the newest version instead.

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

Other reports:

https://youtrack.jetbrains.com/issue/TW-42700
https://youtrack.jetbrains.com/issue/TW-41337
http://stackoverflow.com/questions/29988698/teamcity-nunitlauncher-running-on-linux-mono-gives-corlib-not-in-sync-with-th
2015-10-23 15:12:08 +02:00
Marek Safar fc228e416c Merge pull request #2161 from akoeplinger/bug-34334-c6sr1
Fixes for Bug 34334 - mono-4.2.0-branch
2015-10-23 12:24:07 +02:00
Alexis Christoforides c706a85c7b Revert "[System] Updated SocketTest.TcpDoubleBind."
This reverts commit 4010f73b57.
2015-10-22 18:55:19 -04:00
Zoltan Varga e8594766a8 [gsharedvt] Inflate methods properly in one case. Fixes #34926. 2015-10-22 18:33:42 -04:00
Alexis Christoforides 6ff1c569c9 Revert "Merge pull request #2135 from esdrubal/mono-4.2.0-branch"
This reverts commit 545185ec94, reversing
changes made to b50293b53d.
2015-10-22 18:30:30 -04:00
Alex Rønne Petersen e665173c67 [profiler] Disable the hack to attempt to get code start/size info.
This is causing crashes by poking into runtime internals, and since we no
longer need this for anything critical, disable it.

https://bugzilla.xamarin.com/show_bug.cgi?id=35171
2015-10-22 22:17:09 +02:00
Alexander Köplinger 9ab01f838f [interpreter] Relax check for forcing compilation for built-in structs
Method calls on structs like DateTime wouldn't work before,
even though we know we don't have self mutating structs in mscorlib.

Fixes part 2 of https://bugzilla.xamarin.com/show_bug.cgi?id=34334
2015-10-22 19:30:50 +02:00
Alexander Köplinger 7e72f20d1e [interpreter] Implement comparing string values in (Not)EqualInstruction
When comparing a string with null the other checks in the interpreter for type equality didn't catch this case
and this ultimately resulted in a NotImplementedException in EqualInstruction and NotEqualInstruction.

The fix is to handle the TypeCode.String case in those instructions.
We don't need to do it for CreateLifted() as that method only applies for Nullable<T> types which doesn't make sense for string.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=34334
2015-10-22 19:30:21 +02:00
Alexis Christoforides 66852f89aa Another bump to include F# packaging fix 2015-10-19 15:09:33 -04:00
Marcos Henrich 704e30fddd [corlib] Changes StackTrace.ToString to use Exception format.
StackTrace.ToString format was different from Exception.ToString.
StackTrace.ToString had an identation of 3 spaces instead of 2, outputed
"line " before the line number which Exception.ToString does not, and it
did not print offsets.

This change allows StackTrace.ToString output to be used by the mono-symbolicate tool.
2015-10-19 14:37:44 +01:00
Marcos Henrich 165249622b Test mono-symbolicate with StackTrace.ToString.
We were testing mono-symbolicate tool with Exception.Tostring stack
traces but now we also test that the tool works with StackTrace.ToString.
2015-10-19 14:37:44 +01:00
Ludovic Henry 545185ec94 Merge pull request #2135 from esdrubal/mono-4.2.0-branch
[System] Added icall SupportsPortReuse.
2015-10-16 11:12:55 +01:00
Marcos Henrich e8d2ecaa4d [System] Added icall SupportsPortReuse.
Linux kernels before 3.9 did not support port reuse.
Added private method System.Net.Sockets.Socket.SupportsPortReuse,
which returns true when the runtime is able to bind to the same address
and port multiple times.
2015-10-15 14:11:54 +01:00
Sandy Armstrong b50293b53d Merge pull request #2131 from sandyarmstrong/mono-4.2.0-branch+mt-runtime
[corlib] Use same Console and Environment logic in monotouch_runtime
2015-10-14 09:42:02 -07:00
Rodrigo Kumpera b37aa3fc8a [sdb] Fix state initialization of suspended threads to work when the debugger thread is not attached. Fixes #34750
The problem happens because thread_interrupt runs in the debugger thread (suspend initiator).

thread_interrupt then calls mono_thread_state_init_from_monoctx which collects the state of the current thread
which is definitely not what we wanted.

There used to be some compensation code after calling mono_thread_state_init_from_monoctx to actually init the state properly.
This is why it worked, at all.

Thew problem is that the debugger thread now might not attach at all under some circumstances, which would trigger
mono_thread_state_init_from_monoctx to return FALSE and trip into the assert.

The fix is to simply not use mono_thread_state_init_from_monoctx at all, just copy the state from data. This fix has the
bonus of getting the domain correctly.
2015-10-13 18:33:00 -04:00
Alexis Christoforides 54ce6bd6ed Revert "[System] Added icall SupportsPortReuse."
This reverts commit f2908d1a5a.
2015-10-13 17:30:12 -04:00
Sandy Armstrong b89abf868e [corlib] Use same Console and Environment logic in monotouch_runtime
The `monotouch_runtime` profile is exclusively used for the monotouch
REPL assemblies used by Xamarin Sketches and Inspector. In those cases,
Console and Environment should behave just the same as in the
`monotouch` profile.

The only real difference between the two profiles should be the presence
of SRE in `monotouch_runtime`.
2015-10-13 11:05:19 -07:00
Alexis Christoforides 3c2754755b Trigger a build to bring in F# El Cap patch and version upgrade. Fixes #34612 2015-10-13 12:27:54 -04:00
Marcos Henrich 390acad06d Merge pull request #2125 from esdrubal/mono-4.2.0-branch
[System] Added icall SupportsPortReuse.
2015-10-13 15:41:30 +01:00
Marcos Henrich f2908d1a5a [System] Added icall SupportsPortReuse.
Linux kernels before 3.9 did not support port reuse.
Added private method System.Net.Sockets.Socket.SupportsPortReuse,
which returns true when the runtime is able to bind to the same address
and port multiple times.
2015-10-13 12:15:10 +01:00
Marek Safar d8b68fd578 [mcs] Resolve target before resolving collection/dictionary initializers. Fixes #34604 2015-10-08 15:08:38 +02:00
Jonathan Pryor 28af3f202a [Mono.Posix] Fix signal tests to run on OS X, Android.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=33558

Several of the Signal-related tests were disabled when running on OS X
because OS X doesn't provide reliable delivery: it will try to deliver
a signal, but if it's already been delivered it won't continue
delivering them. This results in failures such as:

	1) MonoTests.Mono.Unix.UnixSignalTest.TestWaitAny :   Expected: 23061
	  But was:  100000

(Note that "Expected" and "actual" are reversed. Oops.)

Thus, signals are delivered, just "not enough."

As It Happens™, Android is similar: running these tests on
Xamarin.Android results in test failures because not enough signals
are received. (It's not as bad as OS X -- only ~10% off -- but it's
not *all* of the signals either.)

Fix the tests so that they *don't* require that we receive as many
signals as we raise. Instead, assert that all of the UnixSignal
instances actually have a UnixSignal.Count value greater than 0, i.e.
that they've been signaled AT ALL.

Loosening up the tests in this manner allows the tests to pass on
OS X, and should allow things to work as expected on Android.
2015-10-07 14:45:02 -04:00
Alexis Christoforides 29c1622b37 Merge pull request #2104 from ludovic-henry/mono-4.2.0-branch
[corlib] Fix dispose race condition in CancellationTokenSource
2015-10-06 17:57:17 -04:00
Marek Safar fd21271747 [mcs] Add link to closest parent async storey only if it hold captured this. Fixes #34168 2015-10-06 13:22:33 +02:00
Rodrigo Kumpera 70539135ea Revert "Inflate calli generic method signature even if not a wrapper"
This reverts commit 92f4544a12.
2015-10-02 14:51:55 -04:00
Ludovic Henry 155e48717a [corlib] Fix dispose race condition in CancellationTokenSource
The race condition would manifest in the following code:

```
for (int i = 0, total = 100000; i < total; ++i) {
    if (i % 50 == 0)
            Console.WriteLine ("{0}/{1}", i, total);

    var c1 = new CancellationTokenSource ();
    var wh = c1.Token.WaitHandle;
    c1.CancelAfter (1);
    Thread.Sleep (1);
    c1.Dispose ();
}
```

And we would observe the following exception:
```
Unhandled Exception: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'System.Threading.ManualResetEvent'.
 at System.Threading.WaitHandle.CheckDisposed () [0x00016] in /Users/builder/data/lanes/1196/33e00ac6/source/mono/mcs/class/corlib/System.Threading/WaitHandle.cs:426
 at System.Threading.EventWaitHandle.Set () [0x0000c] in /Users/builder/data/lanes/1196/33e00ac6/source/mono/mcs/class/corlib/System.Threading/EventWaitHandle.cs:205
 at (wrapper remoting-invoke-with-check) System.Threading.EventWaitHandle:Set ()
 at System.Threading.CancellationTokenSource.NotifyCancellation (Boolean throwOnFirstException) [0x00051] in /Users/builder/data/lanes/1196/33e00ac6/source/mono/external/referencesource/mscorlib/system/threading/CancellationTokenSource.cs:723
 at System.Threading.CancellationTokenSource.Cancel (Boolean throwOnFirstException) [0x00006] in /Users/builder/data/lanes/1196/33e00ac6/source/mono/external/referencesource/mscorlib/system/threading/CancellationTokenSource.cs:409
 at System.Threading.CancellationTokenSource.Cancel () <0x7d75ada8 + 0x00017> in <filename unknown>:0
 at System.Threading.CancellationTokenSource.TimerCallbackLogic (System.Object obj) [0x00012] in /Users/builder/data/lanes/1196/33e00ac6/source/mono/external/referencesource/mscorlib/system/threading/CancellationTokenSource.cs:538
```

This would be a race condition between the TimerCallbackLogic call to Cancel and the call to Dispose on another thread. You could trigger it more reliably by putting a Thread.Sleep at CancellationTokenSource.cs:599.

Also fixes ConcurrentCancelLinkedTokenSourceWhileDisposing race condition between Cancel and Dispose, by applying the same pattern as CancellationTokenSource.TimerCallbackLogic.
2015-10-02 17:23:08 +01:00
Virgile Bello 92f4544a12 Inflate calli generic method signature even if not a wrapper 2015-10-02 16:07:09 +01:00
Rodrigo Kumpera cc1cf601d6 Merge pull request #2094 from kumpera/el_cap_fix
[runtime] Attempt to resolve DllImport using the installation lib dir.
2015-09-29 18:02:17 -04:00
Zoltan Varga c75e47b524 [jit] Fix the linking of bblocks for switch statements, previously we were linking the bblock containing the range check with the target bblocks as well, causing problems when using llvm. Fixes #34147. 2015-09-29 16:39:19 -04:00
Alexis Christoforides 804ddbc632 [runtime] Attempt to resolve DllImport using the installation lib dir. 2015-09-28 16:31:18 -04:00
Marek Habersack 328e048e15 [test] Fix dependency on compiler behavior for a couple of tests
A couple of tests for System.Reflection.MethodBody assumed the code generated
by the compiler will be the same as the one generated by Mono's MCS. However,
when the code is built by CSC in release mode (version that comes with VS2015
was tested) the optimizations remove locals required by the old version of the
tests. Also, CSC orders the locals differently to MCS and that breaks one of
the tests which relied on the declaration order.
Another difference is that CSC and MCS type a certain local variable differently.
The variable being a byte* in source code is output in IL as such by MCS, but CSC
outputs an int8& - a by-ref type.
The tests are built by VS but they are executed by Mono on Android and so the
differences come up as errors.
This commit fixes both issues by working around the differences.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=33370 when it is included in XA
2015-09-28 11:49:13 -04:00
Marek Habersack e325236fa3 [threadpool] Prevent high CPU usage in certain conditions
Threadpool uses poll(2) to watch the file descriptors for activity but
it can sometimes miss that an fd went into error. When that happens the
poll call is interrupted with EAGAIN since the erroneous fd's events have
already been read and there's nothing left in the queue for it. That, in turn,
causes mono to run the loop so quickly that it uses 100% of the CPU. It happens,
for instance, with Xamarin Studio which can utilize two CPU cores to the full while
idling on the opening screen.

This commit makes sure to remove the descriptors with errors from the poll set and
thus preventing the syscall from being interrupted and returning EAGAIN.
2015-09-25 19:17:52 +01:00
Rodrigo Kumpera aa64024074 [threading] Apparentlty zero is a valid tls key on some systems.
(cherry picked from commit 2437b1ea77)
2015-09-25 13:32:17 +01:00
David Karlaš 3b2029216e [XBuild] Ignoring paths of .csproj, .targets and .sln file paths so in case of missmatch between values in <ProjectReference> or .sln and actual file system continue matching project file path and project 2015-09-24 17:18:26 +02:00
David Karlaš 77972f864d [XBuild] Bug 25480 - OutputPath property is not set for this project
This error was generated when iOS(or any other kind of project, that is referencing other project in solution via <ProjectReference>) wanted to get OutputPath of PCL(or any other referenced project) but it failed in case of IDE because wrong conditions(see .targets files changes). Reason this bug was never discovered before is because PCL project was already loaded before with correct configuration/platform so not having AssignProjectConfiguration target executed had no effect. Reason it appeared in this case(Bug 25480) was that .sln and .csproj<ProjectReference> had folder path defined as XamlSamples but actual file system had xamlsamples(notice different chars casing). So projects.TryGet(filePath, out project) failed, hence project had to be reloaded, and then bug from .targets files showed up...

A bit more details about fix: The AssignProjectConfiguration target assigns configurations to the various @(ProjectReference), and is used from targets like ResolveProjectReferences, which are enabled only while building solution files ( $(BuildingSolutionFile) ) or when invoked from the IDE ( $(BuildingInsideVisualStudio) ). But the AssignProjectConfiguration target ignores the IDE case, which breaks usage of ResolveProjectReferences from the same. Fix up to run for both the cases.
2015-09-24 17:18:14 +02:00
Marcos Henrich 4a18c575ac Merge pull request #2070 from esdrubal/mono-4.2.0-branch
[System] Fix TCP socket reuse.
2015-09-21 14:12:33 +01:00
Marcos Henrich 4010f73b57 [System] Updated SocketTest.TcpDoubleBind.
Multiple threads listening to the same address and port are not possible
before linux 3.9 kernel, where the socket option SO_REUSEPORT was
introduced.

This commit makes TcpDoubleBind sensible to this OS capability.
2015-09-21 14:09:44 +01:00
Marcos Henrich 0fd8e508db [System] Fix TCP socket reuse.
TCP sockets with option SocketOptionName.ReuseAddress were not working on Linux.

Fixes #31557.
2015-09-21 14:09:43 +01:00
Marcos Henrich c22742e3f8 [System] Test Socket TCP double bind.
Test checks that when setting TCP socket option ReuseAddress, it is
possible to bind other sockets to the same endpoint.

Covers #31557.
2015-09-21 14:09:43 +01:00
Marek Safar d120a48340 [corlib] Match es-es NumberGroupSeparator with es. Fixes #34047 2015-09-21 10:00:22 +02:00
Marek Safar d983aa605a Merge branch 'pr/2065' 2015-09-21 09:12:52 +02:00
Zoltan Varga 3b0d49736f Add an 'rgctx' field to MonoDelegate, not yet used. 2015-09-20 14:57:18 -04:00
Alex Rønne Petersen 5c4305818c [mcs] 'future' option is now 'experimental' - clarify in man page and help text. 2015-09-20 08:12:12 +02:00
Alex Rønne Petersen 2d9372887c [profiler] Emit dummy code start/size info in cases where we can't retrieve it. 2015-09-20 08:11:00 +02:00
João Matos 628dfbbc89 Merge pull request #2066 from lukaszunity/start-managed-process-fix-mono-4.2
Process.Start fix for Mono 4.2.0
2015-09-18 11:48:34 +01:00
Lukasz b5fa2b4eda Put quotes around path to mono. Fixes bug where Process.Start will fail for a managed process if the path to mono contains spaces. 2015-09-18 12:08:34 +02:00
Zoltan Varga cf5a450af3 [runtime] Fix a potential buffer overflow in mono_network_get_data (). Fixes #33851. 2015-09-17 14:25:12 -04:00
Ludovic Henry 486936d464 [delegate] Fix NRE on GetHashCode 2015-09-17 17:49:38 +01:00
Ludovic Henry d0b9c74d35 [threadpool-io-poll] Use mono_poll instead of platform specific poll/WSAPoll 2015-09-17 16:38:12 +01:00
Ludovic Henry 5fa2fd3d5c [threadpool-io] Log if an error occured on a socket 2015-09-17 16:38:03 +01:00
Ludovic Henry 77de476c44 [delegate] Fix Equals on Delegate to virtual method
The comparison was failing because we were still using the method field (instead of the Method property), which would then return, in the case of a delegate to a virtual function, the method on the base class, instead of the method on the derived class. Updated the test cases to check that too.
2015-09-17 16:37:12 +01:00
Ludovic Henry 20f555aefb [delegate] Bump BCL version for field added on Delegate 2015-09-17 16:36:07 +01:00
Ludovic Henry 4a7fcac075 [delegate] Fix bug #33218 "Action ReflectedType differs from Delegate ReflectedType" 2015-09-17 16:34:41 +01:00
Zoltan Varga 11ce499c40 [sdb] Avoid aborting the runtime with a breakpoint signal if Debugger.Break () is called, add a MONO_DEBUG=native-debugger-break option to enable it. Fixes #33952. 2015-09-15 15:05:56 -04:00
Marek Safar 90c1daf7dc [mcs] Lift result of null operator over dotted expressions only ending with not null operator on value type. Fixes #33797 2015-09-14 17:17:17 +02:00
Marek Safar dbd64296dc Bump ikvm to merge a fix for #32487 2015-09-11 15:31:39 +02:00
Rodrigo Kumpera 19130f7816 [threading] Allow mono_thread_info_current_unchecked to be called before the tls key it uses is initialized. 2015-09-10 17:37:55 -04:00
Rodrigo Kumpera 4fd72b41e7 Fix the build. 2015-09-10 15:08:37 -04:00
Rodrigo Kumpera c02307527f [suspend] Wrap mmap and unmmap around critical sections to better handle library interposing. Fixes #19379
Instruments uses library interposing to record calls to mmap and munmap. It does take lock within the interposers
which means the async suspend could suspend a thread holding such lock while sgen tries to mmap more memory in,
causing a deadlock.

The workaround is to protect our uses of mmap and munmap in the hopes that they are enough to reduce the likelihood
of those hangs happening.
2015-09-10 14:56:19 -04:00
Marcos Henrich e82dc9b80a Fixes DotNetRelativeOrAbsoluteTest.
Test was not changing Uri.useDotNetRelativeOrAbsolute back to its
previous value.
2015-09-09 19:45:59 -04:00
Zoltan Varga 58a0d6c0f4 Fix a warning. 2015-09-09 17:41:13 -04:00
Rolf Bjarne Kvinge 588a9dfb97 [mono-api-html] Adding members to an interface is a breaking change, so show it in red. 2015-09-09 11:41:50 +02:00
Rolf Bjarne Kvinge 070414b678 [mono-api-info] Sort constructors using full signature.
So that info files can be compared textually to test for api equality.
2015-09-09 10:32:56 +02:00
Rolf Bjarne Kvinge 924615b32a [mono-api-html] Fix printing of Obsolete attributes. 2015-09-08 13:56:04 +02:00
Rolf Bjarne Kvinge c9a6d708a9 [mono-api-info] Sort nested types.
So that info files can be compared textually to test for api equality.
2015-09-08 13:56:04 +02:00
Rolf Bjarne Kvinge 749a6d407e [mono-api-info] Sort methods using full signature.
So that info files can be compared textually to test for api equality.
2015-09-08 12:06:52 +02:00
Marek Safar 4a1653412f [mcs] Null operator on value type extension argument. Fixes #33754 2015-09-08 11:07:11 +02:00
Marek Safar ec95d97fa6 [mcs] Lift result of binary operation on enum types in more cases. Fixes #33723 2015-09-07 20:30:15 +02:00
Zoltan Varga b72b8b187d [aot] Avoid an assert in mono_aot_jit_info_table_find () when the address is right after the end of the method. Fixes #32955. 2015-09-07 09:36:15 -04:00
Rolf Bjarne Kvinge a3bcbb7b58 [mono-api-info] Order interfaces.
So that info files can be compared textually to test for api equality.
2015-09-07 12:58:09 +02:00
Marcos Henrich 74ea9f56e3 Merge pull request #2038 from esdrubal/mono-4.2.0-branch
[corlib] Fixes TimeZoneInfo.GetDaylightChanges.
2015-09-06 19:41:42 +01:00
Marcos Henrich 537f1de77a [corlib] Fixes TimeZoneInfo.GetDaylightChanges.
Fixes #32722.
2015-09-06 19:40:07 +01:00
Marcos Henrich c39fc0cecc [corlib] Test GetSystemTimeZones in all timezones.
Covers #32722.
2015-09-06 19:40:06 +01:00
Marcos Henrich b2cd2b28fc Merge pull request #2037 from esdrubal/mono-4.2.0-branch
[System] UriKind.RelativeOrAbsolute workaround.
2015-09-05 12:08:12 +01:00
Marcos Henrich 67805650b9 [System] UriKind.RelativeOrAbsolute workaround.
In .NET an URI constructor from "/foo" and UriKind.RelativeOrAbsolute is
relative whereas in mono it is assumed as an absolute file path.

This adds another workaround that changes all Uri constructor calls to
behave like .NET when receiving UriKind.RelativeOrAbsolute.

The environment variable workaround consists in setting
MONO_URI_DOTNETRELATIVEORABSOLUTE=true before starting the application:

Reflection workaround:
```
if (Type.GetType ("Mono.Runtime") != null)
    typeof (Uri).GetField ("useDotNetRelativeOrAbsolute",
        BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic).
        SetValue (null, true);
```

WARNING: The workarounds change the behavior of all Uri constructor calls.
Unexpected problems can occur if an used library relies on
UriKind.RelativeOrAbsolute to parse absolute file paths.
2015-09-05 12:06:58 +01:00
Zoltan Varga ec3afb7da4 [jit] Fix crashes in the dwarf writer if the backing field of an enum is not named 'value__'. Fixes #33591. 2015-09-04 17:46:42 -04:00
triton 6a6343c5da [threadpool-io] Fixed the Windows backend to call the correct polling function. 2015-09-03 22:49:13 +01:00
Marek Habersack d0f6e32026 Fix NREX in Linux network change notification code
Linux code uses a netlink socket to be notified about network interface
changes. The code is a bit racy and for that reson it can happen that
the LinuxNetworkChange.OnDataAvailable handler is called after the
socket is destroyed (from a timer event) and socket stored in an
instance variable is already null. This is a race most probably
introduced by the new threadpool or TPL code as it started to happen in
several places (mostly BCL tests on Android, but it's *not* specific to
Android).
The workaround here serves as a quick band-aid to be able to move on,
but a more thorough review of the socket code will be required.
2015-09-03 23:18:42 +02:00
Marek Safar 413cb9b41a Merge pull request #1968 from LogosBible/uribuilder-no-hostname
Fix UriBuilder.ToString() when the host is empty.
2015-09-03 20:46:16 +02:00
Marek Safar 5382fc7b11 [mcs] Use auto-property backing field for setting only when setter is not available. Fixes #33600 2015-09-03 17:37:49 +02:00
Marek Safar f215040500 [mcs] Cache fixed array type expression. Fixes #33573 2015-09-03 13:06:11 +02:00
Ludovic Henry 1ba5bc6aa7 [threadpool-io] Reduce the value of poll_fds_size on socket removal 2015-09-03 10:12:58 +01:00
Ludovic Henry f41fa10aa8 [threadpool-io] Remove sparse-array for poll backend
The sparse-array approach led to better insert/remove performance, by allowing a O(1) access, but led to memory consumption issue. The kernel would, for example, have to parse the whole array, even if it's mostly empty, and that can be an issue for large arrays.
2015-09-03 10:12:57 +01:00
Ludovic Henry 4c84f3c99d [threadpool-io] Remove unecessary operation change
These 2 operations are going to be treated the same in managed, so the change is useless
2015-09-03 10:12:57 +01:00
Ludovic Henry 312c249d36 [threadpool-io] Add log tracing 2015-09-03 10:12:57 +01:00
Ludovic Henry fa0059bb83 [threadpool-io] Rework backend API
The main change is the fd will not be removed from the backend when there is no event to poll, but only when we close the socket. This also reduce the number of functions of the backend.
2015-09-03 10:12:57 +01:00
Ludovic Henry f180a0aa3b [threadpool-io] Move the states table to the selector thread exclusively
This greatly simplify the model of the states as we do not need to worry about modifications in different threads.
2015-09-03 10:12:57 +01:00
Ludovic Henry b17dda2348 [threadpool-io] Disable AIO by default 2015-09-03 10:12:56 +01:00
Marek Safar 864629bacd [mcs] Implements null operator used from both outer and inner expression of the statement. Fixes #33341 2015-09-03 10:58:50 +02:00
Zoltan Varga 9871c89692 [sdb] Fix locals info when two c# level locals are allocated to the same IL local. 2015-09-02 16:40:36 -04:00
Joel Martinez 90d7758e2e [mdoc] Fixes an issue with member and type deletion.
Specifically, when updating classic and unified assemblies, members
that were completely removed from one or both assemblies were not
being removed from the XML. This patch updates mdoc's `DeleteMember`
method to properly handle deletion in all scenarios (normal, classic, unified).

Of course, deletion will still not happen if one of two things is true:

- `--delete` is *not* passed into the `mdoc update` call and the member node
  contains existing documentation.
- `--preserve` *is* passed into the `mdoc update` invocation.

In both of those cases, the member will not be deleted, and a message stating
as such will be written as a warning to the output.
2015-09-02 11:49:17 -04:00
Miguel de Icaza 8eff004670 Bump version, in preparation for a future release 2015-09-02 11:49:09 -04:00
Marek Safar d3f3d95a1c [corlib] Construct specific culture using most specific culture name region. Fixes #33400 2015-09-02 10:58:04 +02:00
Zoltan Varga a88262b52b Revert "[sdb] Disallow nested invokes."
This reverts commit d3e75456b3.

Revert this, it is supported functionality.
2015-09-01 21:22:01 -04:00
Mark Probst 8486317e0b [sgen] Properly synchronize allocated_blocks.
We were missing a memory barrier here.  This might fix the current
intermittent crashes on wrench.
2015-09-01 18:29:21 -04:00
Zoltan Varga 7d8a09f2ed [runtime] Throw an exception instead of asserting when trying to call remoting methods linked away. 2015-09-01 16:17:16 -04:00
Zoltan Varga 393fd6001e [bcl] Disable some tests which rely on fp behavior on mobile. (#33510). 2015-09-01 15:10:16 -04:00
Zoltan Varga cd90e8c706 [ppdb] Fix support for Assembly.LoadFrom(). Fixes #33550. 2015-09-01 15:06:01 -04:00
Zoltan Varga f902ecd5be Revert "[llvm] Disable support for nested clauses again, it still causes test failures like #32583."
This reverts commit 557e9f5c0b.

Revert this as it breaks the build.
2015-09-01 12:24:25 -04:00
Marek Safar 595392d965 [mcs] Remove not implemented from ambiguous static type lookup. Fixes #33527 2015-09-01 11:40:40 +02:00
Zoltan Varga 557e9f5c0b [llvm] Disable support for nested clauses again, it still causes test failures like #32583. 2015-08-31 18:36:30 -04:00
Marek Safar 2701b19413 Revert "[mcs] Don't report error for warnings which are not intended to be compiler warnings. Fixes #33487"
This reverts commit 6dec86a023.
2015-08-31 15:23:59 +02:00
Marek Safar 6dec86a023 [mcs] Don't report error for warnings which are not intended to be compiler warnings. Fixes #33487 2015-08-31 14:16:30 +02:00
Marcos Henrich 70c6478d97 [runtime] Removed duplicated code 2015-08-31 10:26:46 +01:00
Marcos Henrich c24df31a2d Fixes get_module_filename. 2015-08-31 10:14:38 +01:00
Marcos Henrich a832ca5578 Merge pull request #2009 from esdrubal/DotNetRelativeOrAbsolute
[System] UriKind.RelativeOrAbsolute workaround.
2015-08-29 12:29:45 +01:00
Vlad Brezae 90877bd0fb [sgen] Add missing write barriers for the concurrent collector 2015-08-28 18:09:19 -07:00
Vlad Brezae fb9b4f8789 [sgen] Major allocation should not happen while we sweep 2015-08-28 18:08:55 -07:00
Vlad Brezae ae33495a12 [sgen] Clear nursery at gc if we are doing concurrent checks 2015-08-28 18:08:35 -07:00
Vlad Brezae 9173d8aa78 [sgen] Fix scanning of invalid entries within arrays 2015-08-28 18:08:19 -07:00
Marek Habersack 9b990f2b19 Remove stray ifdef 2015-08-28 15:19:52 +02:00
Zoltan Varga 296bc43db3 Fix the build. 2015-08-27 16:29:18 -04:00
Marek Safar bb2eacec40 [mcs] Try to report better error message for file excedding PE/COFF limit. Fixes #32487 2015-08-27 16:17:43 -04:00
Zoltan Varga 6f87943866 [gsharedvt] Disable the box+brtrue optimization for gsharedvt types. Fixes #33324. 2015-08-27 16:15:42 -04:00
Zoltan Varga d3e75456b3 [sdb] Disallow nested invokes. 2015-08-26 16:42:01 -04:00
Dylan Borg f4de388789 fix the x86 build 2015-08-26 12:14:40 -04:00
Zoltan Varga 801e6f8760 [runtime] Fix native backtraces with lldb by closing stdin. 2015-08-25 10:47:52 -04:00
Alex Rønne Petersen b81f846775 [profiler] Add GC handle events with backtraces. 2015-08-25 09:16:48 +02:00
Alex Rønne Petersen 4ca894aaf4 [profiler] Remove CodeAnalyst profiler module.
This product has been discontinued by AMD and we don't even have support for
building this profiler module in the build system anyway; chances are pretty
good that bitrot has set in.
2015-08-25 09:16:41 +02:00
Alex Rønne Petersen 0c74c0342c [profiler] Describe buffer size arithmetic with comments. 2015-08-25 09:16:33 +02:00
Zoltan Varga cdc35fc76b [sdb] Remove the code which stopped single stepping when exiting a runtime invoke, it was only enabled on ios/android, and it doesn't seem to be needed anymore. 2015-08-24 16:53:33 -04:00
Marek Safar 7e42365186 [runtime] Remove eager exception stack construction when it contains dynamic method. Fixes #33064
We used to construct exception stack traces as string at throw site (for dynamic methods) but
that does not work correctly because exception stack trace can be decomposed via
new StackTrace (exception) or merged via ExceptionDispatchInfo both of them need the exception
stack in raw form and not as a string.

Further the format used by local stack builder was not same as format used by
System.Diagnostics.StackTrace.

The orignal reason for the specialization was that dynamic method can be collected
before stack is rendered which leads to stack frame to be reported as

at <unknown method> instead of
at (wrapper dynamic-method)

That should be addressed by gc-link between dynamic method and exception or
stack-frame.
2015-08-21 23:38:16 -04:00
Martin Baulig 1d2c58215f [WFC]: Fix yesterday's commit.
We actually don't need the length check here.  The only place where
the 'ref parameters' could possibly be replaced is at the end of the
private Request() method - to remove the 'IAsyncResult' argument from
and End*() method.

This fixes commit 0b1360c8e3 and bug #32886.
2015-08-19 13:19:50 +02:00
Zoltan Varga 220b9ba759 [sdb] Fix the handling of strings with embedded null values. Fixes #33066. 2015-08-18 17:18:47 -04:00
Martin Baulig 0b1360c8e3 [WCF]: Fix non-byref parameters; bug #32886. 2015-08-18 20:01:54 +02:00
Marek Habersack cff09392e1 [tests] Disable a Unix signal test on Android
The test causes the runtime to silently crash in fashion similar to what
real-time signals do to the runtime (a segfault without a single trace
of a crash, causing the process to just hang)
2015-08-18 14:55:09 +02:00
Marek Safar 08b7103fef [system] Keep excluded socket mobile tests in sync 2015-08-17 18:48:31 +02:00
Marek Safar 4b31a4cd57 [corlib] Update incorrect test 2015-08-17 16:30:40 +02:00
Marek Safar a22465351b [corlib] Propagate captured ExceptionDispatchInfo to user's StackTrace copies. Fixes #32918 2015-08-17 16:28:16 +02:00
Zoltan Varga 4fd7f72a55 [bcl] Fix test failures in the System.ServiceModel tests after 9ffb681d06. 2015-08-15 22:27:23 -04:00
Alexander Köplinger 5345159fdd [corlib] Implement MonoEvent Module property
Add tests for Event-, Method- and ConstructorInfo to verify accessing .Module works (the latter two already worked before this change).
2015-08-15 14:47:42 -04:00
Zoltan Varga 34ea1c350f [jit] Remove some dead code. 2015-08-15 00:08:49 -04:00
Zoltan Varga 917c8f6b12 [gsharedvt] Don't pass non-variable size gsharedvt types by ref. Fixes #32931. 2015-08-14 18:45:49 -04:00
Zoltan Varga 66ddca9cbc [arm] Add support for split reg-stack argument passing to the dyn call code. Fixes #33080. 2015-08-14 14:05:52 -04:00
Rolf Bjarne Kvinge 880b0ddde1 Add specific configure option to enable the WatchOS BCL libraries. 2015-08-14 12:30:43 +02:00
Marcos Henrich 644d8d6571 [runtime] GetModuleFileNameEx
GetModuleFileNameEx now returns a full path instead of the process name.
Fixes #32579
2015-08-14 10:13:21 +01:00
Marcos Henrich b4ff1e3d0f Fixes process names trimmed to 15 chars.
Process names were trimmed to 15 characters. proc_name was used to
retrieve the process name, by looking at its implementation we can see
that it returns a buffer which the size is MAXCOMLEN defined as 16.

When the proc_name result length is equal to 15 (MAXCOMLEN - 1) we now check if
proc_pidpath is able to return a longer process name.

Fixes #32539.
2015-08-14 10:13:20 +01:00
Rolf Bjarne Kvinge 05d33f1888 Build an initial version of System.Net.Http.dll for monotouch as part of the regular BCL build.
We have Facade assemblies that depend on System.Net.Http.dll to exist, so
we can't delay building it (at least one version of it).
2015-08-13 14:45:42 +02:00
Marek Habersack afdc35694b Posix RTS test fixes and Android compatibility
Android's libc (bionic) defines the _GNU_SOURCE macro but fails to adhere
to the GNU sematics in (at least) one case - the strerror_r function.
The function follows XSI semantics instead of the GNU one which caused our
code to segfault on Android. This patch special-cases Android to use the XSI
semantics for strerror_r. This un-breaks some POSX real-time singals tests.

It also makes provisions for detecting whether the real-time signals are safe
to use on the current platform. They are safe for all platforms desktop Mono
runs on, but they're not safe on most Android platforms.
2015-08-13 11:28:09 +02:00
Alexander Köplinger 14804f4582 Revert "[Microsoft.Build.Engine] Fix bug with escaped semicolon and spaces"
This reverts commit 51297ed7ab.

It caused a regression for escaped quotes (%22) in msbuild properties. See https://github.com/mono/mono/commit/51297ed7ab06480df84520c758639b6cef0790d9#commitcomment-11827605.

Disable test that now fails again after the revert. Add new test that verifies the behavior originally broken by the change.
2015-08-13 00:03:42 +02:00
Zoltan Varga 044b879cfb [runtime] Revert part of the previous commit to avoid the profiler crashing. 2015-08-13 00:03:36 +02:00
Zoltan Varga 186ce2fc46 [runtime] Avoid passing gshared methods to clients of the embedding api. 2015-08-13 00:03:28 +02:00
Ludovic Henry 0900418353 Merge pull request #1974 from rolfbjarne/bug32947-4.2.0-pre2
[threadpool-ms-io] Remove unnecessary asserts. Fixes #32947.
2015-08-11 14:20:50 -03:00
João Matos 12eefdae82 [aot] Rewrite the options parser to properly handle arguments.
Basically our previous behaviour was just splitting strings by "," which did not behave as expected when passing strings.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=31996.
2015-08-11 17:44:10 +01:00
Rolf Bjarne Kvinge a1c8874b2c [threadpool-ms-io] Remove unnecessary asserts. Fixes #32947.
Neither is_socket_async_callback nor is_async_read_handler need to
actually successfully load the classes they're comparing against;
if the classes can't be loaded, then the input class is obviously
not of that class.

This occurs when mscorlib is linked, the classes to compare against
might be linked away.

https://bugzilla.xamarin.com/show_bug.cgi?id=32947
2015-08-11 15:13:04 +02:00
Marek Safar 376b2c32bb [corlib] Handle Module in RuntimePropertyInfo. Fixes #32815 2015-08-10 13:05:26 +02:00
Marek Safar 5048da46fe [mcs] Fix string interpolation parsing where inner expression contains { } tokens. Fixes #32832 2015-08-10 11:14:59 +02:00
Ludovic Henry eede15eb71 [runtime] Fix memory corruption due to incorrect use of MONO_OBJECT_SETREF
MONO_OBJECT_SETREF would use mono_gc_wbarrier_set_field which would write over 8 bytes ( *(void**)field = value ), while we want to write over 1 byte here.
2015-08-07 09:32:06 -04:00
Ludovic Henry 5bcb420286 [runtime] Add testing for unhandled exception 2015-08-07 09:31:59 -04:00
Ludovic Henry 3f07b978c4 [runtime] Refactor AsyncResult.Invoke icall and swallow exception on AsyncCallback
The swallowed exception is the behavior we can observe on .NET and Mono 4.0
2015-08-07 09:31:47 -04:00
Ludovic Henry 0d47e98ca4 [bcl] Remove old ThreadPool managed class 2015-08-07 09:27:59 -04:00
Zoltan Varga abc5449308 [runtime] Avoid a memory overflow in Buffer.InternalBlockCopy () if the caller passes in a negative value by mistake. 2015-08-06 22:16:07 -04:00
Marek Safar 5bcc48192c [system.net.http] Add special handling for chunked transfer-encoding httpwebrequest initialization. Fixes #31877 2015-08-05 10:12:27 +02:00
Zoltan Varga ac5452a1b9 Fix the build. 2015-08-04 23:02:23 -04:00
Rodrigo Kumpera b892a92153 [runtime] Reenable Frak TLS on OSX 2015-08-04 22:05:13 -04:00
Marek Safar 8abcfa68f6 [mcs] Cached labels definite assignment check does not need exact match but anything larger than original set satisfies the condition. Fixes #32732 2015-08-04 15:33:55 +02:00
Marek Safar 012cc7f646 [mcs] Special case return expression of Task<Task> in async block. Fixes #32712 2015-08-04 13:02:03 +02:00
Zoltan Varga 3396738374 [arm] Avoid running out of thunk space if the same instruction is patched multiple times. Fixes #32179. 2015-08-03 12:04:27 -04:00
Tom Philpot 64e24dffc1 Fix NRE in CheckAvailableForRecycling. Fixes #32685 2015-08-01 08:55:24 +02:00
Jonathan Pryor 33a75810b5 [mkbundle] Add mkbundle --dos2unix parameter.
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=25086
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=31875
Fixes: https://bugzilla.xamarin.com/show_bug.cgi?id=32171

Reverts and reworks commit bcfec743.

The problem is that when Xamarin.Android is running mkbundle, dos2unix
should NEVER be used, because the Android NDK NEVER wants Unix-like
paths, which is what dos2unix creates.

Commit bcfec743 attempted to fix this by removing dos2unix invocation
from the Xamarin.Android codepath.

The problem is that the logic was backwards: it removed dos2unix
invocation when XAMARIN_ANDROID was NOT defined, and PRESERVED
dos2unix invocation when XAMARIN_ANDROID WAS defined.

Meaning commit bcfec743 broke normal/default mkbundle.exe use on
Windows -- it would no longer probe for and use dos2unix if present --
and Xamarin.Android use of mkbundle continued to check for and use
dos2unix if it was present, continuing the buggy behavior.

Doh!

Thus, a reworking: Add a `mkbundle --dos2unix` parameter.
If `mkbundle --dos2unix=false` is specified, dos2unix will NOT be
probed for, and will NOT be used. If `mkbundle --dos2unix` or
`mkbundle --dos2unix=true` is used, then dos2unix WILL be used.

This allows the caller to consistently, ahead of time, control
mkbundle's behavior regarding dos2unix, which will e.g. allow
Xamarin.Android to *always* specify --dos2unix=false, allowing things
to build as desired there.
2015-07-31 15:36:32 -04:00
Marek Safar 2d1c17d47e [runtime] Add 2.0 build assemblies to remapping table. Fixes #32561 2015-07-31 13:52:45 +02:00
Martin Baulig c133880bc4 [System]: Fix WebConnectionStream.SetHeadersAsync() logic for #31830.
This fixes commits 8ccfe0f8ff and
c109f9ca03.

Added new test:
https://github.com/xamarin/web-tests/commit/d60bc3f637ca2bf4aa1379b839d878e224d344c8
2015-07-30 15:36:43 +02:00
Sebastien Pouliot 6b6e7ca19e [tests] iOS9 (beta) have fixed bug #27864, adjust test 2015-07-29 16:45:58 -04:00
Martin Baulig c109f9ca03 Revert "[System] Don't assume WebConnectionStream of unknown http methods require write stream. Fixes #31830"
This reverts commit 8ccfe0f8ff.

This commit breaks the Content-Type logic for existing HTTP verbs such as for instance
using DELETE with an empty body [1].  Added two new test cases [2] and [3] to the stable
branch of the web-tests (https://github.com/xamarin/web-tests/tree/stable) for the particular
scenario from bug #31830 as well as the default HttpClient.SendAsync() without a Content [4].

The rules are as follows:

1.) HttpWebRequest adds the Content-Length header if and only if you're calling
    GetRequestStream(); a length of 0 will be used if you don't actually write
    any content.

    This is true for POST, PUT, DELETE and "obscute" verbs.

2.) HttpClient.SendAsync() always adds a Content-Length header.

Tests:

[1] https://github.com/xamarin/web-tests/blob/31b8fed0ec1283b8c0693bb14d1ac266792c1020/Xamarin.WebTests/Xamarin.WebTests.Tests/TestPost.cs#L84

[2] https://github.com/xamarin/web-tests/blob/31b8fed0ec1283b8c0693bb14d1ac266792c1020/Xamarin.WebTests/Xamarin.WebTests.Tests/TestPost.cs#L296

[3] https://github.com/xamarin/web-tests/blob/31b8fed0ec1283b8c0693bb14d1ac266792c1020/Xamarin.WebTests/Xamarin.WebTests.Tests/TestHttpClient.cs#L134

[4] https://github.com/xamarin/web-tests/blob/31b8fed0ec1283b8c0693bb14d1ac266792c1020/Xamarin.WebTests/Xamarin.WebTests.Tests/TestHttpClient.cs#L127

(cherry picked from commit 3f1ae72f1b385c3c5e4b5ac2b93d13418c020f02)
2015-07-28 21:14:18 +02:00
Marcin Cieslak 3b17abfb9b [mswin][build] unbreak windows build on 'updates_signal' 2015-07-27 15:20:49 -04:00
Marek Safar 8331376182 [mcs] Reset doc reader state after expression bodied property. Fixes #32456 2015-07-27 14:12:01 +02:00
Marek Safar 84b3dda86f [Mono.Debugger.Soft] Exclude invalid C# code 2015-07-24 18:10:58 +02:00
Marek Safar e8c3f7719e [mcs] Fix crash during ambiguous implementation of the query pattern error reporting. Fixes #32060 2015-07-24 17:31:24 +02:00
Marek Safar ae9fcd19f0 [mcs] struct parameterless instance constructor feature was removed from C#6 for compatibility reasons 2015-07-24 15:55:27 +02:00
Zoltan Varga 5a5d899da0 [runtime] Avoid stack overflow when marshalling an out stringbuilder argument in pinvoke callbacks. Fixes #31932. 2015-07-23 23:09:02 -04:00
Zoltan Varga bf863dbc46 [arm] Allocate thunk space for tail calls. Fixes #32179. 2015-07-23 23:04:34 -04:00
Zoltan Varga 362468798c [gsharedvt] Set exception_message when disabling LLVM. 2015-07-22 20:29:14 -04:00
Zoltan Varga 118291ff5d [arm] Enable support for a few more calling conventions for LLVM. 2015-07-22 20:29:07 -04:00
Marek Habersack 2610994023 [tests] Android 4.4.4 doesn't have signal(2) 2015-07-22 00:13:18 +02:00
Marek Habersack 53b8083989 [tests] Fix path used by the test so that it works on Android 4.4.4 2015-07-22 00:13:18 +02:00
Marek Habersack 59f2da8400 [tests] Disable on Android, getpwnam_r doesn't exist there 2015-07-22 00:13:18 +02:00
Marek Habersack 44ba163605 [tests] Don't assume CWD is writable
Use temporary path instead. CWD is / on Android and is not writable
2015-07-22 00:13:17 +02:00
Marek Habersack 8373e4943d [tests] Nunit syntax helpers don't exist in Xamarin.Android 2015-07-22 00:13:17 +02:00
Zoltan Varga 65b1b10846 [llvm] Fix a problem introduced by 4a685f44c8, the size of the return type was computed incorrectly. 2015-07-21 18:12:06 -04:00
Rodrigo Kumpera 3409240895 [profiler] Correct the profiler format. 2015-07-21 18:05:30 -04:00
Rodrigo Kumpera 3a7212a46e [profiler] Use version 11 for the 4.2 profiler changes plus fix docs on format. 2015-07-21 18:05:24 -04:00
Rodrigo Kumpera 24b917c8a1 Merge pull request #1926 from alexrp/profiler-improvements
More profiler improvements
2015-07-21 18:04:59 -04:00
Zoltan Varga 2efa0cc807 [llvm] Add support for returning vtypes as a scalar, this is used on arm64. 2015-07-21 16:41:18 -04:00
Zoltan Varga 5f01b80b43 [llvm] Add support for pass/returning vtypes by ref. 2015-07-21 16:41:18 -04:00
Ludovic Henry b3838e42d1 [runtime] Make sure EPOLLONESHOT is defined 2015-07-21 12:18:21 -03:00
Marek Safar eb2aad684f [corlib] Use better names for predefined encodings. Fixes #32137 2015-07-21 14:45:34 +02:00
Marek Habersack 080036d99b [test] Fix test on Android
On Android application runs with its CWD set to / and so the path
test modified in this commit expects to find a path of the //one form
which is not what the combine operation returns.
2015-07-21 11:15:32 +02:00
Marek Habersack eafd3db1ab [tests] Disable some tests on Android due to missing APIs
bionic doesn't have the following entries:

  setgrent
  getgrnam_r
  setpwent

API 21 in the NDK conditionally declares some of those but they are absent
from either libc.so or libc.a.
2015-07-21 11:15:32 +02:00
Marek Safar 1f85a26443 [mcs] Set builder for partial method definition attributes. Fixes #31948 2015-07-21 11:12:17 +02:00
Rodrigo Kumpera 27b4ff05b6 [lock-tracer] Small improvements to the decoder. 2015-07-20 19:02:29 -04:00
Rodrigo Kumpera c59699fa3b [lock-decoder] Update it to include the threads lock. 2015-07-20 19:02:21 -04:00
Rodrigo Kumpera 5fa2f04f19 [runtime] Safe publish MonoImage::name_cache and exploit that around the runtime. Fix ImageLock nested use. 2015-07-20 19:02:15 -04:00
Rodrigo Kumpera e665f8967e [mini] Fix locking order violation in mono_get_seq_points.
mono_get_seq_points takes the domain lock then calls mini_get_shared_method.

mini_get_shared_method then calls into general metadata code that eventually take
the loader lock.

The loader lock has precedence over the domain lock.
2015-07-20 19:00:35 -04:00
Rodrigo Kumpera cb6829d336 [build] Rename RUNTIME variable to avoid clash with make.config's version
Starting with 62c86e2243 mono/mini/Makefile now includes mcs/build/config.make.
Both files define RUNTIME, but with different values. The mini one requires the usage of MONO_PATH while the one in
mcs don't.

To fix that we rename the mini var to MINI_RUNTIME.
2015-07-20 19:00:31 -04:00
Rodrigo Kumpera 2fabccfb08 [runtime] Fix locking in mono_image_file_for_image. 2015-07-20 19:00:27 -04:00
Ludovic Henry 9391cdcd27 [threadpool-ms-io] Factor update removing 2015-07-20 16:19:18 -03:00
Ludovic Henry 86084a1870 [threadpool-ms-io] Remove socket synchronously from backend when closing socket
To achieve this, we need to wait for the update to be applied to the backend.

This is mainly for the epoll backend, as we do not need to remove the fd from the backend when using kqueue.
2015-07-20 16:19:18 -03:00
Ludovic Henry c68e23c85c [threadpool-ms-io] Fix epoll socket close/remove race condition
With the previous commit, it fixes a range of bug that happens only with epoll. This is because, contrary to poll and kqueue, epoll keeps an internal state that has to be kept in sync with the threadpool_io->states hash table.

This threadpool_io->states hash table is keeping a list of file descriptor to watch, with the corresponding SocketAsyncResult to callback in case of event on the fd. But epoll also keeps its internal state that needs to me modified with EPOLL_CTL_ADD, EPOLL_CTL_MOD and EPOLL_CTL_DEL.
Contrary to kqueue, EPOLLONESHOT does not force epoll to remove the socket from its internal state once an event have been triggered; but it will just not fire this event again, until this event is reset. Also, epoll will remove a fd from its internal state when this fd is closed.

This will lead to a bunch of out-of-sync states like the following :
 - the user start reading asynchronously the STDOUT of a child process, the child process quit (closing the STDOUT fd), this fd is reused by the OS for something else (like a socket), the IO threadpool call epoll_ctl with EPOLL_CTL_MOD (because the fd is still in the states hashtable), but the OS returns an error because the underlying file is different, even if the fd is the same.
 - the user opens a socket, does some asynchronous operation on it, and close it; removing it from the table but not from epoll (as it does not call epoll_ctl with EPOLL_CTL_DEL). For another reason, the fd has not been closed in the OS (and thus in epoll), because it might, for example, still be open by another process. After that, we receive an event for this fd (as it is still in epoll), and between the time of the epoll_wait and the epoll_ctl with EPOLL_CTL_DEL, the fd is actually closed in the OS, leading to a EBADF error.

The g_warning have also been replaced by g_error, so we do not silently discard this kind of error in testing.
2015-07-20 16:19:18 -03:00
Ludovic Henry 72275b5e74 [bcl] Remove ProcessAsyncReader handle from IO ThreadPool on closing 2015-07-20 16:19:17 -03:00
Ludovic Henry 8a26b5a034 [threadpool-ms-io] Rework some utility functions 2015-07-20 16:19:17 -03:00
Ludovic Henry 20cf9e3dbf [threadpool-ms-io] Replace the 2 locks by only 1 2015-07-20 16:19:17 -03:00
Ludovic Henry 510f4d4f71 [utils] Factor lazy initialization of threadpool-ms and threadpool-ms-io for use by other modules 2015-07-20 16:19:16 -03:00
Zoltan Varga ec44efbd8d [gshared] Fix constrained partial calls to Object:GetType (). 2015-07-20 15:15:38 -04:00
Marek Safar 1ca4d2bc72 [mcs] Add missing interpolated string segmnent clone. Fixes #32135 2015-07-20 19:34:31 +02:00
Marek Safar 9f936798b8 [mcs] Parentheses expression can act as conditional access receiver. Fixes #32130 2015-07-20 18:43:38 +02:00
Marek Safar 4400165ac2 [mcs] Resolve nullable expression before unwrapping. Fixes #32054 2015-07-20 18:43:24 +02:00
Radek Doulik 29de937efd [linker] Instead of preserving every method with a [Register] attribute...
[merged from monodroid by rodo]

part of

commit 0b9c100b60fc2502a0d6347d50cac444bb82b285
Author: Jonathan Pobst <[email protected]>
Date:   Wed Sep 28 15:50:39 2011 -0500

    Instead of preserving every method with a [Register] attribute on it in Mono.Android.dll, only save the things that the user actually uses.  Reduces HelloWorld release apk by ~1.3MB.
2015-07-19 10:57:22 +02:00
Radek Doulik 9c9500fe48 [linker] return count of marked methods
[merged from monodroid by rodo]

 - part of

commit 216f75038afee2105182fc6af329f1fc83c4298f
Author: Radek Doulik <[email protected]>
Date:   Sun Nov 23 11:40:42 2014 +0100

    [linker] mark methods (from Register attr) in base type when needed

     - fixes #10268
     - methods from these Register attributes were not marked:

       https://github.com/xamarin/monodroid/blob/master/src/Mono.Android/src/Android.Widget/AdapterView.cs#L132-135

       because the app used class derived from BaseAdapter class and the methods
       existed only in the base class and were not marked
2015-07-19 10:57:04 +02:00
Radek Doulik b440f7a673 [linker] fix Linking for assemblies with type forwarders (like PCL)
[merged from monodroid by rodo]

commit 840487dd904a5552f77dcc7388b27c37ca09169f
Author: Radek Doulik <[email protected]>
Date:   Thu Oct 16 20:03:58 2014 +0200

     - sometime the assemblies with action set to Copy still might
       contain type references to forwarders and thus point to
       Delete assemblies, which are removed during linking, resulting
       in unresolvable type references

     - fixes https://bugzilla.xamarin.com/show_bug.cgi?id=23617
       XA forms template now builds and works OK
       XA app template builds and works OK
2015-07-19 10:56:31 +02:00
Radek Doulik eabc704b94 [linker] process only .xml files, catch xml exceptions
[merged from monodroid by rodo]

commit f51f044e30b822f191777a395563ef9d46f8b69d
Author: Radek Doulik <[email protected]>
Date:   Wed Mar 4 18:28:59 2015 +0100

     - fixes #27620

     - in this case we were trying to process Application.java
       as linker an assembly XML linker description, which led
       to uncaught XmlException
2015-07-19 10:56:13 +02:00
Radek Doulik 235168ae74 [linker] In ResolveFromXmlStep, bail if no <linker> element is found.
[merged from monodroid by rodo]

commit 2edecdc39ca55c65de4f57557e5e31b5d432eaa4
Author: Alex Rønne Petersen <[email protected]>
Date:   Mon Jul 1 15:35:59 2013 +0200

    The BlacklistStep pass will feed the ResolveFromXmlStep pass XML files
    that may not necessarily *be* linker descriptor files. This can happen
    if an embedded file happens to be named "Foo.Bar.xml" and an assembly
    called Foo.Bar is referenced in a project. The chances of this happening
    are probably very low, but better safe than sorry.
2015-07-19 10:56:03 +02:00
Radek Doulik 9c71282be7 [linker] Fortify the BlacklistStep.
[merged from monodroid by rodo]

commit 3001f693c52be0da673446179daf498265024867
Author: Alex Rønne Petersen <[email protected]>
Date:   Tue Jul 30 20:06:21 2013 +0200

    1. Catch XmlExceptions in case of broken XML files.
    2. Only process files that actually end in ".xml".
2015-07-19 10:55:21 +02:00
Radek Doulik e4c78936cd [linker] Support linker descriptor files embedded in the assemblies being linked.
[merged from monodroid by rodo]

commit 3e19b22eb24ff9faeebe1ace7461d8f91f807041
Author: Alex Rønne Petersen <[email protected]>
Date:   Mon Jul 1 15:34:26 2013 +0200

    This is in addition to those files that are already embedded in the linker assembly
    itself (such as mscorlib.xml). People can use this feature to tell the linker that
    certain methods/fields/types must be kept if a particular assembly is being referenced
    by embedding a descriptor file in it.
2015-07-19 10:54:55 +02:00
Ludovic Henry 40024f85b8 [threadpool-ms] Use define for monitor thread minimal lifetime 2015-07-16 16:30:48 -03:00
Ludovic Henry 23e0541b01 [threadpool-ms] Fix monitor thread starting and ending at a multiple times per second 2015-07-16 16:25:02 -03:00
João Matos 0d045cb82b [runtime] Implemented MonoContext for WatchOS using ucontext.
We cannot use inline assembly for WatchOS.
2015-07-16 18:54:24 +01:00
Marek Habersack 44a3f5cb6a [tests] Fix tests on OS/X
OS/X, like Android, uses a symlink for the $TMP directory. The tests used to assume
that the link points to the /private/tmp directory (which is the case) but earlier
changes introduced here for Android employed a more generic mechanism to determine the
actual temporary directory.
This commit removes the '/private' prefix assumption from OS/X
2015-07-16 17:52:29 +02:00
Marek Habersack 3784c69c2f [tests] Disable until a server that works is found
This test depends on server behavior. I changed the server to xamarin.com
earlier on, but it stopped behaving as required recently. The test should
not rely on random servers, so until we have a server we can rely on I'm
disabling it.
2015-07-15 20:41:41 +02:00
Marek Habersack 2c821dd384 [tests] Crashes on Android 64-bit
Disable for all other architectures as well, as there's not enough
flexibility in this respect :(
2015-07-15 20:41:41 +02:00
Marek Habersack 1d9c46ad68 [tests] Disable on Android due to runtime segfault
The Dispose call in FakeSafeHandle causes the Mono runtime to segfault
when passing the call up the chain. As a consequence of disabling the
base class call, the other tests disabled by this commit fail.
2015-07-15 20:41:40 +02:00
Marek Habersack c68dc66765 [tests] Runtime segfaults on Android, probably due to AppDomain.Unload 2015-07-15 20:41:40 +02:00
Marek Habersack 95cb416bbf [tests] Disable tests not working on mobile platforms 2015-07-15 20:41:39 +02:00
Marek Habersack add93988d1 [tests] Add Xamarin.Android assembly name to list of probes 2015-07-15 20:41:39 +02:00
Marek Habersack f3fd8cb951 [tests] Disable on Android due to environment differences
Assemblies in Xamarin.Android cannot be accessed as FileStream/files directly
2015-07-15 20:41:38 +02:00
Marek Habersack f8f6a0d431 [tests] Adjust the test for Android-specific behavior 2015-07-15 20:41:37 +02:00
Marek Habersack b261748f35 [tests] Disable on Android due to environment differences
Xamarin.Android doesn't ship with the Mono.Compilerservices.SymbolWriter
assembly that is required by this test.
2015-07-15 20:41:37 +02:00
Marek Habersack f822059758 [tests] Assembly.GetEntryAssembly works differently on Android
There's no entry assembly as such, adjust the test accordingly.
2015-07-15 20:41:36 +02:00
Marek Habersack e882a125ee [tests] Disable on Android due to environment differences
It's not possible to save the assembly in the current directory on Android and AssemblyBuilder.DefineDynamicModule will not
allow a full path to the assembly to be passed to it. Trying to change the current directory before saving will not work either as
FileStream will then prepend / to the file name (perhaps it's another bug) and write access to the filesystem root is, obviously, denied
2015-07-15 20:41:36 +02:00
Marek Habersack 554247cd6a [tests] Disable on Android due to environment differences
Xamarin.Android doesn't ship with the Mono.Compilerservices.SymbolWriter
assembly that is required by this test.
2015-07-15 20:41:35 +02:00
Marek Habersack 7c7b648cf1 [tests] Disable on Android
Fails with System.MethodAccessException : Method `t17:.ctor ()' is inaccessible from method `t18:.ctor ()'
2015-07-15 20:41:35 +02:00
Marek Habersack 815079d694 [tests] Disable parts relying on APIs not in Mobile Profile 2015-07-15 20:41:34 +02:00
Marek Habersack 4e13efc5de [tests] The test crashes the runtime 2015-07-15 20:41:33 +02:00
Marek Habersack 83af81148a [tests] Disable code to prevent Mono runtime crash
AppDomain unloading causes a segfault with the Mono runtime on Android.
Until the cause is found and fixed this code must remain disabled.
2015-07-15 20:41:33 +02:00
Marek Habersack cbf56e58ce [tests] Disable on Android due to environment differences
Xamarin.Android doesn't ship with the Mono.Compilerservices.SymbolWriter
assembly that is required by this test.
2015-07-15 20:41:32 +02:00
Marek Habersack 7128850271 [tests] Disable on Android due to environment differences
DefineResource doesn't allow path in its fileName parameter and the
test attempts to write to / in effect (which is the default CWD for
Android apps)
2015-07-15 20:41:32 +02:00
Marek Habersack 4c276327d3 [tests] Xamarin.Android works the same way as the desktop Mono 2015-07-15 20:41:31 +02:00
Marek Habersack 1e9aea859d [tests] Adjust test to work in unsupported scenarios
On Android (possibly on other systems too) it is possible that no gateway address is available and its lack is NOT an error
Here is a sample of /proc/net/route from Nexus 9 running Android 5.1.1 (IPInterfaceProperties parses that file on Linux)

  Iface	Destination	Gateway 	Flags	RefCnt	Use	Metric	Mask		MTU	Window	IRTT
  wlan0	0001A8C0	00000000	0001	0	0	0	00FFFFFF	0	0	0

Gateway is set to any address and it is explicitly ignored by the route information parser

For comparison, here's route contents from an Android 4.4.4 device:

  Iface	Destination	Gateway 	Flags	RefCnt	Use	Metric	Mask		MTU	Window	IRTT
  wlan0	00000000	0101A8C0	0003	0	0	0	00000000	0	0	0
  wlan0	00000000	0101A8C0	0003	0	0	203	00000000	0	0	0
  wlan0	0001A8C0	00000000	0001	0	0	0	00FFFFFF	0	0	0
  wlan0	0001A8C0	00000000	0001	0	0	0	00FFFFFF	0	0	0
  wlan0	0001A8C0	00000000	0001	0	0	203	00FFFFFF	0	0	0
  wlan0	0101A8C0	00000000	0005	0	0	0	FFFFFFFF	0	0	0

Obviously, this test fails on the first device and succeeds on the second. For this reason the test is modified to succeed
in case of devices like the first one since it's not a real failure but a shortcoming of the .NET API
2015-07-15 20:41:31 +02:00
Marek Habersack b67536d46e [tests] Fix tests which rely on temp dir location being a real dir
Android M (that's where I ran into it) makes the path returned by
Path.GetTempPath () a symlink to the real directory used for temporary
files. When the tests change the directory the symlink is followed and
subsequent reads of the current directory name will return the real dir
name which doesn't match what was constructed using the value returned by
GetTempPath ()
2015-07-15 20:41:30 +02:00
Marek Habersack 4dcaef892a [tests] Fails on Android ARM64
The test works on all the other supported architectures but segfaults on
ARM64 (Nexus 9 running Lollipop 5.1.1)
2015-07-15 20:41:29 +02:00
Marek Habersack f2b1ae76b5 [test] Disable on Android for now
The test throws the following exception

  MonoTests.System.Security.Cryptography.AesCfbTests.Roundtrip=System.Security.Cryptography.CryptographicException : Bad PKCS7 padding. Invalid length 236.
  at Mono.Security.Cryptography.SymmetricTransform.ThrowBadPaddingException (PaddingMode padding, Int32 length, Int32 position) <0x3bf26858 + 0x000bb> in <filename unknown>:0
  at Mono.Security.Cryptography.SymmetricTransform.FinalDecrypt (System.Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) <0x3bf264f8 + 0x0022f> in <filename unknown>:0
  at Mono.Security.Cryptography.SymmetricTransform.TransformFinalBlock (System.Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount) <0x3bf219b0 + 0x00077> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.CfbTests.Decryptor (System.Security.Cryptography.SymmetricAlgorithm algo, System.Byte[] encdata) <0x3bf261f8 + 0x00221> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.CfbTests.CFB (System.Security.Cryptography.SymmetricAlgorithm algo, Int32 feedbackSize) <0x3bf20000 + 0x0011b> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.AesCfbTests.CFB (System.Security.Cryptography.SymmetricAlgorithm algo) <0x3ca53ef0 + 0x00043> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.CfbTests.ProcessPadding (System.Security.Cryptography.SymmetricAlgorithm algo) <0x3ca53e80 + 0x0004f> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.CfbTests.ProcessKeySizes (System.Security.Cryptography.SymmetricAlgorithm algo) <0x3bf3fc20 + 0x000b7> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.CfbTests.ProcessBlockSizes (System.Security.Cryptography.SymmetricAlgorithm algo) <0x3bf3f910 + 0x0007b> in <filename unknown>:0
  at MonoTests.System.Security.Cryptography.AesCfbTests.Roundtrip () <0x3bf3cf28 + 0x00073> in <filename unknown>:0
  at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
  at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) <0x3bf3cc10 + 0x0008f> in <filename unknown>:0
2015-07-15 20:41:29 +02:00
Marek Habersack 88a3f06371 [tests] Don't use Assembly.Location on Android
Assembly.Location will contain just the assembly file name without any path, which
is not what the test(s) expect. The reason is that the assemblies on Android live
in the APK, are embedded in the native code or don't exist at all (AOT)
2015-07-15 20:41:28 +02:00
Marek Habersack 2bc21e8d37 [tests] Android behaves the same as desktop Mono
The same exceptions are thrown in Xamarin.Android, unlike in Xamarin.iOS which
behaves differently to desktop Mono
2015-07-15 20:41:28 +02:00
Marek Habersack 9f552c56d4 [tests] Disable for Android
The test works when only its fixture is ran, fails when ran as part of the
entire BCL test suite.
2015-07-15 20:41:27 +02:00
Marek Habersack e3fec9e89d [tests] Disable because URL is no longer there
The test relies on presence of a specific file that is now gone. Disabled
until a stable URL is found :P
2015-07-15 20:41:27 +02:00
Marek Habersack 0844ab738a [tests] Disable for Android
The test works when only its fixture is ran, fails when ran as part of the
entire BCL test suite.
2015-07-15 20:41:26 +02:00
Marek Habersack 2b4bd5351e [tests] Disable for Android
The test works when only its fixture is ran, fails when ran as part of the
entire BCL test suite.
2015-07-15 20:41:25 +02:00
Marek Habersack ffb69e3ed0 [tests] Android doesn't have access to Assembly.Location
Attempts to access the test dll which won't work on Android since the
dll is either in the apk or bundled in the native code or not there at
all (AOT)
2015-07-15 20:41:25 +02:00
Marek Habersack 5a20bf3669 [tests] Disable for Android
The tests work fine if only this fixture is ran, they fail when ran as part
of the entire test suite.
2015-07-15 20:41:24 +02:00
Marek Habersack aac7b3d216 [tests] Disable for Android
The tests work fine if only this fixture is ran, they fail when ran as part
of the entire test suite.
2015-07-15 20:41:24 +02:00
Marek Habersack abe3adff5f [tests] System zlib errors out for these on Android 2015-07-15 20:41:23 +02:00
Marek Habersack 5e0a6c3b13 [tests] Large locks not supported on Android
While bionic reports it supports 64-bit offsets for locks and exposes the
necessary APIs, attempt to use offsets larger than 32 bits results in
an error.
2015-07-15 20:41:23 +02:00
Marek Habersack 370d4195f0 [tests] The test hangs on Android 2015-07-15 20:41:22 +02:00
Marek Habersack 18c9d7d27f [tests] The test hangs on Android 2015-07-15 20:41:21 +02:00
Marek Habersack 80dc792e4c [tests] Use xamarin web server
http://elmundo.es/ started to send more than one cookie while
xamarin.com sends just one.
2015-07-15 20:41:21 +02:00
Marek Habersack e821deecbc [tests] Don't assume specific charset
Don't assume a specific charset in HTTP response from a server. Google
changes response charset based on the country of the client's
IP. There's no point in checking for the specific charset, it's enough
to check whether the response header has correct format.
2015-07-15 20:41:20 +02:00
Marek Habersack be33fcad91 [tests] Different CPUs have different precision
Fix the test to compare the subtraction result to value more
conservative than Double.Epsilon, to account for differences in
different CPU floating point units on Android.
2015-07-15 20:41:20 +02:00
Marek Habersack 0d209f09ad [tests] Use correct path in process tests
/bin/ls doesn't exist on Android, it's /system/bin/ls
2015-07-15 20:41:19 +02:00
Marek Habersack 7830885e02 [test] There is no runtime directory on Android
We return an empty string which is considered to be a valid value in
Android. Adjust the test for that.
2015-07-15 20:41:18 +02:00
Marek Habersack 7dc9cf81bc [tests] Use 2.1 profile assembly names for mobile 2015-07-15 20:41:18 +02:00
Marek Habersack 0c3c93efb5 [tests] Make failures more descriptive and fix XA
The test failures didn't really indicate which of the Fail statements
caused the test failure. Also, the 10k offset turned out to be not
enough for the XA test suite (it's much bigger than that)
2015-07-15 20:41:17 +02:00
Marek Habersack 9e9fecc45a [tests] Assembly.Location doesn't work on XA
Xamarin.Android stores assemblies inside apk (or bundled, or AOT-ed) and
so Assembly.Location will not point to a real path on the
filesystem. It merely contains assembly name.
2015-07-15 20:41:17 +02:00
Marek Habersack fb56b1a52f [tests] No Mono.CompilerServices.SymbolWriter in XA 2015-07-15 20:41:16 +02:00
Marek Habersack ecd44a1678 [tests] No declarative security in mobile profile 2015-07-15 20:41:16 +02:00
Marek Habersack 888874ab45 [tests] Fix for when CWD is /
The test case doesn't account for the situation when the tests are ran
at the root of the Unix filesystem. This is, admittedly, a rare case on
Desktop but it's precisely what CWD is for Android processes. The test
would fail because it would get a path of the //Form instead of the /Form
2015-07-15 20:41:15 +02:00
Marek Habersack 4e98727a7d [tests] Works in stand-alone app, fails in nunit 2015-07-15 20:32:13 +02:00
Marek Habersack 3903d320ec [tests] Fails on mobile with no details 2015-07-15 20:32:06 +02:00
Marek Habersack 16d09c2059 [tests] Doesn't work on mobile 2015-07-15 20:31:58 +02:00
Marek Habersack 6b8a4e5f3c [tests] Works in stand-alone app, fails in nunit 2015-07-15 20:31:50 +02:00
Marek Habersack 79c20ee775 [tests] Xamarin.Android has the desktop behavior 2015-07-15 20:31:46 +02:00
Marek Habersack 05f2e5e522 [tests] Xamarin.Android already has the namespace 2015-07-15 20:31:40 +02:00
Martin Baulig 42ca455df2 [xbuild]: Fix ResolveAssemblyReference.ResolveReference() with empty search paths.
When using shared projects, the search path and/or framework paths may sometimes
contain empty elements.

This fixes commit 5b12d9ae37.

(cherry picked from commit 4efdd29f70)
2015-07-14 23:40:34 +02:00
Marek Safar 4ad996b1e1 [system] Add missing APIs 2015-07-14 20:08:42 +02:00
Zoltan Varga 95333c0a5c [runtime] Fix the mono_get_lmf_addr () optimization for x86-ios. Fixes #31921. 2015-07-14 13:43:28 -04:00
Marek Safar 09212389e2 [ilasm] Imlicitly set enums value__ special flags 2015-07-14 11:33:45 +02:00
Marek Safar ed5e137a72 [ilasm] Make only structs automatically sealed (partially reverts 541a65ddd3) 2015-07-14 11:33:35 +02:00
Marek Safar 5e097d4d49 [ilasm] Don't make enums and structs sealed when sealed modifier is not used 2015-07-14 11:33:24 +02:00
Rolf Bjarne Kvinge a112354a21 Look for resgen2 where mcs is.
Fixes an issue on El Capitán where resgen2 isn't necessarily in PATH.
2015-07-14 10:25:09 +02:00
Ludovic Henry 7128196f5c [threadpool-ms] Add tracing 2015-07-13 22:51:27 -03:00
Zoltan Varga 604017a71d [jit] Fix float32 support for the interlocked opcodes. 2015-07-13 15:15:15 -04:00
Marek Safar 8ccfe0f8ff [System] Don't assume WebConnectionStream of unknown http methods require write stream. Fixes #31830 2015-07-13 17:17:28 +02:00
Zoltan Varga 1daadd26c5 [runtime] Add support for portable pdb files without a MODULE table. Fix mono_ppdb_get_seq_points (). 2015-07-12 16:43:05 -04:00
Zoltan Varga 3c7f754d94 [runtime] Update portable pdb support for the latest spec. 2015-07-12 16:42:58 -04:00
Zoltan Varga fa2f8d903d [runtime] Make mono_trace_set_printerr_handler () call g_set_printerr_handler (). Fixes #31451. 2015-07-12 12:38:33 -04:00
Marek Safar f1ffee0453 [mcs] Emit symbol info local variables for compiler generated storey variables. Fixes #31784 2015-07-11 07:47:02 +02:00
Zoltan Varga 31d5a3eaf4 [aot] Emit the got into the bss section on osx too. 2015-07-10 15:17:13 -04:00
Rodrigo Kumpera 2d4f6b3442 [jit] Use a feature macro instead of hardcoding users. 2015-07-10 13:36:45 -04:00
Rodrigo Kumpera 87e9d0314a [arm] Fixed the max length of seq_point. Fixes #31829. 2015-07-10 12:25:29 -04:00
Rodrigo Kumpera 339f080a2a [jit] Disable fast tls on osx if MONO_HAVE_FAST_TLS is not defined. 2015-07-10 12:25:20 -04:00
Rodrigo Kumpera ebd6235cd3 [utils] Disable fast TLS on darwin until we have proper fallbacks in place. 2015-07-10 12:25:13 -04:00
Rodrigo Kumpera ece83305f8 [mini] Add some extra asserts around fast tls to ensure we don't mess up. 2015-07-10 12:25:09 -04:00
Rodrigo Kumpera b7a2903b28 [utils] Don't abort at startup if remote TLS reads is not available.
Remote TLS reads is not a required feature for the runtime to work on
mach systems. We still want it available, but can leave the assertion
to happen when someone actually use it.

Usage won't happen today as part of regular code execution, so moving
the assert will make us more robust.
2015-07-10 12:24:58 -04:00
Rodrigo Kumpera 65c54d2d84 [utils] Add fallback TLS offset scanning to X86 and AMD64. 2015-07-10 12:24:50 -04:00
Craig S. Bosma de99b00081 Add TLS offset for pre-release OS X 10.11 x86, as in #1919 for x64 2015-07-10 12:22:21 -04:00
Craig S. Bosma 679e726432 Add TLS offset for pre-release OS X 10.11 on amd64 2015-07-10 12:21:55 -04:00
Alan McGovern 6d52dee3d4 Bump to get a new build with a new gtk 2015-07-10 17:12:09 +01:00
Zoltan Varga ec55965085 [llvm] Fix the handling of nested clauses. 2015-07-09 15:34:40 -04:00
Zoltan Varga 8a63d50e64 [jit] Fix a regression introduced by ce567f4026. cfg->flags was initialized with a JitFlags value. 2015-07-09 15:34:34 -04:00
Zoltan Varga 6604c8c595 [sdb] Allow boxed vtypes as this when invoking vtype methods. Fixes #30023. 2015-07-08 17:11:21 -04:00
Zoltan Varga 146772f894 [sdb] Allow invoking of valuetype ctors. 2015-07-07 16:33:30 -04:00
Ludovic Henry b956524379 bump referencesource 2015-07-07 13:59:39 -03:00
Alexis Christoforides 82c2ba94d3 [referencesource] Switch to 'mono-4.2.0-pre-branch' instead of 'mono' branch 2015-07-07 17:07:59 +03:00
Zoltan Varga 96df0a76c4 [aot] Fix static linking support when using llvm. 2015-07-06 22:01:56 -04:00
Zoltan Varga 166dca4754 [aot] Mark the data arrays emitted using llvm as constant. 2015-07-06 21:04:17 -04:00
Zoltan Varga 5318b06bda [aot] Handle already gsharedvt methods correctly in add_extra_method_with_depth (). 2015-07-06 21:04:08 -04:00
Zoltan Varga 8c31e362af [gsharedvt] Handle gsharedvt methods correctly in check_method_sharing(). We need to pass mrgctx/vtable arguments for them since at runtime, the specific method called could be a non-gsharedvt method. 2015-07-06 21:04:01 -04:00
Ludovic Henry 59adeedd90 [threadpool-ms] Fix unhandled exception support 2015-07-06 18:27:27 -04:00
Zoltan Varga 74cd6414be Trigger a build. 2015-07-06 14:37:04 -04:00
Zoltan Varga 57e4ed9c5d Bump version to 4.2.0. 2015-07-06 14:30:03 -04:00
Jonathan Pryor 0bf72ac919 [Mono.Posix] Allow building without [Obsolete] Mono.Posix.
For a future Xamarin.Android release, we'd like to include
Mono.Posix.dll for simple Unix interop support.

That said, since Mono.Posix has never been included with
Xamarin.Andorid before, this makes a perfect opportunity to remove
some [Obsolete] cruft within Mono.Posix.dll, namely the types within
the Mono.Posix namespace.

Unfortunately, simply not compiling the types within the Mono.Posix
directory doesn't result in compilable code, due to references to
types within the Mono.Posix namespace by other types, e.g.
Mono.Unix.PeerCred using Mono.Posix.PeerCredData.

Fix things so that the Mono.Posix sources can be omitted, allowing
compilation of an assembly with fewer [Obsolete] types.

This change shrinks the size of Mono.Posix.dll by ~10.5KB.
2015-07-06 14:03:32 -04:00
Marcos Henrich 94e31f159f Merge pull request #1900 from esdrubal/cyclic-ref
[runtime] mono_class_from_name cyclic ref handling
2015-07-06 11:50:16 +01:00
Marcos Henrich a7c3e83d98 Merge pull request #1906 from esdrubal/xbuild-CopyLocal-fix
[xbuild] Fixes copied TargetFramework assemblies.
2015-07-06 11:49:40 +01:00
João Matos f7816d844a Merge pull request #1913 from RavuAlHemio/bug31635
[Mono.Posix] Special-case UTF-32 in PtrToString. Fixes #31635.
2015-07-06 11:10:32 +01:00
Ondřej Hošek 6bfb7e6d14 [Mono.Posix] Special-case UTF-32 in PtrToString. Fixes #31635.
Since UTF32Encoding returns 8 for GetMaxByteCount(1), PtrToString
expects 8 NUL bytes to stop scanning for the end of the string.
Since all the other UTF schemes are special-cased in
GetStringByteLength, do the same for UTF32Encoding.
2015-07-04 02:05:30 +02:00
Rodrigo Kumpera 5d93b2a292 [jit] Add emulation r4 to u8 conversion. Fixes #31582.
Most targets, like arm and amd64 don't support fast float to ulong conversion.
2015-07-03 14:32:04 -04:00
Ludovic Henry f3e35f228c [runtime] Fix cpu usage greater than 100% error
We simply relax the conditions as we do not need a very high precision.
2015-07-02 15:45:40 -03:00
Rodrigo Kumpera 6efe705614 Merge pull request #1907 from alexanderkyte/slow_aot_startup_hash
[runtime] Speed up find_aot_method_in_module
2015-07-02 14:03:15 -04:00
Alexander Kyte 7bb3b98f58 [runtime] Conversion of a printf to string append for performance 2015-07-01 16:33:34 -04:00
Alexander Kyte 3d47daa63d [runtime] Avoid repeated method hashing in find_aot_module 2015-07-01 16:22:35 -04:00
Alexander Kyte e22887717f [runtime/tests] Added a stress test of find_aot_module. 2015-07-01 16:22:28 -04:00
Marcos Henrich 01dcc6c162 [runtime] mono_class_from_name cyclic ref handling
The changes fix stack overflows caused while traversing images with
cyclic references.

Fixes #31396
2015-07-01 17:26:28 +01:00
Marcos Henrich 5b12d9ae37 [xbuild] Fixes copied TargetFramework assemblies.
xbuild was copying TargetFramework assemblies when the builded project
had dependencies in a TargetFramework.

Doing so is not the msbuild behaviour and was causing bugs while
resolving Types at load time.

Fixes #28592 and #31396
2015-07-01 15:49:37 +01:00
328 changed files with 23005 additions and 2855 deletions

No files matched your search

+1 -1
View File
@@ -23,7 +23,7 @@
[submodule "external/referencesource"]
path = external/referencesource
url = git://github.com/mono/referencesource
branch = mono
branch = mono-4.2.0-branch
[submodule "external/reference-assemblies"]
path = external/binary-reference-assemblies
url = git://github.com/mono/reference-assemblies.git
+1
View File
@@ -497,3 +497,4 @@ to do at all), first edit `.gitmodules` to point to the new location, then:
The desired output diff is a change in `.gitmodules` to reflect the
change in the remote URL, and a change in /<submodule> where you see
the desired change in the commit hash.
+16 -12
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [4.3.0],
AC_INIT(mono, [4.2.2],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README.md])
@@ -3491,10 +3491,11 @@ case "x$libgc" in
;;
esac
AC_ARG_WITH(profile4_5,[ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=no])
AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=no])
AC_ARG_WITH(profile4_5, [ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
AC_ARG_WITH(monotouch, [ --with-monotouch=yes,no If you want to build the Xamarin.iOS assemblies (defaults to no)], [], [with_monotouch=no])
AC_ARG_WITH(monotouch_watch, [ --with-monotouch_watch=yes,no If you want to build the Xamarin.WatchOS assemblies (defaults to no)],[], [with_monotouch_watch=no])
AC_ARG_WITH(xammac, [ --with-xammac=yes,no If you want to build the Xamarin.Mac assemblies (defaults to no)], [], [with_xammac=no])
OPROFILE=no
AC_ARG_WITH(oprofile,[ --with-oprofile=no,<oprofile install dir> Enable oprofile support (defaults to no)],[
@@ -3574,6 +3575,7 @@ if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
with_profile4_5=no
with_monodroid=no
with_monotouch=no
with_monotouch_watch=no
with_xammac=no
fi
@@ -3596,6 +3598,7 @@ libmono_ldflags="$libmono_ldflags $LIBS"
AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH, [test "x$with_monotouch" != "xno"])
AM_CONDITIONAL(INSTALL_MONOTOUCH_WATCH, [test "x$with_monotouch_watch" != "xno"])
AM_CONDITIONAL(INSTALL_XAMMAC, [test "x$with_xammac" != "xno"])
AM_CONDITIONAL(MIPS_GCC, test ${TARGET}${ac_cv_prog_gcc} = MIPSyes)
@@ -4008,13 +4011,14 @@ echo "
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
Libraries:
.NET 4.5: $with_profile4_5
MonoDroid: $with_monodroid
MonoTouch: $with_monotouch
Xamarin.Mac: $with_xammac
JNI support: $jdk_headers_found
libgdiplus: $libgdiplus_msg
zlib: $zlib_msg
.NET 4.5: $with_profile4_5
MonoDroid: $with_monodroid
Xamarin.iOS: $with_monotouch
Xamarin.WatchOS: $with_monotouch_watch
Xamarin.Mac: $with_xammac
JNI support: $jdk_headers_found
libgdiplus: $libgdiplus_msg
zlib: $zlib_msg
$disabled
"
if test x$with_static_mono = xno -a "x$host_win32" != "xyes"; then
+24 -2
View File
@@ -144,7 +144,8 @@ public enum Lock {
AssemblyBindingLock,
MarshalLock,
ClassesLock,
LoaderGlobalDataLock
LoaderGlobalDataLock,
ThreadsLock,
}
public class SimLock
@@ -242,7 +243,24 @@ public class SimLock
}
public override string ToString () {
return String.Format ("{0}", kind);
switch (kind) {
case Lock.LoaderLock:
case Lock.IcallLock:
case Lock.AssemblyBindingLock:
case Lock.MarshalLock:
case Lock.ClassesLock:
case Lock.LoaderGlobalDataLock:
case Lock.ThreadsLock:
return String.Format ("{0}", kind);
case Lock.ImageDataLock:
case Lock.DomainLock:
case Lock.DomainAssembliesLock:
case Lock.DomainJitCodeHashLock:
return String.Format ("{0}[{1}]", kind, id);
default:
return String.Format ("Unknown({0})[{1}]", kind, id);
}
}
}
@@ -311,6 +329,10 @@ public class Trace {
"add_record",
"mono_locks_lock_acquired",
"mono_locks_lock_released",
"mono_threads_lock",
"mono_threads_unlock",
"mono_domain_lock",
"mono_domain_unlock",
};
public Trace (string[] fields) {
+1 -1
+2 -2
View File
@@ -183,11 +183,11 @@ Restrict the compiler to use only the features available in C# 3.0
Restrict the compiler to use only the features available in C# 4.0
specification.
.TP
.I "future"
.I "experimental"
Enables unstable features from upcoming versions of the language.
.PP
Notice that this flag only restricts the language features available to
the programmer. A version of produced assemblies can be controled using
the programmer. A version of produced assemblies can be controlled using
.I SDK
option.
.ne
+6 -1
View File
@@ -992,7 +992,12 @@ where V is the architecture number 4, 5, 6, 7 and the options can be currently b
.TP
\fBMONO_ARM_FORCE_SOFT_FLOAT\fR
When Mono is built with a soft float fallback on ARM and this variable is set to
"1", Mono will always emit soft float code, even if a VFP unit is detected.
"1", Mono will always emit soft float code, even if a VFP unit is
detected.
.TP
\fBMONO_DARWIN_WATCHER_MAXFDS\fR
This is a debugging aid used to force limits on the FileSystemWatcher
implementation in Darwin. There is no limit by default.
.TP
\fBMONO_DISABLE_AIO\fR
If set, tells mono NOT to attempt using native asynchronous I/O services. In
+4
View File
@@ -337,6 +337,10 @@ version
.IP \[bu] 2
\f[I]thread\f[]: thread information
.IP \[bu] 2
\f[I]domain\f[]: app domain information
.IP \[bu] 2
\f[I]context\f[]: remoting context information
.IP \[bu] 2
\f[I]heapshot\f[]: live heap usage at heap shots
.IP \[bu] 2
\f[I]counters\f[]: counters samples
+1 -1
View File
@@ -6,7 +6,7 @@ BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PA
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# Use system resgen as we don't want local System.Windows.Forms dependency
RESGEN = resgen2
RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2
profile-check:
@:
+1 -1
View File
@@ -6,7 +6,7 @@ BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PA
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# Use system resgen as we don't want local System.Windows.Forms dependency
RESGEN = resgen2
RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2
# nuttzing!
+1 -1
View File
@@ -4,7 +4,7 @@ BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PA
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
# Use system resgen as we don't want local System.Windows.Forms dependency
RESGEN = resgen2
RESGEN := $(dir $(shell which $(EXTERNAL_MCS)))resgen2
profile-check:
@:
+1 -1
View File
@@ -46,6 +46,7 @@ mobile_common_dirs := \
System.ComponentModel.DataAnnotations \
System.ComponentModel.Composition.4.5 \
System.Net \
System.Net.Http \
System.Windows \
System.Xml.Serialization \
Mono.CSharp \
@@ -59,7 +60,6 @@ mobile_static_dirs := \
mobile_dynamic_dirs := \
$(mobile_common_dirs) \
Mono.CompilerServices.SymbolWriter \
System.Net.Http
xammac_dirs := \
$(mobile_dynamic_dirs)
@@ -472,7 +472,7 @@ namespace Microsoft.Build.BuildEngine {
BuildItemGroup big;
BuildItem bi = new BuildItem (this);
bi.finalItemSpec = ((ITaskItem2)taskitem).EvaluatedIncludeEscaped;
bi.finalItemSpec = taskitem.ItemSpec;
foreach (DictionaryEntry de in taskitem.CloneCustomMetadata ()) {
bi.unevaluatedMetadata.Add ((string) de.Key, (string) de.Value);
@@ -156,7 +156,7 @@ namespace Microsoft.Build.BuildEngine {
for (int i = 0; i < lists.Count; i++) {
foreach (object o in lists [i]) {
if (o is string)
expressionCollection.Add ((string) o);
expressionCollection.Add (MSBuildUtils.Unescape ((string) o));
else if (!allowItems && o is ItemReference)
expressionCollection.Add (((ItemReference) o).OriginalString);
else if (!allowMd && o is MetadataReference) {
@@ -233,11 +233,11 @@ namespace Microsoft.Build.BuildEngine {
// Trim and Remove empty items
List<ITaskItem> toRemove = new List<ITaskItem> ();
for (int i = 0; i < finalItems.Count; i ++) {
string s = ((ITaskItem2)finalItems [i]).EvaluatedIncludeEscaped.Trim ();
string s = finalItems [i].ItemSpec.Trim ();
if (s.Length == 0)
toRemove.Add (finalItems [i]);
else
((ITaskItem2)finalItems [i]).EvaluatedIncludeEscaped = s;
finalItems [i].ItemSpec = s;
}
foreach (ITaskItem ti in toRemove)
finalItems.Remove (ti);
@@ -208,9 +208,36 @@ namespace Microsoft.Build.Tasks {
if (!TryGetSpecificVersionValue (item, out specific_version))
return null;
var spath_index = 0;
foreach (string spath in search_paths) {
if (string.IsNullOrEmpty (spath))
continue;
assembly_resolver.LogSearchMessage ("For searchpath {0}", spath);
// The first value of search_paths can be the parent assembly directory.
// In that case the value would be treated as a directory.
// This code checks if we should treat the value as a TargetFramework assembly.
// Doing so avoids CopyLocal beeing set to true.
if (spath_index++ == 0 && targetFrameworkDirectories != null) {
foreach (string fpath in targetFrameworkDirectories) {
if (string.IsNullOrEmpty (fpath))
continue;
if (String.Compare (
Path.GetFullPath (spath).TrimEnd (Path.DirectorySeparatorChar),
Path.GetFullPath (fpath).TrimEnd (Path.DirectorySeparatorChar),
StringComparison.InvariantCulture) != 0)
continue;
resolved = assembly_resolver.FindInTargetFramework (item,
fpath, specific_version);
break;
}
if (resolved != null)
break;
}
if (String.Compare (spath, "{HintPathFromItem}") == 0) {
resolved = assembly_resolver.ResolveHintPathReference (item, specific_version);
} else if (String.Compare (spath, "{TargetFrameworkDirectory}") == 0) {
@@ -79,6 +79,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
<Message Text='Text5' Importance='normal'/>
<Message Text='Text6' Importance='high'/>
<Message Text='Text7' />
<Message Text='%22abc test%22 123 %22def%22' />
<Message Text='Text8' Importance='weird_importance'/>
</Target>
</Project>
@@ -102,7 +103,8 @@ namespace MonoTests.Microsoft.Build.Tasks {
Assert.AreEqual (0, testLogger.CheckAny ("Text5", MessageImportance.Normal), "A5");
Assert.AreEqual (0, testLogger.CheckAny ("Text6", MessageImportance.High), "A6");
Assert.AreEqual (0, testLogger.CheckAny ("Text7", MessageImportance.Normal), "A7");
Assert.AreEqual (1, testLogger.CheckAny ("Text8", MessageImportance.Normal), "A8");
Assert.AreEqual (0, testLogger.CheckAny ("\"abc test\" 123 \"def\"", MessageImportance.Normal), "A8");
Assert.AreEqual (1, testLogger.CheckAny ("Text8", MessageImportance.Normal), "A9");
}
}
}
@@ -91,6 +91,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
}
[Test]
[Category("NotWorking")] // this fails due to an xbuild bug, it works on MS.NET
public void TestLineWithEscapedSemicolon ()
{
string[] lines = new string[] { "abc%3Btest%3B%3B", "%3Bdef" };
@@ -101,6 +102,7 @@ namespace MonoTests.Microsoft.Build.Tasks {
}
[Test]
[Category("NotWorking")] // this fails due to an xbuild bug, it works on MS.NET
public void TestLineWithEscapedSpace ()
{
string[] lines = new string[] { " %20%20abc%20test ", " def%20%20" };
@@ -110,6 +112,16 @@ namespace MonoTests.Microsoft.Build.Tasks {
});
}
[Test]
public void TestLineWithEscapedQuote ()
{
string[] lines = new string[] { "%22abc test%22 123 %22def%22" };
CreateProjectAndCheck (full_filepath, lines, false, true, delegate () {
CheckFileExists (full_filepath, true);
CheckLines (full_filepath, new string [] {"\"abc test\" 123 \"def\""});
});
}
[Test]
public void TestNoOverwrite ()
{
@@ -173,7 +173,7 @@ namespace Microsoft.Build.Utilities
}
public override string ToString ()
{
return ItemSpec;
return escapedItemSpec;
}
public string ItemSpec {
+3 -5
View File
@@ -92,14 +92,12 @@ namespace MonoTests.Mono.Data.Sqlite {
Assert.AreEqual(dr["Company.Name"], "Test CO");
i += 2;
}
Assert.IsTrue(dr.FieldCount>0);
Assert.IsTrue(dr.FieldCount>0, i.ToString ());
}
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2))
Assert.IsTrue (false, "Apple fixed bug 27864, this check can now be removed");
}
} catch (SqliteException ex) {
if (BCL.Tests.TestRuntime.CheckSystemVersion (8, 2)) // Expected Exception on iOS 8.2+, if this does not happen anymore it means apple fixed it
// Expected Exception from iOS 8.2 (broken) to 9.0 (fixed)
if (BCL.Tests.TestRuntime.CheckSystemVersion (8,2) && !BCL.Tests.TestRuntime.CheckSystemVersion (9,0))
Assert.That (ex.Message.Contains ("no such column: com.Name"));
else
throw new AssertionException ("Unexpected Sqlite Error", ex); // This should not happen
@@ -417,7 +417,7 @@ namespace Mono.Debugger.Soft
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
internal const int MINOR_VERSION = 40;
internal const int MINOR_VERSION = 41;
enum WPSuspendPolicy {
NONE = 0,
@@ -801,6 +801,13 @@ namespace Mono.Debugger.Soft
return res;
}
public string ReadUTF16String () {
int len = decode_int (packet, ref offset);
string res = new String (Encoding.Unicode.GetChars (packet, offset, len));
offset += len;
return res;
}
public ValueImpl ReadValue () {
ElementType etype = (ElementType)ReadByte ();
@@ -2418,7 +2425,16 @@ namespace Mono.Debugger.Soft
* STRINGS
*/
internal string String_GetValue (long id) {
return SendReceive (CommandSet.STRING_REF, (int)CmdStringRef.GET_VALUE, new PacketWriter ().WriteId (id)).ReadString ();
var r = SendReceive (CommandSet.STRING_REF, (int)CmdStringRef.GET_VALUE, new PacketWriter ().WriteId (id));
bool is_utf16 = false;
if (Version.AtLeast (2, 41))
is_utf16 = r.ReadByte () == 1;
if (is_utf16)
return r.ReadUTF16String ();
else
return r.ReadString ();
}
internal int String_GetLength (long id) {
+18 -2
View File
@@ -86,6 +86,22 @@ public struct AStruct : ITest2 {
public byte k;
public IntPtr j;
public int l;
/*
public AStruct () {
i = 0;
s = null;
k = 0;
j = IntPtr.Zero;
l = 0;
}
*/
public AStruct (int arg) {
i = arg;
s = null;
k = 0;
j = IntPtr.Zero;
l = 0;
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public int foo (int val) {
@@ -582,7 +598,7 @@ public class Tests : TestsBase, ITest2
public static void arguments () {
arg1 (SByte.MaxValue - 5, Byte.MaxValue - 5, true, Int16.MaxValue - 5, UInt16.MaxValue - 5, 'F', Int32.MaxValue - 5, UInt32.MaxValue - 5, Int64.MaxValue - 5, UInt64.MaxValue - 5, 1.2345f, 6.78910, new IntPtr (Int32.MaxValue - 5), new UIntPtr (UInt32.MaxValue - 5));
int i = 42;
arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object ());
arg2 ("FOO", null, "BLA", ref i, new GClass <int> { field = 42 }, new object (), '\0'.ToString () + "A");
Tests t = new Tests () { field_i = 42, field_s = "S" };
t.arg3 ("BLA");
}
@@ -593,7 +609,7 @@ public class Tests : TestsBase, ITest2
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2) {
public static string arg2 (string s, string s3, object o, ref int i, GClass <int> gc, object o2, string s4) {
return s + (s3 != null ? "" : "") + o + i + gc.field + o2;
}
@@ -2286,6 +2286,12 @@ public class DebuggerTests
v = s.InvokeMethod (e.Thread, m, null);
AssertValue (42, v);
// Pass boxed struct as this
var boxed_this = t.NewInstance () as ObjectMirror;
m = t.GetMethod ("invoke_return_int");
v = boxed_this.InvokeMethod (e.Thread, m, null);
AssertValue (0, v);
// Pass struct as this, receive intptr
m = t.GetMethod ("invoke_return_intptr");
v = s.InvokeMethod (e.Thread, m, null);
@@ -2303,6 +2309,13 @@ public class DebuggerTests
v = s.InvokeMethod (e.Thread, m, null);
AssertValue (42, v);
// .ctor
s = frame.GetArgument (1) as StructMirror;
t = s.Type;
m = t.GetMethods ().First (method => method.Name == ".ctor" && method.GetParameters ().Length == 1);
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.CreateValue (1) });
AssertValue (1, (v as StructMirror)["i"]);
#if NET_4_5
// Invoke a method which changes state
s = frame.GetArgument (1) as StructMirror;
@@ -3306,6 +3319,20 @@ public class DebuggerTests
Assert.AreEqual ("System.Exception", types [0].FullName);
}
[Test]
public void String_GetValue () {
// Embedded nulls
object val;
// Reuse this test
var e = run_until ("arg2");
var frame = e.Thread.GetFrames () [0];
val = frame.GetArgument (6);
Assert.AreEqual ('\0'.ToString () + "A", (val as StringMirror).Value);
}
[Test]
public void String_GetChars () {
object val;
@@ -6,5 +6,6 @@ Mono.Unix/UnixMarshalTest.cs
Mono.Unix/UnixPathTest.cs
Mono.Unix/UnixSignalTest.cs
Mono.Unix/UnixUserTest.cs
Mono.Unix.Android/TestHelper.cs
Mono.Unix.Native/RealTimeSignumTests.cs
Mono.Unix.Native/StdlibTest.cs
@@ -34,7 +34,6 @@ using System.Collections;
using System.Runtime.Remoting.Messaging;
using System.IO;
using System.Runtime.Remoting.Channels;
using Mono.Posix;
namespace Mono.Remoting.Channels.Unix
{
@@ -17,10 +17,10 @@ namespace Mono.Unix.Native {
//
// Non-generated exports
//
#if !MONODROID
[DllImport (LIB, EntryPoint="Mono_Posix_FromRealTimeSignum")]
private static extern int FromRealTimeSignum (Int32 offset, out Int32 rval);
#endif
// convert a realtime signal to os signal
public static int FromRealTimeSignum (RealTimeSignum sig)
{
+8 -2
View File
@@ -33,6 +33,12 @@ using System.Net.Sockets;
namespace Mono.Unix
{
internal struct PeerCredData {
public int pid;
public int uid;
public int gid;
}
public class PeerCred
{
/* Make sure this doesn't clash with anything in
@@ -40,14 +46,14 @@ namespace Mono.Unix
* runtime
*/
private const int so_peercred=10001;
private Mono.Posix.PeerCredData data;
private PeerCredData data;
public PeerCred (Socket sock) {
if (sock.AddressFamily != AddressFamily.Unix) {
throw new ArgumentException ("Only Unix sockets are supported", "sock");
}
data = (Mono.Posix.PeerCredData)
data = (PeerCredData)
sock.GetSocketOption (SocketOptionLevel.Socket, (SocketOptionName)so_peercred);
}
@@ -176,6 +176,10 @@ namespace Mono.Unix {
else if (typeof(UnicodeEncoding).IsAssignableFrom (encodingType)) {
len = GetInt16BufferLength (p);
}
// Encodings that will always end with a 0x00000000 32-bit word
else if (typeof(UTF32Encoding).IsAssignableFrom (encodingType)) {
len = GetInt32BufferLength (p);
}
// Some non-public encoding, such as Latin1 or a DBCS charset.
// Look for a sequence of encoding.GetMaxByteCount() bytes that are all
// 0, which should be the terminating null.
@@ -0,0 +1,12 @@
namespace Mono.Unix.Android
{
// Another version of this class is used by the Xamarin.Android test suite
// It is here to keep the test code #ifdef free as much as possible
public class TestHelper
{
public static bool CanUseRealTimeSignals ()
{
return true;
}
}
}
@@ -8,11 +8,14 @@
//
using NUnit.Framework;
#if !MONODROID
using NUnit.Framework.SyntaxHelpers;
#endif
using System;
using System.Text;
using System.Threading;
using Mono.Unix;
using Mono.Unix.Android;
using Mono.Unix.Native;
namespace MonoTests.Mono.Unix.Native {
@@ -25,6 +28,8 @@ namespace MonoTests.Mono.Unix.Native {
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void TestRealTimeOutOfRange ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts = new RealTimeSignum (int.MaxValue);
}
@@ -32,12 +37,16 @@ namespace MonoTests.Mono.Unix.Native {
[ExpectedException (typeof (ArgumentOutOfRangeException))]
public void TestRealTimeSignumNegativeOffset ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts1 = new RealTimeSignum (-1);
}
[Test]
public void TestRTSignalEquality ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts1 = new RealTimeSignum (0);
RealTimeSignum rts2 = new RealTimeSignum (0);
Assert.That (rts1 == rts2, Is.True);
@@ -47,6 +56,8 @@ namespace MonoTests.Mono.Unix.Native {
[Test]
public void TestRTSignalInequality ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts1 = new RealTimeSignum (0);
RealTimeSignum rts2 = new RealTimeSignum (1);
Assert.That (rts1 == rts2, Is.False);
@@ -56,6 +67,8 @@ namespace MonoTests.Mono.Unix.Native {
[Test]
public void TestRTSignalGetHashCodeEquality ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts1 = new RealTimeSignum (0);
RealTimeSignum rts2 = new RealTimeSignum (0);
Assert.That (rts1.GetHashCode (), Is.EqualTo(rts2.GetHashCode ()));
@@ -64,6 +77,8 @@ namespace MonoTests.Mono.Unix.Native {
[Test]
public void TestRTSignalGetHashCodeInequality ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts1 = new RealTimeSignum (0);
RealTimeSignum rts2 = new RealTimeSignum (1);
Assert.That (rts1.GetHashCode (), Is.Not.EqualTo(rts2.GetHashCode ()));
@@ -72,6 +87,8 @@ namespace MonoTests.Mono.Unix.Native {
[Test]
public void TestIsRTSignalPropertyForRTSignum ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
UnixSignal signal1 = new UnixSignal(new RealTimeSignum (0));
Assert.That (signal1.IsRealTimeSignal, Is.True);
}
@@ -79,6 +96,8 @@ namespace MonoTests.Mono.Unix.Native {
[Test]
public void TestIsRTSignalPropertyForSignum ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
UnixSignal signal1 = new UnixSignal (Signum.SIGSEGV);
Assert.That (signal1.IsRealTimeSignal, Is.False);
}
@@ -226,21 +226,22 @@ namespace MonoTests.System.IO
{
StdioFileStream fs = null;
StdioFileStream fs2 = null;
string tempPath = Path.Combine (Path.GetTempPath (), "temp");
try {
if (!File.Exists ("temp")) {
TextWriter tw = File.CreateText ("temp");
if (!File.Exists (tempPath)) {
TextWriter tw = File.CreateText (tempPath);
tw.Write ("FOO");
tw.Close ();
}
fs = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
fs2 = new StdioFileStream ("temp", FileMode.Open, FileAccess.Read);
fs = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
fs2 = new StdioFileStream (tempPath, FileMode.Open, FileAccess.Read);
} finally {
if (fs != null)
fs.Close ();
if (fs2 != null)
fs2.Close ();
if (File.Exists ("temp"))
File.Delete ("temp");
if (File.Exists (tempPath))
File.Delete (tempPath);
}
}
@@ -856,7 +857,8 @@ namespace MonoTests.System.IO
[ExpectedException (typeof (NotSupportedException))]
public void SetLengthWithClosedBaseStream ()
{
StdioFileStream fs = new StdioFileStream ("temp", FileMode.Create);
string path = TempFolder + Path.DirectorySeparatorChar + "temp";
StdioFileStream fs = new StdioFileStream (path, FileMode.Create);
BufferedStream bs = new BufferedStream (fs);
fs.Close ();
@@ -25,6 +25,7 @@ namespace MonoTests.Mono.Unix {
public class UnixGroupTest
{
[Test]
[Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
public void ListAllGroups_ToString ()
{
try {
@@ -41,6 +42,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
public void ReentrantConstructors ()
{
var seen = new Dictionary<string, object> ();
@@ -65,6 +67,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // API 21 conditionally has setgrent in the NDK headers, but bionic doesn't export it
public void NonReentrantSyscalls ()
{
var seen = new Dictionary<string, object> ();
@@ -95,6 +98,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // API 21 conditionally has getgrnam_r in the NDK headers, but bionic doesn't export it
public void InvalidGroups_Constructor_Name ()
{
string[] badGroups = new string[]{"i'm bad", "so am i", "does-not-exist"};
@@ -8,6 +8,7 @@
using NUnit.Framework;
using System;
using System.Collections.Generic;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
@@ -87,6 +88,69 @@ namespace MonoTests.Mono.Unix {
string s = UnixMarshal.PtrToString (p);
UnixMarshal.FreeHeap (p);
}
[Test]
public void TestUtf32PtrToString ()
{
var utf32NativeEndianNoBom = new UTF32Encoding(
bigEndian: !BitConverter.IsLittleEndian,
byteOrderMark: false,
throwOnInvalidCharacters: true
);
// assemble a buffer that contains:
// 1. eight garbage bytes
// 2. the native-endian UTF-32 string "Hello, World" without BOM
// 3. four 0 bytes (as a C wide string terminator)
// 4. the native-endian UTF-32 string "broken" without BOM
// 5. eight 0 bytes
// 6. four garbage bytes
var buf = new List<byte>();
for (int i = 0; i < 2; ++i) {
buf.Add((byte)0x12);
buf.Add((byte)0x34);
buf.Add((byte)0x56);
buf.Add((byte)0x78);
}
buf.AddRange(utf32NativeEndianNoBom.GetBytes("Hello, World"));
for (int i = 0; i < 4; ++i) {
buf.Add((byte)0x00);
}
buf.AddRange(utf32NativeEndianNoBom.GetBytes("broken"));
for (int i = 0; i < 8; ++i) {
buf.Add((byte)0x00);
}
buf.Add((byte)0x12);
buf.Add((byte)0x34);
buf.Add((byte)0x56);
buf.Add((byte)0x78);
// get the array version of this
var bufArr = buf.ToArray();
// allocate a buffer that will contain this string
IntPtr bufPtr = UnixMarshal.AllocHeap(bufArr.Length);
string returned;
try
{
// copy it in
Marshal.Copy(bufArr, 0, bufPtr, bufArr.Length);
// try getting it back
returned = UnixMarshal.PtrToString(bufPtr + 8, utf32NativeEndianNoBom);
}
finally
{
UnixMarshal.FreeHeap(bufPtr);
}
Assert.AreEqual("Hello, World", returned);
}
}
}
@@ -37,7 +37,7 @@ namespace MonoTests.Mono.Unix
Assert.AreEqual ("one", path);
path = UnixPath.Combine (current, "one");
expected = current + DSC + "one";
expected = (current == "/" ? String.Empty : current) + DSC + "one";
Assert.AreEqual (expected, path);
path = UnixPath.Combine ("one", current);
@@ -8,15 +8,18 @@
//
using NUnit.Framework;
#if !MONODROID
using NUnit.Framework.SyntaxHelpers;
#endif
using System;
using System.Text;
using System.Threading;
using Mono.Unix;
using Mono.Unix.Android;
using Mono.Unix.Native;
#if !MONODROID
namespace NUnit.Framework.SyntaxHelpers { class Dummy {} }
#endif
namespace MonoTests.Mono.Unix {
[TestFixture]
@@ -115,6 +118,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // Crashes (silently) the runtime in similar fashion to real-time signals
public void TestSignumProperty ()
{
UnixSignal signal1 = new UnixSignal (Signum.SIGSEGV);
@@ -125,6 +129,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestRealTimeCstor ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts = new RealTimeSignum (0);
using (UnixSignal s = new UnixSignal (rts))
{
@@ -138,6 +144,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestSignumPropertyThrows ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
UnixSignal signal1 = new UnixSignal (new RealTimeSignum (0));
Signum s = signal1.Signum;
}
@@ -146,6 +154,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestRealTimeSignumProperty ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts = new RealTimeSignum (0);
UnixSignal signal1 = new UnixSignal (rts);
Assert.That (signal1.RealTimeSignum, Is.EqualTo (rts));
@@ -156,6 +166,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestRealTimePropertyThrows ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
UnixSignal signal1 = new UnixSignal (Signum.SIGSEGV);
RealTimeSignum s = signal1.RealTimeSignum;
}
@@ -164,6 +176,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestRaiseRTMINSignal ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
RealTimeSignum rts = new RealTimeSignum (0);
using (UnixSignal signal = new UnixSignal (rts))
{
@@ -178,6 +192,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestRaiseRTMINPlusOneSignal ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
/*this number is a guestimate, but it's ok*/
for (int i = 1; i < 10; ++i) {
RealTimeSignum rts = new RealTimeSignum (i);
@@ -203,6 +219,8 @@ namespace MonoTests.Mono.Unix {
[Category ("NotOnMac")]
public void TestCanRegisterRTSignalMultipleTimes ()
{
if (!TestHelper.CanUseRealTimeSignals ())
return;
/*this number is a guestimate, but it's ok*/
for (int i = 1; i < 10; ++i) {
RealTimeSignum rts = new RealTimeSignum (i);
@@ -375,6 +393,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // Android 4.4.4 doesn't have signal(2)
public void TestSignalActionInteraction ()
{
using (UnixSignal a = new UnixSignal (Signum.SIGINT)) {
@@ -391,7 +410,6 @@ namespace MonoTests.Mono.Unix {
const int StormCount = 100000;
[Test]
[Category("NotOnMac")] // OSX signal storming will not deliver every one
public void TestRaiseStorm ()
{
UnixSignal[] usignals = CreateSignals (signals);
@@ -405,7 +423,7 @@ namespace MonoTests.Mono.Unix {
t.Start ();
foreach (Thread t in threads)
t.Join ();
AssertCount (usignals);
AssertCountSet (usignals);
CloseSignals (usignals);
}
@@ -417,6 +435,13 @@ namespace MonoTests.Mono.Unix {
Assert.AreEqual (sum, StormCount);
}
static void AssertCountSet (UnixSignal[] usignals)
{
foreach (UnixSignal s in usignals) {
Assert.IsTrue (s.Count > 0);
}
}
static UnixSignal[] CreateSignals (Signum[] signals)
{
UnixSignal[] s = new UnixSignal [signals.Length];
@@ -443,7 +468,6 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category("NotOnMac")] // OSX signal storming will not deliver every one
public void TestAddRemove ()
{
UnixSignal[] usignals = CreateSignals (signals);
@@ -458,7 +482,7 @@ namespace MonoTests.Mono.Unix {
foreach (Thread t in threads)
t.Join ();
AssertCount (usignals);
AssertCountSet (usignals);
CloseSignals (usignals);
}
@@ -478,7 +502,6 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category("NotOnMac")] // OSX signal storming will not deliver every one
public void TestWaitAny ()
{
UnixSignal[] usignals = CreateSignals (signals);
@@ -496,7 +519,7 @@ namespace MonoTests.Mono.Unix {
foreach (Thread t in threads)
t.Join ();
AssertCount (usignals);
AssertCountSet (usignals);
CloseSignals (usignals);
}
@@ -25,6 +25,7 @@ namespace MonoTests.Mono.Unix {
public class UnixUserTest
{
[Test]
[Category ("AndroidNotWorking")] // setpwent is missing from bionic
public void ListAllUsers_ToString ()
{
try {
@@ -80,6 +81,7 @@ namespace MonoTests.Mono.Unix {
[Test]
[Category ("NotOnMac")]
[Category ("AndroidNotWorking")] // setpwent is missing from bionic
public void NonReentrantSyscalls ()
{
ArrayList user_ids = new ArrayList (4);
@@ -119,6 +121,7 @@ namespace MonoTests.Mono.Unix {
}
[Test]
[Category ("AndroidNotWorking")] // API 21 has getpwnam_r in the NDK headers, but bionic doesn't export it
public void InvalidUsers_Constructor_Name ()
{
string[] badUsers = new string[]{"i'm bad", "so am i", "does-not-exist"};
@@ -243,6 +243,17 @@ namespace MonoTests.System.Linq.Expressions {
return 42;
}
[Test]
public void CallMethodOnDateTime ()
{
var left = Expression.Call (Expression.Constant (DateTime.Now), typeof(DateTime).GetMethod ("AddDays"), Expression.Constant (-5.0));
var right = Expression.Constant (DateTime.Today.AddDays (1));
var expr = Expression.GreaterThan (left, right);
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
Assert.IsFalse (eq ());
}
[Test]
[Category ("NotDotNet")] // http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=339351
[ExpectedException (typeof (ArgumentException))]
@@ -398,7 +409,6 @@ namespace MonoTests.System.Linq.Expressions {
}
[Test]
[Category ("NotWorkingInterpreter")]
public void Connect282702 ()
{
var lambda = Expression.Lambda<Func<Func<int>>> (
@@ -93,6 +93,18 @@ namespace MonoTests.System.Linq.Expressions
Assert.IsFalse (eq ());
}
[Test]
public void StringWithNull ()
{
BinaryExpression expr = Expression.Equal (Expression.Constant ("a"), Expression.Constant (null));
Assert.AreEqual (ExpressionType.Equal, expr.NodeType);
Assert.AreEqual (typeof (bool), expr.Type);
Assert.IsNull (expr.Method);
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
Assert.IsFalse (eq ());
}
[Test]
public void Nullable_LiftToNull_SetToFalse ()
{
@@ -79,6 +79,30 @@ namespace MonoTests.System.Linq.Expressions
Assert.AreEqual ("(1 != 2)", expr.ToString ());
}
[Test]
public void PrimitiveNonNumeric ()
{
BinaryExpression expr = Expression.NotEqual (Expression.Constant ('a'), Expression.Constant ('b'));
Assert.AreEqual (ExpressionType.NotEqual, expr.NodeType);
Assert.AreEqual (typeof (bool), expr.Type);
Assert.IsNull (expr.Method);
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
Assert.IsTrue (eq ());
}
[Test]
public void StringWithNull ()
{
BinaryExpression expr = Expression.NotEqual (Expression.Constant ("a"), Expression.Constant (null));
Assert.AreEqual (ExpressionType.NotEqual, expr.NodeType);
Assert.AreEqual (typeof (bool), expr.Type);
Assert.IsNull (expr.Method);
var eq = Expression.Lambda<Func<bool>> (expr).Compile ();
Assert.IsTrue (eq ());
}
[Test]
public void Nullable_LiftToNull_SetToFalse ()
{
@@ -37,7 +37,7 @@ namespace MonoTests.System.Security.Cryptography {
public class AesManagedTest {
[Test]
#if !MOBILE
#if !MONOTOUCH
[ExpectedException (typeof (CryptographicException))]
#endif
public void CFB_NotAllowed ()
@@ -61,7 +61,7 @@ namespace MonoTests.System.Security.Cryptography {
}
[Test]
#if !MOBILE
#if !MONOTOUCH
[ExpectedException (typeof (CryptographicException))]
#endif
public void OFB_NotAllowed ()
@@ -1263,20 +1263,29 @@ namespace System.Data.SqlClient
throw new ArgumentNullException ("values");
int len = values.Length;
int bigDecimalIndex = command.Tds.ColumnValues.BigDecimalIndex;
var tds = command.Tds;
int columns = Math.Min (len, tds.Columns.Count);
// If a four-byte decimal is stored, then we can't convert to
// a native type. Throw an OverflowException.
if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
throw new OverflowException ();
try {
command.Tds.ColumnValues.CopyTo (0, values, 0,
len > command.Tds.ColumnValues.Count ? command.Tds.ColumnValues.Count : len);
} catch (TdsInternalException ex) {
command.Connection.Close ();
throw SqlException.FromTdsInternalException ((TdsInternalException) ex);
if ((command.CommandBehavior & CommandBehavior.SequentialAccess) != 0) {
for (int i = 0; i < columns; ++i) {
values [i] = tds.GetSequentialColumnValue (i);
}
} else {
int bigDecimalIndex = tds.ColumnValues.BigDecimalIndex;
// If a four-byte decimal is stored, then we can't convert to
// a native type. Throw an OverflowException.
if (bigDecimalIndex >= 0 && bigDecimalIndex < len)
throw new OverflowException ();
try {
tds.ColumnValues.CopyTo (0, values, 0, columns);
} catch (TdsInternalException ex) {
command.Connection.Close ();
throw SqlException.FromTdsInternalException ((TdsInternalException)ex);
}
}
return (len < FieldCount ? len : FieldCount);
return columns;
}
@@ -363,6 +363,10 @@ namespace System.Net.Http.Headers
first = false;
}
// Return null for empty values list
if (first)
return null;
return sb.ToString ();
}
@@ -30,6 +30,7 @@ using System.Threading;
using System.Threading.Tasks;
using System.Collections.Specialized;
using System.Net.Http.Headers;
using System.Linq;
namespace System.Net.Http
{
@@ -274,7 +275,26 @@ namespace System.Net.Http
// Add request headers
var headers = wr.Headers;
foreach (var header in request.Headers) {
headers.AddValue (header.Key, HttpRequestHeaders.GetSingleHeaderString (header.Key, header.Value));
var values = header.Value;
if (header.Key == "Host") {
//
// Host must be explicitly set for HttpWebRequest
//
wr.Host = request.Headers.Host;
continue;
}
if (header.Key == "Transfer-Encoding") {
// Chunked Transfer-Encoding is never set for HttpWebRequest. It's detected
// from ContentLength by HttpWebRequest
values = values.Where (l => l != "chunked");
}
var values_formated = HttpRequestHeaders.GetSingleHeaderString (header.Key, values);
if (values_formated == null)
continue;
headers.AddValue (header.Key, values_formated);
}
return wr;
@@ -606,6 +606,95 @@ namespace MonoTests.System.Net.Http
}
}
[Test]
public void Send_Complete_CustomHeaders_Host ()
{
bool? failed = null;
var listener = CreateListener (l => {
var request = l.Request;
try {
Assert.AreEqual ("customhost", request.Headers["Host"], "#1");
failed = false;
} catch {
failed = true;
}
});
try {
var client = new HttpClient ();
client.DefaultRequestHeaders.Add("Host", "customhost");
var request = new HttpRequestMessage (HttpMethod.Get, LocalServer);
var response = client.SendAsync (request, HttpCompletionOption.ResponseHeadersRead).Result;
Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
Assert.AreEqual (false, failed, "#102");
} finally {
listener.Abort ();
listener.Close ();
}
}
[Test]
public void Send_Transfer_Encoding_Chunked ()
{
bool? failed = null;
var listener = CreateListener (l => {
var request = l.Request;
try {
Assert.AreEqual (1, request.Headers.Count, "#1");
failed = false;
} catch {
failed = true;
}
});
try {
var client = new HttpClient ();
client.DefaultRequestHeaders.TransferEncodingChunked = true;
client.GetAsync (LocalServer).Wait ();
Assert.AreEqual (false, failed, "#102");
} finally {
listener.Abort ();
listener.Close ();
}
}
[Test]
public void Send_Transfer_Encoding_Custom ()
{
bool? failed = null;
var listener = CreateListener (l => {
failed = true;
});
try {
var client = new HttpClient ();
client.DefaultRequestHeaders.TransferEncoding.Add (new TransferCodingHeaderValue ("chunked2"));
var request = new HttpRequestMessage (HttpMethod.Get, LocalServer);
try {
client.SendAsync (request, HttpCompletionOption.ResponseHeadersRead).Wait ();
Assert.Fail ("#1");
} catch (AggregateException e) {
Assert.AreEqual (typeof (ProtocolViolationException), e.InnerException.GetType (), "#2");
}
Assert.IsNull (failed, "#102");
} finally {
listener.Abort ();
listener.Close ();
}
}
[Test]
public void Send_Complete_Content ()
@@ -1,54 +0,0 @@
../../build/common/Consts.cs
Assembly/AssemblyInfo.cs
System.Net.Http/ByteArrayContent.cs
System.Net.Http/ClientCertificateOption.cs
System.Net.Http/DelegatingHandler.cs
System.Net.Http/FormUrlEncodedContent.cs
System.Net.Http/HttpClient.cs
System.Net.Http/HttpClientHandler.cs
System.Net.Http/HttpCompletionOption.cs
System.Net.Http/HttpContent.cs
System.Net.Http/HttpMessageHandler.cs
System.Net.Http/HttpMessageInvoker.cs
System.Net.Http/HttpMethod.cs
System.Net.Http/HttpRequestException.cs
System.Net.Http/HttpRequestMessage.cs
System.Net.Http/HttpResponseMessage.cs
System.Net.Http/MessageProcessingHandler.cs
System.Net.Http/MultipartContent.cs
System.Net.Http/MultipartFormDataContent.cs
System.Net.Http/StreamContent.cs
System.Net.Http/StringContent.cs
System.Net.Http.Headers/AuthenticationHeaderValue.cs
System.Net.Http.Headers/CacheControlHeaderValue.cs
System.Net.Http.Headers/CollectionExtensions.cs
System.Net.Http.Headers/CollectionParser.cs
System.Net.Http.Headers/ContentDispositionHeaderValue.cs
System.Net.Http.Headers/ContentRangeHeaderValue.cs
System.Net.Http.Headers/EntityTagHeaderValue.cs
System.Net.Http.Headers/HashCodeCalculator.cs
System.Net.Http.Headers/HeaderInfo.cs
System.Net.Http.Headers/HttpContentHeaders.cs
System.Net.Http.Headers/HttpHeaderKind.cs
System.Net.Http.Headers/HttpHeaders.cs
System.Net.Http.Headers/HttpHeaderValueCollection.cs
System.Net.Http.Headers/HttpRequestHeaders.cs
System.Net.Http.Headers/HttpResponseHeaders.cs
System.Net.Http.Headers/Lexer.cs
System.Net.Http.Headers/MediaTypeHeaderValue.cs
System.Net.Http.Headers/MediaTypeWithQualityHeaderValue.cs
System.Net.Http.Headers/NameValueHeaderValue.cs
System.Net.Http.Headers/NameValueWithParametersHeaderValue.cs
System.Net.Http.Headers/Parser.cs
System.Net.Http.Headers/ProductHeaderValue.cs
System.Net.Http.Headers/ProductInfoHeaderValue.cs
System.Net.Http.Headers/QualityValue.cs
System.Net.Http.Headers/RangeConditionHeaderValue.cs
System.Net.Http.Headers/RangeHeaderValue.cs
System.Net.Http.Headers/RangeItemHeaderValue.cs
System.Net.Http.Headers/RetryConditionHeaderValue.cs
System.Net.Http.Headers/StringWithQualityHeaderValue.cs
System.Net.Http.Headers/TransferCodingHeaderValue.cs
System.Net.Http.Headers/TransferCodingWithQualityHeaderValue.cs
System.Net.Http.Headers/ViaHeaderValue.cs
System.Net.Http.Headers/WarningHeaderValue.cs
@@ -1 +0,0 @@
#include monotouch_System.Net.Http.dll.sources
@@ -181,8 +181,8 @@ namespace System.Runtime.Serialization
void ReadISerializable (ClassDataContract classContract)
{
ConstructorInfo ctor = classContract.GetISerializableConstructor ();
context.ReadSerializationInfo (xmlReader, classContract.UnderlyingType);
ctor.Invoke (objectLocal, new object [] {context.GetStreamingContext ()});
var info = context.ReadSerializationInfo (xmlReader, classContract.UnderlyingType);
ctor.Invoke (objectLocal, new object [] {info, context.GetStreamingContext ()});
}
void ReadClass (ClassDataContract classContract)
@@ -469,8 +469,13 @@ namespace System.Runtime.Serialization
PrimitiveDataContract primitiveContract = PrimitiveDataContract.GetPrimitiveDataContract(memberType);
if (primitiveContract != null && !writeXsiType)
primitiveContract.XmlFormatContentWriterMethod.Invoke (writer, new object [] {memberValue});
else
InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
else {
// InternalSerialize(XmlFormatGeneratorStatics.InternalSerializeMethod, () => memberValue, memberType, writeXsiType);
var typeHandleValue = Type.GetTypeHandle (memberValue);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
}
}
else
{
@@ -500,22 +505,19 @@ namespace System.Runtime.Serialization
if (isNull2) {
XmlFormatGeneratorStatics.WriteNullMethod.Invoke (ctx, new object [] {writer, memberType, DataContract.IsTypeSerializable(memberType)});
} else {
InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod),
() => memberValue, memberType, writeXsiType);
var typeHandleValue = Type.GetTypeHandle (memberValue);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (memberValue, memberType, Globals.TypeOfObject));
if (isNullableOfT)
ctx.InternalSerialize (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
else
ctx.InternalSerializeReference (writer, memberValue, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle);
//InternalSerialize((isNullableOfT ? XmlFormatGeneratorStatics.InternalSerializeMethod : XmlFormatGeneratorStatics.InternalSerializeReferenceMethod), () => memberValue, memberType, writeXsiType);
}
}
}
}
}
void InternalSerialize (MethodInfo methodInfo, Func<object> memberValue, Type memberType, bool writeXsiType)
{
var v = memberValue ();
var typeHandleValue = Type.GetTypeHandle (v);
var isDeclaredType = typeHandleValue.Equals (CodeInterpreter.ConvertValue (v, memberType, Globals.TypeOfObject));
methodInfo.Invoke (ctx, new object [] {writer, memberValue != null ? v : null, isDeclaredType, writeXsiType, DataContract.GetId (memberType.TypeHandle), memberType.TypeHandle});
}
object UnwrapNullableObject(Func<object> memberValue, ref Type memberType, out bool isNull)// Leaves !HasValue on stack
{
object v = memberValue ();
@@ -5,10 +5,12 @@ System.Runtime.Serialization/Bug2843Test.cs
System.Runtime.Serialization/Bug3258Test.cs
System.Runtime.Serialization/Bug242Test.cs
System.Runtime.Serialization/Bug695203Test.cs
System.Runtime.Serialization/Bug36100.cs
System.Runtime.Serialization/DataContractResolverTest.cs
System.Runtime.Serialization/DataContractSerializerTest_DuplicateQName.cs
System.Runtime.Serialization/DataContractSerializerTest_NullableWithDictionary.cs
System.Runtime.Serialization/DataContractSerializerTest_InvalidCharacters.cs
System.Runtime.Serialization/DataContractSerializerTest_ISerializable.cs
System.Runtime.Serialization/DataContractSerializerTest.cs
System.Runtime.Serialization/KnownTypeAttributeTest.cs
System.Runtime.Serialization/XmlObjectSerializerTest.cs
@@ -0,0 +1,114 @@
//
// DataContractSerializerTest_ISerializable.cs
//
// Author:
// Aaron Bockover <[email protected]>
//
// Copyright 2015 Xamarin Inc. All rights reserved.
//
// 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.IO;
using System.Runtime.Serialization;
using System.Xml;
using NUnit.Framework;
namespace MonoTests.System.Runtime.Serialization
{
[TestFixture]
public class DataContractSerializerTest_ISerializable
{
[Serializable]
sealed class TestClassISerializable : ISerializable
{
public string Foo { get; }
public TestClassISerializable (string foo)
{
Foo = foo;
}
TestClassISerializable (SerializationInfo info, StreamingContext context)
{
Foo = info.GetString ("foo");
}
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
info.AddValue ("foo", Foo);
}
}
// Tests that the ISerializable constructor is properly invoked, which
// regressed when integrating MS Reference Source DCS, et. al.:
// https://bugzilla.xamarin.com/show_bug.cgi?id=37171
[Test]
public void TestISerializableCtor ()
{
var serializer = new DataContractSerializer (
typeof(TestClassISerializable),
new DataContractSerializerSettings {
DataContractResolver = new Resolver ()
}
);
var stream = new MemoryStream ();
var expected = new TestClassISerializable ("hello world");
serializer.WriteObject (stream, expected);
stream.Flush ();
stream.Position = 0;
var actual = (TestClassISerializable)serializer.ReadObject (stream);
Assert.AreEqual (expected.Foo, actual.Foo, "#DCS_ISer_Ctor");
}
// Resolver to force DCS to serialize any type, ensuring the ISerializable
// path will be taken for objects implementing that interface
class Resolver : DataContractResolver
{
public override Type ResolveName (string typeName, string typeNamespace,
Type declaredType, DataContractResolver knownTypeResolver)
{
return Type.GetType (typeNamespace == null
? typeName
: typeNamespace + "." + typeName
);
}
public override bool TryResolveType (Type type, Type declaredType,
DataContractResolver knownTypeResolver,
out XmlDictionaryString typeName,
out XmlDictionaryString typeNamespace)
{
var name = type.FullName;
var namesp = type.Namespace;
name = name.Substring (type.Namespace.Length + 1);
typeName = new XmlDictionaryString (XmlDictionary.Empty, name, 0);
typeNamespace = new XmlDictionaryString (XmlDictionary.Empty, namesp, 0);
return true;
}
}
}
}
@@ -584,10 +584,14 @@ namespace System.ServiceModel.Dispatcher
{
Message msg;
var input = (IInputChannel) result.AsyncState;
if (input.EndTryReceive (result, out msg))
ProcessInput (input, msg);
else
try {
if (input.EndTryReceive (result, out msg))
ProcessInput (input, msg);
else
input.Close ();
} catch (ObjectDisposedException) {
input.Close ();
}
}
void ProcessRequest (IReplyChannel reply, RequestContext rc)
@@ -461,8 +461,6 @@ namespace System.ServiceModel.MonoInternal
if (p == parameters)
return retval;
if (p.Length != parameters.Length)
throw new InvalidOperationException ();
Array.Copy (p, parameters, p.Length);
return retval;
}
@@ -128,6 +128,7 @@ System.ServiceModel.Description/WsdlImporterTest.cs
System.ServiceModel.Dispatcher/ActionFilterTest.cs
System.ServiceModel.Dispatcher/Bug652331Test.cs
System.ServiceModel.Dispatcher/Bug652331_2Test.cs
System.ServiceModel.Dispatcher/Bug32886Test.cs
System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs
System.ServiceModel.Dispatcher/DispatchOperationTest.cs
System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs
@@ -0,0 +1,706 @@
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2015 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.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Description;
using System.Threading;
using NUnit.Framework;
using WebServiceMoonlightTest.ServiceReference1;
using MonoTests.Helpers;
namespace MonoTests.System.ServiceModel.Dispatcher
{
[TestFixture]
public class Bug32886
{
[Test]
public void Bug32886_Test () // test in one of the comment
{
// Init service
int port = NetworkHelpers.FindFreePort ();
ServiceHost serviceHost = new ServiceHost (typeof (TempConvertSoapImpl), new Uri ("http://localhost:" + port + "/TempConvertSoap"));
serviceHost.AddServiceEndpoint (typeof (TempConvertSoap), new BasicHttpBinding (), string.Empty);
// Enable metadata exchange (WSDL publishing)
var mexBehavior = new ServiceMetadataBehavior ();
mexBehavior.HttpGetEnabled = true;
serviceHost.Description.Behaviors.Add (mexBehavior);
serviceHost.AddServiceEndpoint (typeof (IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding (), "mex");
serviceHost.Open ();
try {
// client
var binding = new BasicHttpBinding ();
var remoteAddress = new EndpointAddress ("http://localhost:" + port + "/TempConvertSoap");
var client = new TempConvertSoapClient (binding, remoteAddress);
var wait = new ManualResetEvent (false);
client.CelsiusToFahrenheitCompleted += delegate (object o, CelsiusToFahrenheitCompletedEventArgs e) {
if (e.Error != null)
throw e.Error;
Assert.AreEqual ("76.1", e.Result, "#1");
wait.Set ();
};
client.CelsiusToFahrenheitAsync ("24.5");
if (!wait.WaitOne (TimeSpan.FromSeconds (20)))
Assert.Fail ("timeout");
} finally {
serviceHost.Close ();
}
}
class TempConvertSoapImpl : TempConvertSoap
{
public FahrenheitToCelsiusResponse FarenheitToCelsius (FahrenheitToCelsiusRequest request)
{
var farenheit = double.Parse (request.Body.Fahrenheit);
var celsius = ((farenheit - 32) / 9) * 5;
return new FahrenheitToCelsiusResponse (new FahrenheitToCelsiusResponseBody (celsius.ToString ()));
}
public CelsiusToFahrenheitResponse CelsiusToFarenheit (CelsiusToFahrenheitRequest request)
{
var celsius = double.Parse (request.Body.Celsius);
var farenheit = ((celsius * 9) / 5) + 32;
return new CelsiusToFahrenheitResponse (new CelsiusToFahrenheitResponseBody (farenheit.ToString ()));
}
Func<FahrenheitToCelsiusRequest,FahrenheitToCelsiusResponse> farenheitToCelsius;
Func<CelsiusToFahrenheitRequest,CelsiusToFahrenheitResponse> celsiusToFarenheit;
public IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, AsyncCallback callback, object asyncState)
{
if (farenheitToCelsius == null)
farenheitToCelsius = new Func<FahrenheitToCelsiusRequest,FahrenheitToCelsiusResponse> (FarenheitToCelsius);
return farenheitToCelsius.BeginInvoke (request, callback, asyncState);
}
public FahrenheitToCelsiusResponse EndFahrenheitToCelsius (IAsyncResult result)
{
return farenheitToCelsius.EndInvoke (result);
}
public IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, AsyncCallback callback, object asyncState)
{
if (celsiusToFarenheit == null)
celsiusToFarenheit = new Func<CelsiusToFahrenheitRequest,CelsiusToFahrenheitResponse> (CelsiusToFarenheit);
return celsiusToFarenheit.BeginInvoke (request, callback, asyncState);
}
public CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (IAsyncResult result)
{
return celsiusToFarenheit.EndInvoke (result);
}
}
}
}
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.34003
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
//
// This code was auto-generated by SlSvcUtil, version 5.0.61118.0
//
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute (Namespace = "http://www.w3schools.com/webservices/", ConfigurationName = "TempConvertSoap")]
public interface TempConvertSoap
{
[System.ServiceModel.OperationContractAttribute (AsyncPattern = true, Action = "http://www.w3schools.com/webservices/FahrenheitToCelsius", ReplyAction = "*")]
System.IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState);
FahrenheitToCelsiusResponse EndFahrenheitToCelsius (System.IAsyncResult result);
[System.ServiceModel.OperationContractAttribute (AsyncPattern = true, Action = "http://www.w3schools.com/webservices/CelsiusToFahrenheit", ReplyAction = "*")]
System.IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState);
CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (System.IAsyncResult result);
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
public partial class FahrenheitToCelsiusRequest
{
[System.ServiceModel.MessageBodyMemberAttribute (Name = "FahrenheitToCelsius", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
public FahrenheitToCelsiusRequestBody Body;
public FahrenheitToCelsiusRequest ()
{
}
public FahrenheitToCelsiusRequest (FahrenheitToCelsiusRequestBody Body)
{
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
public partial class FahrenheitToCelsiusRequestBody
{
[System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
public string Fahrenheit;
public FahrenheitToCelsiusRequestBody ()
{
}
public FahrenheitToCelsiusRequestBody (string Fahrenheit)
{
this.Fahrenheit = Fahrenheit;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
public partial class FahrenheitToCelsiusResponse
{
[System.ServiceModel.MessageBodyMemberAttribute (Name = "FahrenheitToCelsiusResponse", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
public FahrenheitToCelsiusResponseBody Body;
public FahrenheitToCelsiusResponse ()
{
}
public FahrenheitToCelsiusResponse (FahrenheitToCelsiusResponseBody Body)
{
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
public partial class FahrenheitToCelsiusResponseBody
{
[System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
public string FahrenheitToCelsiusResult;
public FahrenheitToCelsiusResponseBody ()
{
}
public FahrenheitToCelsiusResponseBody (string FahrenheitToCelsiusResult)
{
this.FahrenheitToCelsiusResult = FahrenheitToCelsiusResult;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
public partial class CelsiusToFahrenheitRequest
{
[System.ServiceModel.MessageBodyMemberAttribute (Name = "CelsiusToFahrenheit", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
public CelsiusToFahrenheitRequestBody Body;
public CelsiusToFahrenheitRequest ()
{
}
public CelsiusToFahrenheitRequest (CelsiusToFahrenheitRequestBody Body)
{
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
public partial class CelsiusToFahrenheitRequestBody
{
[System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
public string Celsius;
public CelsiusToFahrenheitRequestBody ()
{
}
public CelsiusToFahrenheitRequestBody (string Celsius)
{
this.Celsius = Celsius;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.ServiceModel.MessageContractAttribute (IsWrapped = false)]
public partial class CelsiusToFahrenheitResponse
{
[System.ServiceModel.MessageBodyMemberAttribute (Name = "CelsiusToFahrenheitResponse", Namespace = "http://www.w3schools.com/webservices/", Order = 0)]
public CelsiusToFahrenheitResponseBody Body;
public CelsiusToFahrenheitResponse ()
{
}
public CelsiusToFahrenheitResponse (CelsiusToFahrenheitResponseBody Body)
{
this.Body = Body;
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
[System.Runtime.Serialization.DataContractAttribute (Namespace = "http://www.w3schools.com/webservices/")]
public partial class CelsiusToFahrenheitResponseBody
{
[System.Runtime.Serialization.DataMemberAttribute (EmitDefaultValue = false, Order = 0)]
public string CelsiusToFahrenheitResult;
public CelsiusToFahrenheitResponseBody ()
{
}
public CelsiusToFahrenheitResponseBody (string CelsiusToFahrenheitResult)
{
this.CelsiusToFahrenheitResult = CelsiusToFahrenheitResult;
}
}
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
public interface TempConvertSoapChannel : TempConvertSoap, System.ServiceModel.IClientChannel
{
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
public partial class FahrenheitToCelsiusCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
public FahrenheitToCelsiusCompletedEventArgs (object[] results, System.Exception exception, bool cancelled, object userState) :
base (exception, cancelled, userState)
{
this.results = results;
}
public string Result {
get {
base.RaiseExceptionIfNecessary ();
return ((string)(this.results [0]));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
public partial class CelsiusToFahrenheitCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
{
private object[] results;
public CelsiusToFahrenheitCompletedEventArgs (object[] results, System.Exception exception, bool cancelled, object userState) :
base (exception, cancelled, userState)
{
this.results = results;
}
public string Result {
get {
base.RaiseExceptionIfNecessary ();
return ((string)(this.results [0]));
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute ()]
[System.CodeDom.Compiler.GeneratedCodeAttribute ("System.ServiceModel", "4.0.0.0")]
public partial class TempConvertSoapClient : System.ServiceModel.ClientBase<TempConvertSoap>, TempConvertSoap
{
private BeginOperationDelegate onBeginFahrenheitToCelsiusDelegate;
private EndOperationDelegate onEndFahrenheitToCelsiusDelegate;
private System.Threading.SendOrPostCallback onFahrenheitToCelsiusCompletedDelegate;
private BeginOperationDelegate onBeginCelsiusToFahrenheitDelegate;
private EndOperationDelegate onEndCelsiusToFahrenheitDelegate;
private System.Threading.SendOrPostCallback onCelsiusToFahrenheitCompletedDelegate;
private BeginOperationDelegate onBeginOpenDelegate;
private EndOperationDelegate onEndOpenDelegate;
private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
private BeginOperationDelegate onBeginCloseDelegate;
private EndOperationDelegate onEndCloseDelegate;
private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
public TempConvertSoapClient ()
{
}
public TempConvertSoapClient (string endpointConfigurationName) :
base (endpointConfigurationName)
{
}
public TempConvertSoapClient (string endpointConfigurationName, string remoteAddress) :
base (endpointConfigurationName, remoteAddress)
{
}
public TempConvertSoapClient (string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
base (endpointConfigurationName, remoteAddress)
{
}
public TempConvertSoapClient (System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
base (binding, remoteAddress)
{
}
public System.Net.CookieContainer CookieContainer {
get {
System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager> ();
if ((httpCookieContainerManager != null)) {
return httpCookieContainerManager.CookieContainer;
} else {
return null;
}
}
set {
System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager> ();
if ((httpCookieContainerManager != null)) {
httpCookieContainerManager.CookieContainer = value;
} else {
throw new System.InvalidOperationException ("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
"ookieContainerBindingElement.");
}
}
}
public event System.EventHandler<FahrenheitToCelsiusCompletedEventArgs> FahrenheitToCelsiusCompleted;
public event System.EventHandler<CelsiusToFahrenheitCompletedEventArgs> CelsiusToFahrenheitCompleted;
public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
System.IAsyncResult TempConvertSoap.BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState)
{
return base.Channel.BeginFahrenheitToCelsius (request, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
private System.IAsyncResult BeginFahrenheitToCelsius (string Fahrenheit, System.AsyncCallback callback, object asyncState)
{
FahrenheitToCelsiusRequest inValue = new FahrenheitToCelsiusRequest ();
inValue.Body = new FahrenheitToCelsiusRequestBody ();
inValue.Body.Fahrenheit = Fahrenheit;
return ((TempConvertSoap)(this)).BeginFahrenheitToCelsius (inValue, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
FahrenheitToCelsiusResponse TempConvertSoap.EndFahrenheitToCelsius (System.IAsyncResult result)
{
return base.Channel.EndFahrenheitToCelsius (result);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
private string EndFahrenheitToCelsius (System.IAsyncResult result)
{
FahrenheitToCelsiusResponse retVal = ((TempConvertSoap)(this)).EndFahrenheitToCelsius (result);
return retVal.Body.FahrenheitToCelsiusResult;
}
private System.IAsyncResult OnBeginFahrenheitToCelsius (object[] inValues, System.AsyncCallback callback, object asyncState)
{
string Fahrenheit = ((string)(inValues [0]));
return this.BeginFahrenheitToCelsius (Fahrenheit, callback, asyncState);
}
private object[] OnEndFahrenheitToCelsius (System.IAsyncResult result)
{
string retVal = this.EndFahrenheitToCelsius (result);
return new object[] {
retVal
};
}
private void OnFahrenheitToCelsiusCompleted (object state)
{
if ((this.FahrenheitToCelsiusCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.FahrenheitToCelsiusCompleted (this, new FahrenheitToCelsiusCompletedEventArgs (e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void FahrenheitToCelsiusAsync (string Fahrenheit)
{
this.FahrenheitToCelsiusAsync (Fahrenheit, null);
}
public void FahrenheitToCelsiusAsync (string Fahrenheit, object userState)
{
if ((this.onBeginFahrenheitToCelsiusDelegate == null)) {
this.onBeginFahrenheitToCelsiusDelegate = new BeginOperationDelegate (this.OnBeginFahrenheitToCelsius);
}
if ((this.onEndFahrenheitToCelsiusDelegate == null)) {
this.onEndFahrenheitToCelsiusDelegate = new EndOperationDelegate (this.OnEndFahrenheitToCelsius);
}
if ((this.onFahrenheitToCelsiusCompletedDelegate == null)) {
this.onFahrenheitToCelsiusCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnFahrenheitToCelsiusCompleted);
}
base.InvokeAsync (this.onBeginFahrenheitToCelsiusDelegate, new object[] {
Fahrenheit
}, this.onEndFahrenheitToCelsiusDelegate, this.onFahrenheitToCelsiusCompletedDelegate, userState);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
System.IAsyncResult TempConvertSoap.BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState)
{
return base.Channel.BeginCelsiusToFahrenheit (request, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
private System.IAsyncResult BeginCelsiusToFahrenheit (string Celsius, System.AsyncCallback callback, object asyncState)
{
CelsiusToFahrenheitRequest inValue = new CelsiusToFahrenheitRequest ();
inValue.Body = new CelsiusToFahrenheitRequestBody ();
inValue.Body.Celsius = Celsius;
return ((TempConvertSoap)(this)).BeginCelsiusToFahrenheit (inValue, callback, asyncState);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
CelsiusToFahrenheitResponse TempConvertSoap.EndCelsiusToFahrenheit (System.IAsyncResult result)
{
return base.Channel.EndCelsiusToFahrenheit (result);
}
[System.ComponentModel.EditorBrowsableAttribute (System.ComponentModel.EditorBrowsableState.Advanced)]
private string EndCelsiusToFahrenheit (System.IAsyncResult result)
{
CelsiusToFahrenheitResponse retVal = ((TempConvertSoap)(this)).EndCelsiusToFahrenheit (result);
return retVal.Body.CelsiusToFahrenheitResult;
}
private System.IAsyncResult OnBeginCelsiusToFahrenheit (object[] inValues, System.AsyncCallback callback, object asyncState)
{
string Celsius = ((string)(inValues [0]));
return this.BeginCelsiusToFahrenheit (Celsius, callback, asyncState);
}
private object[] OnEndCelsiusToFahrenheit (System.IAsyncResult result)
{
string retVal = this.EndCelsiusToFahrenheit (result);
return new object[] {
retVal
};
}
private void OnCelsiusToFahrenheitCompleted (object state)
{
if ((this.CelsiusToFahrenheitCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.CelsiusToFahrenheitCompleted (this, new CelsiusToFahrenheitCompletedEventArgs (e.Results, e.Error, e.Cancelled, e.UserState));
}
}
public void CelsiusToFahrenheitAsync (string Celsius)
{
this.CelsiusToFahrenheitAsync (Celsius, null);
}
public void CelsiusToFahrenheitAsync (string Celsius, object userState)
{
if ((this.onBeginCelsiusToFahrenheitDelegate == null)) {
this.onBeginCelsiusToFahrenheitDelegate = new BeginOperationDelegate (this.OnBeginCelsiusToFahrenheit);
}
if ((this.onEndCelsiusToFahrenheitDelegate == null)) {
this.onEndCelsiusToFahrenheitDelegate = new EndOperationDelegate (this.OnEndCelsiusToFahrenheit);
}
if ((this.onCelsiusToFahrenheitCompletedDelegate == null)) {
this.onCelsiusToFahrenheitCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnCelsiusToFahrenheitCompleted);
}
base.InvokeAsync (this.onBeginCelsiusToFahrenheitDelegate, new object[] {
Celsius
}, this.onEndCelsiusToFahrenheitDelegate, this.onCelsiusToFahrenheitCompletedDelegate, userState);
}
private System.IAsyncResult OnBeginOpen (object[] inValues, System.AsyncCallback callback, object asyncState)
{
return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen (callback, asyncState);
}
private object[] OnEndOpen (System.IAsyncResult result)
{
((System.ServiceModel.ICommunicationObject)(this)).EndOpen (result);
return null;
}
private void OnOpenCompleted (object state)
{
if ((this.OpenCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.OpenCompleted (this, new System.ComponentModel.AsyncCompletedEventArgs (e.Error, e.Cancelled, e.UserState));
}
}
public void OpenAsync ()
{
this.OpenAsync (null);
}
public void OpenAsync (object userState)
{
if ((this.onBeginOpenDelegate == null)) {
this.onBeginOpenDelegate = new BeginOperationDelegate (this.OnBeginOpen);
}
if ((this.onEndOpenDelegate == null)) {
this.onEndOpenDelegate = new EndOperationDelegate (this.OnEndOpen);
}
if ((this.onOpenCompletedDelegate == null)) {
this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnOpenCompleted);
}
base.InvokeAsync (this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
}
private System.IAsyncResult OnBeginClose (object[] inValues, System.AsyncCallback callback, object asyncState)
{
return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose (callback, asyncState);
}
private object[] OnEndClose (System.IAsyncResult result)
{
((System.ServiceModel.ICommunicationObject)(this)).EndClose (result);
return null;
}
private void OnCloseCompleted (object state)
{
if ((this.CloseCompleted != null)) {
InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
this.CloseCompleted (this, new System.ComponentModel.AsyncCompletedEventArgs (e.Error, e.Cancelled, e.UserState));
}
}
public void CloseAsync ()
{
this.CloseAsync (null);
}
public void CloseAsync (object userState)
{
if ((this.onBeginCloseDelegate == null)) {
this.onBeginCloseDelegate = new BeginOperationDelegate (this.OnBeginClose);
}
if ((this.onEndCloseDelegate == null)) {
this.onEndCloseDelegate = new EndOperationDelegate (this.OnEndClose);
}
if ((this.onCloseCompletedDelegate == null)) {
this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback (this.OnCloseCompleted);
}
base.InvokeAsync (this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
}
protected override TempConvertSoap CreateChannel ()
{
return new TempConvertSoapClientChannel (this);
}
private class TempConvertSoapClientChannel : ChannelBase<TempConvertSoap>, TempConvertSoap
{
public TempConvertSoapClientChannel (System.ServiceModel.ClientBase<TempConvertSoap> client) :
base (client)
{
}
public System.IAsyncResult BeginFahrenheitToCelsius (FahrenheitToCelsiusRequest request, System.AsyncCallback callback, object asyncState)
{
object[] _args = new object[1];
_args [0] = request;
System.IAsyncResult _result = base.BeginInvoke ("FahrenheitToCelsius", _args, callback, asyncState);
return _result;
}
public FahrenheitToCelsiusResponse EndFahrenheitToCelsius (System.IAsyncResult result)
{
object[] _args = new object[0];
FahrenheitToCelsiusResponse _result = ((FahrenheitToCelsiusResponse)(base.EndInvoke ("FahrenheitToCelsius", _args, result)));
return _result;
}
public System.IAsyncResult BeginCelsiusToFahrenheit (CelsiusToFahrenheitRequest request, System.AsyncCallback callback, object asyncState)
{
object[] _args = new object[1];
_args [0] = request;
System.IAsyncResult _result = base.BeginInvoke ("CelsiusToFahrenheit", _args, callback, asyncState);
return _result;
}
public CelsiusToFahrenheitResponse EndCelsiusToFahrenheit (System.IAsyncResult result)
{
object[] _args = new object[0];
CelsiusToFahrenheitResponse _result = ((CelsiusToFahrenheitResponse)(base.EndInvoke ("CelsiusToFahrenheit", _args, result)));
return _result;
}
}
}
@@ -121,7 +121,9 @@ namespace System.Xml.Xsl
public void Transform (IXPathNavigable input, XsltArgumentList arguments, Stream results)
{
Transform (input.CreateNavigator (), arguments, results);
using (var sw = new StreamWriter (results)) {
Transform (input.CreateNavigator (), arguments, sw);
}
}
public void Transform (IXPathNavigable input, XmlWriter results)
@@ -168,5 +168,31 @@ xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:msxsl='urn:schemas-micros
// Returns true on .NET and False on mono 2.10.2
Assert.IsTrue (xslCompiledTransform.OutputSettings.Indent, "#1");
}
[Test] // Bug 36436
public void TransformWithXmlDocument ()
{
XmlDocument doc = new XmlDocument ();
doc.LoadXml (@"<ROOT/>");
XmlDocument st = new XmlDocument ();
st.LoadXml (@"<?xml version=""1.0"" encoding=""utf-8""?>
<xsl:stylesheet version=""1.0"" xmlns:vy=""Vineyard.Elements""
xmlns:xsl=""http://www.w3.org/1999/XSL/Transform"" xmlns:xlink=""http://www.w3.org/1999/xlink"" xmlns:user=""http://www.mydomain.com/mynamespace"">
<xsl:output method=""xml""/>
<xsl:param name=""os"" select=""ios""/>
<xsl:template match=""/ROOT"" >
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>");
XslCompiledTransform xsl = new XslCompiledTransform ();
xsl.Load (st);
XsltArgumentList args = new XsltArgumentList ();
MemoryStream mstr = new MemoryStream ();
xsl.Transform (doc, args, mstr);
}
}
}
@@ -1487,9 +1487,13 @@ namespace System.Diagnostics {
}
public void Close () {
RemoveFromIOThreadPool (handle);
stream.Close ();
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
extern static void RemoveFromIOThreadPool (IntPtr handle);
void IThreadPoolWorkItem.ExecuteWorkItem()
{
async_result.Invoke ();
+10 -1
View File
@@ -162,6 +162,8 @@ namespace System.IO {
class KqueueMonitor : IDisposable
{
static bool initialized;
public int Connection
{
get { return conn; }
@@ -171,6 +173,13 @@ namespace System.IO {
{
this.fsw = fsw;
this.conn = -1;
if (!initialized){
int t;
initialized = true;
var maxenv = Environment.GetEnvironmentVariable ("MONO_DARWIN_WATCHER_MAXFDS");
if (maxenv != null && Int32.TryParse (maxenv, out t))
maxFds = t;
}
}
public void Dispose ()
@@ -625,7 +634,7 @@ namespace System.IO {
const int F_GETPATH = 50;
const int __DARWIN_MAXPATHLEN = 1024;
static readonly kevent[] emptyEventList = new System.IO.kevent[0];
const int maxFds = 200;
int maxFds = Int32.MaxValue;
FileSystemWatcher fsw;
int conn;
@@ -28,27 +28,6 @@
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.NetworkInformation {
public abstract class IPv4InterfaceStatistics {
protected IPv4InterfaceStatistics ()
{
}
public abstract long BytesReceived { get; }
public abstract long BytesSent { get; }
public abstract long IncomingPacketsDiscarded { get; }
public abstract long IncomingPacketsWithErrors { get; }
public abstract long IncomingUnknownProtocolPackets { get; }
public abstract long NonUnicastPacketsReceived { get; }
public abstract long NonUnicastPacketsSent { get; }
public abstract long OutgoingPacketsDiscarded { get; }
public abstract long OutgoingPacketsWithErrors { get; }
[MonoTODO("Not implemented for Linux")]
public abstract long OutputQueueLength { get; }
public abstract long UnicastPacketsReceived { get; }
public abstract long UnicastPacketsSent { get; }
}
class Win32IPv4InterfaceStatistics : IPv4InterfaceStatistics
{
Win32_MIB_IFROW info;
@@ -442,8 +442,10 @@ namespace System.Net.NetworkInformation {
unsafe void OnDataAvailable (object sender, SocketAsyncEventArgs args)
{
if (nl_sock == null) // Recent changes in Mono cause MaybeCloseSocket to be called before OnDataAvailable
return;
EventType type;
fixed (byte *ptr = args.Buffer) {
fixed (byte *ptr = args.Buffer) {
type = ReadEvents (nl_sock.Handle, new IntPtr (ptr), args.BytesTransferred, 8192);
}
nl_sock.ReceiveAsync (nl_args);
+1 -1
View File
@@ -312,7 +312,7 @@ namespace System.Net
lock (this) {
idleSince = outIdleSince;
if (removeList != null) {
if (removeList != null && groups != null) {
foreach (var group in removeList)
if (groups.ContainsKey (group.Name))
RemoveConnectionGroup (group);
@@ -654,7 +654,8 @@ namespace System.Net
if (setInternalLength && !no_writestream && writeBuffer != null)
request.InternalContentLength = writeBuffer.Length;
if (!(sendChunked || request.ContentLength > -1 || no_writestream || webdav))
bool has_content = !no_writestream && (writeBuffer == null || request.ContentLength > -1);
if (!(sendChunked || has_content || no_writestream || webdav))
return false;
headersSent = true;
+2
View File
@@ -1008,6 +1008,8 @@ ReferenceSources/Win32Exception.cs
../../../external/referencesource/System/net/System/Net/WebPermission.cs
../../../external/referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs
../../../external/referencesource/System/sys/system/runtime/versioning/FrameworkName.cs
+20 -4
View File
@@ -96,6 +96,12 @@ namespace System {
set { s_IriParsing = value; }
}
// Do not rename this.
// User code might set this to true with reflection.
// When set to true an Uri constructed with UriKind.RelativeOrAbsolute
// and paths such as "/foo" is assumed relative.
private static bool useDotNetRelativeOrAbsolute;
#if BOOTSTRAP_BASIC
private static readonly string hexUpperChars = "0123456789ABCDEF";
private static readonly string [] Empty = new string [0];
@@ -147,6 +153,8 @@ namespace System {
IriParsing = true;
else if (iriparsingVar == "false")
IriParsing = false;
useDotNetRelativeOrAbsolute = Environment.GetEnvironmentVariable ("MONO_URI_DOTNETRELATIVEORABSOLUTE") == "true";
}
public Uri (string uriString) : this (uriString, false)
@@ -173,12 +181,21 @@ namespace System {
// When used instead of UriKind.RelativeOrAbsolute paths such as "/foo" are assumed relative.
const UriKind DotNetRelativeOrAbsolute = (UriKind) 300;
private void ProcessUriKind (string uriString, ref UriKind uriKind)
{
if (uriString == null)
return;
if (uriKind == DotNetRelativeOrAbsolute ||
(uriKind == UriKind.RelativeOrAbsolute && useDotNetRelativeOrAbsolute))
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
}
public Uri (string uriString, UriKind uriKind)
{
source = uriString;
if (uriString != null && uriKind == DotNetRelativeOrAbsolute)
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
ProcessUriKind (uriString, ref uriKind);
ParseUri (uriKind);
@@ -212,8 +229,7 @@ namespace System {
return;
}
if (uriKind == DotNetRelativeOrAbsolute)
uriKind = (uriString.StartsWith ("/", StringComparison.Ordinal))? UriKind.Relative : UriKind.RelativeOrAbsolute;
ProcessUriKind (uriString, ref uriKind);
if (uriKind != UriKind.RelativeOrAbsolute &&
uriKind != UriKind.Absolute &&
+8 -2
View File
@@ -263,7 +263,12 @@ namespace System
builder.Append (scheme);
// note: mailto and news use ':', not "://", as their delimiter
builder.Append (Uri.GetSchemeDelimiter (scheme));
if (UriParser.IsKnownScheme(scheme)) {
builder.Append (Uri.GetSchemeDelimiter (scheme));
}
else {
builder.Append (host.Length > 0 ? Uri.SchemeDelimiter : ":");
}
if (username != String.Empty) {
builder.Append (username);
@@ -280,7 +285,8 @@ namespace System
if (path != String.Empty &&
builder [builder.Length - 1] != '/' &&
path.Length > 0 && path [0] != '/')
path.Length > 0 && path [0] != '/' &&
host.Length > 0)
builder.Append ('/');
builder.Append (path);
builder.Append (query);
@@ -26,7 +26,7 @@ namespace MonoTests.System.ComponentModel
SynchronizationContext sc1 = new SynchronizationContext ();
SynchronizationContext sc2 = new SynchronizationContext ();
#if MOBILE
#if MOBILE && !MONODROID
Assert.IsNotNull (SynchronizationContext.Current, "A1");
#else
Assert.IsNull (SynchronizationContext.Current, "A1");
@@ -838,9 +838,18 @@ namespace MonoTests.System.Diagnostics
}
private ProcessStartInfo GetCrossPlatformStartInfo ()
ProcessStartInfo GetCrossPlatformStartInfo ()
{
return RunningOnUnix ? new ProcessStartInfo ("/bin/ls", "/") : new ProcessStartInfo ("help", "");
if (RunningOnUnix) {
string path;
#if MONODROID
path = "/system/bin/ls";
#else
path = "/bin/ls";
#endif
return new ProcessStartInfo (path, "/");
} else
return new ProcessStartInfo ("help", "");
}
[Test]
@@ -376,6 +376,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("AndroidNotWorking")] // system zlib returns Z_STREAM_ERROR
public void Bug28777_EmptyFlush ()
{
MemoryStream backing = new MemoryStream ();
@@ -386,6 +387,7 @@ namespace MonoTests.System.IO.Compression
}
[Test]
[Category ("AndroidNotWorking")] // system zlib returns Z_BUF_ERROR
public void Bug28777_DoubleFlush ()
{
byte[] buffer = new byte [4096];
@@ -7,6 +7,8 @@
using NUnit.Framework;
using System;
using System.Globalization;
using System.IO;
using System.Net;
using System.Net.NetworkInformation;
@@ -29,18 +31,82 @@ namespace MonoTests.System.Net.NetworkInformation
}
Assert.IsTrue (numUnicastAddresses > 0);
}
// Borrowed from IPInterfaceProperties.cs
bool HasOnlyDefaultGateway (string iface)
{
int gwCount = 0;
int defaultGwCount = 0;
#if MONODROID
if (!File.Exists ("/proc/net/route"))
return false;
try {
using (StreamReader reader = new StreamReader ("/proc/net/route")) {
string line;
reader.ReadLine (); // Ignore first line
while ((line = reader.ReadLine ()) != null) {
line = line.Trim ();
if (line.Length == 0)
continue;
string [] parts = line.Split ('\t');
if (parts.Length < 3)
continue;
string gw_address = parts [2].Trim ();
byte [] ipbytes = new byte [4];
if (gw_address.Length == 8 && iface.Equals (parts [0], StringComparison.OrdinalIgnoreCase)) {
for (int i = 0; i < 4; i++) {
if (!Byte.TryParse (gw_address.Substring (i * 2, 2), NumberStyles.HexNumber, null, out ipbytes [3 - i]))
continue;
}
IPAddress ip = new IPAddress (ipbytes);
if (ip.Equals (IPAddress.Any))
defaultGwCount++;
else
gwCount++;
}
}
}
} catch {
}
#endif
return gwCount == 0 && defaultGwCount > 0;
}
[Test]
public void AtLeastOneGatewayAddress ()
{
int numGatewayAddresses = 0;
NetworkInterface[] adapters = NetworkInterface.GetAllNetworkInterfaces ();
// On Android (possibly on other systems too) it is possible that no gateway address is available and its lack is NOT an error
// Here is a sample of /proc/net/route from Nexus 9 running Android 5.1.1 (IPInterfaceProperties parses that file on Linux)
//
// Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
// wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
//
// Gateway is set to any address and it is explicitly ignored by the route information parser
//
// For comparison, here's route contents from an Android 4.4.4 device:
//
// Iface Destination Gateway Flags RefCnt Use Metric Mask MTU Window IRTT
// wlan0 00000000 0101A8C0 0003 0 0 0 00000000 0 0 0
// wlan0 00000000 0101A8C0 0003 0 0 203 00000000 0 0 0
// wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
// wlan0 0001A8C0 00000000 0001 0 0 0 00FFFFFF 0 0 0
// wlan0 0001A8C0 00000000 0001 0 0 203 00FFFFFF 0 0 0
// wlan0 0101A8C0 00000000 0005 0 0 0 FFFFFFFF 0 0 0
//
// Obviously, this test fails on the first device and succeeds on the second. For this reason the test is modified to succeed
// in case of devices like the first one since it's not a real failure but a shortcoming of the .NET API
//
foreach (NetworkInterface adapter in adapters)
{
IPInterfaceProperties adapterProperties = adapter.GetIPProperties ();
GatewayIPAddressInformationCollection gatewayAddresses = adapterProperties.GatewayAddresses;
numGatewayAddresses += gatewayAddresses.Count;
numGatewayAddresses += HasOnlyDefaultGateway (adapter.Name) ? 1 : gatewayAddresses.Count;
}
Assert.IsTrue (numGatewayAddresses > 0);
}
@@ -56,6 +122,9 @@ namespace MonoTests.System.Net.NetworkInformation
}
[Test]
// The code works as expected when part of a regular app. It fails when executed from within an NUnit test
// Might be a problem with the test suite. To investigate.
[Category("AndroidNotWorking")]
public void AtLeastOneDnsAddress ()
{
int numDnsAddresses = 0;
@@ -66,6 +135,7 @@ namespace MonoTests.System.Net.NetworkInformation
IPAddressCollection dnsAddresses = adapterProperties.DnsAddresses;
numDnsAddresses += dnsAddresses.Count;
}
Console.WriteLine ("numDnsAddresses == {0}", numDnsAddresses);
// reading /etc/resolve.conf does not work on iOS devices (but works on simulator)
// ref: https://bugzilla.xamarin.com/show_bug.cgi?id=27707
#if !MONOTOUCH
@@ -48,6 +48,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ServerHandshakeReturnCrapStatusCodeTest ()
{
// On purpose,
@@ -64,6 +65,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ServerHandshakeReturnWrongUpgradeHeader ()
{
#pragma warning disable 4014
@@ -82,6 +84,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ServerHandshakeReturnWrongConnectionHeader ()
{
#pragma warning disable 4014
@@ -102,6 +105,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // The test hangs when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void EchoTest ()
{
const string Payload = "This is a websocket test";
@@ -126,6 +130,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void CloseOutputAsyncTest ()
{
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
@@ -142,6 +147,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void CloseAsyncTest ()
{
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
@@ -158,6 +164,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test, ExpectedException (typeof (ArgumentNullException))]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void SendAsyncArgTest_NoArray ()
{
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
@@ -171,6 +178,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test, ExpectedException (typeof (ArgumentNullException))]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ReceiveAsyncArgTest_NoArray ()
{
Assert.IsTrue (socket.ConnectAsync (new Uri (EchoServerUrl), CancellationToken.None).Wait (5000));
@@ -178,6 +186,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ReceiveAsyncWrongState_Closed ()
{
try {
@@ -192,6 +201,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void SendAsyncWrongState_Closed ()
{
try {
@@ -206,6 +216,7 @@ namespace MonoTests.System.Net.WebSockets
}
[Test]
[Category ("MobileNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void SendAsyncWrongState_CloseSent ()
{
try {
@@ -476,6 +476,7 @@ namespace MonoTests.System.Net {
}
[Test]
[Category ("AndroidNotWorking")] // Fails ("reuse1") when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void ConnectionReuse ()
{
var uri = "http://localhost:" + NetworkHelpers.FindFreePort () + "/";
@@ -70,7 +70,7 @@ namespace MonoTests.System.Net
Assert.AreEqual ("OK", res.StatusCode.ToString (), "#B1");
Assert.AreEqual ("OK", res.StatusDescription, "#B2");
Assert.AreEqual ("text/html; charset=ISO-8859-1", res.Headers.Get ("Content-Type"), "#C1");
Assert.IsTrue (res.Headers.Get ("Content-Type").StartsWith ("text/html; charset=", StringComparison.OrdinalIgnoreCase), "#C1");
Assert.IsNotNull (res.LastModified, "#C2");
Assert.AreEqual (0, res.Cookies.Count, "#C3");
@@ -123,14 +123,15 @@ namespace MonoTests.System.Net
}
[Test]
[Category("InetAccess")]
//[Category("InetAccess")]
[Category ("NotWorking")] // Disabled until a server that meets requirements is found
public void Cookies1 ()
{
// The purpose of this test is to ensure that the cookies we get from a request
// are stored in both, the CookieCollection in HttpWebResponse and the CookieContainer
// in HttpWebRequest.
// If this URL stops sending *one* and only one cookie, replace it.
string url = "http://www.elmundo.es";
string url = "http://xamarin.com";
CookieContainer cookies = new CookieContainer ();
HttpWebRequest req = (HttpWebRequest) WebRequest.Create (url);
req.KeepAlive = false;
@@ -2814,6 +2815,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category("MobileNotWorking")]
public void BeginWrite_Request_Aborted ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -87,7 +87,7 @@ public class ServicePointManagerTest
ServicePointManager.MaxServicePoints = 0;
ServicePoint sp = ServicePointManager.FindServicePoint (googleUri, new WebProxy (apacheUri));
Assert.AreEqual (apacheUri, sp.Address, "#1");
#if NET_2_1
#if NET_2_1 && !MONODROID
Assert.AreEqual (10, sp.ConnectionLimit, "#2");
#else
Assert.AreEqual (2, sp.ConnectionLimit, "#2");
@@ -53,10 +53,13 @@ public class ServicePointTest
HttpWebRequest req = (HttpWebRequest) WebRequest.Create ("http://www.google.com");
HttpWebResponse res = (HttpWebResponse) req.GetResponse ();
#if FOUND_SOME_OTHER_URL
// URL is no longer found, disabled the test until a more reliable URL is found :P
//WriteServicePoint ("google after getting a response", google);
ServicePoint google2 = ServicePointManager.FindServicePoint (new Uri ("http://www.google.com/dilbert.html"));
Assert.AreEqual (google, google2, "#equals");
res.Close ();
#endif
// in both instances property CurrentConnections is 0 according to ms.net.
// let's see what it says when we do async operations...
@@ -83,10 +86,11 @@ public class ServicePointTest
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
res2.Close ();
ServicePoint sp2;
#if FOUND_SOME_OTHER_URL
// unless of course some buffering is taking place.. let's check
Uri uri2 = new Uri ("http://freedesktop.org/Software/pkgconfig/releases/pkgconfig-0.15.0.tar.gz");
ServicePoint sp2 = ServicePointManager.FindServicePoint (uri2);
sp2 = ServicePointManager.FindServicePoint (uri2);
req2 = (HttpWebRequest) WebRequest.Create (uri2);
async = req2.BeginGetResponse (null, null);
//WriteServicePoint ("Large file: after async BeginGetResponse", sp2);
@@ -97,6 +101,7 @@ public class ServicePointTest
// and so it shows
//Console.WriteLine ("ContentLength: " + res2.ContentLength);
res2.Close ();
#endif
// what's the limit of the cache?
@@ -148,6 +153,7 @@ public class ServicePointTest
[Test]
[Category ("InetAccess")]
[Category ("AndroidNotWorking")] // #A1 fails
public void EndPointBind ()
{
Uri uri = new Uri ("http://www.go-mono.com/");
@@ -163,7 +169,7 @@ public class ServicePointTest
};
req.GetResponse ().Close ();
Assert.IsTrue (called);
Assert.IsTrue (called, "#A1");
req = (HttpWebRequest) WebRequest.Create (uri);
called = false;
@@ -174,7 +180,7 @@ public class ServicePointTest
};
req.GetResponse ().Close ();
Assert.IsTrue (called);
Assert.IsTrue (called, "#A2");
}
public static void GetRequestStreamCallback (IAsyncResult asynchronousResult)
@@ -119,6 +119,14 @@ namespace MonoTests.System.Net
// ignore interruption of blocking call
if (ex.ErrorCode != SOCKET_CLOSED && ex.ErrorCode != SOCKET_INVALID_ARGS)
throw;
#if MOBILE
} catch (InvalidOperationException ex) {
// This breaks some tests running on Android. The problem is that the stack trace
// doesn't point to where the exception is actually thrown from but the entire process
// is aborted because of unhandled exception.
Console.WriteLine ("SocketResponder.Listen failed:");
Console.WriteLine (ex);
#endif
} finally {
Thread.Sleep (500);
if (socket != null)
@@ -1417,6 +1417,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadValues1 ()
{
IPEndPoint ep = NetworkHelpers.LocalEphemeralEndPoint ();
@@ -1783,6 +1784,7 @@ namespace MonoTests.System.Net
#if NET_4_5
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadStringAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9301, (webClient, uri, cancelEvent) =>
@@ -1799,6 +1801,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadDataAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9302, (webClient, uri, cancelEvent) =>
@@ -1814,6 +1817,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadValuesAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9303, (webClient, uri, cancelEvent) =>
@@ -1829,6 +1833,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadFileAsyncCancelEvent ()
{
UploadAsyncCancelEventTest (9304,(webClient, uri, cancelEvent) =>
@@ -1847,6 +1852,7 @@ namespace MonoTests.System.Net
}
[Test]
[Category ("AndroidNotWorking")] // Test suite hangs if the tests runs as part of the entire BCL suite. Works when only this fixture is ran
public void UploadFileAsyncContentType ()
{
var serverUri = "http://localhost:13370/";
@@ -43,6 +43,7 @@ namespace MonoTests.System.Net
{
[Test]
[Category("Async")]
[Category("AndroidNotWorking")] // Attempts to access the test dll which won't work on Android
public void DownloadData ()
{
WebClient wc;
@@ -94,6 +95,7 @@ namespace MonoTests.System.Net
[Test]
[Category("InetAccess")]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void Cancellation ()
{
WebClient wc = new WebClient ();
@@ -121,6 +123,7 @@ namespace MonoTests.System.Net
[Test]
[Category("InetAccess")]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple ()
{
WebClient wc = new WebClient ();
@@ -139,6 +142,7 @@ namespace MonoTests.System.Net
[Test]
[Category("InetAccess")]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple2 ()
{
WebClient wc = new WebClient ();
@@ -151,6 +155,7 @@ namespace MonoTests.System.Net
[Test]
[Category("InetAccess")]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void DownloadMultiple3 ()
{
WebClient wc = new WebClient ();
@@ -316,6 +316,9 @@ namespace MonoTests.System.Net {
}
[Test] //BNC#323452
// Throws exception with Status == Timeout. The same code behaves as the test expects when run from a regular app.
// Might be an issue with the test suite. To investigate.
[Category("AndroidNotWorking")]
public void TestFailedConnection ()
{
try {
@@ -326,7 +329,7 @@ namespace MonoTests.System.Net {
//#if NET_2_0 e.Message == "Unable to connect to the remote server"
//#if NET_1_1 e.Message == "The underlying connection was closed: Unable to connect to the remote server."
Assert.AreEqual (((WebException)e).Status, WebExceptionStatus.ConnectFailure);
Assert.AreEqual (WebExceptionStatus.ConnectFailure, ((WebException)e).Status);
//#if !NET_1_1 (this is not true in .NET 1.x)
Assert.IsNotNull (e.InnerException);
@@ -337,6 +340,7 @@ namespace MonoTests.System.Net {
}
[Test] //BNC#323452
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void TestFailedResolution ()
{
try {
@@ -387,6 +387,13 @@ namespace MonoTests.System
// this is what ASP.NET really means (the ?)
Assert.AreEqual ("http://192.168.0.21/error404.aspx?aspxerrorpath=/WebResource.axd", ub.Uri.ToString ());
}
[Test]
public void NoHostname ()
{
UriBuilder ub = new UriBuilder ("about", null, -1, "config");
Assert.AreEqual ("about:config", ub.ToString ());
}
}
}
+38 -6
View File
@@ -1946,12 +1946,44 @@ namespace MonoTests.System
[Test]
public void DotNetRelativeOrAbsoluteTest ()
{
var uri1 = new Uri ("/foo", DotNetRelativeOrAbsolute);
Assert.IsFalse (uri1.IsAbsoluteUri);
Uri uri2;
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri2);
Assert.IsFalse (uri2.IsAbsoluteUri);
FieldInfo useDotNetRelativeOrAbsoluteField = null;
bool useDotNetRelativeOrAbsoluteOld = false;
if (Type.GetType ("Mono.Runtime") != null) {
useDotNetRelativeOrAbsoluteField = typeof (Uri).GetField ("useDotNetRelativeOrAbsolute",
BindingFlags.Static | BindingFlags.GetField | BindingFlags.NonPublic);
useDotNetRelativeOrAbsoluteOld = (bool) useDotNetRelativeOrAbsoluteField.GetValue (null);
useDotNetRelativeOrAbsoluteField.SetValue (null, false);
}
try {
Uri uri;
uri = new Uri ("/foo", DotNetRelativeOrAbsolute);
Assert.IsFalse (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri);
Assert.IsFalse (uri.IsAbsoluteUri);
if (useDotNetRelativeOrAbsoluteField != null) {
uri = new Uri ("/foo", UriKind.RelativeOrAbsolute);
Assert.IsTrue (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", UriKind.RelativeOrAbsolute, out uri);
Assert.IsTrue (uri.IsAbsoluteUri);
useDotNetRelativeOrAbsoluteField.SetValue (null, true);
}
uri = new Uri ("/foo", UriKind.RelativeOrAbsolute);
Assert.IsFalse (uri.IsAbsoluteUri);
Uri.TryCreate("/foo", DotNetRelativeOrAbsolute, out uri);
Assert.IsFalse (uri.IsAbsoluteUri);
} finally {
if (useDotNetRelativeOrAbsoluteField != null)
useDotNetRelativeOrAbsoluteField.SetValue (null, useDotNetRelativeOrAbsoluteOld);
}
}
[Test]
@@ -725,6 +725,8 @@ ReferenceSources/Win32Exception.cs
../../../external/referencesource/System/net/System/Net/WebPermission.cs
../../../external/referencesource/System/net/System/Net/WriteStreamClosedEventArgs.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/IPInterfaceStatistics.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/ScopeLevel.cs
../../../external/referencesource/System/net/System/Net/NetworkInformation/UnicastIPAddressInformation.cs
../../../external/referencesource/System/sys/system/threading/Barrier.cs
@@ -36,7 +36,10 @@ namespace System
return false;
var from = Type.GetTypeCode (source);
switch (Type.GetTypeCode (target)) {
var to = Type.GetTypeCode (target);
if (from == to && source.IsPrimitive)
return true;
switch (to) {
case TypeCode.Char:
switch (from) {
case TypeCode.Byte:
@@ -146,4 +149,4 @@ namespace System
return st == type || CanConvertPrimitive ((RuntimeType) st, type);
}
}
}
}
@@ -34,6 +34,10 @@ namespace System
switch (codePage) {
case 1200: return GetResourceString ("Globalization.cp_1200");
case 1201: return GetResourceString ("Globalization.cp_1201");
case 12000: return GetResourceString ("Globalization.cp_12000");
case 12001: return GetResourceString ("Globalization.cp_12001");
case 20127: return GetResourceString ("Globalization.cp_20127");
case 65000: return GetResourceString ("Globalization.cp_65000");
case 65001: return GetResourceString ("Globalization.cp_65001");
default: return codePage.ToString (CultureInfo.InvariantCulture);
}
@@ -57,6 +57,7 @@ namespace System.Diagnostics {
public const int METHODS_TO_SKIP = 0;
private StackFrame[] frames;
readonly StackTrace[] captured_traces;
private bool debug_info;
public StackTrace ()
@@ -119,11 +120,6 @@ namespace System.Diagnostics {
}
public StackTrace (Exception e, int skipFrames, bool fNeedFileInfo)
: this (e, skipFrames, fNeedFileInfo, false)
{
}
internal StackTrace (Exception e, int skipFrames, bool fNeedFileInfo, bool returnNativeFrames)
{
if (e == null)
throw new ArgumentNullException ("e");
@@ -132,22 +128,7 @@ namespace System.Diagnostics {
frames = get_trace (e, skipFrames, fNeedFileInfo);
if (!returnNativeFrames) {
bool resize = false;
for (int i = 0; i < frames.Length; ++i)
if (frames [i].GetMethod () == null)
resize = true;
if (resize) {
var l = new List<StackFrame> ();
for (int i = 0; i < frames.Length; ++i)
if (frames [i].GetMethod () != null)
l.Add (frames [i]);
frames = l.ToArray ();
}
}
captured_traces = e.captured_traces;
}
public StackTrace (StackFrame frame)
@@ -189,21 +170,14 @@ namespace System.Diagnostics {
return frames;
}
internal bool AddFrames (StringBuilder sb, bool isException = false)
bool AddFrames (StringBuilder sb)
{
bool printOffset;
string debugInfo, indentation;
string unknown = Locale.GetText ("<unknown method>");
if (isException) {
printOffset = true;
indentation = " ";
debugInfo = Locale.GetText (" in {0}:{1} ");
} else {
printOffset = false;
indentation = " ";
debugInfo = Locale.GetText (" in {0}:line {1}");
}
indentation = " ";
debugInfo = Locale.GetText (" in {0}:{1} ");
var newline = String.Format ("{0}{1}{2} ", Environment.NewLine, indentation,
Locale.GetText ("at"));
@@ -220,21 +194,17 @@ namespace System.Diagnostics {
string internal_name = frame.GetInternalMethodName ();
if (internal_name != null)
sb.Append (internal_name);
else if (printOffset)
sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> {2}", frame.GetMethodAddress (), frame.GetNativeOffset (), unknown);
else
sb.AppendFormat (unknown);
sb.AppendFormat ("<0x{0:x5} + 0x{1:x5}> {2}", frame.GetMethodAddress (), frame.GetNativeOffset (), unknown);
} else {
GetFullNameForStackTrace (sb, frame.GetMethod ());
if (printOffset) {
if (frame.GetILOffset () == -1) {
sb.AppendFormat (" <0x{0:x5} + 0x{1:x5}>", frame.GetMethodAddress (), frame.GetNativeOffset ());
if (frame.GetMethodIndex () != 0xffffff)
sb.AppendFormat (" {0}", frame.GetMethodIndex ());
} else {
sb.AppendFormat (" [0x{0:x5}]", frame.GetILOffset ());
}
if (frame.GetILOffset () == -1) {
sb.AppendFormat (" <0x{0:x5} + 0x{1:x5}>", frame.GetMethodAddress (), frame.GetNativeOffset ());
if (frame.GetMethodIndex () != 0xffffff)
sb.AppendFormat (" {0}", frame.GetMethodIndex ());
} else {
sb.AppendFormat (" [0x{0:x5}]", frame.GetILOffset ());
}
sb.AppendFormat (debugInfo, frame.GetSecureFileName (),
@@ -306,6 +276,21 @@ namespace System.Diagnostics {
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
//
// Add traces captured using ExceptionDispatchInfo
//
if (captured_traces != null) {
foreach (var t in captured_traces) {
if (!t.AddFrames (sb))
continue;
sb.Append (Environment.NewLine);
sb.Append ("--- End of stack trace from previous location where exception was thrown ---");
sb.Append (Environment.NewLine);
}
}
AddFrames (sb);
return sb.ToString ();
}
@@ -816,8 +816,15 @@ namespace System.Globalization
CultureInfo ci = new CultureInfo ();
if (!ci.construct_internal_locale_from_name (name)) {
int idx = name.IndexOf ('-');
if (idx < 1 || !ci.construct_internal_locale_from_name (name.Substring (0, idx)))
int idx = name.Length - 1;
if (idx > 0) {
while ((idx = name.LastIndexOf ('-', idx - 1)) > 0) {
if (ci.construct_internal_locale_from_name (name.Substring (0, idx)))
break;
}
}
if (idx <= 0)
throw CreateNotFoundException (src_name);
}
@@ -69,12 +69,28 @@ namespace System.Reflection {
}
}
public override Module Module {
get {
return GetRuntimeModule ();
}
}
internal RuntimeType GetDeclaringTypeInternal ()
{
return (RuntimeType) DeclaringType;
}
RuntimeType ReflectedTypeInternal {
get {
return (RuntimeType) ReflectedType;
}
}
internal RuntimeModule GetRuntimeModule ()
{
return GetDeclaringTypeInternal ().GetRuntimeModule ();
}
#region ISerializable
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
@@ -82,12 +82,28 @@ namespace System.Reflection {
}
}
public override Module Module {
get {
return GetRuntimeModule ();
}
}
internal RuntimeType GetDeclaringTypeInternal ()
{
return (RuntimeType) DeclaringType;
}
RuntimeType ReflectedTypeInternal {
get {
return (RuntimeType) ReflectedType;
}
}
internal RuntimeModule GetRuntimeModule ()
{
return GetDeclaringTypeInternal ().GetRuntimeModule ();
}
#region Object Overrides
public override String ToString()
{
@@ -86,6 +86,9 @@ namespace System.Runtime.Remoting.Contexts {
[MethodImpl (MethodImplOptions.InternalCall)]
extern static void RegisterContext (Context ctx);
[MethodImpl (MethodImplOptions.InternalCall)]
extern static void ReleaseContext (Context ctx);
public Context ()
{
@@ -97,6 +100,7 @@ namespace System.Runtime.Remoting.Contexts {
~Context ()
{
ReleaseContext (this);
}
public static Context DefaultContext {
@@ -90,7 +90,6 @@ namespace System.Threading {
private IntPtr interrupt_on_stop;
private IntPtr flags;
private IntPtr thread_pinning_ref;
private IntPtr async_invoke_method;
/*
* These fields are used to avoid having to increment corlib versions
* when a new field is added to the unmanaged MonoThread structure.
@@ -1,356 +0,0 @@
//
// System.Threading.ThreadPool.cs
//
// Author:
// Patrik Torstensson
// Dick Porter ([email protected])
// Maurer Dietmar ([email protected])
//
// (C) Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// 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.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.CompilerServices;
using System.Runtime.Remoting.Messaging;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
namespace System.Threading {
public static class ThreadPool {
[Obsolete("This method is obsolete, use BindHandle(SafeHandle) instead")]
public static bool BindHandle (IntPtr osHandle)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.BindHandle (osHandle);
else
return true;
}
public static bool BindHandle (SafeHandle osHandle)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
return Microsoft.ThreadPool.BindHandle (osHandle);
} else {
if (osHandle == null)
throw new ArgumentNullException ("osHandle");
return true;
}
}
public static void GetAvailableThreads (out int workerThreads, out int completionPortThreads)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.GetAvailableThreads (out workerThreads, out completionPortThreads);
else
GetAvailableThreads_internal (out workerThreads, out completionPortThreads);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void GetAvailableThreads_internal (out int workerThreads, out int completionPortThreads);
public static void GetMaxThreads (out int workerThreads, out int completionPortThreads)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.GetMaxThreads (out workerThreads, out completionPortThreads);
else
GetMaxThreads_internal (out workerThreads, out completionPortThreads);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void GetMaxThreads_internal (out int workerThreads, out int completionPortThreads);
public static void GetMinThreads (out int workerThreads, out int completionPortThreads)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.GetMinThreads (out workerThreads, out completionPortThreads);
else
GetMinThreads_internal (out workerThreads, out completionPortThreads);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void GetMinThreads_internal (out int workerThreads, out int completionPortThreads);
[MonoTODO("The min number of completion port threads is not evaluated.")]
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public static bool SetMinThreads (int workerThreads, int completionPortThreads)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.SetMinThreads (workerThreads, completionPortThreads);
else
return SetMinThreads_internal (workerThreads, completionPortThreads);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern bool SetMinThreads_internal (int workerThreads, int completionPortThreads);
[SecurityPermission (SecurityAction.Demand, ControlThread=true)]
public static bool SetMaxThreads (int workerThreads, int completionPortThreads)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.SetMaxThreads (workerThreads, completionPortThreads);
else
return SetMaxThreads_internal (workerThreads, completionPortThreads);
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern bool SetMaxThreads_internal (int workerThreads, int completionPortThreads);
public static bool QueueUserWorkItem (WaitCallback callBack)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.QueueUserWorkItem (callBack, null);
else
return QueueUserWorkItem (callBack, null);
}
public static bool QueueUserWorkItem (WaitCallback callBack, object state)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
return Microsoft.ThreadPool.QueueUserWorkItem (callBack, state);
} else {
if (callBack == null)
throw new ArgumentNullException ("callBack");
if (callBack.IsTransparentProxy ()) {
IAsyncResult ar = callBack.BeginInvoke (state, null, null);
if (ar == null)
return false;
} else {
AsyncResult ares = new AsyncResult (callBack, state, !ExecutionContext.IsFlowSuppressed());
pool_queue (ares);
}
return true;
}
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
static extern void pool_queue (AsyncResult ares);
// TODO: It should be interface interface only to avoid extra allocation
internal static void QueueWorkItem (WaitCallback callBack, object state)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.QueueUserWorkItem (callBack, state);
else
pool_queue (new AsyncResult (callBack, state, false));
}
public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack,
object state,
int millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.RegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
else
return RegisterWaitForSingleObject (waitObject, callBack, state, (long) millisecondsTimeOutInterval, executeOnlyOnce);
}
public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack,
object state,
long millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
return Microsoft.ThreadPool.RegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
} else {
if (waitObject == null)
throw new ArgumentNullException ("waitObject");
if (callBack == null)
throw new ArgumentNullException ("callBack");
if (millisecondsTimeOutInterval < -1)
throw new ArgumentOutOfRangeException ("timeout", "timeout < -1");
if (millisecondsTimeOutInterval > Int32.MaxValue)
throw new NotSupportedException ("Timeout is too big. Maximum is Int32.MaxValue");
TimeSpan timeout = new TimeSpan (0, 0, 0, 0, (int) millisecondsTimeOutInterval);
RegisteredWaitHandle waiter = new RegisteredWaitHandle (waitObject, callBack, state,
timeout, executeOnlyOnce);
QueueUserWorkItem (new WaitCallback (waiter.Wait), null);
return waiter;
}
}
public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack,
object state,
TimeSpan timeout,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.RegisterWaitForSingleObject (waitObject, callBack, state, timeout, executeOnlyOnce);
else
return RegisterWaitForSingleObject (waitObject, callBack, state, (long) timeout.TotalMilliseconds, executeOnlyOnce);
}
[CLSCompliant(false)]
public static RegisteredWaitHandle RegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack,
object state,
uint millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.RegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
else
return RegisterWaitForSingleObject (waitObject, callBack, state, (long) millisecondsTimeOutInterval, executeOnlyOnce);
}
[CLSCompliant (false)]
unsafe public static bool UnsafeQueueNativeOverlapped (NativeOverlapped *overlapped)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.UnsafeQueueNativeOverlapped (overlapped);
else
throw new NotImplementedException ();
}
#if !NET_2_1 || MOBILE
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
public static bool UnsafeQueueUserWorkItem (WaitCallback callBack, object state)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool) {
return Microsoft.ThreadPool.UnsafeQueueUserWorkItem (callBack, state);
} else {
if (callBack == null)
throw new ArgumentNullException ("callBack");
// no stack propagation here (that's why it's unsafe and requires extra security permissions)
if (!callBack.IsTransparentProxy ()) {
AsyncResult ares = new AsyncResult (callBack, state, false);
pool_queue (ares);
return true;
}
try {
if (!ExecutionContext.IsFlowSuppressed ())
ExecutionContext.SuppressFlow (); // on current thread only
IAsyncResult ar = callBack.BeginInvoke (state, null, null);
if (ar == null)
return false;
} finally {
if (ExecutionContext.IsFlowSuppressed ())
ExecutionContext.RestoreFlow ();
}
return true;
}
}
[MonoTODO("Not implemented")]
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack, object state, int millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.UnsafeRegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
else
throw new NotImplementedException ();
}
[MonoTODO("Not implemented")]
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack, object state, long millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.UnsafeRegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
else
throw new NotImplementedException ();
}
[MonoTODO("Not implemented")]
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack, object state, TimeSpan timeout,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.UnsafeRegisterWaitForSingleObject (waitObject, callBack, state, timeout, executeOnlyOnce);
else
throw new NotImplementedException ();
}
[MonoTODO("Not implemented")]
[CLSCompliant (false)]
[SecurityPermission (SecurityAction.Demand, ControlEvidence=true, ControlPolicy=true)]
public static RegisteredWaitHandle UnsafeRegisterWaitForSingleObject (WaitHandle waitObject,
WaitOrTimerCallback callBack, object state, uint millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.UnsafeRegisterWaitForSingleObject (waitObject, callBack, state, millisecondsTimeOutInterval, executeOnlyOnce);
else
throw new NotImplementedException ();
}
#endif
#region ReferenceSources
// Extracted from ../../../../external/referencesource/mscorlib/system/threading/threadpool.cs
internal static void UnsafeQueueCustomWorkItem(IThreadPoolWorkItem workItem, bool forceGlobal)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.UnsafeQueueCustomWorkItem (workItem, forceGlobal);
else
QueueWorkItem ((obj) => ((IThreadPoolWorkItem)obj).ExecuteWorkItem (), workItem);
}
internal static IEnumerable<IThreadPoolWorkItem> GetQueuedWorkItems()
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.GetQueuedWorkItems ();
else
return new IThreadPoolWorkItem [0];
}
internal static bool TryPopCustomWorkItem(IThreadPoolWorkItem workItem)
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
return Microsoft.ThreadPool.TryPopCustomWorkItem (workItem);
else
return false;
}
internal static void NotifyWorkItemProgress()
{
if (Microsoft.ThreadPool.UseMicrosoftThreadPool)
Microsoft.ThreadPool.NotifyWorkItemProgress ();
}
#endregion
}
}
+2 -5
View File
@@ -152,10 +152,7 @@ namespace System
stdin = new CStreamReader (OpenStandardInput (0), inputEncoding);
} else {
#endif
// FULL_AOT_RUNTIME is used (instead of MONOTOUCH) since we only want this code when running on
// iOS (simulator or devices) and *not* when running tools (e.g. btouch #12179) that needs to use
// the mscorlib.dll shipped with Xamarin.iOS
#if MONOTOUCH && FULL_AOT_RUNTIME
#if MONOTOUCH
stdout = new NSLogWriter ();
#else
stdout = new UnexceptionalStreamWriter (OpenStandardOutput (0), outputEncoding);
@@ -163,7 +160,7 @@ namespace System
#endif
stdout = TextWriter.Synchronized (stdout);
#if MONOTOUCH && FULL_AOT_RUNTIME
#if MONOTOUCH
stderr = new NSLogWriter ();
#else
stderr = new UnexceptionalStreamWriter (OpenStandardError (0), outputEncoding);
+1 -1
View File
@@ -7,7 +7,7 @@
// Copyright 2012-2014 Xamarin Inc. All rights reserved.
//
#if FULL_AOT_RUNTIME
#if MONOTOUCH
using System;
using System.IO;
+25 -18
View File
@@ -60,6 +60,7 @@ namespace System
private object m_target;
private IntPtr method;
private IntPtr delegate_trampoline;
private IntPtr rgctx;
private IntPtr method_code;
private MethodInfo method_info;
@@ -68,6 +69,8 @@ namespace System
private MethodInfo original_method_info;
private DelegateData data;
private bool method_is_virtual;
#pragma warning restore 169, 414, 649
#endregion
@@ -99,17 +102,13 @@ namespace System
public MethodInfo Method {
get {
if (method_info != null) {
return method_info;
} else {
if (method != IntPtr.Zero) {
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
}
return method_info;
}
return GetMethodImpl ();
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern MethodInfo GetVirtualMethod_internal ();
public object Target {
get {
return m_target;
@@ -467,13 +466,15 @@ namespace System
return MemberwiseClone ();
}
internal bool Compare (Delegate d)
public override bool Equals (object obj)
{
Delegate d = obj as Delegate;
if (d == null)
return false;
// Do not compare method_ptr, since it can point to a trampoline
if (d.m_target == m_target && d.method == method) {
if (d.m_target == m_target && d.Method == Method) {
if (d.data != null || data != null) {
/* Uncommon case */
if (d.data != null && data != null)
@@ -492,19 +493,25 @@ namespace System
return false;
}
public override bool Equals (object obj)
{
return Compare (obj as Delegate);
}
public override int GetHashCode ()
{
return method.GetHashCode () ^ (m_target != null ? m_target.GetHashCode () : 0);
/* same implementation as CoreCLR */
return GetType ().GetHashCode ();
}
protected virtual MethodInfo GetMethodImpl ()
{
return Method;
if (method_info != null) {
return method_info;
} else {
if (method != IntPtr.Zero) {
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
}
// This is from ISerializable
+2 -3
View File
@@ -57,7 +57,7 @@ namespace System {
* of icalls, do not require an increment.
*/
#pragma warning disable 169
private const int mono_corlib_version = 134;
private const int mono_corlib_version = 138;
#pragma warning restore 169
[ComVisible (true)]
@@ -549,8 +549,7 @@ namespace System {
return GetFolderPath (folder, SpecialFolderOption.None);
}
// for monotouch, not monotouch_runtime
#if !(MONOTOUCH && FULL_AOT_RUNTIME)
#if !MONOTOUCH
[MethodImplAttribute (MethodImplOptions.InternalCall)]
private extern static string GetWindowsFolderPath (int folder);
+3 -20
View File
@@ -199,26 +199,8 @@ namespace System
/* Not thrown yet */
return null;
StringBuilder sb = new StringBuilder ();
// Add traces captured using ExceptionDispatchInfo
if (captured_traces != null) {
foreach (var t in captured_traces) {
if (!t.AddFrames (sb, true))
continue;
sb.Append (Environment.NewLine);
sb.Append ("--- End of stack trace from previous location where exception was thrown ---");
sb.Append (Environment.NewLine);
}
}
StackTrace st = new StackTrace (this, 0, true, true);
st.AddFrames (sb, true);
stack_trace = sb.ToString ();
return stack_trace;
StackTrace st = new StackTrace (this, 0, true);
return stack_trace = st.ToString ();
}
}
@@ -316,6 +298,7 @@ namespace System
{
captured_traces = (StackTrace[]) exceptionDispatchInfo.BinaryStackTraceArray;
trace_ips = null;
stack_trace = null;
}
//
+45 -29
View File
@@ -33,6 +33,7 @@
using System.Collections;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
@@ -112,6 +113,14 @@ namespace System
return base.GetHashCode ();
}
protected override MethodInfo GetMethodImpl ()
{
if (delegates != null)
return delegates [delegates.Length - 1].Method;
return base.GetMethodImpl ();
}
// <summary>
// Return, in order of invocation, the invocation list
// of a MulticastDelegate
@@ -161,6 +170,32 @@ namespace System
return ret;
}
/* Based on the Boyer–Moore string search algorithm */
int LastIndexOf (Delegate[] haystack, Delegate[] needle)
{
if (haystack.Length < needle.Length)
return -1;
if (haystack.Length == needle.Length) {
for (int i = 0; i < haystack.Length; ++i)
if (!haystack [i].Equals (needle [i]))
return -1;
return 0;
}
for (int i = haystack.Length - needle.Length, j; i >= 0;) {
for (j = 0; needle [j].Equals (haystack [i]); ++i, ++j) {
if (j == needle.Length - 1)
return i - j;
}
i -= j + 1;
}
return -1;
}
protected sealed override Delegate RemoveImpl (Delegate value)
{
if (value == null)
@@ -201,42 +236,23 @@ namespace System
return ret;
} else {
/* wild case : remove MulticastDelegate from MulticastDelegate
* complexity is O(m * n), with n the number of elements in
* complexity is O(m + n), with n the number of elements in
* this.delegates and m the number of elements in other.delegates */
MulticastDelegate ret = AllocDelegateLike_internal (this);
ret.delegates = new Delegate [delegates.Length];
/* we should use a set with O(1) lookup complexity
* but HashSet is implemented in System.Core.dll */
List<Delegate> other_delegates = new List<Delegate> ();
for (int i = 0; i < other.delegates.Length; ++i)
other_delegates.Add (other.delegates [i]);
int idx = delegates.Length;
if (delegates.Equals (other.delegates))
return null;
/* we need to remove elements from the end to the beginning, as
* the addition and removal of delegates behaves like a stack */
for (int i = delegates.Length - 1; i >= 0; --i) {
/* if delegates[i] is not in other_delegates,
* then we can safely add it to ret.delegates
* otherwise we remove it from other_delegates */
if (!other_delegates.Remove (delegates [i]))
ret.delegates [--idx] = delegates [i];
}
int idx = LastIndexOf (delegates, other.delegates);
if (idx == -1)
return this;
/* the elements are at the end of the array, we
* need to move them back to the beginning of it */
int count = delegates.Length - idx;
Array.Copy (ret.delegates, idx, ret.delegates, 0, count);
MulticastDelegate ret = AllocDelegateLike_internal (this);
ret.delegates = new Delegate [delegates.Length - other.delegates.Length];
if (count == 0)
return null;
if (count == 1)
return ret.delegates [0];
if (count != delegates.Length)
Array.Resize (ref ret.delegates, count);
Array.Copy (delegates, ret.delegates, idx);
Array.Copy (delegates, idx + other.delegates.Length, ret.delegates, idx, delegates.Length - idx - other.delegates.Length);
return ret;
}
+6 -5
View File
@@ -870,12 +870,12 @@ namespace System
}
// DaylightTime.Start is relative to the Standard time.
if (start != DateTime.MinValue)
start += BaseUtcOffset;
if (!TryAddTicks (start, BaseUtcOffset.Ticks, out start))
start = DateTime.MinValue;
// DaylightTime.End is relative to the DST time.
if (end != DateTime.MinValue)
end += BaseUtcOffset + delta;
if (!TryAddTicks (end, BaseUtcOffset.Ticks + delta.Ticks, out end))
end = DateTime.MinValue;
} else {
AdjustmentRule first = null, last = null;
@@ -1318,7 +1318,8 @@ namespace System
else {
abbrevs.Add (abbrev_index, sb.ToString ());
//Adding all the substrings too, as it seems to be used, at least for Africa/Windhoek
for (int j = 1; j < sb.Length; j++)
//j == sb.Length empty substring also needs to be added #31432
for (int j = 1; j <= sb.Length; j++)
abbrevs.Add (abbrev_index + j, sb.ToString (j, sb.Length - j));
abbrev_index = i + 1;
sb = new StringBuilder ();
@@ -171,6 +171,21 @@ namespace MonoTests.System.Globalization
ci = CultureInfo.CreateSpecificCulture ("");
Assert.AreEqual (CultureInfo.InvariantCulture, ci, "#5");
ci = CultureInfo.CreateSpecificCulture ("zh-hant");
Assert.AreEqual ("zh-HK", ci.Name, "#6");
ci = CultureInfo.CreateSpecificCulture ("zh-hans");
Assert.AreEqual ("zh-CN", ci.Name, "#7");
ci = CultureInfo.CreateSpecificCulture ("zh-hans-CN");
Assert.AreEqual ("zh-CN", ci.Name, "#8");
ci = CultureInfo.CreateSpecificCulture ("zh-hant-US");
Assert.AreEqual ("zh-HK", ci.Name, "#9");
ci = CultureInfo.CreateSpecificCulture ("az-CyrlM-BR");
Assert.AreEqual ("az-Latn-AZ", ci.Name, "#10");
}
[Test]
Loaded 100 of 328 files, more files were not shown because too many files have changed in this diff. Show more