Compare commits

...
314 Commits
Author SHA1 Message Date
monojenkins d01276bb36 Bump API snapshot submodule 2018-10-07 15:25:44 +02:00
Marek Safar 7f1768441c Bump corefx 2018-10-07 15:25:44 +02:00
Alexander Köplinger 39d89a335c Fix build of mono-merp.c
It was missing the format arguments that were in a later iteration of https://github.com/mono/mono/pull/10823
2018-09-27 10:45:44 +02:00
monojenkins a533cb343b [merp] Fix return value handling of posix_spawn (#10824) 2018-09-26 11:46:09 -04:00
Ludovic Henry c5b8988d22 [sdb] Disable an assert to avoid breaking debugging. (#10315)
Fixes https://github.com/mono/mono/issues/8848.
Fixes https://github.com/mono/mono/issues/9262.
Fixes https://github.com/mono/mono/issues/8627.
2018-08-27 17:42:24 -04:00
Alexander Kyte 15eab7066c [2018-02] Add pipeline to convert managed exception into telemetry format (#10249) 2018-08-27 15:56:04 -04:00
Alexander Köplinger e0e035e3b1 Bump xunit-binaries
Gets in fix for invalid NUnit xml output generated by xunit

(cherry picked from commit 0955dd2307)
2018-08-22 14:03:40 +02:00
monojenkins 4e0a2ac0dd [llvm] Avoid using the preserveall calling convention on watchos, xcode10 asserts on it. (#9325)
Fixes https://github.com/mono/mono/issues/9318.
2018-08-20 21:33:45 +02:00
Alexander Köplinger 02928166e5 Bump nunitlite to get NUnit2 xml output fix and failure on file not found fix (#10188)
See mono/NUnitLite#11 and mono/NUnitLite#12

(cherry picked from commit 8f67fb9fb1)
2018-08-20 14:43:14 +02:00
monojenkins 6c1f4b9746 [System.Xml.Linq] Fix namespace conflict with new Xamarin.Mac namespace in test code. (#10185)
macOS 10.14 introduces a Network framework, which means Xamarin.Mac now has a Network namespace.

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

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

so just remove the using and use the full 'System.Net' namespace instead.
2018-08-20 12:11:43 +02:00
Marek Safar 4fe3280bba Revert "[sdk] Do not fix android platform-tools version. Make it configurable. (#9508)"
This reverts commit 077307fce4.
2018-07-20 13:56:50 +02:00
Marek Safar 12ae4f9b0c Revert "[runtime] Fix the --enable-minimal=aot build. (#9394)"
This reverts commit 1bdbf71a8b.
2018-07-20 13:56:50 +02:00
Marek Safar a2b95fbb4b Revert "[2018-02] Backport /bin/bash shell set for wasm"
This reverts commit 97aa066389.
2018-07-20 13:56:50 +02:00
monojenkins f795aa5d2d [llvm] Avoid using the preserveall calling convention in another place on watchos. (#9578)
Fixes https://github.com/mono/mono/issues/9318.
2018-07-19 12:49:21 +02:00
monojenkins 04493d2224 Fix LogcatTextWriter_Log interpreting messages it logs, potentially writing random garbage and/or crashing (introduced by https://github.com/mono/mono/commit/984f6484666c2ee6fefec949c81fdff1189c9488) (Fixes https://github.com/xamarin/xamarin-android/issues/1951) (#9612) 2018-07-18 11:41:09 -04:00
Alexander Kyte 35284c340c [runtime] Make sigterm dumper send file to merp (#9586) 2018-07-18 11:38:20 -04:00
monojenkins 077307fce4 [sdk] Do not fix android platform-tools version. Make it configurable. (#9508) 2018-07-14 10:48:31 +02:00
monojenkins 1ad118647c [arm64] Make OP_CHECK_THIS read only a byte, to prevent unaligned access errors. (#9546) 2018-07-14 10:45:50 +02:00
Alexander Köplinger 86f99d31bd Merge pull request #9483 from alexanderkyte/2018-02-merp_params
[Backport 2018-02] Add merp parameters
2018-07-12 21:15:53 +02:00
Alexander Kyte 97aa066389 [2018-02] Backport /bin/bash shell set for wasm 2018-07-11 14:43:56 -04:00
Alexander Kyte 37091f00c2 [runtime] Enable application to register path for MERP restart 2018-07-10 15:28:40 -04:00
Alexander Kyte 955ad4538e [runtime] Make merp eventType icall argument 2018-07-10 15:28:20 -04:00
Jay Krell fc0c12f768 [Coop] Convert Mono.Runtime to coop. (#8599) 2018-07-10 15:27:49 -04:00
Bernhard Urban c495285cac [debugger] more locking and avoid race around mono_threads_join_lock & loader lock 2018-07-10 10:12:39 +02:00
Alexander Kyte d18b8941ab [debugger] Add locking around tls->frames usage/freeing 2018-07-10 10:12:39 +02:00
monojenkins 1bdbf71a8b [runtime] Fix the --enable-minimal=aot build. (#9394)
[2018-02] [runtime] Fix the --enable-minimal=aot build.

Backport of #8952.

/cc @lewurm
2018-07-09 15:25:40 -04:00
monojenkins cae8c54884 [mini] add workaround for AMD Ryzen Threadripper issue (#9358)
[2018-02] [mini] add workaround for AMD Ryzen Threadripper issue

Backport of #9321.

/cc @lewurm
2018-06-30 03:40:24 -04:00
Aleksey Kliger 8b479398bb [loader] LoadFrom of problematic images should reprobe (correctly)
This reverts commit 569bd3bc52
which itself reverted efe1fdeb9d.

Additionally, cherrypick 60f06e6ca2: refonly load
of problematic image is allowed.
2018-06-29 16:43:08 +02:00
monojenkins 9ef7249458 [2018-02] [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources (#9364)
* [sdks] Only rebuild MXE when it doesn't exist, not when we just cloned the sources

* [sdks] Default to ~/android-toolchain and ~/android-archives to better share with XA
2018-06-29 14:15:52 +02:00
Alexander Kyte cd5d306ea0 Merge pull request #9330 from monojenkins/backport-pr-9274-to-2018-02
[2018-02] Make requested MERP file format changes
2018-06-28 11:29:36 -04:00
Alexander Kyte 8b628bb532 [merp] Change XML file output path 2018-06-27 10:21:41 +00:00
Alexander Kyte 671db7c46d [merp] Change and emit event type 2018-06-27 10:21:41 +00:00
monojenkins a57665c315 [2018-02] [runtime] Package merp params in 3 ways needed (#9270)
* [runtime] Package merp params in 3 ways needed

* [runtime] Use GUID rather than assembly name in json
2018-06-25 21:31:50 +02:00
monojenkins f552ff99a1 [runtime] Make mono-state dumper abandon stuck threads (#9271)
Threads which do things with signals and locks may end up unresponsive
to our signals. I cannot get threads that crash in a lock to respond to
SIGTERM on Darwin even if I explicitly unmask SIGTERM on those threads.

In order to defensively program against platform bugs around signals and
stubborn threads, we need to be able to abandon these threads and
continue, dumping other threads.
2018-06-25 21:29:50 +02:00
Bernhard Urban 4e1474e9e3 [interp] check existence of InterpMethod before removing it from interp code hastable
when creating dynamic methods, we put those in a queue so they can be
collected later via `mono_jit_free_method ()`. the interpreter part was
assuming, as soon as we allocate a dynamic method, it will be executed
eventually and therefore an InterpMethod must exist in
`info.interp_code_hash`, but this isn't necessarily the case.
2018-06-18 11:24:55 +02:00
monojenkins f3235f3d03 [Linux,XA build] Fix building of Windows cross-compilers on Ubuntu Linux (#9172)
Ubuntu Linux (possibly others too, but only Ubuntu is tested thus the
limitation) don't need to build or use `mxe`, they instead use mingw packaged
for the distribution, thus making the build faster.

This commit detects the Linux flavor in use and, if it's Ubuntu, configures the
build so that system mingw is used instead of mxe.
2018-06-16 15:16:36 +02:00
monojenkins 3467e374ba [SDKS,Android] Install cmake when provisioning Android SDK (#9140)
Android NDK supports cmake in addition to the older make-based ndk-build as the
build system and Xamarin.Android is in the process of switching the build of its
native bits to cmake. The reason for this switch is that certain parts of
Xamarin.Android (libmonodroid) are built for both the host system and
the Android target. The host system build currently uses hand-crafted code
directly in .csproj to build the native bits while the Android build uses
ndk-build. This results in duplication of code, compiler parameters are
specified in two locations - it is easy to introduce incompatibilities, bug
fixes may be applied only in one scenario etc.

Using cmake allows us to use a single build "script" for all the targets, thus
making the build more reliable. Android SDK has a cmake package which contains
full support for NDK builds and allows us to easily use cmake across all the
supported platforms without having to install cmake on the host system.

This commit adds the cmake package to the Android SDK provisiong process and,
alas, at the same time adds a workaround to properly unpack the package. Unlike
other Android SDK packages, cmake doesn't unpack to a single subdirectory of the
zip root, instead all its files and directories are placed directly in the zip
root. This requires yet another workaround to install the package properly.
2018-06-16 15:14:33 +02:00
Ankit Jain f353dc4db0 Bump msbuild to track mono-2018-02 (#9129) 2018-06-14 14:29:07 -04:00
Rodrigo Kumpera f59eac4c0f [profiler] Don't raise events until the profiler transitions to the ready state. Fixes #8866.
We can't raise event before that as the profiler depends on too much runtime
infrastructure at this point for it to reliably work.

For example, we need the threading infrastructure to be init'd so we can access the
thread-local profiler state to store events there.
2018-06-14 15:02:19 +02:00
Marek Safar a37e6e5739 Bump corefx to fix System.Data windows build 2018-06-13 18:20:52 +02:00
monojenkins 6f9bef3bdb update to Android P final API. (#9078) 2018-06-07 16:22:46 -07:00
Zoltan Varga 1c24c158b0 [bitcode] Fix the generation of invalid llvm IR for some Span code. 2018-06-01 12:22:18 +02:00
monojenkins a49a68c6d7 [interp] Fix native to interp transition (#8957)
When using the interp_wrapper to enter interp from native we don't need to save the lmf since it doesn't make sense to unwind to native. Also make sure we have the interp context set up if we weren't attached at interp transition time.
2018-05-31 09:37:55 +02:00
Marek Safar 92e11812f4 [System.Runtime.Serialization] Makes more APIs work for mobile 2018-05-30 23:54:22 +02:00
monojenkins 260676f948 Bump API snapshot submodule 2018-05-30 23:53:47 +02:00
Matt Sylvia eefdf4ed31 Bump external/cecil to b6c50e3 2018-05-30 23:53:47 +02:00
Alexander Kyte 0754926394 [2018-02] Finalize merp integration (#8869) 2018-05-29 15:19:34 -04:00
monojenkins 7bdb7dd765 Bump API snapshot submodule 2018-05-29 09:52:20 +02:00
Marek Safar 65d719d16e [Facades] Removes System.Memory 2018-05-29 09:52:20 +02:00
Rodrigo Kumpera 88262b52d2 [profiler] Switch tls storage to use mono_thread_info_get/set_tools_data. Fixes #7683
External threads are detached using TLS destructors and this leads to non-determinism around to cleanup ordering of keys.
This causes the profiler to see the profiler tls key null'd even though it was not detached yet.
2018-05-28 10:19:02 +02:00
Rodrigo Kumpera aaed1f77ce [mono-threads] Introduce mono_thread_info_get/set_tools_data so they can store data sanely.
The tools_data is a helper to bind tls data lifecycle to MonoThreadInfo.
This is needed to make it sane to deal with posix TLS destructors.
2018-05-28 10:19:02 +02:00
Alexander Kyte 58637d0ee7 [runtime] Gracefully handle crashes before mono-state dependencies initialized (#8842) 2018-05-24 12:38:14 -04:00
EgorBo c22f532871 don't fail on unsupported ipv6 in BeginConnect 2018-05-24 11:28:56 +02:00
monojenkins d2a4141475 Bump API snapshot submodule 2018-05-24 09:59:48 +02:00
Marek Safar 5db90bde0c Update failing mcs tests 2018-05-24 09:59:48 +02:00
Marek Safar 21716f8b68 [corlib] Hide types which could conflict with System.Memory 2018-05-24 09:59:48 +02:00
monojenkins f2381f329a [monitor] Fix abort of synchronisation wrapper (#8827)
Backport of #8812.

/cc @marek-safar
2018-05-23 10:57:06 -04:00
Alexis Christoforides 4afcb37eca Merge pull request #8837 from monojenkins/backport-pr-7412-to-2018-02
[2018-02] [MacSDK] Update Nuget to 4.7.0
2018-05-23 10:00:17 -04:00
Alexis Christoforides 139d2a441b [MacSDK] Update Nuget to 4.7.0
This update includes (should include) https://github.com/NuGet/NuGet.Client/commit/eca1a8d23a54818c116eef63875de6a554227ea7 which we need in Mono.
2018-05-23 13:58:41 +00:00
Alexander Kyte 76c1c1baec [runtime] Add missing va_start (#8807) 2018-05-22 18:07:07 -04:00
monojenkins 9529b37b69 [android] Fix truncating of messages longer than 4096 characters (#8763)
Backport of #8735.

/cc @marek-safar
2018-05-22 16:57:59 -04:00
Ankit Jain f80aeb547f Bump msbuild to track mono-2018-02 (#8728) 2018-05-22 20:49:52 +02:00
Alexander Kyte cbbe573e20 Merge pull request #8687 from alexanderkyte/2018-02-freeform
Backport "Implement Freeform Unmanaged Error" to 2018-02
2018-05-21 22:05:30 -04:00
Alexander Kyte f80ae8146f [runtime] Fixup freeform unmanaged exception handler 2018-05-21 16:46:00 -04:00
Zoltan Varga 5152e84055 [aot] Fix encoding/decoding of types with custom modifiers. (#8729)
* [aot] Fix encoding/decoding of types with custom modifiers.

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

* [aot] Add a test, disabling for now because it depends on c# 7.2.

* [aot] Bump AOT file format version.

* [aot] Only disable the test with mcs.

* [aot] Fix compilation of test.
2018-05-21 18:39:45 +02:00
Alexander Köplinger 35d4d7e8e6 [ci] Fix URL for apidiff/csprojdiff report
The upgraded HTML publisher plugin on Jenkins now generates a different URL.

(cherry picked from commit fa9579a8fa)
2018-05-18 14:27:16 +02:00
monojenkins d3fa0e12d0 [Mono.CSharp] Mimic the settings from System to track the feature flags, fixes GitHub #8698 (#8705) 2018-05-14 21:04:16 +02:00
Ankit Jain 2c0121911d Bump msbuild to track mono-2018-02 (#8682) 2018-05-14 12:46:41 +02:00
Alexander Kyte fc45400caa [runtime] Make unhandled state dumper OSX-specific
Since this needs to be backported, we're going to make this osx-specific
for now, and then I'll backport this. This is fully working on linux,
including the android SDK at the time of this commit
2018-05-11 19:33:27 -04:00
Alexander Kyte baf8448122 [runtime] Fix windows build 2018-05-11 19:32:41 -04:00
Alexander Kyte e6b6562cdc [runtime] Fix merp reference in mono-state code 2018-05-11 19:32:40 -04:00
Alexander Kyte c0bf542e2a [runtime] Add freeform dumper preprocessor symbols to autogen 2018-05-11 19:32:40 -04:00
Alexander Kyte 4f23989316 [runtime] Add CI dumper using mono-state 2018-05-11 19:32:39 -04:00
Alexander Kyte 514c06b12f [runtime] Integrate signal-based state machine with merp forking 2018-05-11 19:30:43 -04:00
Alexander Kyte d785f7d7f0 [runtime] Write unmanaged exception dumper 2018-05-11 19:30:42 -04:00
Alexander Kyte b7ea31a324 [runtime] Add helper to get portable IP value 2018-05-11 19:28:28 -04:00
Alexander Kyte 8d2dc95494 [runtime] Make assertion message fetchable 2018-05-11 19:28:28 -04:00
Ankit Jain 93e3dafc38 [msbuild] Bump to track mono-2018-02 branch which tracks vs15.7 (#8596)
* Bump msbuild to track mono-2018-02

.. and track changes in the build scripts.

* [msbuild] Zip test results and log files for surfacing in jenkins (#8523)

(cherry picked from commit 0b8f0d2f83)
2018-05-08 19:25:20 +02:00
Alexander Köplinger 965c939531 Merge pull request #8580 from radical/nuget-hash-updates-2018-02
nuget-hash-extractor: updates
2018-05-05 18:28:50 +02:00
monojenkins 7c317d0af3 [native types] fix nfloat:NaN on arm64 JIT and interp (#8564)
interp: If one of the operands is NaN, we have a default result: It is false (0)
when doing a compare (`ceq_r8`), but must be true (1) on `cne_r8`.

JIT: match behaviour what C# compiler would generate for float/double.
2018-05-04 17:08:21 -07:00
Ankit Jain 6ec37b18d9 nuget-hash-extractor: Add msbuild extensions nuget version from
.. mono-2018-02 branch, which tracks vs15.7:

    Microsoft.NET.Build.Extensions:         2.1.200-preview-62827-05

Version from:
https://github.com/dotnet/cli/blob/b390c9805e6730886129e424f9ce23ee4604266c/build/DependencyVersions.props

None of the assemblies were newer, so none of the lists have any
changes.
2018-05-04 17:34:34 -04:00
Ankit Jain 2a90cd598d nuget-hash-extractor: Add msbuild extensions nuget version from
.. xplat-master msbuild branch.

	Microsoft.NET.Build.Extensions:         2.1.300-preview3-62804-06

Version from:
https://github.com/dotnet/cli/blob/8c937a0db08e56660aca456ac088f2d0e70735ab/build/DependencyVersions.props

None of the assemblies were newer, so none of the lists have any
changes.

(cherry picked from commit 7d68b33343)
2018-05-04 17:11:37 -04:00
Ankit Jain 48fcc7e350 nuget-hash-extractor: Add all option to emit all 3 lists
This is faster than invoking the extractor thrice.

(cherry picked from commit 34d79079d2)
2018-05-04 16:57:07 -04:00
Ankit Jain 90b0ea99cd nuget-hash-extractor: Improvements for better, deterministic output
- Ensure the various lists we emit have unique entries, are sorted to be
deterministic
- Ignore ref assemblies

(cherry picked from commit de7a1ec01b)
2018-05-04 16:57:01 -04:00
Ankit Jain 217d0c7ab7 nuget-hash-extractor: Sort the lists for easier reviews
mcs/tools/xbuild/data/deniedAssembliesList.txt:
	- sorted by name and assembly version
	- This file had one duplicate line
		System.Text.Encoding.CodePages.dll,FD178CD4-EF4F-44D5-9C3F-812B1E25126B,4,0,2,0

mono/metadata/image.c:
	- sorted by hashcode
	- This had one duplicate line
		IGNORED_ASSEMBLY (0xFA686A38, SYS_TEXT_ENC_CODEPAGES, "FD178CD4-EF4F-44D5-9C3F-812B1E25126B", "4.3.0 net46"),

(cherry picked from commit 376050c2bc)
2018-05-04 16:56:48 -04:00
Rolf Bjarne Kvinge 9824e260f5 Only show config.log when running on bots. 2018-04-30 23:20:20 +01:00
Rolf Bjarne Kvinge a085951264 [sdks] Wrap configure to provide better output.
Wrap configure in a script that:

* Captures stdout/stderr and only shows it in case of errors.
* If configure fails, and a cache file was used, deletes the cache file and
  tries again.
* If configure really fails, then print config.log in addition to
  stdout/stderr, since a lot of valuable diagnostic output is in that file
  (and it's annoying to track down configure failures on bots when the file
  with the important output has already been deleted).
2018-04-30 23:20:20 +01:00
monojenkins b4a42e6e4b [sdks] fix $(mktemp) usage on older versions of macOS (#8520)
Context: https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x

When making the bumps to use the `mono-sdks` upstream in Xamarin.Android,
we were getting build errors such as:

    usage: mktemp [-d] [-q] [-t prefix] [-u] template ... (TaskId:404)

The build bot is running Mavericks (10.9), so it must be an issue with older
versions of macOS.

When reading the Unix StackExchange post, it appears that the `-t` option
without a template should work more reliably on older macOS versions.

Then I tested it locally via `make -C sdks/builds provision-android`.

The command:

    mktemp -d unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: unzip_android_archive_Nt1XzgS5/android-P/

And sure enough, looking into `sdks/builds` it had created a directory in
the working directory, so it isn't using a path inside of `$TMPDIR`.

Changing the command to:

    mktemp -d -t unzip_android_archive_XXXXXXXX

Resulted in paths such as:

    creating: /var/folders/nx/rzr6lcqj6j3_vp7vtp28v2cw0000gn/T/unzip_android_archive_W247QkyW/android-P/

The StackExchange post mentions `-t` is a "prefix" that gets expanded to
`$TMPDIR/{prefix}.XXXXXXXX`, so I think it is better to use this option as
long as it works on all platforms.
2018-04-30 17:24:43 -04:00
Vlad Brezae a0228295dc [2018-02][interp] Backport interp entry changes (#8464)
* [interp] Enter in the interp through a single generic trampoline (#8056)

* [arm] Create trampoline for passing fixed arguments

It is the same as static rgctx trampoline, but it clobbers ARMREG_IP

* [arm] Create trampoline for native to interp transition

* [arm] Add interp entry from trampoline

Tweak CallContext methods to work in opposite direction

* [interp] Create wrapper that saves lmf for m2i transitions

If we want to unwind from interpreter directly into managed code we need to have a wrapper whose purpose is to save the lmf, so we can start unwinding frame by frame.

* [arm] Add unwind info for interp entry trampoline

We need to unwind through this trampoline since it sits between jitted code and the interp lmf wrapper.

* [interp] Let the unwinder unwind through trampolines

These frames are still ignored (by EH and stack walking), they are only used for unwiding further to the caller.

* [interp] Interp entry trampoline for arm64

* [interp] Include lmf wrapper in aot image

* [arm64] Add unwind info for native to interp trampoline

* [arm64] Set correct frame type for trampoline frames
2018-04-26 14:18:11 -04:00
Ludovic Henry 91509419f5 [2018-02] [mini] Don't verify types if you store to a pointer byref. (#8424)
* [mini] Don't verify types if you store to a pointer byref. Workarounds #8403.

* [mini] Add regression test for punting a type system check.
2018-04-24 13:46:29 -04:00
monojenkins 07ba54237d [arm] Fix a regression introduced by: (#8416)
[watch] Align cinfo->stack_usage to 16 on watchos. (#8354)

Fixes https://github.com/mono/mono/issues/8409.
2018-04-24 03:55:48 -04:00
monojenkins 5130d89a0d [watch] Align cinfo->stack_usage to 16 on watchos. (#8376)
Fixes https://github.com/mono/mono/issues/7685.
2018-04-23 12:57:15 -04:00
Ludovic Henry 78740e252b [2018-02] [runtime] Add a signal handler for sigterm (#8383)
* [runtime] Add a signal handler for sigterm

* [runtime] Register sigtramp when merp handler enabled

* [runtime] Limit sigterm handler symbol definition to OSX
2018-04-23 08:49:27 -04:00
monojenkins 0d37a86d2c [sdks] Match more closely the pre-SDKs configure flags passed to LLVM (#8380) 2018-04-20 16:07:37 -04:00
monojenkins 9061f77e7f [System.Net] do not use Thread for SocketTest.TestSelect1 (#8369)
it makes the test less reliable. Potentially helps with
https://github.com/mono/mono/issues/8360
2018-04-20 13:49:00 -04:00
monojenkins 700f316825 Fix mono_perfcounter_instance_exists to match prototype when #ifndef DISABLE_PERFCOUNTERS. (#8335) 2018-04-20 11:24:58 -04:00
Niklas Therning 12d764f5a0 Remove unused signal.h include in interp.c
This include breaks compiling the interpreter on platforms which don't have a
signal.h. The code in interp.c doesn't seem to need it to be included anyway.
2018-04-19 22:55:43 +02:00
monojenkins 638a7ed3b0 [corlib] Disable failing test on XA (#8352)
This follows https://github.com/mono/mono/commit/64ec2dd3eb1309b84819b34c4279d946acacd082.
2018-04-19 15:39:09 -04:00
monojenkins 6c5b8bcc39 [sdks] Fix mktemp parameters (#8324) 2018-04-18 19:20:10 -04:00
monojenkins b1dda64bda [corlib] Fix TimeZoneInfo.Local when /usr/share/zoneinfo is a symlink (#8304)
We'd be using the path verbatim to compare with the resolved value of
/etc/localtime but if it's a symlink (like on OSX 10.13+) the comparison failed.

The fix is to resolve any symlinks for /usr/share/zoneinfo too.

Fixes https://github.com/mono/mono/issues/8267 and https://github.com/xamarin/maccore/issues/628
2018-04-18 21:14:38 +02:00
monojenkins 64ec2dd3eb [corlib] SynchronizationContext does not work on non-root AppDomain on Android (#8296)
AndroidEnvironment.GetDefaultSyncContext just crashes when called on an AppDomain which is not the root AppDomain. This started appearing with the mono:2018-02 integration during which https://github.com/mono/mono/commit/252d61d0558b0bfa3461f3339ce617e2e4c285bb was introduced.

Fixes https://github.com/xamarin/xamarin-android/issues/1561\#issuecomment-381736716
2018-04-18 11:09:24 -04:00
monojenkins 9bbc930d62 [w32file-unix] fix mistake in 8430155946 (#8299)
commit message said
> [w32file-unix] convert nano seconds to microseconds properly, by using
> TICKS_PER_MILLISECOND (which has L suffix in its definition)

first it talks about microseconds, but then uses constant for _milli_
seconds
2018-04-18 13:44:28 +02:00
Rolf Bjarne Kvinge 891c01eb6e [2018-02] [runtime] Add public API to set the pending exception. (#8280)
* [runtime] Add public API to set the pending exception.

Xamarin.iOS and Xamarin.Mac need a public API to set the pending exception
when converting Objective-C exceptions to managed exceptions.

This adds a public API to support this scenario.

Partially fixes https://bugzilla.xamarin.com/show_bug.cgi?id=60065.

* [runtime] Document that pending exceptions should not be overwritten when the runtime is handling a thread abort request.
2018-04-17 22:31:41 -04:00
Marek Safar e03516d11f [mcs] Implements C# 7 digits separators 2018-04-18 03:08:17 +02:00
monojenkins 4a00c501b2 [2018-02] Harden JIT job control against cctors deadlocking. (#8235)
* [mini] Don't wait for other threads to finish JITing if the current thread is running a cctor.

This eliminates a possible source of deadlocks found during AOT runs of Roslyn.

* [mini] Introduce a 1s timeout to JIT job control to ensure we don't simply deadlock in case of execution dependency bugs.

* [mini] fix spelling5DD
2018-04-15 13:26:13 -04:00
monojenkins 34b31f05f5 [2018-02] Fix timestamp for file copy (#8247)
* [FileTest] regression for https://github.com/xamarin/xamarin-macios/issues/3929

* [w32file-unix] fix File.Copy timestamps

4a8d840d6f introduced that the destination
file of a copy operation has the same modification and access timestamps
as the source file.

With e0e185d70a this behaviour regresses,
since getting timestamps provides more precise information. Fixing this
by being more accurate when applying timestamps to destination file.

* [w32file-unix] convert nano seconds to microseconds properly, by using TICKS_PER_MILLISECOND (which has L suffix in its definition)

* [w32file-unix] introduce constant for ns->qs conversion with proper suffix

fixes problem on 32bit.
2018-04-15 13:24:29 -04:00
monojenkins 8e08947e1c [sdks] Fix typo + Fix verbosity of unzip-android-archive.sh (#8243) 2018-04-13 19:37:04 -04:00
Ludovic Henry d96186b5e8 [w32handle] Lower minimum memory usage (2nd attempt) (#8154)
Adopts a linked list of MonoW32HandleSlot (based on feedback from Rolf Kvinge). This allows for an unlimited amount of handles to be allocated, as well as for a lower cost to allocate only 1 handle across the process.

Fixes https://github.com/mono/mono/issues/7460
2018-04-13 18:15:07 -04:00
monojenkins 763e7f9d78 [system.net] disable some tests to unblock XI integration (#8205)
regression tracked here: https://github.com/xamarin/xamarin-macios/issues/3827
2018-04-12 21:59:31 -04:00
Rolf Bjarne Kvinge 35cb6bda95 [System.Net.Http] Use '*' as the host instead of '+' in the tests. Fixes xamarin/maccore#673.
Use '*' as the host instead of '+' in the tests.

The behavior should be the same, just faster, because '+' will fail to resolve
("Could not resolve host '+'"), and we'll fall back to the same behavior as
'*': https://github.com/mono/mono/blob/5128cce2dcd097aa4e7b86dd3b56e833c15a9ff0/mcs/class/System/System.Net/EndPointManager.cs#L83-L96

The problem arises when failing to resolve '+' takes a long time: on some of
our bots it takes 5-10 seconds. This adds up quickly since the tests try many
times, effectively increasing a test run from 1-2 seconds to 30+ minutes.

Fixes https://github.com/xamarin/maccore/issues/673.
2018-04-12 17:48:55 +02:00
Aleksey Kliger 61da4c7a5f [eglib] GMarkup: allow all ASCII NameStartChar and NameChar except ':'
Follow https://www.w3.org/TR/xml/#sec-common-syn except don't allow ':' and
non-ASCII.

Element and attribute names must start with a letter or '_'.
Element and attribute names may contain letters, numbers, '.', '-', '_'.

Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=19436
2018-04-12 01:25:44 +02:00
monojenkins 2710e67296 [sdks] Add ANDROID_BUILD_TOOLS_DIR to differentiate it from ANDROID_BUILD_TOOLS_VERSION (#8192) 2018-04-11 19:10:21 -04:00
monojenkins dbf27d49ad [sdks] Fix typo (#8187) 2018-04-11 18:18:23 -04:00
Ludovic Henry 02390a7414 [sdks] Fix build (#8183) 2018-04-11 15:34:38 -04:00
Marek Safar cea4294912 [corlib] Make more crypto oids work on mobile profiles when not linked out 2018-04-11 17:14:21 +02:00
Marek Safar 9e7efad7be [mcs] Fixes parameter check for interface types used with default parameters 2018-04-11 11:04:20 +02:00
Zoltan Varga d0562a9e6f [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set. (#8017) (#8150)
* [sdks] Add support for building llvm unless the USE_PREBUILT_LLVM Make.config var is set.

* [sdks] Use prebuilt llvm binaries on ios CI.

* [sdks] Use the IGNORE_PACKAGE_LLVM variable to enable the building of llvm.
2018-04-10 15:26:31 -04:00
Alexander Köplinger 887d3ad27e [System] Don't use http://www.mono-project.com for test (#8147)
When we tried switching mono-project.com to enforce HTTPS these tests
started failing on systems without working SSL configuration.

Use a different domain which is guaranteed to be available over HTTP instead.

(cherry picked from commit a748bad303)
2018-04-10 15:07:25 +02:00
Marek Safar 363790b1ec [corlib] Implements CryptoConfig::AddAlgorithm on all profiles 2018-04-10 11:17:49 +02:00
monojenkins bf838da659 [w32file] Fix memory leak (#8114)
Fixes https://github.com/mono/mono/issues/7655
2018-04-10 02:43:20 +02:00
monojenkins c530c5182f [2018-02] Implement C#7 binary literals (#8119)
* C# 7.0 binary literal support

* [mcs] Add another negative error test
2018-04-10 02:41:59 +02:00
monojenkins e310966925 [2018-02] [Facades] Add System.Drawing.Common on mobile only (#8128)
* [Facades] Add System.Drawing.Common on mobile only

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

* Bump API snapshot submodule
2018-04-10 02:36:09 +02:00
Marek Safar 5c2ab44dec [mcs] Adds private protected modifier to the parser only 2018-04-09 19:38:59 +02:00
monojenkins 0fac09cf89 [sdks] Fix arguments passed to llvm on Linux (#8109) 2018-04-09 08:48:01 -04:00
monojenkins 02d69477dd [mcs] Fixes codegen when probing reference type expression is known to pass and pattern variable has to be created (#8085) 2018-04-07 22:23:10 -04:00
Bernhard Urban 54f51bf701 [interp] use same domain as transform phase to register debug data for a method 2018-04-06 19:58:38 -04:00
monojenkins 0ca09346e3 [SDKS] fix Linux (and possibly other OSes) build for Android (#8044)
OS: Ubuntu 18.03
CMake: 3.10

For some reason cmake fails to detect any make program (be it ninja or make)
when cross-compiling for Android in XA. It happens despite the programs being in
$PATH and working correctly. The effect is that CMAKE_MAKE_PROGRAM is set to
"not found" in CMakeCache.txt and configuration fails as follows:

 Call Stack (most recent call first):
   external/mono/external/boringssl/util/android-cmake/android.toolchain.cmake:1140 (CMAKE_FORCE_CXX_COMPILER)
   external/mono/sdks/builds/android-armeabi-v7a-debug/mono/btls/build-shared/CMakeFiles/3.10.2/CMakeSystem.cmake:6 (include)
      CMakeLists.txt:3 (project)
   CMake Error: CMake was unable to find a build program corresponding to "Ninja".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      -- Configuring incomplete, errors occurred!

This commit does not fix the issue, per se, but it works around it by finding
the first ninja/make (as configured) executable in $PATH and setting the
CMAKE_MAKE_PROGRAM to full path of the executable. I haven't spent too much time
investigating *why* cmake fails to find the executable (I merely ran it with
--trace-expand --debug-output which revealed nothing of consequence) but this
workaround should be safe for any version of CMake and any OS we use makefiles
on.
2018-04-06 16:16:08 -04:00
Marek Safar f5989de3b4 [mcs] Implements C# 7.2 stackalloc span conversion in conditional expression 2018-04-06 20:58:53 +02:00
Bernhard Urban 8ad8623646 [interp] workaround undefined behaviour in r8 to u1 cast
This fixes `test_0_simple_double_casts` on iOS/arm64.
According to the C standard (section [conv.fpint]), the behaviour of
such a cast is undefined if the truncated value doesn't fit into the
destination type.

```c
unsigned char __attribute__ ((noinline)) convr8u1 (double i)
{
        return (unsigned char) i;
}
```

for arm64, `clang -O0` produces:

```
_convr8u1:
100006848:  ff 43 00 d1     sub sp, sp, #16
10000684c:  e0 07 00 fd     str d0, [sp, #8]
100006850:  e0 07 40 fd     ldr d0, [sp, #8]
100006854:  08 00 78 1e     fcvtzs  w8, d0
100006858:  00 1d 00 53     uxtb    w0, w8
10000685c:  ff 43 00 91     add sp, sp, #16
100006860:  c0 03 5f d6     ret
```

while `clang -O2` produces:

```
_convr8u1:
100006ae8:  00 00 78 1e     fcvtzs  w0, d0
100006aec:  c0 03 5f d6     ret
```

which is fine according the standard: Any value < 256 gets casted just
fine, but for example `convr8u1 ((double) 0xffff)` would end up with
`0xffff` in `w0`.

We workaround this behaviour by casting to a 32bit int first, the
resulting code looks like this then:

```
_convr8u1:
100006ae4:  08 00 78 1e     fcvtzs  w8, d0
100006ae8:  00 1d 00 12     and w0, w8, #0xff
100006aec:  c0 03 5f d6     ret
```
2018-04-06 08:25:35 -04:00
Zoltan Varga 19cc4c427a [runtime] Fix --disable-btls. 2018-04-06 11:45:19 +02:00
Marek Safar e88bfbcbce [mcs] Implements C# 7.2 conditional ref expression 2018-04-06 08:19:56 +02:00
monojenkins 7048fb45ab [sdks] Use wget in place of curl, it's installed by default on Linux (#8058)
[2018-02] [sdks] Use wget in place of curl, it's installed by default on Linux
2018-04-05 19:23:00 -04:00
Martin Baulig 2c564f83f2 [System]Fix memory leak in the web stack related to Task.Delay (partial fix of #7356).
Using `Task.Delay (timeout)` has the potential of possibly allocating and holding large
chunks of memory throughout the timeout period.  While this is not strictly speaking a
memory leak because those objects will eventually be disposed and garbage collected, it
can cause memory usage of apps to grow quite significantly in the short run.

The default timeout values are as follows:

* `HttpWebRequest.ReadWriteTimeout`: 5 minutes.

* `HttpWebRequest.Timeout`: 100 seconds.

* `ServicePointManager.MaxServicePointIdleTime`: 100 seconds.

And these values can be increased by the user.  This means that we're potentially holding
hundreds, maybe even thousands of timeout objects in memory for 5+ minutes.

This has now been fixed by using the `Task.Delay(int,CancellationToken)` constructor.

Note that disposing a `CancellationTokenSource` will not cancel it, so the following code
will still leak:

	using (var cts = new CancellationTokenSource ()) {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	}

To actually make the `Task.Delay` instance go away when we're done with it, we need to
use this pattern:

	var cts = new CancellationTokenSource ();
	try {
		Task.Delay (TimeSpan.FromDays (3), cts.Token);
		// Work
	} finally {
		cts.Cancel ();
		cts.Dispose ();
	}

We also cannot use `CancellationToken.CancelAfter()` for timeouts because unfortunately
some of the underlying framework code that we're using does not honor cancellation
requests - like for instance `NetworkStream`.

This is a partial fix for #7356.  While this commit significantly improves the problem,
there may be other unrelated issues left that needs to be investigated.
2018-04-05 14:05:57 -04:00
monojenkins 3c52f0a4a9 [SDKS] Fix Android SDK build on Linux (#8023)
Current build uses `tar` to extract ZIP archives. This works with BSD
tar but not with GNU tar, alas. Tar was used in order to strip the root
directory of Android archive while moving files into place. This commit
replaces `tar` with a call to a shell script (because doing what it does
using Make defines is an exercise in pain) which works both on macOS/BSD
and on Linux.
2018-04-05 11:38:56 -04:00
Bernhard Urban c5f99aa4dc [interp] do not bake object reference into code stream
it won't be scanned by the GC, defer string allocation to
execution-time instead.
2018-04-05 17:33:02 +02:00
monojenkins 1e35db0ae2 [interp] fix i4<>i8 conversion for builtin types, it was inverted (#7986) 2018-04-04 18:23:13 -04:00
monojenkins 88f5058a33 [sdks] Fix MXE_PREFIX for XA (#8010)
It should take 7 characters from the hash, not 6.
2018-04-04 15:28:58 -04:00
monojenkins 0d5eb5c9bb [sdb] Add reference counting for single step requests, they can be accessed concurrently by the single step processing code and the event request clearing code. Fixes #7137. (#7972) 2018-04-04 13:38:43 -04:00
Ludovic Henry 723f194cdc [2018-02] [sdks] Add provisioning for Android SDK and NDK (#7979)
* [sdks] Add provisioning for Android SDK and NDK

This will also be used by XA

* Add missing backslash to mxe.mk

* Only grab bin/autopoint

* [sdks] Use provisioning for MXE

We want to treat MXE the same way we do Android SDK and NDK because it only rarely changes, and it's very long to build it.
2018-04-04 13:48:52 +02:00
monojenkins a5e4482376 [System] Disable SocketTest.AcceptBlockingStatus (#7977)
It frequently fails on ARM: https://github.com/mono/mono/issues/6513
2018-04-04 03:06:36 +02:00
monojenkins 95cc49a65c [2018-02] [Facades] Add System.Memory facade to mobile profiles (#7967)
* [Facades] Add System.Memory facade to mobile profiles

Contains only the types we have right now.

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

* Bump API snapshot submodule
2018-04-03 18:56:17 +02:00
Zoltan Varga dea448aa83 Disable building btls/ and support/ on the bcl build, they are not needed. 2018-04-03 14:13:44 +02:00
Zoltan Varga 21cef8b793 [runtime] Add a --disable-btl-lib configure option to disable the building of the btls lib, but compile the managed code with btls support. 2018-04-03 14:13:44 +02:00
Bernhard Urban 0ba54d6bdd [ppc] use ucontext_t
`struct ucontext` has been removed from glibc and `ucontext_t` has been
around for a while now.

Fixes a build failure on Ubuntu 18.04

Related glibc change
https://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=251287734e89a52da3db682a8241eb6bccc050c9;hp=c86ed71d633c22d6f638576f7660c52a5f783d66
2018-04-02 21:55:17 -04:00
Rodrigo Kumpera c3e00ab9bc [runtime] Add regression test for nested famility visibility. 2018-03-31 23:54:55 +02:00
Rodrigo Kumpera 30b5b2b188 [runtime] Fix class visibility check for protected nested classes. Fixes #7657.
A nested class that has protected access must be checked using the same inheritance based rules as members.
The existing code ignores that and does a plain visibility check that is only amendable for public/internal nested types.
2018-03-31 23:54:55 +02:00
monojenkins 29adf3012f Bump API snapshot submodule 2018-03-30 13:42:46 +02:00
Marek Safar d6fde73640 [corlib] Update linker descriptor with missing types 2018-03-30 13:42:46 +02:00
Marek Safar 572c33ae18 [corlib] Enable machine.config dependant version of CryptoConfig for net_4_x profile only 2018-03-30 13:42:46 +02:00
Bernhard Urban dcdd956e1b [perfcounters] fix alignment issue on 32bit
clang fails to properly align 64bit members of the `MonoPerfCounters` struct on
32bit builds:

```
* thread #1, name = 'tid_403', queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=EXC_ARM_DA_ALIGN, address=0x16933124)
    frame #0: 0x0066f4b2 mini`mono_atomic_cas_i64(dest=0x16933124, exch=<unavailable>, comp=<unavailable>) at atomic.c:519 [opt]
   516 	gint64
   517 	mono_atomic_cas_i64(volatile gint64 *dest, gint64 exch, gint64 comp)
   518 	{
-> 519 		return  __sync_val_compare_and_swap (dest, comp, exch);
   520 	}
   521
   522 	#elif defined (TARGET_ANDROID)
(lldb) up
frame #1: 0x006292ea mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued [inlined] mono_atomic_inc_i64 at atomic.h:397 [opt]
   394 		do {
   395 			get = *val;
   396 			set = get + 1;
-> 397 		} while (mono_atomic_cas_i64 (val, set, get) != get);
   398 		return set;
   399 	}
   400
(lldb) up
frame #2: 0x006292d6 mini`ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued at threadpool.c:743 [opt]
   740 	ves_icall_System_Threading_ThreadPool_NotifyWorkItemQueued (void)
   741 	{
   742 	#ifndef DISABLE_PERFCOUNTERS
-> 743 		mono_atomic_inc_i64 (&mono_perfcounters->threadpool_workitems);
   744 	#endif
   745 	}
   746
```

Note that the member `threadpool_workitems` is on an unnatural alignment
(`0x16933124`) regarding to its type `gint64`.

related https://github.com/xamarin/xamarin-macios/issues/3826
2018-03-30 05:05:07 -04:00
monojenkins 811e3b4dcd [sdks] Fix LLVM build for XA (#7919) 2018-03-29 20:48:45 -04:00
monojenkins 25aba4e86e [2018-02] [sdks] Fix LLVM build on Linux for XA + Fix MXE usage on non-Darwin platforms (#7912)
* [sdks] Fix LLVM build on Linux for XA

* [sdks] Fix MXE usage on non-Darwin platforms
2018-03-29 13:06:52 -04:00
monojenkins ae7f365c06 [sdks] Fix usage of MXE for XA (#7898) 2018-03-28 22:05:25 -04:00
monojenkins cda8574a88 [jit] Add signature checking for CALLI. (#7880)
Fixes #7792.
2018-03-28 21:45:47 -04:00
monojenkins a6b0e1ccbe [2018-02] [sdks] Pass LLVM_SRC from XA to use xamarin-android/external/llvm + Pass IGNORE_PACKAGE_MXE from XA + Only checkout specific MXE and LLVM commit when cloning (#7895)
* [sdks] Pass LLVM_SRC from XA to use `xamarin-android/external/llvm`

We do not clone to `$(LLVM_SRC)` because this is up to XA.

* [sdks] Pass IGNORE_PACKAGE_MXE from XA

This is to avoid rebuilding MXE while XA already took care of it.

* [sdks] Only checkout specific MXE and LLVM commit when cloning
2018-03-28 21:44:19 -04:00
monojenkins 7ee378c904 [sdks] Pass MXE_SRC from XA to use xamarin-android/external/mxe (#7890)
We do not clone to or remove `$(MXE_SRC)` because this is up to XA.
2018-03-28 18:27:28 -04:00
monojenkins 511ca9f507 Whitelist illinkanalyzer in macOS package (#7862)
Fixes #7860
2018-03-28 15:09:39 +02:00
Alexis Christoforides 88b5266376 Merge pull request #7851 from monojenkins/backport-pr-7849-to-2018-02
[2018-02] [corlib] Restores ConcurrentDictionary serialization support.
2018-03-27 17:30:12 -04:00
Ankit Jain 4aa9fd41b8 [msbuild] Bump to pick up updates (#7846) 2018-03-27 21:04:54 +02:00
Marek Safar 4bf541a969 [System] Makes TLS providers linker friendly 2018-03-27 19:26:04 +02:00
Bernhard Urban b250b4a657 [2018-02] [sdk] sync ios and android changes from master into 2018-02 (#7831)
* [sdks] Add targets for the watch cross compiler. (#7061)

* [offsets-tool] Add an '--output' argument to specify the output file directly instead of generating it from the target triple.

* [sdks] Add targets for the watch cross compiler.

* Ios sdk changes (#7258)

* [sdks] Add armv7s device build.

* [sdks] Disable dtrace on the cross compiler builds.

* [sdks] Avoid building mono-dtrace.h for the cross compilers, its not needed anymore.

* [sdks] Add a configure-mono target.

* [sdks] Put back the call to CheckXcodeDir.

* [sdks] Enable ccache if possible.

* [sdks] Generalize iosDeviceTemplate so it can build the tvos runtime as well. Add tvos device build.

* [sdks] Add tv simulator build.

* [sdks] Add watch simulator build.

* [sdks] Add watch device build.

* [sdks] Unify targets to build runtimes (#7394)

* [sdks] Move common targets

* [sdks] Have RELEASE be empty when CONFIGURATION != 'release'

* [sdks] Create common runtime compilation template

* [sdks] Use runtime template for Android

* [sdks] Use runtime template for iOS

* [sdks] IOS fixes. (#7617)

* [sdks] Fix ios build.

* [sdks] Pass -DMONOTOUCH to the ios cross compiler builds. Compile monotouch/tvos/watchos profiles for the bcl build.

* [sdk] missing diffs for ios and android

* [ci] sync run-jenkins.sh regarding sdks android

* [ci] remove package-android-host-Linux
2018-03-27 09:36:26 -04:00
Marek Safar 6c324b91b2 [corlib] Restores ConcurrentDictionary serialization support.
Fixes #7822
2018-03-27 12:59:14 +00:00
Ludovic Henry 77fc4cfa2e Remove suspicious mono_gchandle_free
Fixes https://github.com/mono/mono/issues/7786
2018-03-26 17:58:56 +02:00
Bernhard Urban 3984508a04 [icall] remove DISABLE_PROCESS_HANDLING (#7827)
The only user was Xamarin.iOS in a weird way: The define is only set for
device builds where the icall table is excluded anyway. For the cross
compiler however, the define isn't set, and therefore those icalls can
be resolved by the AOT compiler.

With the interpreter now, this define actually had an effect: The
guarded icalls weren't inclueded in `libmono-icall-table.a`.
2018-03-26 10:25:48 -04:00
monojenkins 67a2468db9 support increment and decrement of nint/nuint (#7790)
update definition to be in sync with XI
2018-03-25 23:13:01 -04:00
monojenkins da0e172ae5 improve error message and add another interp_in signature (#7789) 2018-03-25 23:12:45 -04:00
Zoltan Varga 1c9d8aad07 [sdks] Fix the ios sdk build. (#7801) (#7824) 2018-03-25 19:06:32 -04:00
monojenkins c6fc176f5c Fix Android build for toolchain (#7818) 2018-03-23 21:20:44 -04:00
monojenkins c9bf7a3878 Disable the interpreter on ios device builds. (#7795) 2018-03-23 14:22:50 -04:00
Marek Safar d37075a949 [System] Disable a test file to resolve compilation error 2018-03-23 14:08:19 +01:00
Marek Safar 42fc0bd51f Bump corefx to bring a fix for #7696 2018-03-23 14:08:19 +01:00
monojenkins 2487301faf Fix Android build for mxe (#7782) 2018-03-22 20:49:43 -04:00
Ludovic Henry 0d6be4da5e [sdks] Fix Android build on Linux (#7777) 2018-03-22 18:40:22 -04:00
monojenkins ebbed2bb87 Revert "Swap Close/Dispose calls so that the receiver_thread_main loop will be properly interrupted (#7390)" (#7751)
This reverts commit e7ba41d14c.
2018-03-22 17:51:57 -04:00
monojenkins e5bad88ebb Fix Android build (#7769) 2018-03-22 16:55:46 -04:00
Martin Baulig 238c21cf77 Fix a race condition that was exposed by #7358 (see #7668).
The latest `WebCompletionSource<T>` changes (PR #7358) exposed and
intensified the side-effects of a race condition between `WebOperation`
and `ServicePointScheduler`.

* WebCompletionSource<T> now contains new `CurrentResult` and `CurrentStatus`
  properties, which allow completion status to be checked in a non-blocking way.

* WebOperation.CompleteResponseRead() has been renamed into Finish() and
  contains the continuation that was previouly known as FinishReading().
  Calling this new Finish() method will now complete the `finishedTask`
  completion, which has a new accessor called `Finished`.

* The ServicePointScheduler's main-loop is still woken up by completion of
  `WebOperation.Finished.Task`, but we use the new `CurrentResult` property
  to check state in a non-blocking way.  This ensures the the clean-up and
  bookkeeping work that's necessary after `WebCompletion.Finish()` always
  happens prior to starting new connections.
2018-03-22 19:40:02 +01:00
Alexander Kyte 2fbd5a16a3 [runtime] Fix file handle leak with dedup+aot (#7721) 2018-03-21 16:01:47 -04:00
monojenkins a13c12ac99 [2018-02] [loader] Don't load framework Facade assemblies that are older than expected. (#7708)
* Don't load framework Facade assemblies that are older than expected.

If there is an older framework Facade assembly in the search order before the
one that we want, don't load it.

"older" here means just compare the major components of the version.

Fixes https://github.com/mono/mono/issues/7624
2018-03-21 11:47:37 -04:00
Alexis Christoforides bdf405fae4 Merge pull request #7726 from mono/backport-new-boottime-2018-02
Backport new boottime
2018-03-21 11:12:00 -04:00
Zoltan Varga ce612bb49e Fix partially shared constrained calls in llvmonly mode.
Fixes https://github.com/mono/mono/issues/7535.
2018-03-21 12:55:55 +01:00
Zoltan Varga 0a3d40ac60 Avoid aot-ing the bcl libs twice in make fullaotcheck/llvmonlycheck. 2018-03-21 12:55:55 +01:00
Bernhard Urban c17d8c6dcd remove WildcardConnect () on WatchOS 2018-03-21 10:39:49 +01:00
Alexis Christoforides 07d5a031d4 [runtime] Don't use clock_gettime on WatchOS and tvOS. 2018-03-20 18:35:18 -04:00
Alexis Christoforides ff546b9d8b [runtime] Don't use clock_gettime in MacOS.
Even though it's found during configure when targetting 10.7, it's not "really" available before versions 10.12 and it would crash with "lazy symbol binding failed".
2018-03-20 18:35:16 -04:00
Zoltan Varga 9922d1af20 [runtime] Fix mono_msec_boottime () so it compiles on older ios versions, clock_gettime () is only available from ios 10. (#7671) 2018-03-20 18:35:01 -04:00
Alexis Christoforides 875240538e [mono-time] Replace mono_msec_boottime() with CoreCLR implementation. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58413 2018-03-20 18:32:45 -04:00
monojenkins e29f146ab3 [2018-02] [sgen] Use current nursery size when computing allowance (#7648)
* Use current nursery size when computing allowance

The allowance is the minimum heap growth that we allow between two majors (which is 4 * nursery_size). We need to use the current nursery size instead of the 4MB default, in order to facilitate low memory uses.

* Account for soft heap limit in allowance calculation

This is relevant in cases where the nursery size and soft heap limit are comparable in size.
2018-03-20 15:07:50 -04:00
Marek Safar 535bfc5d84 Add csc-dim as a prototype if default interface implementation 2018-03-20 17:46:56 +01:00
Ludovic Henry 5b66de0bf0 [2018-02] [sdks] Fix concurrent building of MonoAotOffsetsDumper.exe + Simplify building of support library (#7688)
* [sdks] Simply building of support library

* [sdks] Fix ios targets

* [sdks] Cleanup of some targets
2018-03-20 10:14:59 -04:00
Ankit Jain a6c7b9eca4 [msbuild] Bump msbuild to pick up fix for issue #7184 (#7666)
MSBuild always recompiles project if it has a resx with a windows path.
https://github.com/mono/mono/issues/7184
2018-03-20 13:59:27 +01:00
Bernhard Urban 3577465fcd add LL suffix to constant in order to prevent overflowing on 32bit systems 2018-03-20 06:45:12 -04:00
Bernhard Urban 7d9e106c03 1000ns = 1us and 1us = 10ticks 2018-03-20 06:45:12 -04:00
Bernhard Urban 3931767dca reduce compiler warnings 2018-03-20 06:45:12 -04:00
Bernhard Urban deb3474e7c add regression test for github issue 7646 2018-03-20 06:45:12 -04:00
Bernhard Urban 27c7a4b01e use utimes if available in order to set subsecond information on access and write time 2018-03-20 06:45:12 -04:00
Bernhard Urban da5b39d785 factor setfiletime 2018-03-20 06:45:12 -04:00
Bernhard Urban 7f69ff87b5 use CONVERT_BASE in more places 2018-03-20 06:45:12 -04:00
Bernhard Urban e33bf27c9a replace SECMULT with TICKS_PER_SECOND 2018-03-20 06:45:12 -04:00
Bernhard Urban 79030a3284 remove unused mono_w32file_get_times () 2018-03-20 06:45:12 -04:00
Alexis Christoforides e74d4a6e31 Merge pull request #7686 from mono/backport-gh-7584
[System.Net] Replace use of obsolete `SupportsIPv6` property.
2018-03-19 23:02:01 -04:00
Alexis Christoforides c2fe39f13e Revert "Replace mono_msec_boottime() with CoreCLR implementation. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58413"
This reverts commit cb89a1575c.

The commit breaks iOS and needs testing on earlier MacOS versions.
2018-03-19 22:58:50 -04:00
Alexis Christoforides 0d8de253cb [System.Net] Replace use of obsolete SupportsIPv6 property.
The obsolete property was always set to false. Fixes https://github.com/mono/mono/issues/6940
2018-03-19 11:53:23 -04:00
Zoltan Varga e9c512092d Increase the buffer size in emit_exception_debug_info ().
Fixes https://github.com/mono/mono/issues/7637.
2018-03-16 13:10:57 +01:00
monojenkins 08a7043b66 [2018-02] [System]: Introduce WebCompletionSource\u003cT\u003e and use it in WebOperation. (#7641)
* Introduce `WebCompletionSource<T>` and use it in `WebOperation`.

* Fix issue in ServicePointScheduler with collection being modified in foreach.

* Update WebOperation.cs

* Work around mcs limitations.

* Use TaskCreationOptions.RunContinuationsAsynchronously in WebCompletionSource.

* Add the test from #7355.

* Put back the 'foreach' loop in ServicePointScheduler.

With the WebCompletionSource changes, this should no longer cause
any problems.
2018-03-16 13:10:31 +01:00
Alexis Christoforides cb89a1575c Replace mono_msec_boottime() with CoreCLR implementation. Fixes https://bugzilla.xamarin.com/show_bug.cgi?id=58413 2018-03-15 18:25:58 +01:00
Rodrigo Kumpera 1a0508a58c Handle multiple segments in IsolatedStored::GetFileNames. Fixes bxc #11771 2018-03-15 11:16:27 +01:00
Zoltan Varga d67d75a4f3 Disable delegate-15.exe in the full-aot profile. 2018-03-14 22:32:37 +01:00
Zoltan Varga 6036b45bce Avoid calling mono_class_vtable () for open constructed types. 2018-03-14 22:32:37 +01:00
Bernhard Urban 9136f4c1a0 only target macOS, HOST_DARWIN includes iOS etc. as well 2018-03-14 09:14:04 +01:00
monojenkins abb82546d7 [2018-02] [Facades] Make System.Net.Http.Rtc.dll a net_4_x only facade (#7595)
Backport of #7590.
2018-03-14 00:10:17 +01:00
Alexander Kyte 6af13f6e83 Add icall to configure MERP options / enable it 2018-03-13 11:30:33 +01:00
Alexander Kyte c684567bd7 Add optional Microsoft Telemetry unmanaged dumper 2018-03-13 11:30:33 +01:00
Marek Safar 4ab5e8a495 Update source file location from commit d4816ef1ab 2018-03-13 08:49:13 +01:00
monojenkins ed56e90aca [2018-02] [Facades] Add missing Facades that exist in .NET 4.7.1 (#7551)
* Add missing Facades that exist in .NET 4.7.1

Some of them we had on mobile only, others were missing completely.

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

* Bump API snapshot submodule
2018-03-12 13:26:16 +01:00
Zoltan Varga 57e18b15d0 [sgen] Fix the clearing of bits in the gc descriptor bitmap when using weak fields. Fixes #7378. 2018-03-12 09:15:07 +01:00
monojenkins 279d7e230f [2018-02] [threads] Fix race between abort socket syscall and thread shutdown (#7521)
* Fix race between abort socket syscall and thread shutdown

The race happens when we call mono_thread_info_abort_socket_sycall_for_close on
a thread that's about to shut down.

We lookup the MonoThreadInfo for that thread outside the
mono_thread_info_suspend_lock, and then use it to send the signal once we've
taken the lock.

In between those two actions, the other thread already finished
unregister_thread and pthreads may already have destroyed its TLS keys and
otherwise started to dismantle the thread.

The fix is to do a second mono_thread_info_lookup once we have the lock and
only signal the other thread if it still around.

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

* Simplify mono_thread_info_abort_socket_syscall_for_close

Call mono_thread_info_lookup while holding the thread info suspend lock.
We no longer need to check for STATE_DETACHED because removing MonoThreadInfo on
detach is done while holding the suspend lock.
2018-03-09 17:54:16 -05:00
Zoltan Varga 2ce1d5f3d5 Comment/stub out some unused icalls to prevent problems with AOT. 2018-03-09 16:36:55 +01:00
Alexander Köplinger 668baf1915 [acceptance-tests] Actually disable gcsuppressfinalize.exe test
d1ed53624b wasn't enough, it needs to be removed from the CORECLR_COREMANGLIB_TEST_CS_SRC list.

(cherry picked from commit 85b605042b)
2018-03-09 14:36:59 +01:00
Martin Baulig 2201952d9a WebRequestStream now throws correct exception on cancellation (#7074). 2018-03-09 13:42:35 +01:00
Alexis Christoforides 4d3e9d53b2 Fix resolution of interfaces in classes implementing IEnumerator. Fixes #59400
Assume a class implementing multiple generic I`1 interfaces. If a virtual call invocation is trying to resolve the correct interface using object O implementing I`1 also , the interface is resolved using a set of rules (not fully implemented in Mono), but a requirement is that the chosen interface is "variant-compatible" with object O, that is its generic parameters are set to the same types.

This last requirement is relaxed as an implementation-specific detail when I`1 is IEnumerator`1, in which case e.g. a virtual call on a class implementing IEnumerator<byte> can happen with an object of type IEnumerator<sbyte> by way of sharing IEnumerator`1 as a generic interface they define. Here, clearly the interfaces are not "variant-compatible", and this is allowed.

Resolution of classes implementing IEnumerator should still attempt to select a compatible interface using the standard rules before attempting to apply this special rule.
2018-03-09 13:41:14 +01:00
monojenkins 2476d2ac06 Move the check for open constructed types later in mono_jit_compile_method_with_opt (), this function can receive gshared methods in llvmonly mode. (#7504)
Fixes https://github.com/mono/mono/issues/7364.
2018-03-08 19:08:17 -05:00
monojenkins 91fe1eb5f5 Fix generated file when passing --bundled-header (#7510)
There would be a compilation error in the XA build as follow:

```
obj/Release/bundles/armeabi-v7a/temp.c: In function 'install_aot_modules':
obj/Release/bundles/armeabi-v7a/temp.c:49:25: error: 'MONO_AOT_MODE_NORMAL' undeclared (first use in this function)
  mono_jit_set_aot_mode (MONO_AOT_MODE_NORMAL);
                         ^
obj/Release/bundles/armeabi-v7a/temp.c:49:25: note: each undeclared identifier is reported only once for each function it appears in
```
2018-03-08 17:23:34 -05:00
Ludovic Henry bb0c123e74 Use runtime template for iOS 2018-03-08 14:28:51 +01:00
Ludovic Henry e965e1647d Use runtime template for Android 2018-03-08 14:28:51 +01:00
Ludovic Henry a652297384 Create common runtime compilation template 2018-03-08 14:28:51 +01:00
Ludovic Henry 685d39238a Have RELEASE be empty when CONFIGURATION != 'release' 2018-03-08 14:28:51 +01:00
Ludovic Henry 3648ace2b9 Move common targets 2018-03-08 14:28:51 +01:00
Aleksey Kliger b62bfdcb55 An array is not an IEnumerator`1
Address https://github.com/mono/mono/issues/7093 in kind of an adhoc way.

The correct fix is to make
```
    ((IEnumerable<U>) (new T[] {...})).GetEnumerator()
```
return an `IEnumerator<U>` (like .NET does) instead of `IEnumerator<T>`
and to stop marking IEnumerator as an array special interface.
2018-03-08 10:51:22 +01:00
Aleksey Kliger 9f2841c3a0 An array is not an IEnumerator`1
regression test for Regression test for https://github.com/mono/mono/issues/7093
2018-03-08 10:51:22 +01:00
Aleksey Kliger 6f90188e9f Add IEnumerator`1 to MonoDefaults struct 2018-03-08 10:51:22 +01:00
Marek Safar 84027bddaa Remove compiler config sections for types which cannot be instantiated
Fixes #7389
2018-03-08 10:32:14 +01:00
Sebastien Lebreton 66f19a974a Swap Close/Dispose calls so that the receiver_thread_main loop will be properly interrupted 2018-03-07 16:03:44 +01:00
monojenkins 99b7f59ddc [2018-02] Fix for gcc 4.4; nominal support for older. (#7435)
Backport of #7419.
2018-03-07 00:50:43 +01:00
Marek Safar f28abdbebd Fixes decoding of CMS/PKCS #7 messages with an explicit cryptographic object identifier 2018-03-06 15:53:36 +01:00
Rolf Bjarne Kvinge 2dc56b5a60 [2018-02] [corlib] Ignore TimeZoneTest.TestCtors on iOS under certain conditions due to an Apple bug. (#7428)
Fixes https://github.com/xamarin/maccore/issues/629.
2018-03-06 14:31:38 +01:00
Alexander Köplinger 58d02a9603 [acceptance-tests] Disable gcsuppressfinalize.exe test that started failing
See https://github.com/mono/mono/issues/7432

(cherry picked from commit d1ed53624b)
2018-03-06 14:07:26 +01:00
Alexander Köplinger fa1ec4ac4d [packaging] Support setting the FULL_VERSION number via env vars (#7414)
The Linux build currently just displays "tarball" since we don't
have the .git directory when building the Linux packages.

This allows us to pass environment variables that contain the
branch+commit to the build for generating version.h so we can
show the more detailed info like on OSX.

(cherry picked from commit 7c34f0c746)
2018-03-05 20:17:34 +01:00
Bernhard Urban 30aadcaa3a [2018-02] [metadata] split IL generation code into seperate compilation units. (#7375)
* [metadata] move ENABLE_ILGEN definition to configure

* [metadata] split IL generation code into seperate compilation units.

By adding callbacks for IL generating runtime code, we can link in code
later into the runtime that does such for configurations which do not
need IL generation initially. This is the case if you configure the
runtime with `--enable-minimal=jit,interpreter`.

In such configuration, the build will produce an additional library,
called `libmono-ilgen`.

An embedded can choose to link this library to the final binary and
initialize IL generation with the following three, newly added, API
calls:

* `void mono_marshal_ilgen_init (void)`
* `void mono_method_builder_ilgen_init (void)`
* `void mono_sgen_mono_ilgen_init (void)`

This change is mostly moving code around, but there are minor changes
like introducing the enum `MarshalTypeCheckPositions`, so we avoid
copy/paste constants accross compilation units.

* [windows] add IL gen files to windows build and set ENABLE_ILGEN

* [fixup!] fix windows build
2018-03-05 13:41:42 -05:00
Ankit Jain 214321dee5 [msbuild] Bump to track msbuild's mono-2018-02 branch (#7395) 2018-03-05 13:18:57 -05:00
monojenkins 413f2fb976 Reenable HttpRequestIgnoreBadCookies in monotouch. (#7391)
The test was ran in the current xamarin-macions and works as expected.
2018-03-03 00:19:07 +01:00
monojenkins 020ac2de89 Problem building on Arch linux #7200 https://github.com/mono/mono/issues/7200 Three styles: 1. LIBS="$LIBS -lfoo" -- common and probably works 2. LIBS+="-lfoo" -- was here and does not work 3. LIBS+=" -lfoo" -- should work (#7383) 2018-03-02 17:28:17 +01:00
Ankit Jain 769bf9ef25 nuget-hash-extractor: Add msbuild extensions nuget version from vs15.6 msbuild branch
Version `2.1.100-preview-62617-01` from:

https://github.com/dotnet/cli/blob/b9e74c65201ef39c74b6d75cedbb605a88cd26ec/build/DependencyVersions.props

Also, update the list in the runtime and deniedAssembliesList.txt
installed for use by msbuild.

(cherry picked from commit 95e48771d0eb30e92c3d9006ba0cd66b5a8b0c91)
2018-03-02 08:46:29 +01:00
Ankit Jain 878a54030a nuget-hash-extractor: Change the nuget repo name to use for
fetching Microsoft.NET.Build.Extensions nuget from `cli-deps` to
`dotnet-core`. Both of these should have the same nugets but sometimes
seem to be off by one.

(cherry picked from commit 89182050a769013e68d1d90d5fbca90415425aec)
2018-03-02 08:46:29 +01:00
Aleksey Kliger a849f9a6e8 Fix path clobbering when trying to shadow copy siblings
The original version of this code overwrote the same string over and over
again.  Because of the order of operations, when looking for siblings of
Test.dll, we would probe for Test.dll.mdb, then Test.pdb, then Test.pdb.config
(note the last one - should be Test.dll.config).

New version of the code uses fresh strings for each sibling.

Fixes https://github.com/mono/mono/issues/7262
2018-03-02 08:43:13 +01:00
monojenkins d9aa6f4083 Use attribute(deprecated) instead of attribute(error). (#7369)
Backport of #7362.
2018-03-01 22:30:35 +01:00
Alexander Köplinger c0b76ff9ae Don't throw NotImplementedException in Dispose()
We had a few stubs that threw not implemented exceptions in Dispose()
which causes the finalizer thread to abort.

Since those classes throw in the constructor already there's no way
to create a valid object and we can remove the throw in Dispose().

Fixes https://github.com/mono/mono/issues/7338
2018-03-01 17:39:08 +01:00
Aleksey Kliger (λgeek) 5cef19dcd2 [2018-02][runtime] Don't assert in mono_class_is_assignable_from on iface gtd (#7290)
* [test] System.Type.IsAssignableFrom of gtd array special interfaces.

Regression test for https://github.com/mono/mono/issues/7095

* [runtime] Don't assert in mono_class_is_assignable_from on iface gtd

Don't assert when comparing if an "array special interface" is assignable from
an array.

The code assumed that the special interface is some sort of generic instance
like ``IList`1<string>``, but it could be a generic type definition
``IList`1``.

There is a case where we would be obligated to return TRUE:
If someone used reflection to get the generic param of ``IList`1`` and then made an
array:
```
   var i = typeof (IList<>);
   var iparam = i.GetTypeInfo().GenericTypeParameters [0]; // returns gparam T
   var a = iparam.MakeArrayType (); // T[]

   Console.WriteLine (i.IsAssignableFrom (a));
```

But that case is handled by the `MONO_CLASS_IMPLEMENTED_INTERFACE` check,
earlier in mono_class_is_assignable_from.

So we can return FALSE here.

Fixes https://github.com/mono/mono/issues/7095
2018-03-01 11:32:24 -05:00
Martin Baulig ffe180c47f Make it build. 2018-03-01 15:30:24 +01:00
Martin Baulig c627c1b4b6 Bump linker. 2018-03-01 15:30:24 +01:00
Martin Baulig d0e7df4717 [System]: Enable some System.Net.Requests tests from CoreFX. (#7339)
Backport of #7080
2018-02-28 21:32:03 +01:00
monojenkins 28c171a337 [2018-02] [System]: Use new WebCompletionSource instead of TaskCompletionSource. (#7298)
Backport of #7293.
2018-02-28 16:52:10 +01:00
Alexis Christoforides 0c8f0774ce Merge pull request #7336 from monojenkins/backport-pr-7321-to-2018-02
[2018-02] Fix gdb not being used for native stacktraces in some cases
2018-02-28 09:30:32 -05:00
Alexis Christoforides 6a1b416592 Fix gdb not being used for native stacktraces in some cases 2018-02-28 14:23:09 +00:00
monojenkins 078760db9b [2018-02] [TermInfo] support new file format terminfo2 introduced with ncurses6.1 (#7308)
[2018-02] [TermInfo] support new file format terminfo2 introduced with ncurses6.1

Backport of #6960.

/cc @lewurm
2018-02-27 15:15:15 -05:00
Zoltan Varga ffc643d10c Fix VirtualMachine.CreateEnumMirror () so it works with types from non-root domains.
Fixes https://github.com/mono/mono/issues/7289.
2018-02-27 11:42:10 +01:00
Vlad Brezae 6ed6a1b568 Check if we are exceeding the worker count limit 2018-02-27 09:28:12 +01:00
Bernhard Urban 33b47292c3 bump nunitlite
Commit list for mono/NUnitLite:

* mono/NUnitLite@70bb70b [FinallyDelegate] rely on PlatformNotSupportedException in order to determine remoting support (#10)
* mono/NUnitLite@09ad9cf [FinallyDelegate] add comments for why CallContext is used (#9)
* mono/NUnitLite@ab5cc9c [FinallyDelegate] Make this work with platforms without remoting. (#8)

Diff: https://github.com/mono/NUnitLite/compare/b7776829bb7b2f9c58db045a6f40be40bcd96761...70bb70b0ffd0109aadaa6e4ea178972d4fb63ea3
2018-02-27 07:38:19 +01:00
Ludovic Henry df0a29e779 Merge mxe-Win32 and mxe-Win64 targets since we are building both in XA anyway 2018-02-26 18:05:51 +01:00
Zoltan Varga 6ccf73c8c8 Pass only the imt argument if both imt and rgctx arguments are required.
Fixes https://github.com/mono/mono/issues/7240
2018-02-26 18:04:21 +01:00
Alexander Köplinger d6b6fc61f1 Bump bockbuild to get curl error changes 2018-02-23 17:35:54 +01:00
Rodrigo Kumpera 8249522f23 Fix the test name. 2018-02-23 09:47:11 +01:00
Rodrigo Kumpera 2623bc3045 Magic interfaces requires the complex stelemref to handle arrays. Fixes gh #6266 2018-02-23 09:47:11 +01:00
Bernhard Urban 3be3714b6e add another signature for interp_in wrappers 2018-02-22 18:44:02 -05:00
Bernhard Urban daace66339 [2018-02] [xbuild] add property that is available in msbuild (#7202)
They fsharp team decided to remove a `#if MONO` with the assumption that
`xbuild` is dead and everything has switched over to `msbuild`:
https://github.com/Microsoft/visualfsharp/pull/3969/files#diff-bcb4028a918d13bbab2d0c1c15c97e6aL181
https://github.com/Microsoft/visualfsharp/pull/3969/commits/5e17e3111f88b1a1f025ac54c8147052e12f347f#r151844561

which, alas, is not true yet.

With this PR we started to ship above modifications in the MDK:
https://github.com/mono/mono/pull/7018

* Bump API snapshot submodule
2018-02-23 00:06:47 +01:00
Alexis Christoforides fd18515516 Bump bockbuild for https://github.com/mono/bockbuild/pull/62 (#7206) 2018-02-22 15:40:18 +01:00
Zoltan Varga c68cc6a4f4 Emit the same instances in hybrid aot mode as in full aot mode.
Fixes https://github.com/mono/mono/issues/7086.
2018-02-22 14:54:11 +01:00
Zoltan Varga 4169af750b Disable partial sharing during JITting, its only been tested in full aot mode, and doesn't seem to work with JITted methods. Fixes https://github.com/mono/mono/issues/7085. 2018-02-22 14:45:53 +01:00
Zoltan Varga ed22f9fa84 Add hybrid aot tests. 2018-02-22 14:45:53 +01:00
Marek Safar d389ff9ff6 Remove reflection calls for value has to be set 2018-02-22 08:40:23 +01:00
monojenkins d1f461c5a3 Expand "ignore" functionality (#7154) (#7176)
Context: https://github.com/xamarin/xamarin-android/pull/1078

xamarin-android uses `mono-api-html` and `mono-api-info` in order to
perform API comparisons; see e.g. 4e459045.

A recent problem has arisen regarding "inter-API-level diffs": there
are many API changes which we consider to be acceptable, and thus
would like to ignore. Unfortunately, `mono-api-html` doesn't support
ignoring many of these constructs, e.g. base class changes:

	<h3>Type Changed: Android.Preferences.CheckBoxPreference</h3>
	Modified base type: <span class='removed removed-inline removed-breaking-inline'>Android.Preferences.Preference</span> <span class='added '>Android.Preferences.TwoStatePreference</span>

and property type changes:

	<h3>Type Changed: Android.Views.InputEvent</h3>
	<p>Modified properties:</p>
	<pre>
	<div data-is-breaking>	public <span class='added added-breaking-inline'>abstract</span> int DeviceId { get; }
	</div><div data-is-breaking>	public <span class='added added-breaking-inline'>abstract</span> InputSourceType Source { get; }

Overhaul the `mono-api-html` "ignore" infrastructure:

  * Introduce ignore "scoping". Previously, the ignore options would
    only match the *member* text against any provided regular
    expression. Thus, `mono-api-html -r ToString` would ignore *all*
    members containing `ToString`. Furthermore, there was no way to
    restrict the ignore to a particular type. Expand the regex
    semantics so that the declaring type is used as a "prefix" for the
    to-be-matched text. For example, if a class `Example` is removed,
    `mono-api-html` will now match the following value against any
    `-r` regular expressions:

        Example: Removed type

  * Add a `mono-api-html -v` option, to control output verbosity.
    When specified, `mono-api-html` will print out available `-r`/etc.
    option values:

        $ mono-api-html expected.xml new.xml -v
        Possible -a value: Android.Resource: Added fields: public static const int AccessibilityEventTypes;
        Possible -r value: Android.Preferences.CheckBoxPreference: Modified base type: 'Android.Preferences.Preference' to 'Android.Preferences.TwoStatePreference'
        Possible -r value: Android.Views.InputEvent: Modified properties: public int DeviceId { get; }
        Possible -n value: Android.Views.UnavailableException: Added type
        ...

Additionally, allow `mono-api-html` to take a
`Mono.Options.ResponseFileSource`, which allows `@response-files` to
be used as command-line options.
2018-02-22 01:31:33 +01:00
Zoltan Varga 4e29f2ef9a [jit] Handle more cases for gsharedvt constrained calls.
Hopefully fixes https://github.com/mono/mono/issues/7016.
2018-02-21 23:12:19 +01:00
monojenkins b242e82ba4 Add ldflags for bitcode (#7144)
Backport of #7141.
2018-02-21 16:10:50 +01:00
monojenkins 9c9d5d9e22 Fix the Android xattr check to not disable it on all other platforms. (#7146)
Backport of #6798.
2018-02-21 00:30:01 +01:00
monojenkins f8ed9bcd12 [2018-02] [corlib] Fix RuntimeFeatureTest.NoNewFeaturesAdded on mobile (#7151)
Backport of #7149.
2018-02-21 00:13:42 +01:00
monojenkins 578cfcd146 [2018-02] [sdks] Fix for XA integration (#7109) 2018-02-20 12:11:02 -05:00
Bernhard Urban 93705443b6 bump nunit-lite
Commit list for mono/NUnitLite:

* mono/NUnitLite@b777682 [FinallyDelegate] only call it if available, on some platforms (e.g. iOS) it can be set to null (#7)

Diff: https://github.com/mono/NUnitLite/compare/0dc7716771023274074160d1816c2fa610e23d2f...b7776829bb7b2f9c58db045a6f40be40bcd96761
2018-02-20 16:15:29 +01:00
Bernhard Urban 5f626db882 [debugger] disable StepOutAsync test because it's flaky
(cherry picked from commit 8f35227b88)
2018-02-19 11:49:31 +01:00
monojenkins 6cb693c4b5 Bug 60088 - Assertion at ../../../../external/mono/mono/mini/debugger-agent.c:4765, condition array->len == 1' not met Problem was that I didn't consider async void` method when adding that assert (#7105) 2018-02-18 23:06:03 -05:00
monojenkins e96f9fbb4a [2018-02] [sdks] Fix for XA integration (#7104) 2018-02-18 21:13:22 -05:00
Alexander Köplinger 6559a504ed [ci] Disable monodoc tests on Windows for now
They fail: https://github.com/mono/mono/issues/6956

(cherry picked from commit 939d720770)
2018-02-16 21:49:17 +01:00
Alexis Christoforides c62864c98e Disable some PngCodecTest that have trouble on CI right now
(cherry picked from commit dcda4c77bc)

See https://github.com/mono/mono/issues/6908
2018-02-16 21:25:53 +01:00
monojenkins c5accf5ebc Bump aot file format version because of 7cac757e60. (#7082) 2018-02-16 03:01:17 -05:00
Ankit Jain 470256aca5 Add denied assembly versions from previous ms extensions nugets
Extracted from Microsoft.NET.Build.Extensions

	2.1.0-preview1-62414-02   # https://github.com/dotnet/cli/blob/501e11d928c21608999c934f0a7078570b688c6c/build/DependencyVersions.props
	15.5.0-preview-20171027-2 # https://github.com/dotnet/cli/blob/ed916bb13e798a470855fb4f60acd3cabb2765fc/build/DependencyVersions.props
	2.0.0-preview3-20170622-1 # https://github.com/dotnet/cli/blob/7c928a9f18f81001e586e5bf0411f9bfa92e30d4/build/DependencyVersions.props

And also remove incorrect entries from earlier version
2.1.0-preview1-62516-03 , which were not committed to mono's msbuild.

A future commit will sort and de-dedup the lists, but this one avoids
removing any existing duplicates, to make review easier.
2018-02-15 10:54:03 +01:00
Zoltan Varga f0f76abc30 Emit the weak field indexes table using the MONO_AOT_TABLE code, so it works with separate aot data files/bitcode.
Fixes https://github.com/mono/mono/issues/6948.
2018-02-14 18:15:06 +01:00
Ludovic Henry e7e28f4b9d Pass null-terminated string for logging 2018-02-14 11:52:12 +01:00
Zoltan Varga 00dec1f0c0 [2018-02] Fix ios sdk. (#7027)
* [sdks] Bring back download of llvm for iOS (#6818)

Revert part of https://github.com/mono/mono/commit/605cadfb09d6c79723763b8afd09480a5941eabf

* [sdks] Fix execution permission of download-llvm.sh

* [sdks] Fix download-llvm.sh

* [sdks] Fix build for iOS (#6878)

* [sdks] Fix ios+llvm. (#6939)
2018-02-13 22:43:52 -05:00
monojenkins e0c46d9114 Bump mono/NUnitLite (#7006)
Commit list for mono/NUnitLite:

* mono/NUnitLite@0dc7716 [FinallyDelegate] make key for `lookupTable` actually unique (#6)

Diff: https://github.com/mono/NUnitLite/compare/a8bef89392920dd0ef5d74ef3563d97083246414...0dc7716771023274074160d1816c2fa610e23d2f
2018-02-14 02:42:38 +01:00
Alexander Köplinger ba542c0b1e [2018-02] Update F# to 4.1.33
Backport of #7003
2018-02-14 02:35:24 +01:00
Alexander Kyte 72aea0056b Revert mkbundle defaulting behavior made in ca8b8bd346
Fixes https://github.com/mono/mono/issues/6187
2018-02-13 19:07:29 +01:00
Aleksey Kliger 0dfa4f85a9 Unlock loader lock on error paths 2018-02-13 12:51:49 -05:00
Alexander Köplinger d956447d56 [System.Data] Add missing api
Backport of https://github.com/mono/mono/pull/6913
2018-02-13 15:34:02 +01:00
monojenkins 4aa717dc82 [2018-02] [runtime] Make icall tables loadable. (#6944)
* Make icall tables loadable.

Move the icall table code into a separate icall-table.c file, which is either linked into libmono or compiled into a
separate libmono-icall-table.a archive which can be linked into an app, and installed by calling mono_icall_table_init ().

* Change ClCompile to ClInclude for new .h file.

* [runtime] Fix the --enable-icall-symbol-map build. (#6943)
2018-02-12 20:45:40 -05:00
Rodrigo Kumpera d8e28e14a5 Merge pull request #6952 from monojenkins/backport-pr-6890-to-2018-02
[2018-02] [interp] disable test_42_arm64_dyncall_vtypebyval
2018-02-12 17:28:33 -05:00
Bernhard Urban 176f127c1b disable test_42_arm64_dyncall_vtypebyval
regression test introduced by https://github.com/mono/mono/pull/6826
fails on ARM64 with interp
2018-02-12 19:29:43 +00:00
Ankit Jain 764b03fcab nuget-hash-extractor: Add msbuild extensions nuget to list of nugets to
.. process. Version from:

https://github.com/dotnet/cli/blob/501e11d928c21608999c934f0a7078570b688c6c/build/DependencyVersions.props

```
    <MicrosoftNETSdkPackageVersion>2.1.0-preview1-62414-02</MicrosoftNETSdkPackageVersion>
    <MicrosoftNETBuildExtensionsPackageVersion>$(MicrosoftNETSdkPackageVersion)</MicrosoftNETBuildExtensionsPackageVersion>
```

Also, update the list in the runtime and deniedAssembliesList.txt
installed for use by msbuild.
2018-02-12 17:31:57 +01:00
Ankit Jain 1df45be2e9 nuget-hash-extractor: Add support for handling nuget with multiple
.. assemblies.

This is specifically required for handling .net assemblies in
`Microsoft.NET.Build.Extensions` nuget which don't work on mono. These
assemblies are bundled with msbuild and we want to be able to deny these
at runtime.
2018-02-12 17:31:57 +01:00
Martin Baulig e9fa8a306d WebConnection.Connect() needs to probe all IP addresses.
Fix a regression introduced in the new web stack - when connecting
to a DNS host name that resolves to multiple IP addresses, we need
to probe them all.

On iOS, "localhost" will resolve to both "::1" and "127.0.0.1".
2018-02-12 17:00:29 +01:00
Martin Baulig 7126712f86 [System]: Set NetworkStream.ReadTimeout in WebConnection.InitConnection(). (#6898)
Setting ReadTimeout in WebResponseStream.ctor throws System.Net.Sockets.SocketException : Invalid arguments on iOS.

Set it in WebConnection.InitConnection() immediately after establishing a connection, before we read/write anything.
2018-02-09 21:21:36 +01:00
Zoltan Varga 07a5c686e0 Handle arguments of type ArgVtypeOnStack in the dyn call code. Part of the fix for #59184. 2018-02-08 16:54:32 -05:00
Alexander Köplinger bc64a17db8 [bcl] Fix more assembly identity mismatches (#6870)
As a follow up to https://github.com/mono/mono/issues/6848 I checked
all the assemblies and found some more identity mismatches with .NET

(cherry picked from commit c84e6c81a2,
minus the Microsoft.VisualC.dll version fix)
2018-02-08 22:32:51 +01:00
Martin Baulig f3c1fcd7c9 [System]: Revert my latest WebResponseStream changes. (#6887)
This reverts PR #6662 (commit 18a1a25) and #6771 (commit da03780).

These two changes introduced a regression:
https://github.com/mono/mono/issues/6788

(cherry picked from commit 8bfcb27147)
2018-02-08 21:33:37 +01:00
Alexander Köplinger 268f2ac419 Bump bockbuild to get new gtk+ repo location 2018-02-08 19:48:58 +01:00
Marius Ungureanu ebb26ab546 Bump bockbuild to add gtk# generator fix (#6883)
Bug 61202 - Fatal error when adding aspect ratio constraint
2018-02-08 15:32:58 +01:00
Bernhard Urban 01e35bc383 ignore LocalId test on XAMMAC_4_5 too
https://github.com/xamarin/maccore/issues/628
2018-02-08 10:41:39 +01:00
monojenkins 4e374e8cea [2018-02] [reference-assemblies] Fix public key for some newer v4.7.1 facades (#6865)
Fixes https://github.com/mono/mono/issues/6848
2018-02-08 01:08:23 +01:00
Egor Bogatov 94a8a589c8 Add stubs for Interop.NetSecurityNative 2018-02-07 12:51:15 -05:00
monojenkins fd7c5cdac6 [2018-02] [System.Data] Add missing API (fixes 6767) (#6825)
* Add missing api to System.Data (fixes 6767)

* Bump API snapshot submodule
2018-02-07 14:41:50 +01:00
Alexander Köplinger 942dd07c65 [ci] Add setting artifacts.json status
Needed for QA automation.

(cherry picked from commit f8a4bbd357)
2018-02-07 00:42:22 +01:00
Alexander Köplinger f403697225 [ci] Add Windows .msi PR build (#6815)
Use the trigger `@monojenkins build pkg and msi`.

(cherry picked from commit 687dc212dc)
2018-02-07 00:33:20 +01:00
monojenkins 20ada1bc3b [2018-02] [runtime] Add a 'frame_addr' field to MonoStackFrameInfo, which is equal to either interp_frame or ctx->sp. (#6813)
* Add a 'frame_addr' field to MonoStackFrameInfo, which is equal to either interp_frame or ctx->sp.

Use this field to compare frames with each other or with stack addresses instead of setting ctx->sp to
the interp frame address, which breaks mixed mode, since mixed mode assumes ctx->sp is the real
sp of the last native interpreter frame.

* Reenable mixed mode tests.
2018-02-06 13:13:44 -05:00
Alexander Köplinger 3320f45d98 [ci] Make sure packageFileName is a string
It was the file object before and just got turned into string
by coincidence in most places.

(cherry picked from commit c7f89e7837)
2018-02-05 21:35:43 +01:00
Ludovic Henry f804385745 Bump version to 5.12 (#6791) 2018-02-05 15:13:33 -05:00
Alexander Köplinger 8f16dd35ba [ci] Report pending/failed status on GitHub for pkg/msi
(cherry picked from commit 0bfda265b7)
2018-02-05 18:35:23 +01:00
Alexander Köplinger fe918745d5 [ci] Include commit hash in blob URL of pkg/msi
This makes it easier to infer the commit just based on the URL.

(cherry picked from commit 4682391599)
2018-02-05 18:35:15 +01:00
326 changed files with 18442 additions and 11374 deletions

No files matched your search

+2 -8
View File
@@ -11,15 +11,9 @@ else
tools_dir = tools
endif
if BUILD_SUPPORT
support_dir = support
else
support_dir =
endif
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) $(support_dir) data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
SUBDIRS = po $(libgc_dir) mono $(ikvm_native_dir) support data runtime scripts man samples $(tools_dir) msvc $(docs_dir) acceptance-tests llvm
# Keep in sync with SUBDIRS
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native $(support_dir) data runtime scripts man samples tools msvc docs acceptance-tests llvm
DIST_SUBDIRS = m4 po $(libgc_dir) mono ikvm-native support data runtime scripts man samples tools msvc docs acceptance-tests llvm
all: update_submodules
+4 -1
View File
@@ -2217,7 +2217,6 @@ CORECLR_COREMANGLIB_TEST_CS_SRC= \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcgettotalmemory.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gckeepalive.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcmaxgeneration.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcwaitforpendingfinalizers.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstday.cs \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/globalization/calendarweekrule/calendarweekrulefirstfourdayweek.cs \
@@ -3982,6 +3981,10 @@ CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/JIT/Directed/newarr/newarr.cs \
$(CORECLR_PATH)/tests/src/baseservices/exceptions/sharedexceptions/emptystacktrace/oomexception01.cs
# https://github.com/mono/mono/issues/7432
CORECLR_DISABLED_TEST_CS_SRC += \
$(CORECLR_PATH)/tests/src/CoreMangLib/cti/system/gc/gcsuppressfinalize.cs
CORECLR_TEST_IL_SRC = \
$(CORECLR_PATH)/tests/src/JIT/BBT/Scenario4/Not-Int32.il \
$(CORECLR_PATH)/tests/src/JIT/Directed/Convert/implicitConv.il \
+68 -4
View File
@@ -1,7 +1,7 @@
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
AC_INIT(mono, [5.11.0],
AC_INIT(mono, [5.12.0],
[https://github.com/mono/mono/issues/new])
AC_CONFIG_SRCDIR([README.md])
@@ -40,7 +40,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
# This can be reset to 0 when Mono's version number is bumped
# since it's part of the corlib version (the prefix '1' in the full
# version number is to ensure the number isn't treated as octal in C)
MONO_CORLIB_COUNTER=4
MONO_CORLIB_COUNTER=5
MONO_CORLIB_VERSION=`printf "1%02d%02d%02d%03d" $MONO_VERSION_MAJOR $MONO_VERSION_MINOR 0 $MONO_CORLIB_COUNTER`
AC_DEFINE_UNQUOTED(MONO_CORLIB_VERSION,$MONO_CORLIB_VERSION,[Version of the corlib-runtime interface])
@@ -979,6 +979,30 @@ AC_SUBST(JEMALLOC_LDFLAGS)
AC_SUBST(JEMALLOC_AUTOCONF_FLAGS)
fi
# Terminology:
# Crash privacy - Attempts to not send identifying information in the crash dump / to protect the obscurity of the program control flow
# MERP - The MS telemetry profile. Not for general use.
# Structured crashes - crashes at runtime that trigger a stack walk by mono that happens cooperatively
# Structured crashes are not merp crashes. Structured crashes are json dumps made by mono during crashes. Merp upload is going to use the dumping code is a very specific way, and is enabled at runtime with an icall.
#--with-crash_privacy=yes --with-structured_crashes=no means we don't wanna dump in non-merp-enabled builds, and we want to not send symbol strings. This is going to be the default pair of settings for VS4Mac.
#--with-crash_privacy=yes --with-structured_crashes=yes means you want to see crashes on your console, and you want to not see unmanaged symbol names. This is an option for proprietary apps that have manual bugs filed.
#--with-crash_privacy=no --with-structured_crashes=no means you want to see no crash dumps on failure and you don't care about privacy. This is how you'd set a "don't want it, don't care" configuration.
#--with-crash_privacy=no --with-structured_crashes=yes means you want full crashes and you want to see them in the terminal, not on telemetry. This is going to be how we build for CI.
AC_ARG_WITH(crash-privacy, [ --with-crash_privacy=yes,no If you want your crashes to not include names of symbols present in the binary. ], [], [with_crash_privacy=no])
AC_ARG_WITH(structured-crashes, [ --with-structured_crashes=yes,no If you want your unmanaged crashes to result in a small crash dump file. ], [], [with_structured_crashes=yes])
if test "x$with_crash_privacy" = "xno"; then
AC_DEFINE(MONO_PRIVATE_CRASHES,1,[Do not include names of unmanaged functions in the crash dump])
fi
if test "x$with_structured_crashes" = "xno"; then
AC_DEFINE(DISABLE_STRUCTURED_CRASH,1,[Do not create structured crash files during unmanaged crashes])
fi
#
# Set the build profiles and options before things which use them
#
@@ -1421,6 +1445,12 @@ fi
AM_CONDITIONAL(DISABLE_INTERPRETER, test x$mono_feature_disable_interpreter = xyes)
if test "x$mono_feature_disable_interpreter" != "xyes" -o "x$mono_feature_disable_jit" != "xyes"; then
AC_DEFINE(ENABLE_ILGEN, 1, [Some VES is available at runtime])
fi
AM_CONDITIONAL(ENABLE_ILGEN, test x$mono_feature_disable_interpreter != xyes -o x$mono_feature_disable_jit != xyes)
if test "x$mono_feature_disable_simd" = "xyes"; then
AC_DEFINE(DISABLE_SIMD, 1, [Disable SIMD intrinsics related optimizations.])
AC_MSG_NOTICE([Disabled SIMD support])
@@ -1657,6 +1687,33 @@ if test x$platform_android = xyes; then
fi
if test x$host_win32 = xno; then
dnl *************************************
dnl *** Checks for time capabilities ***
dnl *************************************
AC_MSG_CHECKING(for CLOCK_MONOTONIC)
AC_TRY_COMPILE([#include <time.h>], [
const int foo = CLOCK_MONOTONIC;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLOCK_MONOTONIC, 1, [CLOCK_MONOTONIC])
], [
AC_MSG_RESULT(no)
])
AC_MSG_CHECKING(for CLOCK_MONOTONIC_COARSE)
AC_TRY_COMPILE([#include <time.h>], [
const int foo = CLOCK_MONOTONIC_COARSE;
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_CLOCK_MONOTONIC_COARSE, 1, [CLOCK_MONOTONIC_COARSE])
], [
AC_MSG_RESULT(no)
])
AC_CHECK_FUNC(mach_absolute_time, [AC_DEFINE(HAVE_MACH_ABSOLUTE_TIME, 1, [mach_absolute_time])])
AC_CHECK_FUNC(gethrtime, [AC_DEFINE(HAVE_GETHRTIME, 1, [gethrtime])])
AC_CHECK_FUNC(read_real_time, [AC_DEFINE(HAVE_READ_REAL_TIME, 1, [read_real_time])])
dnl hires monotonic clock support
AC_SEARCH_LIBS(clock_gettime, rt)
@@ -4075,7 +4132,7 @@ fi
AC_SUBST(G_HAVE_ISO_VARARGS)
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h iconv.h localcharset.h sys/types.h sys/resource.h)
AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+="-liconv -lcharset"])])
AC_CHECK_LIB([iconv], [locale_charset],[],[AC_CHECK_LIB([charset], [locale_charset],[LIBS+=" -liconv -lcharset"])])
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
AC_SUBST(HAVE_ALLOCA_H)
@@ -4167,6 +4224,8 @@ if test "x$icall_tables" = "xno"; then
AC_DEFINE(DISABLE_ICALL_TABLES, 1, [Icall tables disabled])
fi
AM_CONDITIONAL(DISABLE_ICALL_TABLES, test x$icall_tables = xno)
if test "x$with_tls" = "x__thread"; then
AC_DEFINE(HAVE_KW_THREAD, 1, [Have __thread keyword])
# Pass the information to libgc
@@ -4486,9 +4545,14 @@ dnl *** Btls ***
dnl **************
AC_ARG_ENABLE(btls, [ --disable-btls Disable the BoringTls provider], enable_btls=$enableval, enable_btls=$BTLS_SUPPORTED)
AC_ARG_ENABLE(btls-lib, [ --disable-btls-lib Disable building the BTLS native library], enable_btls_lib=$enableval, enable_btls_lib=$BTLS_SUPPORTED)
AC_ARG_WITH(btls_android_ndk, [ --with-btls-android-ndk Android NDK for BoringTls])
AM_CONDITIONAL(BTLS, test x$enable_btls = xyes)
if test "x$enable_btls" = "xno"; then
enable_btls_lib=no
fi
AM_CONDITIONAL(BTLS, test x$enable_btls_lib = xyes)
btls_android=no
if test "x$enable_btls" = "xyes"; then
+1 -1
+1 -1
+1 -1
+1 -1
View File
@@ -47,7 +47,7 @@ all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
@:
profiles-do--%:
$(MAKE) $(PROFILES:%=profile-do--%--$*)
$(if $(PROFILES),$(MAKE) $(PROFILES:%=profile-do--%--$*))
# The % below looks like profile-name--target-name
profile-do--%:
+1 -1
View File
@@ -394,5 +394,5 @@ ifneq ($(RESX_STRINGS),)
endif
update-corefx-sr: $(RESX_RESOURCE_STRING) $(XTEST_RESX_RESOURCE_STRING)
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS=$(RESX_RESOURCE_STRING) update-corefx-sr-generic \
make SR_OUTPUT=corefx/SR.cs RESX_STRINGS="$(RESX_RESOURCE_STRING)" update-corefx-sr-generic \
&& make SR_OUTPUT=corefx/SR.tests.cs RESX_STRINGS=$(XTEST_RESX_RESOURCE_STRING) update-corefx-sr-generic
+2
View File
@@ -22,3 +22,5 @@ NO_TEST = yes
NO_INSTALL = yes
FRAMEWORK_VERSION = 4.5
MONO_FEATURE_APPLETLS=1
@@ -0,0 +1,35 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Drawing.Common")]
[assembly: AssemblyDescription ("System.Drawing.Common")]
[assembly: AssemblyDefaultAlias ("System.Drawing.Common")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -0,0 +1,49 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Drawing.Common
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Drawing.Common.dll
KEYFILE = ../../Open.snk
LIBRARY_SNK = $(KEYFILE)
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS =
LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
ifdef false # we'll enable this at a later point
# xammac_net_4_5 and the testing_* profiles are special, they don't build
# System.Drawing.dll or equivalent neither in Mono nor in the XM repo.
# For now we embed the types directly here.
# TODO: find a better solution.
EMBEDDED_DRAWING_DEP := $(filter xammac_net_4_5 testing_aot_full testing_aot_hybrid, $(PROFILE))
ifndef EMBEDDED_DRAWING_DEP
# profiles which build a System.Drawing.dll in the repo
REPO_DRAWING_DEP := $(filter net_4_x orbis winaot unreal wasm, $(PROFILE))
ifdef REPO_DRAWING_DEP
LIB_REFS += System.Drawing
else
# When System.Drawing.dll is not built in the Mono repo but in
# the product repo like in the XI/XA case we need to pass in a reference
# to the assembly containing drawing types like Rectangle etc. from there.
# This needs to be passed in via EXTERNAL_FACADE_DRAWING_REFERENCE.
LIB_MCS_FLAGS += /r:$(EXTERNAL_FACADE_DRAWING_REFERENCE)
endif
endif
endif
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,2 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,174 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#if false // we'll enable these at a later point
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Bitmap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BitmapSuffixInSameAssemblyAttribute))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BitmapSuffixInSatelliteAssemblyAttribute))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Brush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Brushes))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphics))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphicsContext))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.BufferedGraphicsManager))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.CharacterRange))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ColorTranslator))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ContentAlignment))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.CopyPixelOperation))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Design.CategoryNameCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.AdjustableArrowCap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.Blend))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.ColorBlend))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CombineMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CompositingMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CompositingQuality))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CoordinateSpace))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.CustomLineCap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.DashCap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.DashStyle))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.FillMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.FlushIntention))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsContainer))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsPath))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsPathIterator))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.GraphicsState))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.HatchBrush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.HatchStyle))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.InterpolationMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LinearGradientBrush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LinearGradientMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LineCap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.LineJoin))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.Matrix))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.MatrixOrder))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathData))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathGradientBrush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PathPointType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PenAlignment))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PenType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.PixelOffsetMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.QualityMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.RegionData))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.SmoothingMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.WarpMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Drawing2D.WrapMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Font))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.FontFamily))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.FontStyle))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics.DrawImageAbort))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Graphics.EnumerateMetafileProc))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.GraphicsUnit))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Icon))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.IDeviceContext))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Image))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Image.GetThumbnailImageAbort))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ImageAnimator))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.BitmapData))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorAdjustType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorChannelFlag))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMap))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMapType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMatrix))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMatrixFlag))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ColorPalette))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EmfPlusRecordType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EmfType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.Encoder))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameter))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameters))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderParameterValueType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.EncoderValue))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.FrameDimension))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageAttributes))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageCodecFlags))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageCodecInfo))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageFlags))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageFormat))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.ImageLockMode))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.Metafile))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileFrameUnit))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileHeader))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetafileType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.MetaHeader))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PaletteFlags))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PixelFormat))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PlayRecordCallback))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.PropertyItem))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Imaging.WmfPlaceableFileHeader))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Pen))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Pens))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.Duplex))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.InvalidPrinterException))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.Margins))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PageSettings))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperKind))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSize))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSource))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PaperSourceKind))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PreviewPageInfo))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PreviewPrintController))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintAction))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintController))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintDocument))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterResolution))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterResolutionKind))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PaperSizeCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PaperSourceCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.PrinterResolutionCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterSettings.StringCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterUnit))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrinterUnitConvert))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintEventArgs))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintEventHandler))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintPageEventArgs))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintPageEventHandler))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.PrintRange))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.QueryPageSettingsEventArgs))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.QueryPageSettingsEventHandler))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Printing.StandardPrintController))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Region))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.RotateFlipType))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SolidBrush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringAlignment))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringDigitSubstitute))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringFormat))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringFormatFlags))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringTrimming))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.StringUnit))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemBrushes))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemColors))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemFonts))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemIcons))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.SystemPens))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.FontCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.GenericFontFamilies))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.HotkeyPrefix))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.InstalledFontCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.PrivateFontCollection))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.Text.TextRenderingHint))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.TextureBrush))]
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Drawing.ToolboxBitmapAttribute))]
#endif
@@ -9,7 +9,7 @@ LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.IO.Compression.ZipFile.dll
KEYFILE = ../../msfinal.pub
KEYFILE = ../../ecma.pub
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System System.IO.Compression.FileSystem
LIB_MCS_FLAGS = $(SIGN_FLAGS)
@@ -0,0 +1,35 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Memory")]
[assembly: AssemblyDescription ("System.Memory")]
[assembly: AssemblyDefaultAlias ("System.Memory")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Memory
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Memory.dll
KEYFILE = ../../Open.snk
LIBRARY_SNK = $(KEYFILE)
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS =
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,3 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,47 @@
//
// Copyright (c) 2018 Microsoft
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.MemoryExtensions))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Memory<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlyMemory<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.ReadOnlySpan<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Span<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryHandle))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.OperationStatus))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.MemoryMarshal))]
// TODO: we don't have these types yet
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.SequencePosition))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.BuffersExtensions))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IBufferWriter<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IMemoryOwner<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.IPinnable))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryManager<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.MemoryPool<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequenceSegment<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequence<>))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Base64))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Formatter))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Text.Utf8Parser))]
//[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Runtime.InteropServices.SequenceMarshal))]
@@ -0,0 +1,35 @@
//
// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.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;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Net.Http.Rtc")]
[assembly: AssemblyDescription ("System.Net.Http.Rtc")]
[assembly: AssemblyDefaultAlias ("System.Net.Http.Rtc")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.0.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -0,0 +1,21 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Net.Http.Rtc
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Net.Http.Rtc.dll
KEYFILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,2 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,25 @@
//
// Copyright (c) 2016 Xamarin Inc. (http://www.xamarin.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.
//
#if false // it is forwarded to System.Net.Http.WebRequest.dll but doesn't actually exist there in the .NET 4.7.1 reference assemblies ...
[assembly:System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Net.Http.RtcRequestFactory))]
#endif
@@ -0,0 +1,35 @@
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Resources.Reader")]
[assembly: AssemblyDescription ("System.Resources.Reader")]
[assembly: AssemblyDefaultAlias ("System.Resources.Reader")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.2.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -0,0 +1,23 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Resources.Reader
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Resources.Reader.dll
KEYFILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,3 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,25 @@
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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.
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceReader))]
@@ -0,0 +1,35 @@
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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;
using System.Reflection;
using System.Runtime.CompilerServices;
[assembly: AssemblyTitle ("System.Resources.Writer")]
[assembly: AssemblyDescription ("System.Resources.Writer")]
[assembly: AssemblyDefaultAlias ("System.Resources.Writer")]
[assembly: AssemblyCompany ("Mono development team")]
[assembly: AssemblyProduct ("Mono Common Language Infrastructure")]
[assembly: AssemblyCopyright ("(c) Various Mono authors")]
[assembly: AssemblyVersion ("4.0.2.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
@@ -0,0 +1,23 @@
MCS_BUILD_DIR = ../../../build
thisdir = class/Facades/System.Resources.Writer
SUBDIRS =
include $(MCS_BUILD_DIR)/rules.make
LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Resources.Writer.dll
KEYFILE = ../../msfinal.pub
SIGN_FLAGS = /delaysign /nowarn:1616,1699
LIB_REFS = System
LIB_MCS_FLAGS = $(SIGN_FLAGS)
PLATFORM_DEBUG_FLAGS =
NO_TEST = yes
include $(MCS_BUILD_DIR)/library.make
@@ -0,0 +1,3 @@
TypeForwarders.cs
AssemblyInfo.cs
@@ -0,0 +1,25 @@
//
// Copyright (c) 2015 Xamarin Inc. (http://www.xamarin.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.
//
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Resources.ResourceWriter))]
+5 -4
View File
@@ -27,7 +27,8 @@ System.Xml.XPath System.Xml.XmlDocument System.Xml.Xsl.Primitives Microsoft.Win3
System.IO.FileSystem.AccessControl System.Reflection.TypeExtensions System.Reflection.Emit.Lightweight System.Reflection.Emit.ILGeneration System.Reflection.Emit \
System.Threading.AccessControl System.ValueTuple \
System.Security.Cryptography.Primitives System.Text.Encoding.CodePages System.IO.FileSystem.Watcher \
System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes
System.Security.Cryptography.ProtectedData System.ServiceProcess.ServiceController System.IO.Pipes \
System.Net.Ping System.Resources.Reader System.Resources.Writer System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp
# common_SUBDIRS dependencies
common_DEPS_SUBDIRS = System.Security.Cryptography.X509Certificates System.ServiceModel.Primitives System.Runtime.Serialization.Primitives \
@@ -50,7 +51,7 @@ testing_aot_full_SUBDIRS = $(monotouch_SUBDIRS)
testing_aot_full_PARALLEL_SUBDIRS = $(monotouch_PARALLEL_SUBDIRS)
net_4_x_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS)
net_4_x_PARALLEL_SUBDIRS = $(common_SUBDIRS) System.Net.Http.Rtc
basic_PARALLEL_SUBDIRS = System.Runtime System.Reflection System.Collections System.Resources.ResourceManager System.Globalization \
System.Threading.Tasks System.Collections.Concurrent System.Text.Encoding System.IO System.Threading System.Diagnostics.Debug \
@@ -89,8 +90,8 @@ unreal_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
wasm_SUBDIRS = $(common_DEPS_SUBDIRS) $(netstandard_drawing_SUBDIRS) $(mobile_only_DEPS_SUBDIRS)
wasm_PARALLEL_SUBDIRS = $(common_SUBDIRS) $(mobile_only_SUBDIRS)
mobile_only_SUBDIRS = System.Net.Ping System.Runtime.Serialization.Formatters System.Security.Cryptography.Csp System.Security.Cryptography.Pkcs \
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy
mobile_only_SUBDIRS = System.Security.Cryptography.Pkcs \
System.Security.Cryptography.Cng System.Runtime.Loader System.Xml.XPath.XmlDocument System.Reflection.DispatchProxy System.Drawing.Common
mobile_only_DEPS_SUBDIRS = System.Security.Cryptography.OpenSsl
@@ -59,6 +59,13 @@ namespace Microsoft.Build.Utilities
bool typeLoadException;
ManualResetEvent canceled;
/* dummy getter/setter for msbuild compability */
public bool YieldDuringToolExecution
{
get;
set;
}
protected ToolTask ()
: this (null, null)
{
+6
View File
@@ -19,6 +19,12 @@ endif
TEST_MCS_FLAGS =
TEST_LIB_REFS = System.Core
ifndef NO_PROCESS_START
REFERENCE_SOURCES_FLAGS += -d:MONO_FEATURE_PROCESS_START
TEST_MCS_FLAGS += -d:MONO_FEATURE_PROCESS_START
endif
LIB_MCS_FLAGS += $(REFERENCE_SOURCES_FLAGS)
BUILT_SOURCES = $(PROFILE)-parser.cs
@@ -19,7 +19,8 @@ namespace Mono.Debugger.Soft
if (!type.IsEnum)
throw new ArgumentException ("type must be an enum type", "type");
TypeMirror t = type.EnumUnderlyingType;
if (value.Value == null || !value.Value.GetType ().IsPrimitive || t != vm.RootDomain.GetCorrespondingType (value.Value.GetType ()))
// Can't access t's domain, so compare type names
if (value.Value == null || !value.Value.GetType ().IsPrimitive || t.Name != vm.RootDomain.GetCorrespondingType (value.Value.GetType ()).Name)
throw new ArgumentException ("Value '" + value.Value + "' does not match the type of the enum.");
}
@@ -322,6 +322,12 @@ public class Tests : TestsBase, ITest2
new Tests ().attach ();
return 0;
}
if (args.Length > 0 && args [0] == "step-out-void-async") {
var wait = new ManualResetEvent (false);
step_out_void_async (wait);
wait.WaitOne ();//Don't exist until step_out_void_async is executed...
return 0;
}
assembly_load ();
breakpoints ();
single_stepping ();
@@ -1742,6 +1748,19 @@ public class Tests : TestsBase, ITest2
{
UninitializedClass.Call();//Breakpoint here and step in
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static async void step_out_void_async (ManualResetEvent wait)
{
await Task.Yield ();
step_out_void_async_2 ();
wait.Set ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static void step_out_void_async_2 ()
{
}
}
public class SentinelClass : MarshalByRefObject {
@@ -10,6 +10,7 @@ using Diag = System.Diagnostics;
using System.Linq;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
using NUnit.Framework;
@@ -3508,6 +3509,10 @@ public class DebuggerTests
Assert.AreEqual ("domains", frames [2].Method.Name);
Assert.AreEqual (vm.RootDomain, frames [2].Domain);
// Check enum creation in other domains
var anenum = vm.CreateEnumMirror (d_method.DeclaringType.Assembly.GetType ("AnEnum"), vm.CreateValue (1));
Assert.AreEqual (1, anenum.Value);
// Test breakpoints on already JITted methods in other domains
m = entry_point.DeclaringType.GetMethod ("invoke_in_domain_2");
Assert.IsNotNull (m);
@@ -4286,6 +4291,26 @@ public class DebuggerTests
e = step_out (); // leave threadpool_io
}
[Test]
[Category("NotWorking")] // flaky, see https://github.com/mono/mono/issues/6997
public void StepOutAsync () {
vm.Detach ();
Start (new string [] { "dtest-app.exe", "step-out-void-async" });
var e = run_until ("step_out_void_async_2");
create_step (e);
var e2 = step_out ();
assert_location (e2, "MoveNext");//we are in step_out_void_async
step_req.Disable ();
step_req.Depth = StepDepth.Out;
step_req.Enable ();
vm.Resume ();
var e3 = GetNextEvent ();
//after step-out from async void, execution should continue
//and runtime should exit
Assert.IsTrue (e3 is VMDeathEvent, e3.GetType().FullName);
vm = null;
}
[Test]
[Category("NotWorking")]
public void ShouldCorrectlyStepOverOnExitFromArgsAfterStepInMethodParameter() {
+2 -1
View File
@@ -4,7 +4,8 @@
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeDeleteContext.cs
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeFreeCredentials.cs
../../../external/corefx/src/Common/src/Microsoft/Win32/SafeHandles/GssSafeHandles.cs
../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
corefx/Interop.NetSecurityNative.cs
#../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
../../../external/corefx/src/Common/src/System/Net/Security/Unix/SafeFreeNegoCredentials.cs
../../../external/corefx/src/Common/src/Interop/Unix/Interop.Libraries.cs
../../../external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.GssBuffer.cs
@@ -0,0 +1,147 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Text;
using Microsoft.Win32.SafeHandles;
// stubs for external/corefx/src/Common/src/Interop/Unix/System.Net.Security.Native/Interop.NetSecurityNative.cs
// needed for https://github.com/mono/mono/issues/6766
// or can be implemented via pal_gssapi (see https://github.com/mono/mono/pull/6806)
static partial class Interop
{
static partial class NetSecurityNative
{
internal static void ReleaseGssBuffer (
IntPtr bufferPtr,
UInt64 length) => throw new NotSupportedException ();
internal static Status DisplayMinorStatus (
out Status minorStatus,
Status statusValue,
ref GssBuffer buffer) => throw new NotSupportedException ();
internal static Status DisplayMajorStatus (
out Status minorStatus,
Status statusValue,
ref GssBuffer buffer) => throw new NotSupportedException ();
internal static Status ImportUserName (
out Status minorStatus,
string inputName,
int inputNameByteCount,
out SafeGssNameHandle outputName) => throw new NotSupportedException ();
internal static Status ImportPrincipalName (
out Status minorStatus,
string inputName,
int inputNameByteCount,
out SafeGssNameHandle outputName) => throw new NotSupportedException ();
internal static Status ReleaseName (
out Status minorStatus,
ref IntPtr inputName) => throw new NotSupportedException ();
internal static Status InitiateCredSpNego (
out Status minorStatus,
SafeGssNameHandle desiredName,
out SafeGssCredHandle outputCredHandle) => throw new NotSupportedException ();
internal static Status InitiateCredWithPassword (
out Status minorStatus,
bool isNtlm,
SafeGssNameHandle desiredName,
string password,
int passwordLen,
out SafeGssCredHandle outputCredHandle) => throw new NotSupportedException ();
internal static Status ReleaseCred (
out Status minorStatus,
ref IntPtr credHandle) => throw new NotSupportedException ();
internal static Status InitSecContext (
out Status minorStatus,
SafeGssCredHandle initiatorCredHandle,
ref SafeGssContextHandle contextHandle,
bool isNtlmOnly,
SafeGssNameHandle targetName,
uint reqFlags,
byte[] inputBytes,
int inputLength,
ref GssBuffer token,
out uint retFlags,
out int isNtlmUsed) => throw new NotSupportedException ();
internal static Status AcceptSecContext (
out Status minorStatus,
ref SafeGssContextHandle acceptContextHandle,
byte[] inputBytes,
int inputLength,
ref GssBuffer token) => throw new NotSupportedException ();
internal static Status DeleteSecContext (
out Status minorStatus,
ref IntPtr contextHandle) => throw new NotSupportedException ();
static Status Wrap(
out Status minorStatus,
SafeGssContextHandle contextHandle,
bool isEncrypt,
byte[] inputBytes,
int offset,
int count,
ref GssBuffer outBuffer) => throw new NotSupportedException ();
static Status Unwrap (
out Status minorStatus,
SafeGssContextHandle contextHandle,
byte[] inputBytes,
int offset,
int count,
ref GssBuffer outBuffer) => throw new NotSupportedException ();
internal static Status WrapBuffer (
out Status minorStatus,
SafeGssContextHandle contextHandle,
bool isEncrypt,
byte[] inputBytes,
int offset,
int count,
ref GssBuffer outBuffer) => throw new NotSupportedException ();
internal static Status UnwrapBuffer (
out Status minorStatus,
SafeGssContextHandle contextHandle,
byte[] inputBytes,
int offset,
int count,
ref GssBuffer outBuffer) => throw new NotSupportedException ();
internal enum Status : uint
{
GSS_S_COMPLETE = 0,
GSS_S_CONTINUE_NEEDED = 1
}
[Flags]
internal enum GssFlags : uint
{
GSS_C_DELEG_FLAG = 0x1,
GSS_C_MUTUAL_FLAG = 0x2,
GSS_C_REPLAY_FLAG = 0x4,
GSS_C_SEQUENCE_FLAG = 0x8,
GSS_C_CONF_FLAG = 0x10,
GSS_C_INTEG_FLAG = 0x20,
GSS_C_ANON_FLAG = 0x40,
GSS_C_PROT_READY_FLAG = 0x80,
GSS_C_TRANS_FLAG = 0x100,
GSS_C_DCE_STYLE = 0x1000,
GSS_C_IDENTIFY_FLAG = 0x2000,
GSS_C_EXTENDED_ERROR_FLAG = 0x4000,
GSS_C_DELEG_POLICY_FLAG = 0x8000
}
}
}
@@ -20,6 +20,12 @@ namespace System.Data.SqlClient
"keyword and always reset the connection")]
public bool ConnectionReset { get; set; }
[MonoTODO("Not implemented in corefx: https://github.com/dotnet/corefx/issues/22474")]
public SqlAuthenticationMethod Authentication {
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
[MonoTODO("Not implemented in corefx: https://github.com/dotnet/corefx/issues/22474")]
public bool ContextConnection {
get => throw new NotImplementedException();
@@ -35,7 +35,7 @@ namespace System.Web.UI.Design
public HtmlControlDesigner () { throw new NotImplementedException (); }
[MonoTODO]
protected override void Dispose (bool disposing) { throw new NotImplementedException (); }
protected override void Dispose (bool disposing) { }
[MonoTODO]
[Obsolete ("Use ControlDesigner.Tag instead")]
@@ -308,6 +308,7 @@ namespace MonoTests.System.Drawing.Imaging {
/* Checks bitmap features on a known 2bbp bitmap */
[Test]
[Category("NotWorking")]
public void Bitmap2bitFeatures ()
{
if (IsArm64Process ())
@@ -339,6 +340,7 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[Category("NotWorking")]
public void Bitmap2bitPixels ()
{
if (IsArm64Process ())
@@ -374,6 +376,7 @@ namespace MonoTests.System.Drawing.Imaging {
}
[Test]
[Category("NotWorking")]
public void Bitmap2bitData ()
{
if (IsArm64Process ())
+1 -1
View File
@@ -5,7 +5,7 @@ include ../../build/rules.make
LIBRARY = System.Dynamic.dll
LIB_REFS = System.Core System
KEYFILE = ../ecma.pub
KEYFILE = ../msfinal.pub
LIB_MCS_FLAGS = -unsafe -d:CODEPLEX_40 -nowarn:414,169
# This is a .NET 4.0+ only assembly
@@ -85,7 +85,7 @@ namespace System.Net.Http
public WindowsProxyUsePolicy WindowsProxyUsePolicy { get { throw new PlatformNotSupportedException (); } set { throw new PlatformNotSupportedException (); } }
protected override void Dispose (bool disposing) { throw new PlatformNotSupportedException (); }
protected override void Dispose (bool disposing) { }
protected override Task<HttpResponseMessage> SendAsync (HttpRequestMessage request, Threading.CancellationToken cancellationToken) { throw new PlatformNotSupportedException (); }
}
@@ -276,7 +276,7 @@ namespace MonoTests.System.Net.Http
httpClient.PostAsync (restRequest.RequestUri, restRequest.Content).Wait (WaitTimeout);
Assert.Fail ("#1");
} catch (AggregateException e) {
Assert.IsTrue (e.InnerException is TaskCanceledException, "#2");
Assert.That (e.InnerException, Is.InstanceOf<TaskCanceledException> (), "#2");
}
}
@@ -680,16 +680,15 @@ namespace MonoTests.System.Net.Http
#endif
public void Send_Complete_CustomHeaders_Host ()
{
bool? failed = null;
Exception error = null;
var port = NetworkHelpers.FindFreePort ();
var listener = CreateListener (l => {
var request = l.Request;
try {
Assert.AreEqual ("customhost", request.Headers["Host"], "#1");
failed = false;
} catch {
failed = true;
} catch (Exception ex) {
error = ex;
}
}, port);
@@ -704,7 +703,7 @@ namespace MonoTests.System.Net.Http
Assert.AreEqual ("", response.Content.ReadAsStringAsync ().Result, "#100");
Assert.AreEqual (HttpStatusCode.OK, response.StatusCode, "#101");
Assert.AreEqual (false, failed, "#102");
Assert.IsNull (error, "#102");
} finally {
listener.Abort ();
listener.Close ();
@@ -1440,10 +1439,29 @@ namespace MonoTests.System.Net.Http
ch.AllowAutoRedirect = false;
}
#if !FEATURE_NO_BSD_SOCKETS
[Test]
// https://github.com/mono/mono/issues/7355
public void WildcardConnect ()
{
try {
using (var client = new HttpClient ()) {
client.GetAsync ("http://255.255.255.255").Wait (WaitTimeout);
}
} catch (AggregateException e) {
Assert.That (e.InnerException, Is.InstanceOf<HttpRequestException> (), "#1");
var rex = (HttpRequestException)e.InnerException;
Assert.That (rex.InnerException, Is.InstanceOf<WebException> (), "#2");
var wex = (WebException)rex.InnerException;
Assert.That (wex.Status, Is.EqualTo (WebExceptionStatus.ConnectFailure), "#3");
}
}
#endif
HttpListener CreateListener (Action<HttpListenerContext> contextAssert, int port)
{
var l = new HttpListener ();
l.Prefixes.Add (string.Format ("http://+:{0}/", port));
l.Prefixes.Add (string.Format ("http://*:{0}/", port));
l.Start ();
AddListenerContext(l, contextAssert);
+1 -1
View File
@@ -5,7 +5,7 @@ include ../../build/rules.make
LIBRARY = System.Numerics.dll
LIB_REFS = System
KEYFILE = ../ecma.pub
LIB_MCS_FLAGS = /unsafe
LIB_MCS_FLAGS = /unsafe -nowarn:436
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
XTEST_LIB_REFS = System Facades/System.Threading.Tasks Facades/System.Runtime.InteropServices.RuntimeInformation System.Core System.Numerics.Vectors Microsoft.CSharp
XTEST_LIB_FLAGS = -unsafe
+1 -1
View File
@@ -4,7 +4,7 @@ include ../../build/rules.make
LIBRARY = System.Reflection.Context.dll
LIB_REFS = System
KEYFILE = ../msfinal.pub
KEYFILE = ../ecma.pub
LIB_MCS_FLAGS =
NO_TEST = yes
@@ -88,6 +88,8 @@
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlSerializableWriter.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XmlWriterDelegator.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XPathQueryGenerator.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaHelper.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
../referencesource/System.Runtime.Serialization/System/Text/Base64Encoding.cs
../referencesource/System.Runtime.Serialization/System/Text/BinHexEncoding.cs
../referencesource/System.Runtime.Serialization/System/Text/SurrogateChar.cs
@@ -20,8 +20,6 @@
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ExportOptions.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/ImportOptions.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaExporter.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaHelper.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/SchemaImporter.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractExporter.cs
../referencesource/System.Runtime.Serialization/System/Runtime/Serialization/XsdDataContractImporter.cs
@@ -2,7 +2,7 @@ using System.Diagnostics;
namespace System.Runtime.Serialization {
internal static class DiagnosticUtility {
internal static partial class DiagnosticUtility {
internal static bool ShouldTraceError = true;
internal static readonly bool ShouldTraceWarning = false;
internal static readonly bool ShouldTraceInformation = false;
@@ -308,5 +308,19 @@ public const string XmlMaxStringContentLengthExceeded = @"XML max string content
public const string XmlObjectAssignedToIncompatibleInterface = @"Object of type '{0}' is assigned to an incompatible interface '{1}'.";
#endregion
// CoreFX
public const string PlatformNotSupported_SchemaImporter = "The implementation of the function requires System.Runtime.Serialization.SchemaImporter which is not supported on this platform.";
public const string PlatformNotSupported_IDataContractSurrogate = "The implementation of the function requires System.Runtime.Serialization.IDataContractSurrogate which is not supported on this platform.";
internal static string Format(string resourceFormats)
{
return resourceFormats;
}
internal static string Format(string resourceFormat, object p1)
{
return string.Format (CultureInfo.InvariantCulture, resourceFormat, p1);
}
}
}
@@ -1,227 +0,0 @@
namespace System.Runtime.Serialization
{
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Runtime.Diagnostics;
using System.Security;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
using System.Runtime.Serialization.Diagnostics;
class SchemaExporter
{
internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
{
if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
return;
XmlSchemaSet schemas = new XmlSchemaSet();
schemas.XmlResolver = null;
InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
if (stableName.Name == null || stableName.Name.Length == 0)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidXmlDataContractName, DataContract.GetClrTypeFullName(type))));
}
internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
{
xsdType = null;
hasRoot = true;
if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray)
{
string name = null;
if (type == Globals.TypeOfXmlElement)
{
xsdType = CreateAnyElementType();
name = "XmlElement";
hasRoot = false;
}
else
{
xsdType = CreateAnyType();
name = "ArrayOfXmlNode";
hasRoot = true;
}
typeName = new XmlQualifiedName(name, DataContract.GetDefaultStableNamespace(type));
return true;
}
typeName = null;
return false;
}
internal static void AddDefaultXmlType(XmlSchemaSet schemas, string localName, string ns)
{
throw new NotImplementedException();
}
static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
{
xsdType = null;
hasRoot = true;
object[] attrs = clrType.GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false);
if (attrs == null || attrs.Length == 0)
{
stableName = DataContract.GetDefaultStableName(clrType);
return false;
}
XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
if (provider.IsAny)
{
xsdType = CreateAnyElementType();
hasRoot = false;
}
string methodName = provider.MethodName;
if (methodName == null || methodName.Length == 0)
{
if (!provider.IsAny)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidGetSchemaMethod, DataContract.GetClrTypeFullName(clrType))));
stableName = DataContract.GetDefaultStableName(clrType);
}
else
{
MethodInfo getMethod = clrType.GetMethod(methodName, /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, null, new Type[] { typeof(XmlSchemaSet) }, null);
if (getMethod == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));
if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)) && !(Globals.TypeOfXmlSchemaType.IsAssignableFrom(getMethod.ReturnType)))
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName), typeof(XmlSchemaType))));
object typeInfo = getMethod.Invoke(null, new object[] { schemas });
if (provider.IsAny)
{
if (typeInfo != null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.InvalidNonNullReturnValueByIsAny, DataContract.GetClrTypeFullName(clrType), methodName)));
stableName = DataContract.GetDefaultStableName(clrType);
}
else if (typeInfo == null)
{
xsdType = CreateAnyElementType();
hasRoot = false;
stableName = DataContract.GetDefaultStableName(clrType);
}
else
{
XmlSchemaType providerXsdType = typeInfo as XmlSchemaType;
if (providerXsdType != null)
{
string typeName = providerXsdType.Name;
string typeNs = null;
if (typeName == null || typeName.Length == 0)
{
DataContract.GetDefaultStableName(DataContract.GetClrTypeFullName(clrType), out typeName, out typeNs);
stableName = new XmlQualifiedName(typeName, typeNs);
providerXsdType.Annotation = GetSchemaAnnotation(ExportActualType(stableName, new XmlDocument()));
xsdType = providerXsdType;
}
else
{
foreach (XmlSchema schema in schemas.Schemas())
{
foreach (XmlSchemaObject schemaItem in schema.Items)
{
if ((object)schemaItem == (object)providerXsdType)
{
typeNs = schema.TargetNamespace;
if (typeNs == null)
typeNs = String.Empty;
break;
}
}
if (typeNs != null)
break;
}
if (typeNs == null)
throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.GetString(SR.MissingSchemaType, typeName, DataContract.GetClrTypeFullName(clrType))));
stableName = new XmlQualifiedName(typeName, typeNs);
}
}
else
stableName = (XmlQualifiedName)typeInfo;
}
}
return true;
}
static XmlSchemaComplexType CreateAnyElementType()
{
XmlSchemaComplexType anyElementType = new XmlSchemaComplexType();
anyElementType.IsMixed = false;
anyElementType.Particle = new XmlSchemaSequence();
XmlSchemaAny any = new XmlSchemaAny();
any.MinOccurs = 0;
any.ProcessContents = XmlSchemaContentProcessing.Lax;
((XmlSchemaSequence)anyElementType.Particle).Items.Add(any);
return anyElementType;
}
static XmlSchemaAnnotation GetSchemaAnnotation(params XmlNode[] nodes)
{
if (nodes == null || nodes.Length == 0)
return null;
bool hasAnnotation = false;
for (int i = 0; i < nodes.Length; i++)
if (nodes[i] != null)
{
hasAnnotation = true;
break;
}
if (!hasAnnotation)
return null;
XmlSchemaAnnotation annotation = new XmlSchemaAnnotation();
XmlSchemaAppInfo appInfo = new XmlSchemaAppInfo();
annotation.Items.Add(appInfo);
appInfo.Markup = nodes;
return annotation;
}
static XmlSchemaComplexType CreateAnyType()
{
XmlSchemaComplexType anyType = new XmlSchemaComplexType();
anyType.IsMixed = true;
anyType.Particle = new XmlSchemaSequence();
XmlSchemaAny any = new XmlSchemaAny();
any.MinOccurs = 0;
any.MaxOccurs = Decimal.MaxValue;
any.ProcessContents = XmlSchemaContentProcessing.Lax;
((XmlSchemaSequence)anyType.Particle).Items.Add(any);
anyType.AnyAttribute = new XmlSchemaAnyAttribute();
return anyType;
}
static XmlElement ExportActualType(XmlQualifiedName typeName, XmlDocument xmlDoc)
{
XmlElement actualTypeElement = xmlDoc.CreateElement(ActualTypeAnnotationName.Name, ActualTypeAnnotationName.Namespace);
XmlAttribute nameAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNameAttribute);
nameAttribute.Value = typeName.Name;
actualTypeElement.Attributes.Append(nameAttribute);
XmlAttribute nsAttribute = xmlDoc.CreateAttribute(Globals.ActualTypeNamespaceAttribute);
nsAttribute.Value = typeName.Namespace;
actualTypeElement.Attributes.Append(nsAttribute);
return actualTypeElement;
}
static XmlQualifiedName actualTypeAnnotationName;
internal static XmlQualifiedName ActualTypeAnnotationName
{
get
{
if (actualTypeAnnotationName == null)
actualTypeAnnotationName = new XmlQualifiedName(Globals.ActualTypeLocalName, Globals.SerializationNamespace);
return actualTypeAnnotationName;
}
}
}
}
@@ -1,54 +0,0 @@
//
// XsdDataContractExporter_mobile.cs
//
// Authors:
// Alexander Köplinger <[email protected]>
//
// Copyright (C) 2016 Xamarin Inc (http://www.xamarin.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;
using System.Collections.Generic;
using System.Reflection;
using System.Xml;
using System.Xml.Schema;
namespace System.Runtime.Serialization
{
public class XsdDataContractExporter
{
public XsdDataContractExporter () { throw new NotImplementedException (); }
public XsdDataContractExporter (XmlSchemaSet schemas) { throw new NotImplementedException (); }
public ExportOptions Options { get { throw new NotImplementedException (); } set { throw new NotImplementedException (); } }
public XmlSchemaSet Schemas { get { throw new NotImplementedException (); } }
public bool CanExport (ICollection<Assembly> assemblies) { throw new NotImplementedException ();}
public bool CanExport (ICollection<Type> types) { throw new NotImplementedException (); }
public bool CanExport (Type type) { throw new NotImplementedException (); }
public void Export (ICollection<Assembly> assemblies) { throw new NotImplementedException (); }
public void Export (ICollection<Type> types) { throw new NotImplementedException (); }
public void Export (Type type) { throw new NotImplementedException (); }
public XmlQualifiedName GetRootElementName (Type type) { throw new NotImplementedException (); }
public XmlSchemaType GetSchemaType (Type type) { throw new NotImplementedException (); }
public XmlQualifiedName GetSchemaTypeName (Type type) { throw new NotImplementedException (); }
}
}
@@ -0,0 +1,31 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Diagnostics;
namespace System.Runtime.Serialization
{
partial class DiagnosticUtility
{
internal static bool IsFatal(Exception exception)
{
while (exception != null)
{
// These exceptions aren't themselves fatal, but since the CLR uses them to wrap other exceptions,
// we want to check to see whether they've been used to wrap a fatal exception. If so, then they
// count as fatal.
if (exception is TypeInitializationException)
{
exception = exception.InnerException;
}
else
{
break;
}
}
return false;
}
}
}
@@ -1,6 +1,8 @@
#include System.Runtime.Serialization.dll.sources
#include ReferenceSource.common.sources
ReferenceSources/SchemaExporter_mobile.cs
ReferenceSources/XsdDataContractExporter_mobile.cs
ReferenceSources/SimplifiedCodeTypeReference.cs
corefx/DiagnosticUtility.cs
../../../external/corefx/src/System.Private.DataContractSerialization/src/System/Runtime/Serialization/XsdDataContractExporter.cs
@@ -46,7 +46,7 @@ namespace System.Security.Cryptography.Pkcs {
// only accessible from SignedPkcs7.SignerInfos
internal SignerInfo (string hashName, X509Certificate2 certificate, SubjectIdentifierType type, object o, int version)
{
_digest = new Oid (CryptoConfig.MapNameToOID (hashName));
_digest = new Oid (CryptoConfig.MapNameToOID (hashName) ?? hashName);
_certificate = certificate;
_counter = new SignerInfoCollection ();
_signed = new CryptographicAttributeObjectCollection ();
@@ -100,6 +100,26 @@ namespace MonoTests.System.Security.Cryptography.Pkcs {
Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes");
Assert.AreEqual (3, si.Version, "Version");
}
[Test]
public void ExplicitCryptographicObjectIdentifier ()
{
var data = new byte [] {
48, 130, 36, 126, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 2, 160, 130, 36, 111, 48, 130, 36, 107, 2, 1, 3, 49, 15, 48, 13, 6, 9, 96, 134, 72, 1, 101, 3, 4, 2, 1, 5, 0, 48, 100, 6, 9, 42, 134, 72, 134, 247, 13, 1, 7, 1, 160, 87, 4, 85, 86, 101, 114, 115, 105, 111, 110, 58, 49, 10, 10, 50, 46, 49, 54, 46, 56, 52, 48, 46, 49, 46, 49, 48, 49, 46, 51, 46, 52, 46, 50, 46, 49, 45, 72, 97, 115, 104, 58, 109, 117, 115, 49, 107, 97, 84, 89, 76, 113, 111, 81, 110, 85, 105, 104, 103, 104, 109, 102, 48, 120, 110, 104, 43, 69, 111, 65, 85, 73, 119, 104, 122, 50, 82, 117, 57, 52, 109, 69, 54, 117, 73, 61, 10, 10, 160, 130, 14, 42, 48, 130, 3, 183, 48, 130, 2, 159, 160, 3, 2, 1, 2, 2, 16, 12, 231, 224, 229, 23, 216, 70, 254, 143, 229, 96, 252, 27, 240, 48, 57, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 5, 5, 0, 48, 101, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 21, 48, 19, 6, 3, 85, 4, 10, 19, 12, 68, 105, 103, 105, 67, 101, 114, 116, 32, 73, 110, 99, 49, 25, 48, 23, 6, 3, 85, 4, 11, 19, 16, 119, 119, 119, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 49, 36, 48, 34, 6, 3, 85, 4, 3, 19, 27, 68, 105, 103, 105, 67, 101, 114, 116, 32, 65, 115, 115, 117, 114, 101, 100, 32, 73, 68, 32, 82, 111, 111, 116, 32, 67, 65, 48, 30, 23, 13, 48, 54, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 90, 23, 13, 51, 49, 49, 49, 49, 48, 48, 48, 48, 48, 48, 48, 90, 48, 101, 49, 11, 48, 9, 6, 3, 85, 4, 6, 19, 2, 85, 83, 49, 21, 48, 19, 6, 3, 85, 4, 10, 19, 12, 68, 105, 103, 105, 67, 101, 114, 116, 32, 73, 110, 99, 49, 25, 48, 23, 6, 3, 85, 4, 11, 19, 16, 119, 119, 119, 46, 100, 105, 103, 105, 99, 101, 114, 116, 46, 99, 111, 109, 49, 36, 48, 34, 6, 3, 85, 4, 3, 19, 27, 68, 105, 103, 105, 67, 101, 114, 116, 32, 65, 115, 115, 117, 114, 101, 100, 32, 73, 68, 32, 82, 111, 111, 116, 32, 67, 65, 48, 130, 1, 34, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 1, 5, 0, 3, 130, 1, 15, 0, 48, 130, 1, 10, 2, 130, 1, 1, 0, 173, 14, 21, 206, 228, 67, 128, 92, 177, 135, 243, 183, 96, 249, 113, 18, 165, 174, 220, 38, 148, 136, 170, 244, 206, 245, 32, 57, 40, 88, 96, 12, 248, 128, 218, 169, 21, 149, 50, 97, 60, 181, 177, 40, 132, 138, 138, 220, 159, 10, 12, 131, 23, 122, 143, 144, 172, 138, 231, 121, 83, 92, 49, 132, 42, 246, 15, 152, 50, 54, 118, 204, 222, 221, 60, 168, 162, 239, 106, 251, 33, 242, 82, 97, 223, 159, 32, 215, 31, 226, 177, 217, 254, 24, 100, 210, 18, 91, 95, 249, 88, 24, 53, 188, 71, 205, 161, 54, 249, 107, 127, 212, 176, 56, 62, 193, 27, 195, 140, 51, 217, 216, 47, 24, 254, 40, 15, 179, 167, 131, 214, 195, 110, 68, 192, 97, 53, 150, 22, 254, 89, 156, 139, 118, 109, 215, 241, 162, 75, 13, 43, 255, 11, 114, 218, 158, 96, 208, 142, 144, 53, 198, 120, 85, 135, 32, 161, 207, 229, 109, 10, 200, 73, 124, 49, 152, 51, 108, 34, 233, 135, 208, 50, 90, 162, 186, 19, 130, 17, 237, 57, 23, 157, 153, 58, 114, 161, 230, 250, 164, 217, 213, 23, 49, 117, 174, 133, 125, 34, 174, 63, 1, 70, 134, 246, 40, 121, 200, 177, 218, 228, 87, 23, 196, 126, 28, 14, 176, 180, 146, 166, 86, 179, 189, 178, 151, 237, 170, 167, 240, 183, 197, 168, 63, 149, 22, 208, 255, 161, 150, 235, 8, 95, 24, 119, 79, 2, 3, 1, 0, 1, 163, 99, 48, 97, 48, 14, 6, 3, 85, 29, 15, 1, 1, 255, 4, 4, 3, 2, 1, 134, 48, 15, 6, 3, 85, 29, 19, 1, 1, 255, 4, 5, 48, 3, 1, 1, 255, 48, 29, 6, 3, 85, 29, 14, 4, 22, 4, 20, 69, 235, 162, 175, 244, 146, 203, 130, 49, 45, 81, 139, 167, 167, 33, 157, 243, 109, 200, 15, 48, 31, 6, 3, 85, 29, 35, 4, 24, 48, 22, 128, 20, 69, 235, 162, 175, 244, 146, 203, 130, 49, 45, 81, 139, 167, 167, 33, 157, 243, 109, 200, 15, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 5, 5, 0, 3, 130, 1, 1, 0, 162, 14, 188, 223, 226, 237, 240, 227, 114, 115, 122, 100, 148, 191, 247, 114, 102, 216, 50, 228, 66, 117, 98, 174, 135, 235, 242, 213, 217, 222, 86, 179, 159, 204, 206, 20, 40, 185, 13, 151, 96, 92, 18, 76, 88, 228, 211, 61, 131, 73, 69, 88, 151, 53, 105, 26, 168, 71, 234, 86, 198, 121, 171, 18, 216, 103, 129, 132, 223, 127, 9, 60, 148, 230, 184, 38, 44, 32, 189, 61, 179, 40, 137, 247, 95, 255, 34, 226, 151, 132, 31, 233, 101, 239, 135, 224, 223, 193, 103, 73, 179, 93, 235, 178, 9, 42, 235, 38, 237, 120, 190, 125, 63, 43, 243, 183, 38, 53, 109, 95, 137, 1, 182, 73, 91, 159, 1, 5, 155, 171, 61, 37, 193, 204, 182, 127, 194, 241, 111, 134, 198, 250, 100, 104, 235, 129, 45, 148, 235, 66, 183, 250, 140, 30, 221, 98, 241, 190, 80, 103, 183, 108, 189, 243, 241, 31, 107, 12, 54, 7, 22, 127, 55, 124, 169, 91, 109, 122, 241, 18, 70, 96, 131, 215, 39, 4, 190, 75, 206, 151, 190, 195, 103, 42, 104, 17, 223, 128, 231, 12, 51, 102, 191, 19, 13, 20, 110, 243, 127, 31, 99, 16, 30, 250, 141, 27, 37, 109, 108, 143, 165, 183, 97, 1, 177, 210, 163, 38, 161, 16, 113, 157, 173, 226, 195, 249, 195, 153, 81, 183, 43, 7, 8, 206, 46, 230, 80, 178, 167, 250, 10, 69, 47, 162, 240, 242, 48, 130, 5, 48, 48, 130, 4, 24, 160, 3, 2, 1, 2, 2, 16, 4, 9, 24, 27, 95, 213, 187, 102, 117, 83, 67, 181, 111, 149, 80, 8, 48, 13, 6, 9, 42, 134, 72, 134, 247, 13, 1, 1, 11, 5, 0, 48, 101, 49, 11, 48, 9, 6, 3,Line truncated
};
SignerInfo si = GetSignerInfo (data);
// default properties
Assert.AreEqual (0, si.SignedAttributes.Count, "SignedAttributes");
Assert.IsNotNull (si.Certificate, "Certificate");
Assert.AreEqual (0, si.CounterSignerInfos.Count, "CounterSignerInfos");
Assert.AreEqual ("sha256", si.DigestAlgorithm.FriendlyName, "DigestAlgorithm.FriendlyName");
Assert.AreEqual ("2.16.840.1.101.3.4.2.1", si.DigestAlgorithm.Value, "DigestAlgorithm.Value");
Assert.AreEqual (SubjectIdentifierType.SubjectKeyIdentifier, si.SignerIdentifier.Type, "SignerIdentifier.Type");
Assert.AreEqual ("F1CC7184EBDA537140C1A57416017810DF133020", (string)si.SignerIdentifier.Value, "SignerIdentifier.Value");
Assert.AreEqual (0, si.UnsignedAttributes.Count, "UnsignedAttributes");
Assert.AreEqual (3, si.Version, "Version");
}
}
}
#endif
@@ -0,0 +1,7 @@
namespace System.Xml
{
static class BinaryCompatibility
{
public static bool TargetsAtLeast_Desktop_V4_5_2 => true;
}
}
+1 -1
View File
@@ -5,6 +5,7 @@ Assembly/AssemblyInfo.cs
ReferenceSources/Res.cs
ReferenceSources/LocalAppContextSwitches.cs
ReferenceSources/ThisAssembly.cs
ReferenceSources/BinaryCompatibility.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/GenerateHelper.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/IteratorDescriptor.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/IlGen/OptimizerPatterns.cs
@@ -237,7 +238,6 @@ ReferenceSources/ThisAssembly.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs
../referencesource/System.Xml/System/Xml/Core/BinaryCompatibility.cs
../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs
../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs
../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs
@@ -9,6 +9,7 @@ ReferenceSources/ThisAssembly.cs
ReferenceSources/TypeScope.cs
ReferenceSources/Wsdl.cs
ReferenceSources/CodeDom.cs
ReferenceSources/BinaryCompatibility.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/ISourceLineInfo.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/ListBase.cs
../referencesource/System.Data.SqlXml/System/Xml/Xsl/Pair.cs
@@ -138,7 +139,6 @@ ReferenceSources/CodeDom.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeInfoAtom.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeView.cs
../referencesource/System.Xml/System/Xml/Cache/XPathNodeViewPropertyDescriptor.cs
../referencesource/System.Xml/System/Xml/Core/BinaryCompatibility.cs
../referencesource/System.Xml/System/Xml/Core/CharEntityEncoderFallback.cs
../referencesource/System.Xml/System/Xml/Core/ConformanceLevel.cs
../referencesource/System.Xml/System/Xml/Core/DtdProcessing.cs
@@ -15,7 +15,6 @@ using NUnit.Framework;
using System;
using System.Xml;
using System.IO;
using Network = System.Net;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Collections.Generic;
@@ -94,7 +93,7 @@ namespace MonoTests.System.Xml.Schema
{
// Create a resolver with default credentials.
XmlUrlResolver resolver = new XmlUrlResolver ();
resolver.Credentials = Network.CredentialCache.DefaultCredentials;
resolver.Credentials = global::System.Net.CredentialCache.DefaultCredentials;
// Set the reader settings object to use the resolver.
XmlReaderSettings settings = new XmlReaderSettings ();
settings.XmlResolver = resolver;
+2 -1
View File
@@ -20,7 +20,8 @@ RESX_RESOURCE_STRING = \
../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \
../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx \
../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \
../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx
TEST_RESOURCES = \
Test/System/test-uri-props.txt \
@@ -226,45 +226,79 @@ namespace Mono.Net.Security
providerRegistration = new Dictionary<string,Tuple<Guid,string>> ();
providerCache = new Dictionary<Guid,MSI.MonoTlsProvider> ();
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, "Mono.AppleTls.AppleTlsProvider");
#if ONLY_APPLETLS || MONOTOUCH || XAMMAC
providerRegistration.Add ("default", appleTlsEntry);
providerRegistration.Add ("apple", appleTlsEntry);
#else
var legacyEntry = new Tuple<Guid,String> (LegacyId, "Mono.Net.Security.LegacyTlsProvider");
providerRegistration.Add ("legacy", legacyEntry);
Tuple<Guid,String> btlsEntry = null;
#if MONO_FEATURE_BTLS
if (IsBtlsSupported ()) {
btlsEntry = new Tuple<Guid,String> (BtlsId, "Mono.Btls.MonoBtlsProvider");
providerRegistration.Add ("btls", btlsEntry);
}
#endif
if (Platform.IsMacOS)
providerRegistration.Add ("default", appleTlsEntry);
else if (btlsEntry != null)
providerRegistration.Add ("default", btlsEntry);
else
providerRegistration.Add ("default", legacyEntry);
providerRegistration.Add ("apple", appleTlsEntry);
#endif
PopulateProviders ();
}
}
#region Platform-Specific code
#if ONLY_APPLETLS || MONOTOUCH || XAMMAC
// TODO: Should be redundant
static void PopulateProviders ()
{
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
providerRegistration.Add ("default", appleTlsEntry);
providerRegistration.Add ("apple", appleTlsEntry);
}
#elif MONODROID
// TODO: Should be redundant
static void PopulateProviders ()
{
var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
providerRegistration.Add ("legacy", legacyEntry);
#if MONO_FEATURE_BTLS
var btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
if (btlsEntry != null)
providerRegistration.Add ("default", btlsEntry);
else
#endif
providerRegistration.Add ("default", legacyEntry);
}
#else
static void PopulateProviders ()
{
#if MONO_FEATURE_APPLETLS
var appleTlsEntry = new Tuple<Guid,String> (AppleTlsId, typeof (Mono.AppleTls.AppleTlsProvider).FullName);
#endif
var legacyEntry = new Tuple<Guid,String> (LegacyId, typeof (Mono.Net.Security.LegacyTlsProvider).FullName);
providerRegistration.Add ("legacy", legacyEntry);
Tuple<Guid,String> btlsEntry = null;
#if MONO_FEATURE_BTLS
if (IsBtlsSupported ()) {
btlsEntry = new Tuple<Guid,String> (BtlsId, typeof (Mono.Btls.MonoBtlsProvider).FullName);
providerRegistration.Add ("btls", btlsEntry);
}
#endif
#if MONO_FEATURE_APPLETLS
if (Platform.IsMacOS)
providerRegistration.Add ("default", appleTlsEntry);
else
#endif
#if MONO_FEATURE_BTLS
if (btlsEntry != null)
providerRegistration.Add ("default", btlsEntry);
else
#endif
providerRegistration.Add ("default", legacyEntry);
#if MONO_FEATURE_APPLETLS
providerRegistration.Add ("apple", appleTlsEntry);
#endif
}
#endif
#if MONO_FEATURE_BTLS
[MethodImpl (MethodImplOptions.InternalCall)]
internal extern static bool IsBtlsSupported ();
#endif
#if MONODROID
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
{
#if MONODROID
MSI.MonoTlsProvider provider = null;
var type = Environment.GetEnvironmentVariable ("XA_TLS_PROVIDER");
switch (type) {
@@ -281,24 +315,40 @@ namespace Mono.Net.Security
default:
throw new NotSupportedException (string.Format ("Invalid TLS Provider: `{0}'.", provider));
}
}
#elif ONLY_APPLETLS || MONOTOUCH || XAMMAC
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
{
return new AppleTlsProvider ();
}
#else
static MSI.MonoTlsProvider CreateDefaultProviderImpl ()
{
var variable = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
if (string.IsNullOrEmpty (variable))
variable = "default";
var type = Environment.GetEnvironmentVariable ("MONO_TLS_PROVIDER");
if (string.IsNullOrEmpty (type))
type = "default";
return LookupProvider (variable, true);
}
switch (type) {
case "default":
#if MONO_FEATURE_APPLETLS
if (Platform.IsMacOS)
goto case "apple";
#endif
#if MONO_FEATURE_BTLS
if (IsBtlsSupported ())
goto case "btls";
#endif
goto case "legacy";
#if MONO_FEATURE_APPLETLS
case "apple":
return new AppleTlsProvider ();
#endif
#if MONO_FEATURE_BTLS
case "btls":
return new MonoBtlsProvider ();
#endif
case "legacy":
return new Mono.Net.Security.LegacyTlsProvider ();
}
#endregion
return LookupProvider (type, true);
#endif
}
#region Mono.Security visible API
-60
View File
@@ -312,73 +312,36 @@ partial class SR
public const string net_nonClsCompliantException = "A non-CLS Compliant Exception (i.e. an object that does not derive from System.Exception) was thrown.";
public const string net_illegalConfigWith = "The '{0}' attribute cannot appear when '{1}' is present.";
public const string net_illegalConfigWithout = "The '{0}' attribute can only appear when '{1}' is present.";
public const string net_baddate = "The value of the date string in the header is invalid.";
public const string net_writestarted = "This property cannot be set after writing has started.";
public const string net_reqsubmitted = "This operation cannot be performed after the request has been submitted.";
public const string net_ftp_no_http_cmd = "The requested FTP command is not supported when using HTTP proxy.";
public const string net_ftp_invalid_method_name = "FTP Method names cannot be null or empty.";
public const string net_ftp_invalid_renameto = "The RenameTo filename cannot be null or empty.";
public const string net_ftp_no_defaultcreds = "Default credentials are not supported on an FTP request.";
public const string net_ftpnoresponse = "This type of FTP request does not return a response stream.";
public const string net_ftp_response_invalid_format = "The response string '{0}' has invalid format.";
public const string net_ftp_no_offsetforhttp = "Offsets are not supported when sending an FTP request over an HTTP proxy.";
public const string net_ftp_invalid_uri = "The requested URI is invalid for this FTP command.";
public const string net_ftp_invalid_status_response = "The status response ({0}) is not expected in response to '{1}' command.";
public const string net_ftp_server_failed_passive = "The server failed the passive mode request with status response ({0}).";
public const string net_ftp_active_address_different = "The data connection was made from an address that is different than the address to which the FTP connection was made.";
public const string net_ftp_proxy_does_not_support_ssl = "SSL cannot be enabled when using a proxy.";
public const string net_ftp_invalid_response_filename = "The server returned the filename ({0}) which is not valid.";
public const string net_ftp_unsupported_method = "This method is not supported.";
public const string net_resubmitcanceled = "An error occurred on an automatic resubmission of the request.";
public const string net_redirect_perm = "WebPermission demand failed for redirect URI.";
public const string net_resubmitprotofailed = "Cannot handle redirect from HTTP/HTTPS protocols to other dissimilar ones.";
public const string net_needchunked = "TransferEncoding requires the SendChunked property to be set to true.";
public const string net_connarg = "Keep-Alive and Close may not be set using this property.";
public const string net_no100 = "100-Continue may not be set using this property.";
public const string net_fromto = "The From parameter cannot be less than To.";
public const string net_rangetoosmall = "The From or To parameter cannot be less than 0.";
public const string net_invalidversion = "This protocol version is not supported.";
public const string net_toosmall = "The specified value must be greater than 0.";
public const string net_toolong = "The size of {0} is too long. It cannot be longer than {1} characters.";
public const string net_connclosed = "The underlying connection was closed: {0}.";
public const string net_servererror = "The remote server returned an error: {0}.";
public const string net_nouploadonget = "Cannot send a content-body with this verb-type.";
public const string net_mutualauthfailed = "The requirement for mutual authentication was not met by the remote server.";
public const string net_invasync = "Cannot block a call on this socket while an earlier asynchronous call is in progress.";
public const string net_inasync = "An asynchronous call is already in progress. It must be completed or canceled before you can call this method.";
public const string net_mustbeuri = "The {0} parameter must represent a valid Uri (see inner exception).";
public const string net_format_shexp = "The shell expression '{0}' could not be parsed because it is formatted incorrectly.";
public const string net_cannot_load_proxy_helper = "Failed to load the proxy script runtime environment from the Microsoft.JScript assembly.";
public const string net_invalid_host = "The specified value is not a valid Host header string.";
public const string net_repcall = "Cannot re-call BeginGetRequestStream/BeginGetResponse while a previous call is still in progress.";
public const string net_badmethod = "Cannot set null or blank methods on request.";
public const string net_io_timeout_use_ge_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value >= 0.";
public const string net_io_timeout_use_gt_zero = "Timeout can be only be set to 'System.Threading.Timeout.Infinite' or a value > 0.";
public const string net_io_no_0timeouts = "NetworkStream does not support a 0 millisecond timeout, use a value greater than zero for the timeout instead.";
public const string net_requestaborted = "The request was aborted: {0}.";
public const string net_tooManyRedirections = "Too many automatic redirections were attempted.";
public const string net_authmodulenotregistered = "The supplied authentication module is not registered.";
public const string net_authschemenotregistered = "There is no registered module for this authentication scheme.";
public const string net_proxyschemenotsupported = "The ServicePointManager does not support proxies with the {0} scheme.";
public const string net_maxsrvpoints = "The maximum number of service points was exceeded.";
public const string net_unknown_prefix = "The URI prefix is not recognized.";
public const string net_notconnected = "The operation is not allowed on non-connected sockets.";
public const string net_notstream = "The operation is not allowed on non-stream oriented sockets.";
public const string net_timeout = "The operation has timed out.";
public const string net_nocontentlengthonget = "Content-Length or Chunked Encoding cannot be set for an operation that does not write data.";
public const string net_contentlengthmissing = "When performing a write operation with AllowWriteStreamBuffering set to false, you must either set ContentLength to a non-negative number or set SendChunked to true.";
public const string net_nonhttpproxynotallowed = "The URI scheme for the supplied IWebProxy has the illegal value '{0}'. Only 'http' is supported.";
public const string net_nottoken = "The supplied string is not a valid HTTP token.";
public const string net_rangetype = "A different range specifier has already been added to this request.";
public const string net_need_writebuffering = "This request requires buffering data to succeed.";
public const string net_securityprotocolnotsupported = "The requested security protocol is not supported.";
public const string net_nodefaultcreds = "Default credentials cannot be supplied for the {0} authentication scheme.";
public const string net_stopped = "Not listening. You must call the Start() method before calling this method.";
public const string net_udpconnected = "Cannot send packets to an arbitrary host while connected.";
public const string net_no_concurrent_io_allowed = "The stream does not support concurrent IO read or write operations.";
public const string net_needmorethreads = "There were not enough free threads in the ThreadPool to complete the operation.";
public const string net_MethodNotSupportedException = "This method is not supported by this class.";
public const string net_PropertyNotSupportedException = "This property is not supported by this class.";
public const string net_ProtocolNotSupportedException = "The '{0}' protocol is not supported by this class.";
public const string net_SelectModeNotSupportedException = "The '{0}' select mode is not supported by this class.";
public const string net_InvalidSocketHandle = "The socket handle is not valid.";
@@ -389,7 +352,6 @@ partial class SR
public const string net_invalidPingBufferSize = "The buffer length must not exceed 65500 bytes.";
public const string net_cant_perform_during_shutdown = "This operation cannot be performed while the AppDomain is shutting down.";
public const string net_cant_create_environment = "Unable to create another web proxy script environment at this time.";
public const string net_completed_result = "This operation cannot be performed on a completed asynchronous result object.";
public const string net_protocol_invalid_family = "'{0}' Client can only accept InterNetwork or InterNetworkV6 addresses.";
public const string net_protocol_invalid_multicast_family = "Multicast family is not the same as the family of the '{0}' Client.";
public const string net_empty_osinstalltype = "The Registry value '{0}' was either empty or not a string type.";
@@ -443,8 +405,6 @@ partial class SR
public const string net_WebResponseParseError_InvalidChunkFormat = "Response chunk format is invalid";
public const string net_WebResponseParseError_UnexpectedServerResponse = "Unexpected server response received";
public const string net_webstatus_Success = "Status success";
public const string net_webstatus_NameResolutionFailure = "The remote name could not be resolved";
public const string net_webstatus_ConnectFailure = "Unable to connect to the remote server";
public const string net_webstatus_ReceiveFailure = "An unexpected error occurred on a receive";
public const string net_webstatus_SendFailure = "An unexpected error occurred on a send";
public const string net_webstatus_PipelineFailure = "A pipeline failure occurred";
@@ -458,25 +418,7 @@ partial class SR
public const string net_webstatus_MessageLengthLimitExceeded = "The message length limit was exceeded";
public const string net_webstatus_CacheEntryNotFound = "The request cache-only policy does not allow a network request and the response is not found in cache";
public const string net_webstatus_RequestProhibitedByCachePolicy = "The request could not be satisfied using a cache-only policy";
public const string net_webstatus_Timeout = "The operation has timed out";
public const string net_webstatus_RequestProhibitedByProxy = "The IWebProxy object associated with the request did not allow the request to proceed";
public const string net_InvalidStatusCode = "The server returned a status code outside the valid range of 100-599.";
public const string net_ftpstatuscode_ServiceNotAvailable = "Service not available, closing control connection";
public const string net_ftpstatuscode_CantOpenData = "Can't open data connection";
public const string net_ftpstatuscode_ConnectionClosed = "Connection closed; transfer aborted";
public const string net_ftpstatuscode_ActionNotTakenFileUnavailableOrBusy = "File unavailable (e.g., file busy)";
public const string net_ftpstatuscode_ActionAbortedLocalProcessingError = "Local error in processing";
public const string net_ftpstatuscode_ActionNotTakenInsufficentSpace = "Insufficient storage space in system";
public const string net_ftpstatuscode_CommandSyntaxError = "Syntax error, command unrecognized";
public const string net_ftpstatuscode_ArgumentSyntaxError = "Syntax error in parameters or arguments";
public const string net_ftpstatuscode_CommandNotImplemented = "Command not implemented";
public const string net_ftpstatuscode_BadCommandSequence = "Bad sequence of commands";
public const string net_ftpstatuscode_NotLoggedIn = "Not logged in";
public const string net_ftpstatuscode_AccountNeeded = "Need account for storing files";
public const string net_ftpstatuscode_ActionNotTakenFileUnavailable = "File unavailable (e.g., file not found, no access)";
public const string net_ftpstatuscode_ActionAbortedUnknownPageType = "Page type unknown";
public const string net_ftpstatuscode_FileActionAborted = "Exceeded storage allocation (for current directory or data set)";
public const string net_ftpstatuscode_ActionNotTakenFilenameNotAllowed = "File name not allowed";
public const string net_httpstatuscode_NoContent = "No Content";
public const string net_httpstatuscode_NonAuthoritativeInformation = "Non Authoritative Information";
public const string net_httpstatuscode_ResetContent = "Reset Content";
@@ -516,8 +458,6 @@ partial class SR
public const string net_headers_req = "This collection holds response headers and cannot contain the specified request header.";
public const string net_headers_rsp = "This collection holds request headers and cannot contain the specified response header.";
public const string net_headers_toolong = "Header values cannot be longer than {0} characters.";
public const string net_WebHeaderInvalidCRLFChars = "Specified value has invalid CRLF characters.";
public const string net_WebHeaderInvalidHeaderChars = "Specified value has invalid HTTP Header characters.";
public const string net_WebHeaderInvalidNonAsciiChars = "Specified value has invalid non-ASCII characters.";
public const string net_WebHeaderMissingColon = "Specified value does not have a ':' separator.";
public const string net_headerrestrict = "The '{0}' header must be modified using the appropriate property or method.";
-2
View File
@@ -15,6 +15,4 @@ partial class SR
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
public const string net_log_set_socketoption_reuseport = "net_log_set_socketoption_reuseport";
public const string net_reqaborted = "The request was aborted: The request was canceled.";
}
@@ -1231,7 +1231,6 @@
<Compile Include="System.Net\ListenerAsyncResult.cs" />
<Compile Include="System.Net\ListenerPrefix.cs" />
<Compile Include="System.Net\MacProxy.cs" />
<Compile Include="System.Net\MonoChunkParser.cs" />
<Compile Include="System.Net\MonoChunkStream.cs" />
<Compile Include="System.Net\MonoHttpDate.cs" />
<Compile Include="System.Net\NetConfig.cs" />
-1
View File
@@ -1231,7 +1231,6 @@
<Compile Include="System.Net\ListenerAsyncResult.cs" />
<Compile Include="System.Net\ListenerPrefix.cs" />
<Compile Include="System.Net\MacProxy.cs" />
<Compile Include="System.Net\MonoChunkParser.cs" />
<Compile Include="System.Net\MonoChunkStream.cs" />
<Compile Include="System.Net\MonoHttpDate.cs" />
<Compile Include="System.Net\NetConfig.cs" />
@@ -1231,7 +1231,6 @@
<Compile Include="System.Net\ListenerAsyncResult.cs" />
<Compile Include="System.Net\ListenerPrefix.cs" />
<Compile Include="System.Net\MacProxy.cs" />
<Compile Include="System.Net\MonoChunkParser.cs" />
<Compile Include="System.Net\MonoChunkStream.cs" />
<Compile Include="System.Net\MonoHttpDate.cs" />
<Compile Include="System.Net\NetConfig.cs" />
@@ -39,7 +39,7 @@ namespace System.CodeDom.Compiler
[ConfigurationCollection (typeof (Compiler), AddItemName = "compiler", CollectionType = ConfigurationElementCollectionType.BasicMap)]
internal sealed class CompilerCollection : ConfigurationElementCollection
{
static readonly string defaultCompilerVersion = "3.5";
static readonly string defaultCompilerVersion = "4.0";
static ConfigurationPropertyCollection properties;
static List <CompilerInfo> compiler_infos;
static Dictionary <string, CompilerInfo> compiler_languages;
@@ -50,30 +50,15 @@ namespace System.CodeDom.Compiler
properties = new ConfigurationPropertyCollection ();
compiler_infos = new List <CompilerInfo> ();
compiler_languages = new Dictionary <string, CompilerInfo> (16, StringComparer.OrdinalIgnoreCase);
compiler_extensions = new Dictionary <string, CompilerInfo> (6, StringComparer.OrdinalIgnoreCase);
compiler_extensions = new Dictionary <string, CompilerInfo> (4, StringComparer.OrdinalIgnoreCase);
CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
new [] { ".cs" }, new [] { "c#", "cs", "csharp" });
CompilerInfo compiler = new CompilerInfo (null, "Microsoft.CSharp.CSharpCodeProvider, " + Consts.AssemblySystem,
new [] { "c#", "cs", "csharp" }, new [] { ".cs" });
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
AddCompilerInfo (compiler);
compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089",
new [] { ".vb" }, new [] { "vb", "vbs", "visualbasic", "vbscript" });
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
AddCompilerInfo (compiler);
compiler = new CompilerInfo (null, "Microsoft.JScript.JScriptCodeProvider, Microsoft.JScript, Version=8.0.1100.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
new [] { ".js" }, new [] { "js", "jscript", "javascript" });
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
AddCompilerInfo (compiler);
compiler = new CompilerInfo (null, "Microsoft.VJSharp.VJSharpCodeProvider, VJSharpCodeProvider, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
new [] { ".jsl", ".java" }, new [] { "vj#", "vjs", "vjsharp" });
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
AddCompilerInfo (compiler);
compiler = new CompilerInfo (null, "Microsoft.VisualC.CppCodeProvider, CppCodeProvider, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a",
new [] { ".h" }, new [] { "c++", "mc", "cpp" });
compiler = new CompilerInfo (null, "Microsoft.VisualBasic.VBCodeProvider, " + Consts.AssemblySystem,
new [] { "vb", "vbs", "visualbasic", "vbscript" }, new [] { ".vb" });
compiler.ProviderOptions ["CompilerVersion"] = defaultCompilerVersion;
AddCompilerInfo (compiler);
}
@@ -59,6 +59,6 @@ namespace System.IO
protected void OnRenamed (RenamedEventArgs e) { throw new NotImplementedException (); }
public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType) { throw new NotImplementedException (); }
public WaitForChangedResult WaitForChanged (WatcherChangeTypes changeType, int timeout) { throw new NotImplementedException (); }
protected override void Dispose (bool disposing) { throw new NotImplementedException (); }
protected override void Dispose (bool disposing) { }
}
}
@@ -1046,6 +1046,10 @@ namespace System.Net.Sockets
sockares.EndPoint = remoteEP = sockares.socket.RemapIPEndPoint (ep);
}
if (!sockares.socket.CanTryAddressFamily(sockares.EndPoint.AddressFamily)) {
throw new ArgumentException(SR.net_invalidAddressList);
}
int error = 0;
if (sockares.socket.connect_in_progress) {
@@ -1,77 +0,0 @@
//
// BufferedReadStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.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;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace System.Net
{
class BufferedReadStream : WebReadStream
{
readonly BufferOffsetSize readBuffer;
public BufferedReadStream (WebOperation operation, Stream innerStream,
BufferOffsetSize readBuffer)
: base (operation, innerStream)
{
this.readBuffer = readBuffer;
}
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
var remaining = readBuffer?.Size ?? 0;
if (remaining > 0) {
int copy = (remaining > size) ? size : remaining;
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, buffer, offset, copy);
readBuffer.Offset += copy;
readBuffer.Size -= copy;
offset += copy;
size -= copy;
return copy;
}
if (InnerStream == null)
return 0;
return await InnerStream.ReadAsync (
buffer, offset, size, cancellationToken).ConfigureAwait (false);
}
}
}
@@ -31,7 +31,7 @@ using System.Runtime.InteropServices;
namespace System.Net {
class ChunkedInputStream : RequestStream {
bool disposed;
MonoChunkParser decoder;
MonoChunkStream decoder;
HttpListenerContext context;
bool no_more_data;
@@ -58,10 +58,10 @@ namespace System.Net {
{
this.context = context;
WebHeaderCollection coll = (WebHeaderCollection) context.Request.Headers;
decoder = new MonoChunkParser (coll);
decoder = new MonoChunkStream (coll);
}
public MonoChunkParser Decoder {
public MonoChunkStream Decoder {
get { return decoder; }
set { decoder = value; }
}
+2 -4
View File
@@ -320,11 +320,9 @@ namespace System.Net {
try {
IPAddress newAddress = IPAddress.Parse(h_addrlist[i]);
#pragma warning disable 618
if( (Socket.SupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
(Socket.SupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
if( (Socket.OSSupportsIPv6 && newAddress.AddressFamily == AddressFamily.InterNetworkV6) ||
(Socket.OSSupportsIPv4 && newAddress.AddressFamily == AddressFamily.InterNetwork) )
addrlist.Add(newAddress);
#pragma warning restore 618
} catch (ArgumentNullException) {
/* Ignore this, as the
* internal call might have
+151 -155
View File
@@ -68,6 +68,7 @@ namespace System.Net
bool hostChanged;
bool allowAutoRedirect = true;
bool allowBuffering = true;
bool allowReadStreamBuffering;
X509CertificateCollection certificates;
string connectionGroup;
bool haveContentLength;
@@ -93,10 +94,11 @@ namespace System.Net
bool sendChunked;
ServicePoint servicePoint;
int timeout = 100000;
int continueTimeout = 350;
WebRequestStream writeStream;
HttpWebResponse webResponse;
TaskCompletionSource<HttpWebResponse> responseTask;
WebCompletionSource responseTask;
WebOperation currentOperation;
int aborted;
bool gotRequestStream;
@@ -108,6 +110,8 @@ namespace System.Net
DecompressionMethods auto_decomp;
int maxResponseHeadersLength;
static int defaultMaxResponseHeadersLength;
static int defaultMaximumErrorResponseLength;
static RequestCachePolicy defaultCachePolicy;
int readWriteTimeout = 300000; // ms
#if SECURITY_DEP
MonoTlsProvider tlsProvider;
@@ -115,6 +119,11 @@ namespace System.Net
#endif
ServerCertValidationCallback certValidationCallback;
// stores the user provided Host header as Uri. If the user specified a default port explicitly we'll lose
// that information when converting the host string to a Uri. _HostHasPort will store that information.
bool hostHasPort;
Uri hostUri;
enum NtlmAuthState
{
None,
@@ -122,7 +131,6 @@ namespace System.Net
Response
}
AuthorizationState auth_state, proxy_auth_state;
string host;
[NonSerialized]
internal Func<Stream, Task> ResendContentFactory;
@@ -130,18 +138,15 @@ namespace System.Net
// Constructors
static HttpWebRequest ()
{
defaultMaxResponseHeadersLength = 64 * 1024;
defaultMaxResponseHeadersLength = 64;
defaultMaximumErrorResponseLength = 64;
defaultCachePolicy = new RequestCachePolicy (RequestCacheLevel.BypassCache);
#if !MOBILE
#pragma warning disable 618
NetConfig config = ConfigurationSettings.GetConfig ("system.net/settings") as NetConfig;
#pragma warning restore 618
if (config != null) {
int x = config.MaxResponseHeadersLength;
if (x != -1)
x *= 64;
defaultMaxResponseHeadersLength = x;
}
if (config != null)
defaultMaxResponseHeadersLength = config.MaxResponseHeadersLength;
#endif
}
@@ -169,32 +174,13 @@ namespace System.Net
}
#endif
[Obsolete ("Serialization is obsoleted for this type", false)]
[Obsolete ("Serialization is obsoleted for this type. http://go.microsoft.com/fwlink/?linkid=14202")]
protected HttpWebRequest (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
SerializationInfo info = serializationInfo;
requestUri = (Uri)info.GetValue ("requestUri", typeof (Uri));
actualUri = (Uri)info.GetValue ("actualUri", typeof (Uri));
allowAutoRedirect = info.GetBoolean ("allowAutoRedirect");
allowBuffering = info.GetBoolean ("allowBuffering");
certificates = (X509CertificateCollection)info.GetValue ("certificates", typeof (X509CertificateCollection));
connectionGroup = info.GetString ("connectionGroup");
contentLength = info.GetInt64 ("contentLength");
webHeaders = (WebHeaderCollection)info.GetValue ("webHeaders", typeof (WebHeaderCollection));
keepAlive = info.GetBoolean ("keepAlive");
maxAutoRedirect = info.GetInt32 ("maxAutoRedirect");
mediaType = info.GetString ("mediaType");
method = info.GetString ("method");
initialMethod = info.GetString ("initialMethod");
pipelined = info.GetBoolean ("pipelined");
version = (Version)info.GetValue ("version", typeof (Version));
proxy = (IWebProxy)info.GetValue ("proxy", typeof (IWebProxy));
sendChunked = info.GetBoolean ("sendChunked");
timeout = info.GetInt32 ("timeout");
redirects = info.GetInt32 ("redirects");
host = info.GetString ("host");
ResetAuthorization ();
// In CoreFX, attempting to serialize this class fails due to
// non-serializable fields, so this constructor never gets called.
// They're throwing PlatformNotSupportedException() in here.
throw new SerializationException ();
}
#if MONO_WEB_DEBUG
@@ -245,11 +231,8 @@ namespace System.Net
}
public virtual bool AllowReadStreamBuffering {
get { return false; }
set {
if (value)
throw new InvalidOperationException ();
}
get { return allowReadStreamBuffering; }
set { allowReadStreamBuffering = value; }
}
static Exception GetMustImplement ()
@@ -309,19 +292,17 @@ namespace System.Net
set {
CheckRequestStarted ();
if (string.IsNullOrEmpty (value)) {
if (string.IsNullOrWhiteSpace (value)) {
webHeaders.RemoveInternal ("Connection");
return;
}
string val = value.ToLowerInvariant ();
if (val.Contains ("keep-alive") || val.Contains ("close"))
throw new ArgumentException ("Keep-Alive and Close may not be set with this property");
throw new ArgumentException (SR.net_connarg, nameof (value));
if (keepAlive)
value = value + ", Keep-Alive";
webHeaders.CheckUpdate ("Connection", value);
string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value);
webHeaders.CheckUpdate ("Connection", checkedValue);
}
}
@@ -393,23 +374,15 @@ namespace System.Net
#if !MOBILE
[MonoTODO]
public static new RequestCachePolicy DefaultCachePolicy {
get {
throw GetMustImplement ();
}
set {
throw GetMustImplement ();
}
get { return defaultCachePolicy; }
set { defaultCachePolicy = value; }
}
#endif
[MonoTODO]
public static int DefaultMaximumErrorResponseLength {
get {
throw GetMustImplement ();
}
set {
throw GetMustImplement ();
}
get { return defaultMaximumErrorResponseLength; }
set { defaultMaximumErrorResponseLength = value; }
}
public string Expect {
@@ -461,40 +434,40 @@ namespace System.Net
}
public string Host {
get {
if (host == null)
return actualUri.Authority;
return host;
Uri uri = hostUri ?? Address;
return (hostUri == null || !hostHasPort) && Address.IsDefaultPort ?
uri.Host : uri.Host + ":" + uri.Port;
}
set {
CheckRequestStarted ();
if (value == null)
throw new ArgumentNullException ("value");
throw new ArgumentNullException (nameof (value));
if (!CheckValidHost (actualUri.Scheme, value))
throw new ArgumentException ("Invalid host: " + value);
Uri uri;
if ((value.IndexOf ('/') != -1) || (!TryGetHostUri (value, out uri)))
throw new ArgumentException (SR.net_invalid_host, nameof (value));
host = value;
hostUri = uri;
// Determine if the user provided string contains a port
if (!hostUri.IsDefaultPort) {
hostHasPort = true;
} else if (value.IndexOf (':') == -1) {
hostHasPort = false;
} else {
int endOfIPv6Address = value.IndexOf (']');
hostHasPort = endOfIPv6Address == -1 || value.LastIndexOf (':') > endOfIPv6Address;
}
}
}
static bool CheckValidHost (string scheme, string val)
bool TryGetHostUri (string hostName, out Uri hostUri)
{
if (val.Length == 0)
return false;
if (val[0] == '.')
return false;
int idx = val.IndexOf ('/');
if (idx >= 0)
return false;
IPAddress ipaddr;
if (IPAddress.TryParse (val, out ipaddr))
return true;
string u = scheme + "://" + val + "/";
return Uri.IsWellFormedUriString (u, UriKind.Absolute);
string s = Address.Scheme + "://" + hostName + Address.PathAndQuery;
return Uri.TryCreate (s, UriKind.Absolute, out hostUri);
}
public DateTime IfModifiedSince {
@@ -539,7 +512,13 @@ namespace System.Net
[MonoTODO ("Use this")]
public int MaximumResponseHeadersLength {
get { return maxResponseHeadersLength; }
set { maxResponseHeadersLength = value; }
set {
CheckRequestStarted ();
if (value < 0 && value != System.Threading.Timeout.Infinite)
throw new ArgumentOutOfRangeException (nameof (value), SR.net_toosmall);
maxResponseHeadersLength = value;
}
}
[MonoTODO ("Use this")]
@@ -551,11 +530,10 @@ namespace System.Net
public int ReadWriteTimeout {
get { return readWriteTimeout; }
set {
if (requestSent)
throw new InvalidOperationException ("The request has already been sent.");
CheckRequestStarted ();
if (value < -1)
throw new ArgumentOutOfRangeException ("value", "Must be >= -1");
if (value <= 0 && value != System.Threading.Timeout.Infinite)
throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_gt_zero);
readWriteTimeout = value;
}
@@ -563,8 +541,15 @@ namespace System.Net
[MonoTODO]
public int ContinueTimeout {
get { throw new NotImplementedException (); }
set { throw new NotImplementedException (); }
get {
return continueTimeout;
}
set {
CheckRequestStarted ();
if ((value < 0) && (value != System.Threading.Timeout.Infinite))
throw new ArgumentOutOfRangeException (nameof (value), SR.net_io_timeout_use_ge_zero);
continueTimeout = value;
}
}
public string MediaType {
@@ -577,8 +562,10 @@ namespace System.Net
public override string Method {
get { return this.method; }
set {
if (value == null || value.Trim () == "")
throw new ArgumentException ("not a valid method");
if (string.IsNullOrEmpty (value))
throw new ArgumentException (SR.net_badmethod, nameof (value));
if (HttpValidationHelpers.IsInvalidMethodOrHeaderString (value))
throw new ArgumentException (SR.net_badmethod, nameof (value));
method = value.ToUpperInvariant ();
if (method != "HEAD" && method != "GET" && method != "POST" && method != "PUT" &&
@@ -603,7 +590,7 @@ namespace System.Net
get { return version; }
set {
if (value != HttpVersion.Version10 && value != HttpVersion.Version11)
throw new ArgumentException ("value");
throw new ArgumentException (SR.net_wrongversion, nameof (value));
force_version = true;
version = value;
@@ -672,22 +659,25 @@ namespace System.Net
get { return webHeaders["Transfer-Encoding"]; }
set {
CheckRequestStarted ();
string val = value;
if (val != null)
val = val.Trim ().ToLower ();
if (val == null || val.Length == 0) {
if (string.IsNullOrWhiteSpace (value)) {
webHeaders.RemoveInternal ("Transfer-Encoding");
return;
}
if (val == "chunked")
throw new ArgumentException ("Chunked encoding must be set with the SendChunked property");
string val = value.ToLower ();
//
// prevent them from adding chunked, or from adding an Encoding without
// turning on chunked, the reason is due to the HTTP Spec which prevents
// additional encoding types from being used without chunked
//
if (val.Contains ("chunked"))
throw new ArgumentException (SR.net_nochunked, nameof (value));
else if (!SendChunked)
throw new InvalidOperationException (SR.net_needchunked);
if (!sendChunked)
throw new ArgumentException ("SendChunked must be True", "value");
webHeaders.CheckUpdate ("Transfer-Encoding", value);
string checkedValue = HttpValidationHelpers.CheckBadHeaderValueChars (value);
webHeaders.CheckUpdate ("Transfer-Encoding", checkedValue);
}
}
@@ -863,7 +853,7 @@ namespace System.Net
}
}
async Task<Stream> MyGetRequestStreamAsync (CancellationToken cancellationToken)
Task<Stream> MyGetRequestStreamAsync (CancellationToken cancellationToken)
{
if (Aborted)
throw CreateRequestAbortedException ();
@@ -894,14 +884,11 @@ namespace System.Net
}
}
return await operation.GetRequestStream ().ConfigureAwait (false);
return operation.GetRequestStream ();
}
public override IAsyncResult BeginGetRequestStream (AsyncCallback callback, object state)
{
if (Aborted)
throw CreateRequestAbortedException ();
return TaskToApm.Begin (RunWithTimeout (MyGetRequestStreamAsync), callback, state);
}
@@ -932,22 +919,39 @@ namespace System.Net
throw new NotImplementedException ();
}
internal static async Task<T> RunWithTimeout<T> (Func<CancellationToken, Task<T>> func, int timeout, Action abort)
public override Task<Stream> GetRequestStreamAsync ()
{
using (var cts = new CancellationTokenSource ()) {
var timeoutTask = Task.Delay (timeout);
var workerTask = func (cts.Token);
var ret = await Task.WhenAny (workerTask, timeoutTask).ConfigureAwait (false);
if (ret == timeoutTask) {
try {
cts.Cancel ();
abort ();
} catch {
// Ignore; we report the timeout.
}
throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout);
return RunWithTimeout (MyGetRequestStreamAsync);
}
internal static Task<T> RunWithTimeout<T> (
Func<CancellationToken, Task<T>> func, int timeout, Action abort)
{
// Call `func` here to propagate any potential exception that it
// might throw to our caller rather than returning a faulted task.
var cts = new CancellationTokenSource ();
var workerTask = func (cts.Token);
return RunWithTimeoutWorker (workerTask, timeout, abort, cts);
}
static async Task<T> RunWithTimeoutWorker<T> (
Task<T> workerTask, int timeout, Action abort,
CancellationTokenSource cts)
{
try {
if (await ServicePointScheduler.WaitAsync (workerTask, timeout).ConfigureAwait (false))
return workerTask.Result;
try {
cts.Cancel ();
abort ();
} catch {
// Ignore; we report the timeout.
}
return workerTask.Result;
throw new WebException (SR.net_timeout, WebExceptionStatus.Timeout);
} catch (Exception ex) {
throw FlattenException (ex);
} finally {
cts.Dispose ();
}
}
@@ -968,15 +972,16 @@ namespace System.Net
if (!sendChunked && transferEncoding != null && transferEncoding.Trim () != "")
throw new ProtocolViolationException ("SendChunked should be true.");
var myTcs = new TaskCompletionSource<HttpWebResponse> ();
var completion = new WebCompletionSource ();
WebOperation operation;
lock (locker) {
getResponseCalled = true;
var oldTcs = Interlocked.CompareExchange (ref responseTask, myTcs, null);
WebConnection.Debug ($"HWR GET RESPONSE: Req={ID} {oldTcs != null}");
if (oldTcs != null) {
if (haveResponse && oldTcs.Task.IsCompleted)
return oldTcs.Task.Result;
var oldCompletion = Interlocked.CompareExchange (ref responseTask, completion, null);
WebConnection.Debug ($"HWR GET RESPONSE: Req={ID} {oldCompletion != null}");
if (oldCompletion != null) {
oldCompletion.ThrowOnError ();
if (haveResponse && oldCompletion.Task.IsCompleted)
return webResponse;
throw new InvalidOperationException ("Cannot re-call start of asynchronous " +
"method while a previous call is still in progress.");
}
@@ -1004,7 +1009,7 @@ namespace System.Net
WebConnection.Debug ($"HWR GET RESPONSE LOOP: Req={ID} {auth_state.NtlmAuthState}");
writeStream = await operation.GetRequestStream ();
writeStream = await operation.GetRequestStreamInternal ();
await writeStream.WriteRequestAsync (cancellationToken).ConfigureAwait (false);
stream = await operation.GetResponseStream ();
@@ -1023,14 +1028,14 @@ namespace System.Net
if (throwMe != null) {
WebConnection.Debug ($"HWR GET RESPONSE LOOP #1 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}");
haveResponse = true;
myTcs.TrySetException (throwMe);
completion.TrySetException (throwMe);
throw throwMe;
}
if (!redirect) {
haveResponse = true;
webResponse = response;
myTcs.TrySetResult (response);
completion.TrySetCompleted ();
return response;
}
@@ -1044,7 +1049,7 @@ namespace System.Net
try {
if (mustReadAll)
await stream.ReadAllAsync (redirect || ntlm != null, cancellationToken).ConfigureAwait (false);
operation.CompleteResponseRead (true);
operation.Finish (true);
response.Close ();
} catch (Exception e) {
throwMe = GetWebException (e);
@@ -1056,7 +1061,7 @@ namespace System.Net
WebConnection.Debug ($"HWR GET RESPONSE LOOP #3 EX: Req={ID} {throwMe.Status} {throwMe.InnerException?.GetType ()}");
haveResponse = true;
stream?.Close ();
myTcs.TrySetException (throwMe);
completion.TrySetException (throwMe);
throw throwMe;
}
@@ -1228,34 +1233,13 @@ namespace System.Net
void ISerializable.GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
{
GetObjectData (serializationInfo, streamingContext);
throw new SerializationException ();
}
protected override void GetObjectData (SerializationInfo serializationInfo,
StreamingContext streamingContext)
{
SerializationInfo info = serializationInfo;
info.AddValue ("requestUri", requestUri, typeof (Uri));
info.AddValue ("actualUri", actualUri, typeof (Uri));
info.AddValue ("allowAutoRedirect", allowAutoRedirect);
info.AddValue ("allowBuffering", allowBuffering);
info.AddValue ("certificates", certificates, typeof (X509CertificateCollection));
info.AddValue ("connectionGroup", connectionGroup);
info.AddValue ("contentLength", contentLength);
info.AddValue ("webHeaders", webHeaders, typeof (WebHeaderCollection));
info.AddValue ("keepAlive", keepAlive);
info.AddValue ("maxAutoRedirect", maxAutoRedirect);
info.AddValue ("mediaType", mediaType);
info.AddValue ("method", method);
info.AddValue ("initialMethod", initialMethod);
info.AddValue ("pipelined", pipelined);
info.AddValue ("version", version, typeof (Version));
info.AddValue ("proxy", proxy, typeof (IWebProxy));
info.AddValue ("sendChunked", sendChunked);
info.AddValue ("timeout", timeout);
info.AddValue ("redirects", redirects);
info.AddValue ("host", host);
throw new SerializationException ();
}
void CheckRequestStarted ()
@@ -1384,7 +1368,19 @@ namespace System.Net
webHeaders.ChangeInternal (connectionHeader, "close");
}
webHeaders.SetInternal ("Host", Host);
string host;
if (hostUri != null) {
if (hostHasPort)
host = hostUri.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped);
else
host = hostUri.GetComponents (UriComponents.Host, UriFormat.Unescaped);
} else if (Address.IsDefaultPort) {
host = Address.GetComponents (UriComponents.Host, UriFormat.Unescaped);
} else {
host = Address.GetComponents (UriComponents.HostAndPort, UriFormat.Unescaped);
}
webHeaders.SetInternal ("Host", host);
if (cookieContainer != null) {
string cookieHeader = cookieContainer.GetCookieHeader (actualUri);
if (cookieHeader != "")
@@ -36,6 +36,7 @@ using System;
using System.Collections;
using System.Globalization;
using System.IO;
using System.IO.Compression;
using System.Net.Sockets;
using System.Runtime.Serialization;
using System.Threading;
@@ -97,6 +98,16 @@ namespace System.Net
this.cookie_container = container;
FillCookies ();
}
string content_encoding = webHeaders ["Content-Encoding"];
if (content_encoding == "gzip" && (stream.Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
this.stream = new GZipStream (stream, CompressionMode.Decompress);
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
}
else if (content_encoding == "deflate" && (stream.Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
this.stream = new DeflateStream (stream, CompressionMode.Decompress);
webHeaders.Remove (HttpRequestHeader.ContentEncoding);
}
}
[Obsolete ("Serialization is obsoleted for this type", false)]
@@ -157,6 +168,8 @@ namespace System.Net
if (contentType == null)
contentType = webHeaders ["Content-Type"];
if (contentType == null)
contentType = string.Empty;
return contentType;
}
@@ -1,372 +0,0 @@
//
// System.Net.MonoChunkParser
//
// Authors:
// Gonzalo Paniagua Javier ([email protected])
//
// (C) 2003 Ximian, Inc (http://www.ximian.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.IO;
using System.Text;
namespace System.Net
{
class MonoChunkParser
{
enum State {
None,
PartialSize,
Body,
BodyFinished,
Trailer
}
class Chunk {
public byte [] Bytes;
public int Offset;
public Chunk (byte [] chunk)
{
this.Bytes = chunk;
}
public int Read (byte [] buffer, int offset, int size)
{
int nread = (size > Bytes.Length - Offset) ? Bytes.Length - Offset : size;
Buffer.BlockCopy (Bytes, Offset, buffer, offset, nread);
Offset += nread;
return nread;
}
}
internal WebHeaderCollection headers;
int chunkSize;
int chunkRead;
int totalWritten;
State state;
//byte [] waitBuffer;
StringBuilder saved;
bool sawCR;
bool gotit;
int trailerState;
ArrayList chunks;
public MonoChunkParser (byte [] buffer, int offset, int size, WebHeaderCollection headers)
: this (headers)
{
Write (buffer, offset, size);
}
public MonoChunkParser (WebHeaderCollection headers)
{
this.headers = headers;
saved = new StringBuilder ();
chunks = new ArrayList ();
chunkSize = -1;
totalWritten = 0;
}
public void ResetBuffer ()
{
chunkSize = -1;
chunkRead = 0;
totalWritten = 0;
chunks.Clear ();
}
public void WriteAndReadBack (byte [] buffer, int offset, int size, ref int read)
{
if (offset + read > 0)
Write (buffer, offset, offset+read);
read = Read (buffer, offset, size);
}
public int Read (byte [] buffer, int offset, int size)
{
return ReadFromChunks (buffer, offset, size);
}
int ReadFromChunks (byte [] buffer, int offset, int size)
{
int count = chunks.Count;
int nread = 0;
var chunksForRemoving = new List<Chunk>(count);
for (int i = 0; i < count; i++) {
Chunk chunk = (Chunk) chunks [i];
if (chunk.Offset == chunk.Bytes.Length) {
chunksForRemoving.Add(chunk);
continue;
}
nread += chunk.Read (buffer, offset + nread, size - nread);
if (nread == size)
break;
}
foreach (var chunk in chunksForRemoving)
chunks.Remove(chunk);
return nread;
}
public void Write (byte [] buffer, int offset, int size)
{
if (offset < size)
InternalWrite (buffer, ref offset, size);
}
void InternalWrite (byte [] buffer, ref int offset, int size)
{
if (state == State.None || state == State.PartialSize) {
state = GetChunkSize (buffer, ref offset, size);
if (state == State.PartialSize)
return;
saved.Length = 0;
sawCR = false;
gotit = false;
}
if (state == State.Body && offset < size) {
state = ReadBody (buffer, ref offset, size);
if (state == State.Body)
return;
}
if (state == State.BodyFinished && offset < size) {
state = ReadCRLF (buffer, ref offset, size);
if (state == State.BodyFinished)
return;
sawCR = false;
}
if (state == State.Trailer && offset < size) {
state = ReadTrailer (buffer, ref offset, size);
if (state == State.Trailer)
return;
saved.Length = 0;
sawCR = false;
gotit = false;
}
if (offset < size)
InternalWrite (buffer, ref offset, size);
}
public bool WantMore {
get { return (chunkRead != chunkSize || chunkSize != 0 || state != State.None); }
}
public bool DataAvailable {
get {
int count = chunks.Count;
for (int i = 0; i < count; i++) {
Chunk ch = (Chunk) chunks [i];
if (ch == null || ch.Bytes == null)
continue;
if (ch.Bytes.Length > 0 && ch.Offset < ch.Bytes.Length)
return (state != State.Body);
}
return false;
}
}
public int TotalDataSize {
get { return totalWritten; }
}
public int ChunkLeft {
get { return chunkSize - chunkRead; }
}
State ReadBody (byte [] buffer, ref int offset, int size)
{
if (chunkSize == 0)
return State.BodyFinished;
int diff = size - offset;
if (diff + chunkRead > chunkSize)
diff = chunkSize - chunkRead;
byte [] chunk = new byte [diff];
Buffer.BlockCopy (buffer, offset, chunk, 0, diff);
chunks.Add (new Chunk (chunk));
offset += diff;
chunkRead += diff;
totalWritten += diff;
return (chunkRead == chunkSize) ? State.BodyFinished : State.Body;
}
State GetChunkSize (byte [] buffer, ref int offset, int size)
{
chunkRead = 0;
chunkSize = 0;
char c = '\0';
while (offset < size) {
c = (char) buffer [offset++];
if (c == '\r') {
if (sawCR)
ThrowProtocolViolation ("2 CR found");
sawCR = true;
continue;
}
if (sawCR && c == '\n')
break;
if (c == ' ')
gotit = true;
if (!gotit)
saved.Append (c);
if (saved.Length > 20)
ThrowProtocolViolation ("chunk size too long.");
}
if (!sawCR || c != '\n') {
if (offset < size)
ThrowProtocolViolation ("Missing \\n");
try {
if (saved.Length > 0) {
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
}
} catch (Exception) {
ThrowProtocolViolation ("Cannot parse chunk size.");
}
return State.PartialSize;
}
chunkRead = 0;
try {
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
} catch (Exception) {
ThrowProtocolViolation ("Cannot parse chunk size.");
}
if (chunkSize == 0) {
trailerState = 2;
return State.Trailer;
}
return State.Body;
}
static string RemoveChunkExtension (string input)
{
int idx = input.IndexOf (';');
if (idx == -1)
return input;
return input.Substring (0, idx);
}
State ReadCRLF (byte [] buffer, ref int offset, int size)
{
if (!sawCR) {
if ((char) buffer [offset++] != '\r')
ThrowProtocolViolation ("Expecting \\r");
sawCR = true;
if (offset == size)
return State.BodyFinished;
}
if (sawCR && (char) buffer [offset++] != '\n')
ThrowProtocolViolation ("Expecting \\n");
return State.None;
}
State ReadTrailer (byte [] buffer, ref int offset, int size)
{
char c = '\0';
// short path
if (trailerState == 2 && (char) buffer [offset] == '\r' && saved.Length == 0) {
offset++;
if (offset < size && (char) buffer [offset] == '\n') {
offset++;
return State.None;
}
offset--;
}
int st = trailerState;
string stString = "\r\n\r";
while (offset < size && st < 4) {
c = (char) buffer [offset++];
if ((st == 0 || st == 2) && c == '\r') {
st++;
continue;
}
if ((st == 1 || st == 3) && c == '\n') {
st++;
continue;
}
if (st > 0) {
saved.Append (stString.Substring (0, saved.Length == 0? st-2: st));
st = 0;
if (saved.Length > 4196)
ThrowProtocolViolation ("Error reading trailer (too long).");
}
}
if (st < 4) {
trailerState = st;
if (offset < size)
ThrowProtocolViolation ("Error reading trailer.");
return State.Trailer;
}
StringReader reader = new StringReader (saved.ToString ());
string line;
while ((line = reader.ReadLine ()) != null && line != "")
headers.Add (line);
return State.None;
}
static void ThrowProtocolViolation (string message)
{
WebException we = new WebException (message, null, WebExceptionStatus.ServerProtocolViolation, null);
throw we;
}
}
}
+352 -75
View File
@@ -1,94 +1,371 @@
//
// MonoChunkStream.cs
// System.Net.MonoChunkStream
//
// Author:
// Martin Baulig <mabaul@microsoft.com>
// Authors:
// Gonzalo Paniagua Javier (gonzalo@ximian.com)
//
// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.com)
// (C) 2003 Ximian, Inc (http://www.ximian.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.
// 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.
//
// 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;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using System.Text;
namespace System.Net
{
class MonoChunkStream : WebReadStream
class MonoChunkStream
{
protected WebHeaderCollection Headers {
get;
enum State {
None,
PartialSize,
Body,
BodyFinished,
Trailer
}
protected MonoChunkParser Decoder {
get;
}
class Chunk {
public byte [] Bytes;
public int Offset;
public MonoChunkStream (WebOperation operation, Stream innerStream,
WebHeaderCollection headers)
: base (operation, innerStream)
{
Headers = headers;
Decoder = new MonoChunkParser (headers);
}
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size,
CancellationToken cancellationToken)
{
cancellationToken.ThrowIfCancellationRequested ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (Decoder.DataAvailable)
return Decoder.Read (buffer, offset, size);
int ret = 0;
byte[] moreBytes = null;
while (ret == 0 && Decoder.WantMore) {
int localSize = Decoder.ChunkLeft;
if (localSize <= 0) // not read chunk size yet
localSize = 1024;
else if (localSize > 16384)
localSize = 16384;
if (moreBytes == null || moreBytes.Length < localSize)
moreBytes = new byte[localSize];
ret = await InnerStream.ReadAsync (
moreBytes, 0, localSize, cancellationToken).ConfigureAwait (false);
if (ret <= 0)
return ret;
Decoder.Write (moreBytes, 0, ret);
ret = Decoder.Read (buffer, offset, size);
public Chunk (byte [] chunk)
{
this.Bytes = chunk;
}
return ret;
public int Read (byte [] buffer, int offset, int size)
{
int nread = (size > Bytes.Length - Offset) ? Bytes.Length - Offset : size;
Buffer.BlockCopy (Bytes, Offset, buffer, offset, nread);
Offset += nread;
return nread;
}
}
internal WebHeaderCollection headers;
int chunkSize;
int chunkRead;
int totalWritten;
State state;
//byte [] waitBuffer;
StringBuilder saved;
bool sawCR;
bool gotit;
int trailerState;
ArrayList chunks;
public MonoChunkStream (byte [] buffer, int offset, int size, WebHeaderCollection headers)
: this (headers)
{
Write (buffer, offset, size);
}
public MonoChunkStream (WebHeaderCollection headers)
{
this.headers = headers;
saved = new StringBuilder ();
chunks = new ArrayList ();
chunkSize = -1;
totalWritten = 0;
}
public void ResetBuffer ()
{
chunkSize = -1;
chunkRead = 0;
totalWritten = 0;
chunks.Clear ();
}
public void WriteAndReadBack (byte [] buffer, int offset, int size, ref int read)
{
if (offset + read > 0)
Write (buffer, offset, offset+read);
read = Read (buffer, offset, size);
}
public int Read (byte [] buffer, int offset, int size)
{
return ReadFromChunks (buffer, offset, size);
}
int ReadFromChunks (byte [] buffer, int offset, int size)
{
int count = chunks.Count;
int nread = 0;
var chunksForRemoving = new List<Chunk>(count);
for (int i = 0; i < count; i++) {
Chunk chunk = (Chunk) chunks [i];
if (chunk.Offset == chunk.Bytes.Length) {
chunksForRemoving.Add(chunk);
continue;
}
nread += chunk.Read (buffer, offset + nread, size - nread);
if (nread == size)
break;
}
foreach (var chunk in chunksForRemoving)
chunks.Remove(chunk);
return nread;
}
public void Write (byte [] buffer, int offset, int size)
{
if (offset < size)
InternalWrite (buffer, ref offset, size);
}
void InternalWrite (byte [] buffer, ref int offset, int size)
{
if (state == State.None || state == State.PartialSize) {
state = GetChunkSize (buffer, ref offset, size);
if (state == State.PartialSize)
return;
saved.Length = 0;
sawCR = false;
gotit = false;
}
if (state == State.Body && offset < size) {
state = ReadBody (buffer, ref offset, size);
if (state == State.Body)
return;
}
if (state == State.BodyFinished && offset < size) {
state = ReadCRLF (buffer, ref offset, size);
if (state == State.BodyFinished)
return;
sawCR = false;
}
if (state == State.Trailer && offset < size) {
state = ReadTrailer (buffer, ref offset, size);
if (state == State.Trailer)
return;
saved.Length = 0;
sawCR = false;
gotit = false;
}
if (offset < size)
InternalWrite (buffer, ref offset, size);
}
public bool WantMore {
get { return (chunkRead != chunkSize || chunkSize != 0 || state != State.None); }
}
public bool DataAvailable {
get {
int count = chunks.Count;
for (int i = 0; i < count; i++) {
Chunk ch = (Chunk) chunks [i];
if (ch == null || ch.Bytes == null)
continue;
if (ch.Bytes.Length > 0 && ch.Offset < ch.Bytes.Length)
return (state != State.Body);
}
return false;
}
}
public int TotalDataSize {
get { return totalWritten; }
}
public int ChunkLeft {
get { return chunkSize - chunkRead; }
}
State ReadBody (byte [] buffer, ref int offset, int size)
{
if (chunkSize == 0)
return State.BodyFinished;
int diff = size - offset;
if (diff + chunkRead > chunkSize)
diff = chunkSize - chunkRead;
byte [] chunk = new byte [diff];
Buffer.BlockCopy (buffer, offset, chunk, 0, diff);
chunks.Add (new Chunk (chunk));
offset += diff;
chunkRead += diff;
totalWritten += diff;
return (chunkRead == chunkSize) ? State.BodyFinished : State.Body;
}
State GetChunkSize (byte [] buffer, ref int offset, int size)
{
chunkRead = 0;
chunkSize = 0;
char c = '\0';
while (offset < size) {
c = (char) buffer [offset++];
if (c == '\r') {
if (sawCR)
ThrowProtocolViolation ("2 CR found");
sawCR = true;
continue;
}
if (sawCR && c == '\n')
break;
if (c == ' ')
gotit = true;
if (!gotit)
saved.Append (c);
if (saved.Length > 20)
ThrowProtocolViolation ("chunk size too long.");
}
if (!sawCR || c != '\n') {
if (offset < size)
ThrowProtocolViolation ("Missing \\n");
try {
if (saved.Length > 0) {
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
}
} catch (Exception) {
ThrowProtocolViolation ("Cannot parse chunk size.");
}
return State.PartialSize;
}
chunkRead = 0;
try {
chunkSize = Int32.Parse (RemoveChunkExtension (saved.ToString ()), NumberStyles.HexNumber);
} catch (Exception) {
ThrowProtocolViolation ("Cannot parse chunk size.");
}
if (chunkSize == 0) {
trailerState = 2;
return State.Trailer;
}
return State.Body;
}
static string RemoveChunkExtension (string input)
{
int idx = input.IndexOf (';');
if (idx == -1)
return input;
return input.Substring (0, idx);
}
State ReadCRLF (byte [] buffer, ref int offset, int size)
{
if (!sawCR) {
if ((char) buffer [offset++] != '\r')
ThrowProtocolViolation ("Expecting \\r");
sawCR = true;
if (offset == size)
return State.BodyFinished;
}
if (sawCR && (char) buffer [offset++] != '\n')
ThrowProtocolViolation ("Expecting \\n");
return State.None;
}
State ReadTrailer (byte [] buffer, ref int offset, int size)
{
char c = '\0';
// short path
if (trailerState == 2 && (char) buffer [offset] == '\r' && saved.Length == 0) {
offset++;
if (offset < size && (char) buffer [offset] == '\n') {
offset++;
return State.None;
}
offset--;
}
int st = trailerState;
string stString = "\r\n\r";
while (offset < size && st < 4) {
c = (char) buffer [offset++];
if ((st == 0 || st == 2) && c == '\r') {
st++;
continue;
}
if ((st == 1 || st == 3) && c == '\n') {
st++;
continue;
}
if (st > 0) {
saved.Append (stString.Substring (0, saved.Length == 0? st-2: st));
st = 0;
if (saved.Length > 4196)
ThrowProtocolViolation ("Error reading trailer (too long).");
}
}
if (st < 4) {
trailerState = st;
if (offset < size)
ThrowProtocolViolation ("Error reading trailer.");
return State.Trailer;
}
StringReader reader = new StringReader (saved.ToString ());
string line;
while ((line = reader.ReadLine ()) != null && line != "")
headers.Add (line);
return State.None;
}
static void ThrowProtocolViolation (string message)
{
WebException we = new WebException (message, null, WebExceptionStatus.ServerProtocolViolation, null);
throw we;
}
}
}
@@ -160,7 +160,7 @@ namespace System.Net
taskList.Add (schedulerEvent.WaitAsync (maxIdleTime));
foreach (var item in operationArray)
taskList.Add (item.Item2.WaitForCompletion (true));
taskList.Add (item.Item2.Finished.Task);
foreach (var item in idleArray)
taskList.Add (item.Item3);
}
@@ -170,32 +170,42 @@ namespace System.Net
var ret = await Task.WhenAny (taskList).ConfigureAwait (false);
lock (ServicePoint) {
if (ret == taskList[0]) {
RunSchedulerIteration ();
continue;
}
bool runMaster = false;
if (ret == taskList[0])
runMaster = true;
int idx = -1;
/*
* We discard the `taskList` at this point as it is only used to wake us up.
*
* The `WebCompletionSource<T>` assigns its `CurrentResult` property prior
* to completing the `Task` instance, so whenever a task is finished we will
* also get a non-null `CurrentResult`.
*
*/
for (int i = 0; i < operationArray.Length; i++) {
if (ret == taskList[i + 1]) {
idx = i;
break;
}
}
var item = operationArray[i];
var result = item.Item2.Finished.CurrentResult;
if (result == null)
continue;
if (idx >= 0) {
var item = operationArray[idx];
Debug ($"MAIN LOOP #2: {idx} group={item.Item1.ID} Op={item.Item2.ID}");
Debug ($"MAIN LOOP #2: {i} group={item.Item1.ID} Op={item.Item2.ID} Status={result.Status}");
operations.Remove (item);
var opTask = (Task<ValueTuple<bool, WebOperation>>)ret;
var runLoop = OperationCompleted (item.Item1, item.Item2, opTask);
Debug ($"MAIN LOOP #2 DONE: {idx} {runLoop}");
if (runLoop)
RunSchedulerIteration ();
continue;
var runLoop = OperationCompleted (item.Item1, item.Item2);
Debug ($"MAIN LOOP #2 DONE: {i} {runLoop}");
runMaster |= runLoop;
}
/*
* This needs to be called after we deal with pending completions to
* ensure that connections are properly recognized as being idle.
*
*/
Debug ($"MAIN LOOP #3: runMaster={runMaster}");
if (runMaster)
RunSchedulerIteration ();
int idx = -1;
for (int i = 0; i < idleArray.Length; i++) {
if (ret == taskList[i + 1 + operationArray.Length]) {
idx = i;
@@ -205,7 +215,7 @@ namespace System.Net
if (idx >= 0) {
var item = idleArray[idx];
Debug ($"MAIN LOOP #3: {idx} group={item.Item1.ID} Cnc={item.Item2.ID}");
Debug ($"MAIN LOOP #4: {idx} group={item.Item1.ID} Cnc={item.Item2.ID}");
idleConnections.Remove (item);
CloseIdleConnection (item.Item1, item.Item2);
}
@@ -242,7 +252,7 @@ namespace System.Net
repeat = SchedulerIteration (defaultGroup);
Debug ($"ITERATION #1: repeat={repeat} groups={groups?.Count}");
Debug ($"ITERATION #1: {repeat} {groups != null}");
if (groups != null) {
foreach (var group in groups) {
@@ -251,11 +261,11 @@ namespace System.Net
}
}
Debug ($"ITERATION #3: repeat={repeat}");
Debug ($"ITERATION #3: {repeat}");
} while (repeat);
}
bool OperationCompleted (ConnectionGroup group, WebOperation operation, Task<(bool, WebOperation)> task)
bool OperationCompleted (ConnectionGroup group, WebOperation operation)
{
#if MONO_WEB_DEBUG
var me = $"{nameof (OperationCompleted)}(group={group.ID}, Op={operation.ID}, Cnc={operation.Connection.ID})";
@@ -263,8 +273,10 @@ namespace System.Net
string me = null;
#endif
var (ok, next) = task.Status == TaskStatus.RanToCompletion ? task.Result : (false, null);
Debug ($"{me}: {task.Status} {ok} {next?.ID}");
var result = operation.Finished.CurrentResult;
var (ok, next) = result.Success ? result.Argument : (false, null);
Debug ($"{me}: {operation.Finished.CurrentStatus} {ok} {next?.ID}");
if (!ok || !operation.Connection.Continue (next)) {
group.RemoveConnection (operation.Connection);
@@ -324,10 +336,9 @@ namespace System.Net
// Is there anything in the queue?
var next = group.GetNextOperation ();
if (next == null) {
Debug ($"{me} no pending operations.");
Debug ($"{me} no pending operations.");
if (next == null)
return false;
}
Debug ($"{me} found pending operation Op={next.ID}");
@@ -431,6 +442,19 @@ namespace System.Net
Interlocked.Decrement (ref currentConnections);
}
public static async Task<bool> WaitAsync (Task workerTask, int millisecondTimeout)
{
var cts = new CancellationTokenSource ();
try {
var timeoutTask = Task.Delay (millisecondTimeout, cts.Token);
var ret = await Task.WhenAny (workerTask, timeoutTask).ConfigureAwait (false);
return ret != timeoutTask;
} finally {
cts.Cancel ();
cts.Dispose ();
}
}
class ConnectionGroup
{
public ServicePointScheduler Scheduler {
@@ -557,7 +581,9 @@ namespace System.Net
public (WebConnection connection, bool created) CreateOrReuseConnection (WebOperation operation, bool force)
{
Scheduler.Debug ($"CREATE OR REUSE: group={ID} OP={operation.ID} force={force}");
var connection = FindIdleConnection (operation);
Scheduler.Debug ($"CREATE OR REUSE #1: group={ID} OP={operation.ID} force={force} - connection={connection?.ID}");
if (connection != null)
return (connection, false);
@@ -587,11 +613,9 @@ namespace System.Net
return m_tcs.Task.Wait (millisecondTimeout);
}
public async Task<bool> WaitAsync (int millisecondTimeout)
public Task<bool> WaitAsync (int millisecondTimeout)
{
var timeoutTask = Task.Delay (millisecondTimeout);
var ret = await Task.WhenAny (m_tcs.Task, timeoutTask).ConfigureAwait (false);
return ret != timeoutTask;
return ServicePointScheduler.WaitAsync (m_tcs.Task, millisecondTimeout);
}
public void Set ()
@@ -0,0 +1,155 @@
//
// WebCompletionSource.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.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;
using System.Threading;
using System.Threading.Tasks;
using System.Runtime.ExceptionServices;
namespace System.Net
{
class WebCompletionSource<T>
{
TaskCompletionSource<Result> completion;
Result currentResult;
public WebCompletionSource (bool runAsync = true)
{
completion = new TaskCompletionSource<Result> (
runAsync ?
TaskCreationOptions.RunContinuationsAsynchronously :
TaskCreationOptions.None);
}
/*
* Provide a non-blocking way of getting the current status.
*
* We are using `TaskCreationOptions.RunContinuationsAsynchronously`
* to prevent any user continuations from being run during the
* `TrySet*()` methods - to make these safe to be called while holding
* internal locks.
*
*/
internal Result CurrentResult => currentResult;
internal Status CurrentStatus => currentResult?.Status ?? Status.Running;
internal Task Task => completion.Task;
public bool TrySetCompleted (T argument)
{
var result = new Result (argument);
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
return false;
return completion.TrySetResult (result);
}
public bool TrySetCompleted ()
{
var result = new Result (Status.Completed, null);
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
return false;
return completion.TrySetResult (result);
}
public bool TrySetCanceled ()
{
return TrySetCanceled (new OperationCanceledException ());
}
public bool TrySetCanceled (OperationCanceledException error)
{
var result = new Result (Status.Canceled, ExceptionDispatchInfo.Capture (error));
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
return false;
return completion.TrySetResult (result);
}
public bool TrySetException (Exception error)
{
var result = new Result (Status.Faulted, ExceptionDispatchInfo.Capture (error));
if (Interlocked.CompareExchange (ref currentResult, result, null) != null)
return false;
return completion.TrySetResult (result);
}
public void ThrowOnError ()
{
if (!completion.Task.IsCompleted)
return;
completion.Task.Result.Error?.Throw ();
}
public async Task<T> WaitForCompletion ()
{
var result = await completion.Task.ConfigureAwait (false);
if (result.Status == Status.Completed)
return (T)result.Argument;
// This will always throw once we get here.
result.Error.Throw ();
throw new InvalidOperationException ("Should never happen.");
}
internal enum Status : int {
Running,
Completed,
Canceled,
Faulted
}
internal class Result
{
public Status Status {
get;
}
public bool Success => Status == Status.Completed;
public ExceptionDispatchInfo Error {
get;
}
public T Argument {
get;
}
public Result (T argument)
{
Status = Status.Completed;
Argument = argument;
}
public Result (Status state, ExceptionDispatchInfo error)
{
Status = state;
Error = error;
}
}
}
class WebCompletionSource : WebCompletionSource<object>
{
}
}
+12 -2
View File
@@ -141,6 +141,8 @@ namespace System.Net
#endif
}
Exception connectException = null;
foreach (IPAddress address in hostEntry.AddressList) {
operation.ThrowIfDisposed (cancellationToken);
@@ -169,7 +171,10 @@ namespace System.Net
throw;
} catch (Exception exc) {
Interlocked.Exchange (ref socket, null)?.Close ();
throw GetException (WebExceptionStatus.ConnectFailure, exc);
// Something went wrong, but we might have multiple IP Addresses
// and need to probe them all.
connectException = GetException (WebExceptionStatus.ConnectFailure, exc);
continue;
}
}
@@ -177,7 +182,10 @@ namespace System.Net
return;
}
throw GetException (WebExceptionStatus.ConnectFailure, null);
if (connectException == null)
connectException = GetException (WebExceptionStatus.ConnectFailure, null);
throw connectException;
}
#if MONO_WEB_DEBUG
@@ -265,6 +273,8 @@ namespace System.Net
goto retry;
}
networkStream.ReadTimeout = operation.Request.ReadWriteTimeout;
return new WebRequestStream (this, operation, networkStream, tunnel);
}
@@ -115,7 +115,7 @@ namespace System.Net
return e;
}
public override int Read (byte[] buffer, int offset, int size)
public override int Read (byte[] buffer, int offset, int count)
{
if (!CanRead)
throw new NotSupportedException (SR.net_writeonlystream);
@@ -127,17 +127,17 @@ namespace System.Net
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
try {
return ReadAsync (buffer, offset, size, CancellationToken.None).Result;
return ReadAsync (buffer, offset, count, CancellationToken.None).Result;
} catch (Exception e) {
throw GetException (e);
}
}
public override IAsyncResult BeginRead (byte[] buffer, int offset, int size,
public override IAsyncResult BeginRead (byte[] buffer, int offset, int count,
AsyncCallback cb, object state)
{
if (!CanRead)
@@ -150,10 +150,10 @@ namespace System.Net
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
var task = ReadAsync (buffer, offset, size, CancellationToken.None);
var task = ReadAsync (buffer, offset, count, CancellationToken.None);
return TaskToApm.Begin (task, cb, state);
}
@@ -169,23 +169,23 @@ namespace System.Net
}
}
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int size,
public override IAsyncResult BeginWrite (byte[] buffer, int offset, int count,
AsyncCallback cb, object state)
{
if (!CanWrite)
throw new NotSupportedException (SR.net_readonlystream);
Operation.ThrowIfClosedOrDisposed ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
var task = WriteAsync (buffer, offset, size, CancellationToken.None);
if (!CanWrite)
throw new NotSupportedException (SR.net_readonlystream);
Operation.ThrowIfClosedOrDisposed ();
var task = WriteAsync (buffer, offset, count, CancellationToken.None);
return TaskToApm.Begin (task, cb, state);
}
@@ -201,23 +201,23 @@ namespace System.Net
}
}
public override void Write (byte[] buffer, int offset, int size)
public override void Write (byte[] buffer, int offset, int count)
{
if (!CanWrite)
throw new NotSupportedException (SR.net_readonlystream);
Operation.ThrowIfClosedOrDisposed ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
if (!CanWrite)
throw new NotSupportedException (SR.net_readonlystream);
Operation.ThrowIfClosedOrDisposed ();
try {
WriteAsync (buffer, offset, size).Wait ();
WriteAsync (buffer, offset, count).Wait ();
} catch (Exception e) {
throw GetException (e);
}
@@ -227,6 +227,13 @@ namespace System.Net
{
}
public override Task FlushAsync (CancellationToken cancellationToken)
{
return cancellationToken.IsCancellationRequested ?
Task.FromCancellation (cancellationToken) :
Task.CompletedTask;
}
internal void InternalClose ()
{
disposed = true;
+75 -70
View File
@@ -60,8 +60,10 @@ namespace System.Net
#if MONO_WEB_DEBUG
static int nextID;
internal readonly int ID = ++nextID;
string ME => $"WO({ID},{Connection?.ID ?? -1})";
#else
internal readonly int ID;
string ME;
#endif
public WebOperation (HttpWebRequest request, BufferOffsetSize writeBuffer, bool isNtlmChallenge, CancellationToken cancellationToken)
@@ -70,26 +72,24 @@ namespace System.Net
WriteBuffer = writeBuffer;
IsNtlmChallenge = isNtlmChallenge;
cts = CancellationTokenSource.CreateLinkedTokenSource (cancellationToken);
requestTask = new TaskCompletionSource<WebRequestStream> ();
requestWrittenTask = new TaskCompletionSource<WebRequestStream> ();
completeResponseReadTask = new TaskCompletionSource<bool> ();
responseTask = new TaskCompletionSource<WebResponseStream> ();
finishedTask = new TaskCompletionSource<(bool, WebOperation)> ();
requestTask = new WebCompletionSource<WebRequestStream> ();
requestWrittenTask = new WebCompletionSource<WebRequestStream> ();
responseTask = new WebCompletionSource<WebResponseStream> ();
finishedTask = new WebCompletionSource<(bool, WebOperation)> ();
}
CancellationTokenSource cts;
TaskCompletionSource<WebRequestStream> requestTask;
TaskCompletionSource<WebRequestStream> requestWrittenTask;
TaskCompletionSource<WebResponseStream> responseTask;
TaskCompletionSource<bool> completeResponseReadTask;
TaskCompletionSource<(bool, WebOperation)> finishedTask;
WebCompletionSource<WebRequestStream> requestTask;
WebCompletionSource<WebRequestStream> requestWrittenTask;
WebCompletionSource<WebResponseStream> responseTask;
WebCompletionSource<(bool, WebOperation)> finishedTask;
WebRequestStream writeStream;
WebResponseStream responseStream;
ExceptionDispatchInfo disposedInfo;
ExceptionDispatchInfo closedInfo;
WebOperation priorityRequest;
volatile bool finishedReading;
int requestSent;
int finished;
public bool Aborted {
get {
@@ -133,18 +133,23 @@ namespace System.Net
void SetCanceled ()
{
requestTask.TrySetCanceled ();
requestWrittenTask.TrySetCanceled ();
responseTask.TrySetCanceled ();
completeResponseReadTask.TrySetCanceled ();
WebConnection.Debug ($"{ME} SET CANCELED");
var error = new OperationCanceledException ();
requestTask.TrySetCanceled (error);
requestWrittenTask.TrySetCanceled (error);
responseTask.TrySetCanceled (error);
Finish (false, error);
}
void SetError (Exception error)
{
WebConnection.Debug ($"{ME} SET ERROR: error={error.GetType ().Name}");
requestTask.TrySetException (error);
requestWrittenTask.TrySetException (error);
responseTask.TrySetException (error);
completeResponseReadTask.TrySetException (error);
Finish (false, error);
}
(ExceptionDispatchInfo, bool) SetDisposed (ref ExceptionDispatchInfo field)
@@ -155,6 +160,13 @@ namespace System.Net
return (old ?? exception, old == null);
}
internal ExceptionDispatchInfo CheckDisposed (CancellationToken cancellationToken)
{
if (Aborted || cancellationToken.IsCancellationRequested)
return CheckThrowDisposed (false, ref disposedInfo);
return null;
}
internal void ThrowIfDisposed ()
{
ThrowIfDisposed (CancellationToken.None);
@@ -163,7 +175,7 @@ namespace System.Net
internal void ThrowIfDisposed (CancellationToken cancellationToken)
{
if (Aborted || cancellationToken.IsCancellationRequested)
ThrowDisposed (ref disposedInfo);
CheckThrowDisposed (true, ref disposedInfo);
}
internal void ThrowIfClosedOrDisposed ()
@@ -174,15 +186,17 @@ namespace System.Net
internal void ThrowIfClosedOrDisposed (CancellationToken cancellationToken)
{
if (Closed || cancellationToken.IsCancellationRequested)
ThrowDisposed (ref closedInfo);
CheckThrowDisposed (true, ref closedInfo);
}
void ThrowDisposed (ref ExceptionDispatchInfo field)
ExceptionDispatchInfo CheckThrowDisposed (bool throwIt, ref ExceptionDispatchInfo field)
{
var (exception, disposed) = SetDisposed (ref field);
if (disposed)
cts?.Cancel ();
exception.Throw ();
if (throwIt)
exception.Throw ();
return exception;
}
internal void RegisterRequest (ServicePoint servicePoint, WebConnection connection)
@@ -208,21 +222,26 @@ namespace System.Net
public void SetPriorityRequest (WebOperation operation)
{
lock (this) {
if (requestSent != 1 || ServicePoint == null || finishedReading)
if (requestSent != 1 || ServicePoint == null || finished != 0)
throw new InvalidOperationException ("Should never happen.");
if (Interlocked.CompareExchange (ref priorityRequest, operation, null) != null)
throw new InvalidOperationException ("Invalid nested request.");
}
}
public Task<WebRequestStream> GetRequestStream ()
public async Task<Stream> GetRequestStream ()
{
return requestTask.Task;
return await requestTask.WaitForCompletion ().ConfigureAwait (false);
}
internal Task<WebRequestStream> GetRequestStreamInternal ()
{
return requestTask.WaitForCompletion ();
}
public Task WaitUntilRequestWritten ()
{
return requestWrittenTask.Task;
return requestWrittenTask.WaitForCompletion ();
}
public WebRequestStream WriteStream {
@@ -234,24 +253,15 @@ namespace System.Net
public Task<WebResponseStream> GetResponseStream ()
{
return responseTask.Task;
return responseTask.WaitForCompletion ();
}
internal async Task<(bool, WebOperation)> WaitForCompletion (bool ignoreErrors)
{
try {
return await finishedTask.Task.ConfigureAwait (false);
} catch {
if (ignoreErrors)
return (false, null);
throw;
}
}
internal WebCompletionSource<(bool, WebOperation)> Finished => finishedTask;
internal async void Run ()
{
try {
FinishReading ();
WebConnection.Debug ($"{ME} RUN");
ThrowIfClosedOrDisposed ();
@@ -265,37 +275,51 @@ namespace System.Net
ThrowIfClosedOrDisposed ();
requestTask.TrySetResult (requestStream);
requestTask.TrySetCompleted (requestStream);
var stream = new WebResponseStream (requestStream);
responseStream = stream;
await stream.InitReadAsync (cts.Token).ConfigureAwait (false);
responseTask.TrySetResult (stream);
WebConnection.Debug ($"{ME} RUN COMPLETE");
responseTask.TrySetCompleted (stream);
} catch (OperationCanceledException) {
WebConnection.Debug ($"{ME} RUN CANCELED");
SetCanceled ();
} catch (Exception e) {
WebConnection.Debug ($"{ME} RUN ERROR: {e.GetType ().Name}");
SetError (e);
}
}
async void FinishReading ()
internal void CompleteRequestWritten (WebRequestStream stream, Exception error = null)
{
bool ok = false;
Exception error = null;
WebConnection.Debug ($"{ME} COMPLETE REQUEST WRITTEN: {error != null}");
try {
ok = await completeResponseReadTask.Task.ConfigureAwait (false);
} catch (Exception e) {
error = e;
}
if (error != null)
SetError (error);
else
requestWrittenTask.TrySetCompleted (stream);
}
internal void Finish (bool ok, Exception error = null)
{
if (Interlocked.CompareExchange (ref finished, 1, 0) != 0)
return;
#if MONO_WEB_DEBUG
var me = $"{ME} FINISH";
#else
string me = null;
#endif
WebConnection.Debug ($"{me}: ok={ok} error={error?.GetType ()}");
WebResponseStream stream;
WebOperation next;
lock (this) {
finishedReading = true;
stream = Interlocked.Exchange (ref responseStream, null);
next = Interlocked.Exchange (ref priorityRequest, null);
Request.FinishedReading = true;
@@ -304,11 +328,12 @@ namespace System.Net
if (error != null) {
if (next != null)
next.SetError (error);
WebConnection.Debug ($"{me} SET ERROR: {error.GetType ().Name}");
finishedTask.TrySetException (error);
return;
}
WebConnection.Debug ($"WO FINISH READING: Cnc={Connection?.ID} Op={ID} ok={ok} error={error != null} stream={stream != null} next={next != null}");
WebConnection.Debug ($"{me}: ok={ok} stream={stream != null} next={next != null}");
var keepAlive = !Aborted && ok && (stream?.KeepAlive ?? false);
if (next != null && next.Aborted) {
@@ -316,29 +341,9 @@ namespace System.Net
keepAlive = false;
}
finishedTask.TrySetResult ((keepAlive, next));
finishedTask.TrySetCompleted ((keepAlive, next));
WebConnection.Debug ($"WO FINISH READING DONE: Cnc={Connection.ID} Op={ID} - {keepAlive} next={next?.ID}");
}
internal void CompleteRequestWritten (WebRequestStream stream, Exception error = null)
{
WebConnection.Debug ($"WO COMPLETE REQUEST WRITTEN: Op={ID} {error != null}");
if (error != null)
SetError (error);
else
requestWrittenTask.TrySetResult (stream);
}
internal void CompleteResponseRead (bool ok, Exception error = null)
{
WebConnection.Debug ($"WO COMPLETE RESPONSE READ: Op={ID} {ok} {error?.GetType ()}");
if (error != null)
completeResponseReadTask.TrySetException (error);
else
completeResponseReadTask.TrySetResult (ok);
WebConnection.Debug ($"{me} DONE: {keepAlive} next={next?.ID}");
}
}
}
@@ -1,149 +0,0 @@
//
// WebReadStream.cs
//
// Author:
// Martin Baulig <[email protected]>
//
// Copyright (c) 2018 Xamarin Inc. (http://www.xamarin.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;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace System.Net
{
abstract class WebReadStream : Stream
{
public WebOperation Operation {
get;
}
protected Stream InnerStream {
get;
}
public WebReadStream (WebOperation operation, Stream innerStream)
{
Operation = operation;
InnerStream = innerStream;
}
Exception NotSupported => new NotSupportedException ();
public override long Length => throw NotSupported;
public override long Position {
get => throw NotSupported;
set => throw NotSupported;
}
public override bool CanSeek => false;
public override bool CanRead => true;
public override bool CanWrite => false;
public override void SetLength (long value)
{
throw NotSupported;
}
public override long Seek (long offset, SeekOrigin origin)
{
throw NotSupported;
}
public override void Write (byte[] buffer, int offset, int count)
{
throw NotSupported;
}
public override void Flush ()
{
throw NotSupported;
}
protected Exception GetException (Exception e)
{
e = HttpWebRequest.FlattenException (e);
if (e is WebException)
return e;
if (Operation.Aborted || e is OperationCanceledException || e is ObjectDisposedException)
return HttpWebRequest.CreateRequestAbortedException ();
return e;
}
public override int Read (byte[] buffer, int offset, int size)
{
if (!CanRead)
throw new NotSupportedException (SR.net_writeonlystream);
Operation.ThrowIfClosedOrDisposed ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
try {
return ReadAsync (buffer, offset, size, CancellationToken.None).Result;
} catch (Exception e) {
throw GetException (e);
}
}
public override IAsyncResult BeginRead (byte[] buffer, int offset, int size,
AsyncCallback cb, object state)
{
if (!CanRead)
throw new NotSupportedException (SR.net_writeonlystream);
Operation.ThrowIfClosedOrDisposed ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
var task = ReadAsync (buffer, offset, size, CancellationToken.None);
return TaskToApm.Begin (task, cb, state);
}
public override int EndRead (IAsyncResult r)
{
if (r == null)
throw new ArgumentNullException (nameof (r));
try {
return TaskToApm.End<int> (r);
} catch (Exception e) {
throw GetException (e);
}
}
}
}
+48 -35
View File
@@ -39,7 +39,7 @@ namespace System.Net
bool requestWritten;
bool allowBuffering;
bool sendChunked;
TaskCompletionSource<int> pendingWrite;
WebCompletionSource pendingWrite;
long totalWritten;
byte[] headers;
bool headersSent;
@@ -131,28 +131,38 @@ namespace System.Net
Operation.CompleteRequestWritten (this);
}
public override async Task WriteAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} WRITE ASYNC: {buffer.Length}/{offset}/{size}");
Operation.ThrowIfClosedOrDisposed (cancellationToken);
if (Operation.WriteBuffer != null)
throw new InvalidOperationException ();
if (buffer == null)
throw new ArgumentNullException (nameof (buffer));
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
var myWriteTcs = new TaskCompletionSource<int> ();
if (Interlocked.CompareExchange (ref pendingWrite, myWriteTcs, null) != null)
WebConnection.Debug ($"{ME} WRITE ASYNC: {buffer.Length}/{offset}/{count}");
if (cancellationToken.IsCancellationRequested)
return Task.FromCanceled (cancellationToken);
Operation.ThrowIfClosedOrDisposed (cancellationToken);
if (Operation.WriteBuffer != null)
throw new InvalidOperationException ();
var completion = new WebCompletionSource ();
if (Interlocked.CompareExchange (ref pendingWrite, completion, null) != null)
throw new InvalidOperationException (SR.GetString (SR.net_repcall));
return WriteAsyncInner (buffer, offset, count, completion, cancellationToken);
}
async Task WriteAsyncInner (byte[] buffer, int offset, int size,
WebCompletionSource completion,
CancellationToken cancellationToken)
{
try {
await ProcessWrite (buffer, offset, size, cancellationToken).ConfigureAwait (false);
@@ -162,20 +172,26 @@ namespace System.Net
await FinishWriting (cancellationToken);
pendingWrite = null;
myWriteTcs.TrySetResult (0);
completion.TrySetCompleted ();
} catch (Exception ex) {
KillBuffer ();
closed = true;
WebConnection.Debug ($"{ME} WRITE ASYNC EX: {ex.Message}");
if (ex is SocketException)
var oldError = Operation.CheckDisposed (cancellationToken);
if (oldError != null)
ex = oldError.SourceException;
else if (ex is SocketException)
ex = new IOException ("Error writing request", ex);
Operation.CompleteRequestWritten (this, ex);
pendingWrite = null;
myWriteTcs.TrySetException (ex);
completion.TrySetException (ex);
if (oldError != null)
oldError.Throw ();
throw;
}
}
@@ -227,12 +243,7 @@ namespace System.Net
}
}
try {
await InnerStream.WriteAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
} catch {
if (!IgnoreIOErrors)
throw;
}
await InnerStream.WriteAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
}
void CheckWriteOverflow (long contentLength, long totalWritten, long size)
@@ -360,26 +371,28 @@ namespace System.Net
async Task WriteChunkTrailer ()
{
using (var cts = new CancellationTokenSource ()) {
var cts = new CancellationTokenSource ();
try {
cts.CancelAfter (WriteTimeout);
var timeoutTask = Task.Delay (WriteTimeout);
var timeoutTask = Task.Delay (WriteTimeout, cts.Token);
while (true) {
var myWriteTcs = new TaskCompletionSource<int> ();
var oldTcs = Interlocked.CompareExchange (ref pendingWrite, myWriteTcs, null);
if (oldTcs == null)
var completion = new WebCompletionSource ();
var oldCompletion = Interlocked.CompareExchange (ref pendingWrite, completion, null);
if (oldCompletion == null)
break;
var ret = await Task.WhenAny (timeoutTask, oldTcs.Task).ConfigureAwait (false);
var oldWriteTask = oldCompletion.WaitForCompletion ();
var ret = await Task.WhenAny (timeoutTask, oldWriteTask).ConfigureAwait (false);
if (ret == timeoutTask)
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
}
try {
await WriteChunkTrailer_inner (cts.Token).ConfigureAwait (false);
} catch {
// Intentionally eating exceptions.
} finally {
pendingWrite = null;
}
await WriteChunkTrailer_inner (cts.Token).ConfigureAwait (false);
} catch {
// Intentionally eating exceptions.
} finally {
pendingWrite = null;
cts.Cancel ();
cts.Dispose ();
}
}
+198 -100
View File
@@ -24,7 +24,6 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
using System.IO;
using System.IO.Compression;
using System.Text;
using System.Collections;
using System.Collections.Generic;
@@ -37,12 +36,12 @@ namespace System.Net
{
class WebResponseStream : WebConnectionStream
{
Stream innerStreamWrapper;
BufferOffsetSize readBuffer;
long contentLength;
long totalRead;
bool nextReadCalled;
int stream_length; // -1 when CL not present
TaskCompletionSource<int> readTcs;
WebCompletionSource pendingRead;
object locker = new object ();
int nestedRead;
bool read_eof;
@@ -82,7 +81,6 @@ namespace System.Net
: base (request.Connection, request.Operation, request.InnerStream)
{
RequestStream = request;
request.InnerStream.ReadTimeout = ReadTimeout;
#if MONO_WEB_DEBUG
ME = $"WRP(Cnc={Connection.ID}, Op={Operation.ID})";
@@ -99,11 +97,17 @@ namespace System.Net
public override bool CanWrite => false;
bool ChunkedRead {
get; set;
protected bool ChunkedRead {
get;
private set;
}
public override async Task<int> ReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
protected MonoChunkStream ChunkStream {
get;
private set;
}
public override async Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} READ ASYNC");
@@ -115,33 +119,33 @@ namespace System.Net
int length = buffer.Length;
if (offset < 0 || length < offset)
throw new ArgumentOutOfRangeException (nameof (offset));
if (size < 0 || (length - offset) < size)
throw new ArgumentOutOfRangeException (nameof (size));
if (count < 0 || (length - offset) < count)
throw new ArgumentOutOfRangeException (nameof (count));
if (Interlocked.CompareExchange (ref nestedRead, 1, 0) != 0)
throw new InvalidOperationException ("Invalid nested call.");
var myReadTcs = new TaskCompletionSource<int> ();
var completion = new WebCompletionSource ();
while (!cancellationToken.IsCancellationRequested) {
/*
* 'readTcs' is set by ReadAllAsync().
* 'currentRead' is set by ReadAllAsync().
*/
var oldReadTcs = Interlocked.CompareExchange (ref readTcs, myReadTcs, null);
WebConnection.Debug ($"{ME} READ ASYNC #1: {oldReadTcs != null}");
if (oldReadTcs == null)
var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null);
WebConnection.Debug ($"{ME} READ ASYNC #1: {oldCompletion != null}");
if (oldCompletion == null)
break;
await oldReadTcs.Task.ConfigureAwait (false);
await oldCompletion.WaitForCompletion ().ConfigureAwait (false);
}
WebConnection.Debug ($"{ME} READ ASYNC #2: {totalRead} {contentLength}");
int nbytes = 0;
int oldBytes = 0, nbytes = 0;
Exception throwMe = null;
try {
// FIXME: NetworkStream.ReadAsync() does not support cancellation.
nbytes = await HttpWebRequest.RunWithTimeout (
ct => ProcessRead (buffer, offset, size, ct),
(oldBytes, nbytes) = await HttpWebRequest.RunWithTimeout (
ct => ProcessRead (buffer, offset, count, ct),
ReadTimeout, () => {
Operation.Abort ();
InnerStream.Dispose ();
@@ -150,80 +154,148 @@ namespace System.Net
throwMe = GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadAsync");
}
WebConnection.Debug ($"{ME} READ ASYNC #3: {totalRead} {contentLength} - {nbytes} {throwMe?.Message}");
WebConnection.Debug ($"{ME} READ ASYNC #3: {totalRead} {contentLength} - {oldBytes} {nbytes} {throwMe?.Message}");
if (throwMe != null) {
lock (locker) {
myReadTcs.TrySetException (throwMe);
readTcs = null;
completion.TrySetException (throwMe);
pendingRead = null;
nestedRead = 0;
}
closed = true;
Operation.CompleteResponseRead (false, throwMe);
Operation.Finish (false, throwMe);
throw throwMe;
}
lock (locker) {
readTcs.TrySetResult (nbytes);
readTcs = null;
pendingRead.TrySetCompleted ();
pendingRead = null;
nestedRead = 0;
}
if (totalRead >= contentLength && !nextReadCalled) {
WebConnection.Debug ($"{ME} READ ASYNC - READ COMPLETE: {nbytes} - {totalRead} {contentLength} {nextReadCalled}");
WebConnection.Debug ($"{ME} READ ASYNC - READ COMPLETE: {oldBytes} {nbytes} - {totalRead} {contentLength} {nextReadCalled}");
if (!nextReadCalled) {
nextReadCalled = true;
Operation.CompleteResponseRead (true);
Operation.Finish (true);
}
}
return nbytes;
return oldBytes + nbytes;
}
async Task<int> ProcessRead (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
async Task<(int, int)> ProcessRead (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} PROCESS READ: {totalRead} {contentLength}");
cancellationToken.ThrowIfCancellationRequested ();
if (read_eof || totalRead >= contentLength) {
if (totalRead >= contentLength) {
read_eof = true;
contentLength = totalRead;
return 0;
return (0, 0);
}
int oldBytes = 0;
int remaining = readBuffer?.Size ?? 0;
if (remaining > 0) {
int copy = (remaining > size) ? size : remaining;
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, buffer, offset, copy);
readBuffer.Offset += copy;
readBuffer.Size -= copy;
offset += copy;
size -= copy;
totalRead += copy;
if (totalRead >= contentLength) {
contentLength = totalRead;
read_eof = true;
}
if (size == 0 || totalRead >= contentLength)
return (0, copy);
oldBytes = copy;
}
if (contentLength != Int64.MaxValue && contentLength - totalRead < size)
size = (int)(contentLength - totalRead);
WebConnection.Debug ($"{ME} PROCESS READ #1: {size} {read_eof}");
WebConnection.Debug ($"{ME} PROCESS READ #1: {oldBytes} {size} {read_eof}");
if (read_eof) {
contentLength = totalRead;
return (oldBytes, 0);
}
var ret = await InnerReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
if (ret <= 0) {
read_eof = true;
contentLength = totalRead;
return ret;
return (oldBytes, 0);
}
totalRead += ret;
return ret;
return (oldBytes, ret);
}
async Task<int> InnerReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
internal async Task<int> InnerReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} INNER READ ASYNC");
Operation.ThrowIfDisposed (cancellationToken);
WebConnection.Debug ($"{ME} INNER READ ASYNC: stream={innerStreamWrapper}");
int nbytes = 0;
bool done = false;
if (!ChunkedRead || (!ChunkStream.DataAvailable && ChunkStream.WantMore)) {
nbytes = await InnerStream.ReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {nbytes} {ChunkedRead}");
if (!ChunkedRead)
return nbytes;
done = nbytes == 0;
}
try {
var ret = await innerStreamWrapper.ReadAsync (
buffer, offset, size, cancellationToken).ConfigureAwait (false);
WebConnection.Debug ($"{ME} INNER READ ASYNC DONE: {ret}");
return ret;
} catch (Exception ex) {
WebConnection.Debug ($"{ME} INNER READ ASYNC EX: {ex.Message}");
throw;
ChunkStream.WriteAndReadBack (buffer, offset, size, ref nbytes);
WebConnection.Debug ($"{ME} INNER READ ASYNC #1: {done} {nbytes} {ChunkStream.WantMore}");
if (!done && nbytes == 0 && ChunkStream.WantMore)
nbytes = await EnsureReadAsync (buffer, offset, size, cancellationToken).ConfigureAwait (false);
} catch (Exception e) {
if (e is WebException || e is OperationCanceledException)
throw;
throw new WebException ("Invalid chunked data.", e, WebExceptionStatus.ServerProtocolViolation, null);
}
if ((done || nbytes == 0) && ChunkStream.ChunkLeft != 0) {
// HandleError (WebExceptionStatus.ReceiveFailure, null, "chunked EndRead");
throw new WebException ("Read error", null, WebExceptionStatus.ReceiveFailure, null);
}
return nbytes;
}
async Task<int> EnsureReadAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
{
byte[] morebytes = null;
int nbytes = 0;
while (nbytes == 0 && ChunkStream.WantMore && !cancellationToken.IsCancellationRequested) {
int localsize = ChunkStream.ChunkLeft;
if (localsize <= 0) // not read chunk size yet
localsize = 1024;
else if (localsize > 16384)
localsize = 16384;
if (morebytes == null || morebytes.Length < localsize)
morebytes = new byte[localsize];
int nread = await InnerStream.ReadAsync (morebytes, 0, localsize, cancellationToken).ConfigureAwait (false);
if (nread <= 0)
return 0; // Error
ChunkStream.Write (morebytes, 0, nread);
nbytes += ChunkStream.Read (buffer, offset + nbytes, size - nbytes);
}
return nbytes;
}
bool CheckAuthHeader (string headerName)
@@ -248,7 +320,7 @@ namespace System.Net
}
}
void Initialize (BufferOffsetSize buffer)
async Task Initialize (BufferOffsetSize buffer, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} INIT: status={(int)StatusCode} bos={buffer.Offset}/{buffer.Size}");
@@ -277,28 +349,35 @@ namespace System.Net
if (!Int32.TryParse (clength, out stream_length))
stream_length = -1;
string me = "WebResponseStream.Initialize()";
string tencoding = null;
if (ExpectContent)
tencoding = Headers["Transfer-Encoding"];
ChunkedRead = (tencoding != null && tencoding.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1);
if (ChunkedRead) {
innerStreamWrapper = new MonoChunkStream (
Operation, CreateStreamWrapper (buffer), Headers);
} else if (!IsNtlmAuth () && contentLength > 0 && buffer.Size >= contentLength) {
innerStreamWrapper = new BufferedReadStream (Operation, null, buffer);
if (!ChunkedRead) {
readBuffer = buffer;
try {
if (contentLength > 0 && readBuffer.Size >= contentLength) {
if (!IsNtlmAuth ())
await ReadAllAsync (false, cancellationToken).ConfigureAwait (false);
}
} catch (Exception e) {
throw GetReadException (WebExceptionStatus.ReceiveFailure, e, me);
}
} else if (ChunkStream == null) {
try {
ChunkStream = new MonoChunkStream (buffer.Buffer, buffer.Offset, buffer.Offset + buffer.Size, Headers);
} catch (Exception e) {
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me);
}
} else {
innerStreamWrapper = CreateStreamWrapper (buffer);
}
string content_encoding = Headers["Content-Encoding"];
if (content_encoding == "gzip" && (Request.AutomaticDecompression & DecompressionMethods.GZip) != 0) {
innerStreamWrapper = new GZipStream (innerStreamWrapper, CompressionMode.Decompress);
Headers.Remove (HttpRequestHeader.ContentEncoding);
} else if (content_encoding == "deflate" && (Request.AutomaticDecompression & DecompressionMethods.Deflate) != 0) {
innerStreamWrapper = new DeflateStream (innerStreamWrapper, CompressionMode.Decompress);
Headers.Remove (HttpRequestHeader.ContentEncoding);
ChunkStream.ResetBuffer ();
try {
ChunkStream.Write (buffer.Buffer, buffer.Offset, buffer.Size);
} catch (Exception e) {
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, e, me);
}
}
WebConnection.Debug ($"{ME} INIT #1: - {ExpectContent} {closed} {nextReadCalled}");
@@ -309,17 +388,10 @@ namespace System.Net
contentLength = 0;
nextReadCalled = true;
}
Operation.CompleteResponseRead (true);
Operation.Finish (true);
}
}
Stream CreateStreamWrapper (BufferOffsetSize buffer)
{
if (buffer == null || buffer.Size == 0)
return InnerStream;
return new BufferedReadStream (Operation, InnerStream, buffer);
}
internal async Task ReadAllAsync (bool resending, CancellationToken cancellationToken)
{
WebConnection.Debug ($"{ME} READ ALL ASYNC: resending={resending} eof={read_eof} total={totalRead} " +
@@ -327,26 +399,33 @@ namespace System.Net
if (read_eof || totalRead >= contentLength || nextReadCalled) {
if (!nextReadCalled) {
nextReadCalled = true;
Operation.CompleteResponseRead (true);
Operation.Finish (true);
}
return;
}
var timeoutTask = Task.Delay (ReadTimeout);
var myReadTcs = new TaskCompletionSource<int> ();
while (true) {
/*
* 'readTcs' is set by ReadAsync().
*/
cancellationToken.ThrowIfCancellationRequested ();
var oldReadTcs = Interlocked.CompareExchange (ref readTcs, myReadTcs, null);
if (oldReadTcs == null)
break;
var completion = new WebCompletionSource ();
var timeoutCts = new CancellationTokenSource ();
try {
var timeoutTask = Task.Delay (ReadTimeout, timeoutCts.Token);
while (true) {
/*
* 'currentRead' is set by ReadAsync().
*/
cancellationToken.ThrowIfCancellationRequested ();
var oldCompletion = Interlocked.CompareExchange (ref pendingRead, completion, null);
if (oldCompletion == null)
break;
// ReadAsync() is in progress.
var anyTask = await Task.WhenAny (oldReadTcs.Task, timeoutTask).ConfigureAwait (false);
if (anyTask == timeoutTask)
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
// ReadAsync() is in progress.
var oldReadTask = oldCompletion.WaitForCompletion ();
var anyTask = await Task.WhenAny (oldReadTask, timeoutTask).ConfigureAwait (false);
if (anyTask == timeoutTask)
throw new WebException ("The operation has timed out.", WebExceptionStatus.Timeout);
}
} finally {
timeoutCts.Cancel ();
timeoutCts.Dispose ();
}
WebConnection.Debug ($"{ME} READ ALL ASYNC #1");
@@ -357,6 +436,7 @@ namespace System.Net
if (totalRead >= contentLength)
return;
byte[] b = null;
int new_size;
if (contentLength == Int64.MaxValue && !ChunkedRead) {
@@ -377,10 +457,19 @@ namespace System.Net
KeepAlive = false;
}
BufferOffsetSize bos;
if (contentLength == Int64.MaxValue) {
var ms = new MemoryStream ();
var buffer = new BufferOffsetSize (new byte[8192], false);
MemoryStream ms = new MemoryStream ();
BufferOffsetSize buffer = null;
if (readBuffer != null && readBuffer.Size > 0) {
ms.Write (readBuffer.Buffer, readBuffer.Offset, readBuffer.Size);
readBuffer.Offset = 0;
readBuffer.Size = readBuffer.Buffer.Length;
if (readBuffer.Buffer.Length >= 8192)
buffer = readBuffer;
}
if (buffer == null)
buffer = new BufferOffsetSize (new byte[8192], false);
int read;
while ((read = await InnerReadAsync (buffer.Buffer, buffer.Offset, buffer.Size, cancellationToken)) != 0)
@@ -388,39 +477,45 @@ namespace System.Net
new_size = (int)ms.Length;
contentLength = new_size;
bos = new BufferOffsetSize (ms.GetBuffer (), 0, new_size, false);
readBuffer = new BufferOffsetSize (ms.GetBuffer (), 0, new_size, false);
} else {
new_size = (int)(contentLength - totalRead);
var b = new byte[new_size];
b = new byte[new_size];
int readSize = 0;
int remaining = new_size;
if (readBuffer != null && readBuffer.Size > 0) {
readSize = readBuffer.Size;
if (readSize > new_size)
readSize = new_size;
Buffer.BlockCopy (readBuffer.Buffer, readBuffer.Offset, b, 0, readSize);
}
int remaining = new_size - readSize;
int r = -1;
while (remaining > 0 && r != 0) {
r = await InnerReadAsync (b, readSize, remaining, cancellationToken).ConfigureAwait (false);
r = await InnerReadAsync (b, readSize, remaining, cancellationToken);
remaining -= r;
readSize += r;
}
bos = new BufferOffsetSize (b, 0, new_size, false);
}
innerStreamWrapper = new BufferedReadStream (Operation, null, bos);
readBuffer = new BufferOffsetSize (b, 0, new_size, false);
totalRead = 0;
nextReadCalled = true;
myReadTcs.TrySetResult (new_size);
completion.TrySetCompleted ();
} catch (Exception ex) {
WebConnection.Debug ($"{ME} READ ALL ASYNC EX: {ex.Message}");
myReadTcs.TrySetException (ex);
completion.TrySetException (ex);
throw;
} finally {
WebConnection.Debug ($"{ME} READ ALL ASYNC #2");
readTcs = null;
pendingRead = null;
}
Operation.CompleteResponseRead (true);
Operation.Finish (true);
}
public override Task WriteAsync (byte[] buffer, int offset, int size, CancellationToken cancellationToken)
public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
{
return Task.FromException (new NotSupportedException (SR.net_readonlystream));
}
@@ -432,12 +527,12 @@ namespace System.Net
nextReadCalled = true;
if (totalRead >= contentLength) {
disposed = true;
Operation.CompleteResponseRead (true);
Operation.Finish (true);
} else {
// If we have not read all the contents
closed = true;
disposed = true;
Operation.CompleteResponseRead (false);
Operation.Finish (false);
}
}
}
@@ -516,7 +611,8 @@ namespace System.Net
WebConnection.Debug ($"{ME} INIT READ ASYNC LOOP DONE: {buffer.Offset} {buffer.Size}");
try {
Initialize (buffer);
Operation.ThrowIfDisposed (cancellationToken);
await Initialize (buffer, cancellationToken).ConfigureAwait (false);
} catch (Exception e) {
throw GetReadException (WebExceptionStatus.ReceiveFailure, e, "ReadDoneAsync6");
}
@@ -637,5 +733,7 @@ namespace System.Net
throw GetReadException (WebExceptionStatus.ServerProtocolViolation, null, "GetResponse");
}
}
}
+4 -4
View File
@@ -25,7 +25,7 @@ System/RemoteExecutorTests.cs
../../../external/corefx/src/Common/tests/System/Net/Configuration.cs
../../../external/corefx/src/Common/tests/System/Net/Configuration.Http.cs
../../../external/corefx/src/Common/tests/System/Net/Configuration.Certificates.cs
#../../../external/corefx/src/System.Net.Requests/tests/*.cs
#../../../external/corefx/src/System.Net.Requests/tests/*.cs:AuthenticationManagerTest.cs,FtpWebRequestTest.cs
# System.Net.WebHeaderCollection
#../../../external/corefx/src/System.Net.WebHeaderCollection/tests/*.cs
@@ -34,13 +34,13 @@ System/RemoteExecutorTests.cs
#../../../external/corefx/src/System.Net.NameResolution/tests/FunctionalTests/*.cs
# System.Net.WebClient
../../../external/corefx/src/System.Net.WebClient/tests/*.cs
../../../external/corefx/src/System.Net.WebClient/tests/*.cs:WebClientTest.cs
# System.Net.Security
../../../external/corefx/src/Common/tests/System/Net/SslProtocolSupport.cs
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/*.cs:TlsAlertsMatchWindowsInterop.cs
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/System/Security/Authentication/ExtendedProtection/*.cs
../../../external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/*.cs:FakeSslState.cs,FakeLazyAsyncResult.cs
#../../../external/corefx/src/System.Net.Security/tests/UnitTests/Fakes/*.cs:FakeSslState.cs,FakeLazyAsyncResult.cs
../../../external/corefx/src/Common/src/System/Net/Logging/NetEventSource.Common.cs
../../../external/corefx/src/Common/src/System/Net/InternalException.cs
../../../external/corefx/src/System.Net.Security/src/System/Net/Security/TlsAlertMessage.cs
@@ -53,7 +53,7 @@ System/RemoteExecutorTests.cs
#../../../external/corefx/src/System.Net.Ping/tests/FunctionalTests/*.cs
# System.Net.WebSockets
../../../external/corefx/src/System.Net.WebSockets/tests/*.cs
#../../../external/corefx/src/System.Net.WebSockets/tests/*.cs
# System.Net.WebProxy
#../../../external/corefx/src/System.Net.WebProxy/tests/*.cs
@@ -163,6 +163,7 @@ namespace MonoTests.System.Net.Sockets
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
[Ignore ("https://github.com/mono/mono/issues/6513")] // frequently fails on ARM
public void AcceptBlockingStatus()
{
bool block;
@@ -253,12 +254,11 @@ namespace MonoTests.System.Net.Sockets
{
Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
ClientSocket clnt = new ClientSocket (srv.LocalEndPoint);
Thread th = new Thread (new ThreadStart (clnt.ConnectSleepClose));
Socket acc = null;
try {
th.Start ();
acc = srv.Accept ();
clnt.Connect ();
clnt.Write ();
acc = srv.Accept ();
ArrayList list = new ArrayList ();
ArrayList empty = new ArrayList ();
list.Add (acc);
@@ -278,6 +278,7 @@ namespace MonoTests.System.Net.Sockets
if (acc != null)
acc.Close ();
srv.Close ();
clnt.Close ();
}
}
@@ -299,10 +300,13 @@ namespace MonoTests.System.Net.Sockets
sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
}
public void ConnectSleepClose ()
public void Connect ()
{
sock.Connect (ep);
Thread.Sleep (2000);
}
public void Close ()
{
sock.Close ();
}
@@ -209,6 +209,13 @@ namespace MonoTests.System.Net
}
}
[Test]
[Category("NotOnWindows")]
public void GetHostAddresses_IPv6 ()
{
var address = Dns.GetHostAddresses("ipv6.google.com");
}
[Test]
public void GetHostName ()
{
@@ -293,9 +293,6 @@ namespace MonoTests.System.Net
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
#if MONOTOUCH
[Ignore ("On device sometimes hangs in the call to listener.GetContext (). See bug #60542.")]
#endif
public void HttpRequestIgnoreBadCookies ()
{
@@ -2621,7 +2621,8 @@ namespace MonoTests.System.Net
var hwr = (HttpWebRequest)WebRequest.Create (uri);
hwr.Host = address2;
Assert.AreEqual (address2, hwr.Host, "#1");
var expected = "[2001::1:1:1:157:0]";
Assert.AreEqual (expected, hwr.Host, "#1");
}
[Test]
@@ -2642,21 +2643,6 @@ namespace MonoTests.System.Net
}
}
[Test]
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
public void AllowReadStreamBuffering ()
{
var hr = WebRequest.CreateHttp ("http://www.google.com");
Assert.IsFalse (hr.AllowReadStreamBuffering, "#1");
try {
hr.AllowReadStreamBuffering = true;
Assert.Fail ("#2");
} catch (InvalidOperationException) {
}
}
class ListenerScope : IDisposable {
EventWaitHandle completed;
public HttpListener listener;
@@ -3253,7 +3239,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.AreEqual ("size", ex.ParamName, "#A5");
Assert.AreEqual ("count", ex.ParamName, "#A5");
}
}
@@ -3284,7 +3270,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#2");
Assert.IsNull (ex.InnerException, "#3");
Assert.IsNotNull (ex.Message, "#4");
Assert.AreEqual ("size", ex.ParamName, "#5");
Assert.AreEqual ("count", ex.ParamName, "#5");
}
}
@@ -3471,6 +3457,7 @@ namespace MonoTests.System.Net
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
// Bug6737
// This test is supposed to fail prior to .NET 4.0
public void Post_EmptyRequestStream ()
@@ -875,7 +875,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.AreEqual ("size", ex.ParamName, "#A5");
Assert.AreEqual ("count", ex.ParamName, "#A5");
}
// read full response
@@ -890,7 +890,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
Assert.AreEqual ("size", ex.ParamName, "#B5");
Assert.AreEqual ("count", ex.ParamName, "#B5");
}
} finally {
rs.Close ();
@@ -928,7 +928,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#A2");
Assert.IsNull (ex.InnerException, "#A3");
Assert.IsNotNull (ex.Message, "#A4");
Assert.AreEqual ("size", ex.ParamName, "#A5");
Assert.AreEqual ("count", ex.ParamName, "#A5");
}
// read full response
@@ -943,7 +943,7 @@ namespace MonoTests.System.Net
Assert.AreEqual (typeof (ArgumentOutOfRangeException), ex.GetType (), "#B2");
Assert.IsNull (ex.InnerException, "#B3");
Assert.IsNotNull (ex.Message, "#B4");
Assert.AreEqual ("size", ex.ParamName, "#B5");
Assert.AreEqual ("count", ex.ParamName, "#B5");
}
} finally {
rs.Close ();
@@ -1221,6 +1221,7 @@ namespace MonoTests.System.Net
[Test]
[Category ("StaticLinkedAotNotWorking")] // Native MPH loading issues
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
#if FEATURE_NO_BSD_SOCKETS
[ExpectedException (typeof (PlatformNotSupportedException))]
#endif
@@ -241,9 +241,6 @@ public class IPAddressTest
[Test]
public void IsLoopbackV6 ()
{
// if (!Socket.SupportsIPv6)
// Assert.Ignore ("IPv6 must be enabled in machine.config");
IPAddress ip = IPAddress.IPv6Loopback;
Assert.IsTrue (IPAddress.IsLoopback (ip), "#1");
@@ -612,9 +609,6 @@ public class IPAddressTest
[Test]
public void ParseWrongV6 ()
{
//if (!Socket.SupportsIPv6)
// Assert.Ignore ("IPv6 must be enabled in machine.config");
for (int i = 0; i < ipv6ParseWrong.Length; i++) {
string ipAddress = ipv6ParseWrong [i];
@@ -1685,10 +1685,12 @@ namespace MonoTests.System.Net
// We throw a PlatformNotSupportedException deeper, which is caught and re-thrown as WebException
[ExpectedException (typeof (WebException))]
#endif
[Category ("MobileNotWorking")] // https://github.com/xamarin/xamarin-macios/issues/3827
[Category ("InetAccess")]
public void GetWebRequestOverriding ()
{
GetWebRequestOverridingTestClass testObject = new GetWebRequestOverridingTestClass ();
testObject.DownloadData ("http://www.mono-project.com");
testObject.DownloadData ("http://www.example.com");
Assert.IsTrue (testObject.overridedCodeRan, "Overrided code wasn't called");
}
@@ -88,7 +88,7 @@ namespace MonoTests.System.Net
WebClient wc = new WebClient ();
string filename = Path.GetTempFileName ();
var task = wc.DownloadFileTaskAsync ("http://www.mono-project.com/", filename);
var task = wc.DownloadFileTaskAsync ("http://www.example.com/", filename);
Assert.IsTrue (task.Wait (15000));
Assert.IsTrue (task.IsCompleted);
Loaded 100 of 326 files, more files were not shown because too many files have changed in this diff. Show more