Compare commits

...
Author SHA1 Message Date
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
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
276 changed files with 7285 additions and 2516 deletions

No files matched your search

+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.1],
[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
+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)) {
@@ -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"};
@@ -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 ()
@@ -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
@@ -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;
}
}
}
@@ -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 ();
@@ -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
@@ -9,8 +9,10 @@
//
using System;
using System.Linq;
using System.Collections;
using System.Threading;
using System.Text.RegularExpressions;
using System.Net;
using System.Net.Sockets;
using NUnit.Framework;
@@ -3476,7 +3478,65 @@ namespace MonoTests.System.Net.Sockets
ss.Close ();
s.Close ();
}
static bool supportsTcpReuse = false;
static bool supportsTcpReuseSet = false;
static bool SupportsTcpReuse ()
{
if (supportsTcpReuseSet)
return supportsTcpReuse;
if (Path.DirectorySeparatorChar == '/') {
/*
* On UNIX OS
* 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.
*/
Regex reg = new Regex(@"^#define\s*SO_REUSEPORT");
foreach (string directory in Directory.GetDirectories ("/usr/include")) {
var f = Directory.GetFiles (directory, "socket.h").SingleOrDefault ();
if (f != null && File.ReadLines (f).Any (l => reg.Match (l).Success)) {
supportsTcpReuse = true;
break;
}
}
} else {
supportsTcpReuse = true;
}
supportsTcpReuseSet = true;
return supportsTcpReuse;
}
// Test case for bug #31557
[Test]
public void TcpDoubleBind ()
{
using (Socket s = new Socket (AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp))
using (Socket ss = new Socket (AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)) {
s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
s.Bind (new IPEndPoint (IPAddress.Any, 12345));
s.Listen(1);
ss.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
Exception ex = null;
try {
ss.Bind (new IPEndPoint (IPAddress.Any, 12345));
ss.Listen(1);
} catch (SocketException e) {
ex = e;
}
Assert.AreEqual (SupportsTcpReuse (), ex == null);
}
}
[Test]
[Category ("NotOnMac")]
public void ConnectedProperty ()
@@ -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
@@ -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,7 +170,7 @@ namespace System.Diagnostics {
return frames;
}
internal bool AddFrames (StringBuilder sb, bool isException = false)
bool AddFrames (StringBuilder sb, bool isException = false)
{
bool printOffset;
string debugInfo, indentation;
@@ -306,6 +287,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, true))
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
}
}
+17 -10
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
@@ -103,13 +106,19 @@ namespace System
return method_info;
} else {
if (method != IntPtr.Zero) {
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
if (!method_is_virtual)
method_info = (MethodInfo)MethodBase.GetMethodFromHandleNoGenericCheck (new RuntimeMethodHandle (method));
else
method_info = GetVirtualMethod_internal ();
}
return method_info;
}
}
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
extern MethodInfo GetVirtualMethod_internal ();
public object Target {
get {
return m_target;
@@ -467,13 +476,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,14 +503,10 @@ 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 ()
+1 -1
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)]
+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;
}
//
+4 -4
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;
@@ -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]
@@ -87,12 +87,13 @@ namespace MonoTests.System.IO
[Test]
public void CtorFileNotFoundException_Mode_Open ()
{
const string file_name = "thisfileshouldnotexist.test";
// absolute path
string path = TempFolder + DSC + "thisfileshouldnotexists.test";
string path = TempFolder + DSC + file_name;
DeleteFile (path);
FileStream stream = null;
try {
stream = new FileStream (TempFolder + DSC + "thisfileshouldnotexists.test", FileMode.Open);
stream = new FileStream (TempFolder + DSC + file_name, FileMode.Open);
Assert.Fail ("#A1");
} catch (FileNotFoundException ex) {
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#A2");
@@ -111,14 +112,18 @@ namespace MonoTests.System.IO
// relative path
string orignalCurrentDir = Directory.GetCurrentDirectory ();
Directory.SetCurrentDirectory (TempFolder);
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
// the real directory name, not that of the TempFolder symlink and the test will fail
// (happens e.g. on Android M)
string realTempDir = Directory.GetCurrentDirectory ();
path = realTempDir + DSC + file_name;
try {
stream = new FileStream ("thisfileshouldnotexists.test", FileMode.Open);
stream = new FileStream (file_name, FileMode.Open);
Assert.Fail ("#B1");
} catch (FileNotFoundException ex) {
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
// under OSX 'var' is a symlink to 'private/var'
if (MacOSX)
path = "/private" + path;
Assert.AreEqual (path, ex.FileName, "#B3");
Assert.IsNull (ex.InnerException, "#B4");
Assert.IsNotNull (ex.Message, "#B5");
@@ -135,8 +140,9 @@ namespace MonoTests.System.IO
[Test]
public void CtorFileNotFoundException_Mode_Truncate ()
{
const string file_name = "thisfileshouldNOTexist.test";
// absolute path
string path = TempFolder + DSC + "thisfileshouldNOTexists.test";
string path = TempFolder + DSC + file_name;
DeleteFile (path);
FileStream stream = null;
try {
@@ -159,14 +165,18 @@ namespace MonoTests.System.IO
// relative path
string orignalCurrentDir = Directory.GetCurrentDirectory ();
Directory.SetCurrentDirectory (TempFolder);
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
// the real directory name, not that of the TempFolder symlink and the test will fail
// (happens e.g. on Android M)
string realTempDir = Directory.GetCurrentDirectory ();
path = realTempDir + DSC + file_name;
try {
stream = new FileStream ("thisfileshouldNOTexists.test", FileMode.Truncate);
stream = new FileStream (file_name, FileMode.Truncate);
Assert.Fail ("#B1");
} catch (FileNotFoundException ex) {
Assert.AreEqual (typeof (FileNotFoundException), ex.GetType (), "#B2");
// under OSX 'var' is a symlink to 'private/var'
if (MacOSX)
path = "/private" + path;
Assert.AreEqual (path, ex.FileName, "#B3");
Assert.IsNull (ex.InnerException, "#B4");
Assert.IsNotNull (ex.Message, "#B5");
@@ -183,8 +193,9 @@ namespace MonoTests.System.IO
[Test]
public void CtorIOException1 ()
{
const string file_name = "thisfileshouldexists.test";
// absolute path
string path = TempFolder + DSC + "thisfileshouldexists.test";
string path = TempFolder + DSC + file_name;
FileStream stream = null;
DeleteFile (path);
try {
@@ -209,11 +220,18 @@ namespace MonoTests.System.IO
// relative path
string orignalCurrentDir = Directory.GetCurrentDirectory ();
Directory.SetCurrentDirectory (TempFolder);
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
// the real directory name, not that of the TempFolder symlink and the test will fail
// (happens e.g. on Android M)
string realTempDir = Directory.GetCurrentDirectory ();
path = realTempDir + DSC + file_name;
try {
stream = new FileStream ("thisfileshouldexists.test", FileMode.CreateNew);
stream = new FileStream (file_name, FileMode.CreateNew);
stream.Close ();
stream = null;
stream = new FileStream ("thisfileshouldexists.test", FileMode.CreateNew);
stream = new FileStream (file_name, FileMode.CreateNew);
Assert.Fail ("#B1");
} catch (IOException ex) {
Assert.AreEqual (typeof (IOException), ex.GetType (), "#B2");
@@ -327,8 +345,14 @@ namespace MonoTests.System.IO
{
string orignalCurrentDir = Directory.GetCurrentDirectory ();
Directory.SetCurrentDirectory (TempFolder);
// If TempFolder is a symlink, Mono will follow it and ex.FileName below will contain
// the real directory name, not that of the TempFolder symlink and the test will fail
// (happens e.g. on Android M)
string realTempDir = Directory.GetCurrentDirectory ();
string relativePath = "DirectoryDoesNotExist" + Path.DirectorySeparatorChar + "file.txt";
string fullPath = Path.Combine (TempFolder, relativePath);
string fullPath = Path.Combine (realTempDir, relativePath);
try {
new FileStream (relativePath, FileMode.Open);
Assert.Fail ("#A1");
@@ -2537,6 +2537,7 @@ namespace MonoTests.System.IO
}
[Test]
[Category ("AndroidNotWorking")] // locks with offsets bigger than Int32.Max don't work on Android
public void Lock_Large ()
{
// note: already worked without HAVE_LARGE_FILE_SUPPORT
+4 -3
View File
@@ -173,9 +173,10 @@ namespace MonoTests.System.IO
Assert.AreEqual ("one", testPath, "Combine #03");
string current = Directory.GetCurrentDirectory ();
bool currentIsDSC = current.Length == 1 && current [0] == DSC;
testPath = Path.Combine (current, "one");
string expected = current + DSC + "one";
string expected = (currentIsDSC ? String.Empty : current) + DSC + "one";
Assert.AreEqual (expected, testPath, "Combine #04");
testPath = Path.Combine ("one", current);
@@ -484,9 +485,9 @@ namespace MonoTests.System.IO
public void GetFullPath ()
{
string current = Directory.GetCurrentDirectory ();
bool currentIsDSC = current.Length == 1 && current [0] == DSC;
string testFullPath = Path.GetFullPath ("foo.txt");
string expected = current + DSC + "foo.txt";
string expected = (currentIsDSC ? String.Empty : current) + DSC + "foo.txt";
Assert.AreEqual (expected, testFullPath, "GetFullPath #01");
testFullPath = Path.GetFullPath ("a//./.././foo.txt");
@@ -410,6 +410,7 @@ public class AssemblyBuilderTest
}
[Test]
[Category ("AndroidNotWorking")] // DefineResource doesn't allow path in its fileName parameter and the test attempts to write to / in effect
public void TestDefineResource ()
{
ab.DefineResource ("foo", "FOO", "foo.txt", ResourceAttributes.Public);
@@ -586,6 +587,7 @@ public class AssemblyBuilderTest
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.Compilerservices.SymbolWriter assembly
public void TestDefineDynamicModule ()
{
ab.DefineDynamicModule ("foo", "foo.dll");
@@ -1829,9 +1831,13 @@ public class AssemblyBuilderTest
fullName);
newDomain.DoCallBack (new CrossAppDomainDelegate (helper.Test));
} finally {
#if !MONODROID
// RUNTIME: crash
// AppDomain unloading crashes the runtime on Android
if (newDomain != null) {
AppDomain.Unload (newDomain);
}
#endif
}
}
@@ -830,6 +830,7 @@ public class ConstructorBuilderTest
// Same as in MethodBuilderTest
[Test]
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
public void AddDeclarativeSecurity_Complete ()
{
ConstructorBuilder cb = genClass.DefineConstructor (
@@ -851,6 +852,7 @@ public class ConstructorBuilderTest
}
[Test]
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
public void AddDeclarativeSecurity_PSet_Null ()
{
ConstructorBuilder cb = genClass.DefineConstructor (
@@ -867,6 +869,7 @@ public class ConstructorBuilderTest
}
[Test]
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
public void AddDeclarativeSecurity_Action_Invalid ()
{
ConstructorBuilder cb = genClass.DefineConstructor (
@@ -892,6 +895,7 @@ public class ConstructorBuilderTest
}
[Test]
[Category ("MobileNotWorking")] // No declarative security in the mobile profile
public void AddDeclarativeSecurity_Action_Duplicate ()
{
ConstructorBuilder cb = genClass.DefineConstructor (
@@ -12,6 +12,8 @@ using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.InteropServices;
using System.Text;
using System.Diagnostics;
using System.Runtime.ExceptionServices;
using NUnit.Framework;
@@ -477,6 +479,106 @@ namespace MonoTests.System.Reflection.Emit
public string Name;
}
class ExceptionHandling_Test_Support
{
public static Exception Caught;
public static string CaughtStackTrace;
public static void ThrowMe ()
{
Caught = null;
CaughtStackTrace = null;
throw new Exception("test");
}
public static void Handler (Exception e)
{
Caught = e;
CaughtStackTrace = e.StackTrace.ToString ();
}
}
[Test]
public void ExceptionHandling ()
{
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
var ig = method.GetILGenerator ();
ig.BeginExceptionBlock();
ig.Emit(OpCodes.Call, typeof(ExceptionHandling_Test_Support).GetMethod("ThrowMe"));
ig.BeginCatchBlock(typeof(Exception));
ig.Emit(OpCodes.Call, typeof(ExceptionHandling_Test_Support).GetMethod("Handler"));
ig.EndExceptionBlock();
ig.Emit(OpCodes.Ret);
var invoke = (Action<int>) method.CreateDelegate (typeof(Action<int>));
invoke (456324);
Assert.IsNotNull (ExceptionHandling_Test_Support.Caught, "#1");
Assert.AreEqual (2, ExceptionHandling_Test_Support.CaughtStackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.None).Length, "#2");
var st = new StackTrace (ExceptionHandling_Test_Support.Caught, 0, true);
// Caught stack trace when dynamic method is gone
Assert.AreEqual (ExceptionHandling_Test_Support.CaughtStackTrace, st.ToString (), "#3");
// Catch handler stack trace inside dynamic method match
Assert.AreEqual (ExceptionHandling_Test_Support.Caught.StackTrace, st.ToString (), "#4");
}
class ExceptionHandlingWithExceptionDispatchInfo_Test_Support
{
public static Exception Caught;
public static string CaughtStackTrace;
public static void ThrowMe ()
{
Caught = null;
CaughtStackTrace = null;
Exception e;
try {
throw new Exception("test");
} catch (Exception e2) {
e = e2;
}
var edi = ExceptionDispatchInfo.Capture(e);
edi.Throw();
}
public static void Handler (Exception e)
{
var split = e.StackTrace.Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Assert.AreEqual (5, split.Length, "#1");
Assert.IsTrue (split [1].Contains ("---"), "#2");
}
}
[Test]
public void ExceptionHandlingWithExceptionDispatchInfo ()
{
var method = new DynamicMethod ("", typeof(void), new[] { typeof(int) }, typeof (DynamicMethodTest));
var ig = method.GetILGenerator ();
ig.BeginExceptionBlock();
ig.Emit(OpCodes.Call, typeof(ExceptionHandlingWithExceptionDispatchInfo_Test_Support).GetMethod("ThrowMe"));
ig.BeginCatchBlock(typeof(Exception));
ig.Emit(OpCodes.Call, typeof(ExceptionHandlingWithExceptionDispatchInfo_Test_Support).GetMethod("Handler"));
ig.EndExceptionBlock();
ig.Emit(OpCodes.Ret);
var invoke = (Action<int>) method.CreateDelegate (typeof(Action<int>));
invoke (444);
}
#if !MONODROID
// RUNTIME: crash
[Test]
public void TypedRef ()
{
@@ -508,6 +610,7 @@ namespace MonoTests.System.Reflection.Emit
{
Assert.AreEqual (typeof (TypedRefTarget), TypedReference.GetTargetType (tr));
}
#endif
}
}
@@ -136,6 +136,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_Name_Null ()
{
AssemblyBuilder ab = genAssembly ();
@@ -152,6 +153,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_Name_Empty ()
{
AssemblyBuilder ab = genAssembly ();
@@ -169,6 +171,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_Name_NullChar ()
{
AssemblyBuilder ab = genAssembly ();
@@ -188,6 +191,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_InterfaceNotAbstract ()
{
AssemblyBuilder ab = genAssembly ();
@@ -224,6 +228,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_Parent_Interface ()
{
TypeBuilder tb;
@@ -241,6 +246,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DefineType_TypeSize ()
{
AssemblyBuilder ab = genAssembly ();
@@ -252,6 +258,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
[ExpectedException (typeof (ArgumentException))]
public void DuplicateTypeName () {
AssemblyBuilder ab = genAssembly ();
@@ -267,6 +274,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter assembly
public void DuplicateSymbolDocument ()
{
AssemblyBuilder ab = genAssembly ();
@@ -1182,6 +1182,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")] // Fails with System.MethodAccessException : Method `t17:.ctor ()' is inaccessible from method `t18:.ctor ()'
public void DefineDefaultConstructor_Parent_DefaultCtorInaccessible ()
{
TypeBuilder tb;
@@ -8434,6 +8435,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("MobileNotWorking")] // Not available in the 2.1 profile
public void TestAddDeclarativeSecurityAlreadyCreated ()
{
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -8452,6 +8454,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("MobileNotWorking")] // Not available in the 2.1 profile
public void TestAddDeclarativeSecurityNullPermissionSet ()
{
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -8468,6 +8471,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("MobileNotWorking")] // Not available in the 2.1 profile
public void TestAddDeclarativeSecurityInvalidAction ()
{
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -8488,6 +8492,7 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("MobileNotWorking")] // Not available in the 2.1 profile
public void TestAddDeclarativeSecurityDuplicateAction ()
{
TypeBuilder tb = module.DefineType (genTypeName ());
@@ -10878,6 +10883,7 @@ namespace MonoTests.System.Reflection.Emit
//Test for #572660
[Test]
[Category ("MobileNotWorking")] // Mono.CompilerServices.SymbolWriter not available in XA
public void CircularArrayType()
{
var assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName("Test"), AssemblyBuilderAccess.RunAndSave);
@@ -11025,6 +11031,10 @@ namespace MonoTests.System.Reflection.Emit
}
[Test]
[Category ("AndroidNotWorking")]
// 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
public void Ldfld_Encoding_10122 () {
Build2<Example<int>> ();
}
@@ -1112,6 +1112,7 @@ public class AssemblyNameTest {
}
[Test]
[Category ("AndroidNotWorking")] // Accessing assemblies by asm.Location is not supported
public void GetAssemblyName_CodeBase ()
{
Assembly execAssembly = Assembly.GetExecutingAssembly ();
@@ -123,6 +123,7 @@ namespace MonoTests.System.Reflection
// note: only available in default appdomain
// http://weblogs.asp.net/asanto/archive/2003/09/08/26710.aspx
// Not sure we should emulate this behavior.
#if !MONODROID
string fname = AppDomain.CurrentDomain.FriendlyName;
if (fname.EndsWith (".dll")) { // nunit-console
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
@@ -131,10 +132,15 @@ namespace MonoTests.System.Reflection
Assert.IsNotNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
}
#else
Assert.IsNull (Assembly.GetEntryAssembly (), "GetEntryAssembly");
Assert.IsTrue (AppDomain.CurrentDomain.IsDefaultAppDomain (), "!default appdomain");
#endif
}
#if !MONOTOUCH // Reflection.Emit is not supported.
[Test]
[Category("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter
public void GetModules_MissingFile ()
{
AssemblyName newName = new AssemblyName ();
@@ -184,7 +190,10 @@ namespace MonoTests.System.Reflection
public void Corlib_test ()
{
Assembly corlib_test = Assembly.GetExecutingAssembly ();
#if MOBILE
#if MONODROID
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
Assert.IsNull (corlib_test.Evidence, "Evidence");
#elif MOBILE
Assert.IsNotNull (corlib_test.EntryPoint, "EntryPoint");
Assert.IsNull (corlib_test.Evidence, "Evidence");
#else
@@ -238,6 +247,7 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
public void GetFiles_False ()
{
Assembly corlib = typeof (int).Assembly;
@@ -250,6 +260,7 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be accessed as FileStream
public void GetFiles_True ()
{
Assembly corlib = typeof (int).Assembly;
@@ -387,7 +398,7 @@ namespace MonoTests.System.Reflection
[Test]
public void LoadWithPartialName ()
{
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest", "mscorlibtests" };
string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_plattest", "mscorlibtests", "BclTests" };
foreach (string s in names)
if (Assembly.LoadWithPartialName (s) != null)
@@ -540,6 +551,7 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("MobileNotWorking")]
public void bug78465 ()
{
string assemblyFileName = Path.Combine (
@@ -577,6 +589,7 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category("MobileNotWorking")]
public void bug78468 ()
{
string assemblyFileNameA = Path.Combine (Path.GetTempPath (),
@@ -659,6 +672,7 @@ namespace MonoTests.System.Reflection
}
[Test]
[Category ("AndroidNotWorking")] // Assemblies in Xamarin.Android cannot be directly as files
public void ReflectionOnlyLoadFrom ()
{
string loc = typeof (AssemblyTest).Assembly.Location;
@@ -830,6 +844,7 @@ namespace MonoTests.System.Reflection
[Test] // bug #79715
[Category("MobileNotWorking")]
public void Load_PartialVersion ()
{
string tempDir = Path.Combine (Path.GetTempPath (),
@@ -140,5 +140,14 @@ namespace MonoTests.System.Reflection
var ctor = typeof (Gen<>).GetConstructor (Type.EmptyTypes);
Assert.IsTrue (ctor.ContainsGenericParameters);
}
[Test]
public void ConstructorInfoModule ()
{
Type type = typeof (Foo);
ConstructorInfo co = type.GetConstructors ()[0];
Assert.AreEqual (type.Module, co.Module);
}
}
}
@@ -114,6 +114,15 @@ namespace MonoTests.System.Reflection
} catch (InvalidOperationException) {}
}
[Test]
public void EventInfoModule ()
{
Type type = typeof (TestClass);
EventInfo ev = type.GetEvent ("pub");
Assert.AreEqual (type.Module, ev.Module);
}
#pragma warning disable 67
public class PrivateEvent
{
@@ -361,14 +361,20 @@ namespace MonoTests.System.Reflection
IList<LocalVariableInfo> locals = mb.LocalVariables;
// This might break with different compilers etc.
Assert.AreEqual (2, locals.Count, "#3");
bool foundPinnedBytePointer = false;
unsafe {
foreach (LocalVariableInfo lvi in locals) {
if (lvi.LocalType == typeof (byte[]))
// This is optimized out by CSC in .NET 4.6
Assert.IsFalse (lvi.IsPinned, "#3-1");
Assert.IsTrue ((locals [0].LocalType == typeof (byte[])) || (locals [1].LocalType == typeof (byte[])), "#4");
if (locals [0].LocalType == typeof (byte[]))
Assert.AreEqual (false, locals [0].IsPinned, "#5");
else
Assert.AreEqual (false, locals [1].IsPinned, "#6");
if (/* mcs */ lvi.LocalType == typeof (byte*) || /* csc */ lvi.LocalType == typeof (byte).MakeByRefType ()) {
foundPinnedBytePointer = true;
Assert.IsTrue (lvi.IsPinned, "#3-2");
}
}
}
Assert.IsTrue (foundPinnedBytePointer, "#4");
}
public int return_parameter_test ()
@@ -400,6 +406,15 @@ namespace MonoTests.System.Reflection
//Assert.IsTrue (pi.IsRetval, "#3");
}
[Test]
public void MethodInfoModule ()
{
Type type = typeof (MethodInfoTest);
MethodInfo me = type.GetMethod ("return_parameter_test");
Assert.AreEqual (type.Module, me.Module);
}
[Test]
public void InvokeOnRefOnlyAssembly ()
{
@@ -795,21 +810,44 @@ namespace MonoTests.System.Reflection
var type = typeof (GenericClass<>).GetMethod("Method").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeofT, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
bool foundTypeOfK = false;
bool foundExpectedType = false;
MethodBody mb = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody();
foreach (LocalVariableInfo lvi in mb.LocalVariables) {
if (lvi.LocalType == typeofK) {
foundTypeOfK = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#1-1");
} else if (lvi.LocalType == typeofT) {
foundExpectedType = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#1-2");
}
}
type = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeofT, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
type = typeof (GenericClass<>).GetMethod("Method2").GetMethodBody().LocalVariables[1].LocalType;
Assert.AreEqual (typeofK, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
type = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody().LocalVariables[0].LocalType;
Assert.AreEqual (typeof (int), type);
type = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody().LocalVariables[1].LocalType;
Assert.AreEqual (typeofK, type);
Assert.AreEqual (typeof (GenericClass<>), type.DeclaringType);
Assert.IsTrue (foundTypeOfK, "#1-3");
if (mb.LocalVariables.Count < 2)
Assert.Ignore ("Code built in release mode - 'T var0' optmized out");
else
Assert.IsTrue (foundExpectedType, "#1-4");
foundTypeOfK = false;
foundExpectedType = false;
mb = typeof (GenericClass<int>).GetMethod("Method2").GetMethodBody();
foreach (LocalVariableInfo lvi in mb.LocalVariables) {
if (lvi.LocalType == typeofK) {
foundTypeOfK = true;
Assert.AreEqual (typeof (GenericClass<>), lvi.LocalType.DeclaringType, "#2-1");
} else if (lvi.LocalType == typeof (int)) {
foundExpectedType = true;
}
}
Assert.IsTrue (foundTypeOfK, "#2-3");
if (mb.LocalVariables.Count < 2)
Assert.Ignore ("Code built in release mode - 'int var0' optmized out");
else
Assert.IsTrue (foundExpectedType, "#2-4");
}
#endif
}
@@ -193,19 +193,19 @@ public class ModuleTest
try {
module.ResolveMethod (1234);
Assert.Fail ();
Assert.Fail ("1234");
} catch (ArgumentException) {
}
try {
module.ResolveMethod (t.MetadataToken);
Assert.Fail ();
Assert.Fail ("MetadataToken");
} catch (ArgumentException) {
}
try {
module.ResolveMethod (t.GetMethod ("ResolveMethod").MetadataToken + 10000);
Assert.Fail ();
module.ResolveMethod (t.GetMethod ("ResolveMethod").MetadataToken + 100000);
Assert.Fail ("GetMethod");
} catch (ArgumentOutOfRangeException) {
}
}
@@ -330,6 +330,7 @@ public class ModuleTest
}
#if !MONOTOUCH
[Test]
[Category ("AndroidNotWorking")] // Mono.CompilerServices.SymbolWriter not available for Xamarin.Android
public void GetTypes ()
{
AssemblyName newName = new AssemblyName ();
@@ -68,10 +68,10 @@ namespace MonoTests.System.Reflection.Emit
Assert.AreEqual ("type", inst.Name, "#1");
Assert.AreEqual ("foo", inst.Namespace, "#2");
#if NET_4_0
#if NET_4_0 && !MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089],[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
#elif NET_2_1
#elif NET_2_1 || MOBILE
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]]", inst.FullName, "#3");
Assert.AreEqual ("foo.type[[System.Double, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.String, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], MonoTests.System.Reflection.Emit.MonoGenericClassTest, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", inst.AssemblyQualifiedName, "#4");
#else
@@ -48,6 +48,7 @@ namespace MonoTests.System.Reflection
{
Type type = typeof (TestClass);
PropertyInfo property = type.GetProperty ("ReadOnlyProperty");
Assert.IsNotNull (property.Module, "#0");
MethodInfo [] methods = property.GetAccessors (true);
Assert.AreEqual (1, methods.Length, "#A1");
@@ -30,6 +30,7 @@ using System;
using NUnit.Framework;
using System.Runtime.ExceptionServices;
using System.Threading.Tasks;
using System.Diagnostics;
namespace MonoTests.System.Runtime.ExceptionServices
{
@@ -150,7 +151,25 @@ namespace MonoTests.System.Runtime.ExceptionServices
Assert.IsTrue (split [1].Contains ("---"), "#2");
Assert.IsTrue (split [4].Contains ("---"), "#3");
}
}
}
[Test]
public void StackTraceUserCopy ()
{
try {
try {
throw new NotImplementedException ();
} catch (Exception e) {
var edi = ExceptionDispatchInfo.Capture (e);
edi.Throw();
}
} catch (Exception ex) {
var st = new StackTrace (ex, true);
var split = st.ToString ().Split (new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
Assert.AreEqual (4, split.Length, "#1");
Assert.IsTrue (split [1].Contains ("---"), "#2");
}
}
}
}
Loaded 100 of 276 files, more files were not shown because too many files have changed in this diff. Show more