mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-15 17:10:51 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d9001b5ae7 | ||
|
|
e69d4b57d7 | ||
|
|
fd9f379d29 | ||
|
|
e3084ecece | ||
|
|
da5b1c675d | ||
|
|
bef1e63358 | ||
|
|
56325f4097 | ||
|
|
c4a1b40fbd | ||
|
|
0c9250280d | ||
|
|
14aac0c541 | ||
|
|
a77128ca79 | ||
|
|
296a9afdb2 | ||
|
|
e59c3fbb68 | ||
|
|
062f0ab8ca | ||
|
|
e1ef774391 | ||
|
|
6d1f88e0ad | ||
|
|
a3f3bfc4c3 | ||
|
|
9bd3079f1c | ||
|
|
6ac1ff75a2 | ||
|
|
a119807a01 | ||
|
|
d234d34b70 | ||
|
|
444a9a3fc4 | ||
|
|
8946e49a97 | ||
|
|
5c784c9747 | ||
|
|
fdb704901e | ||
|
|
92a177923c | ||
|
|
1b2e536b22 | ||
|
|
ec4ef9bc34 | ||
|
|
cc8deca901 | ||
|
|
335f0109c5 | ||
|
|
90d6e496e4 | ||
|
|
4b60e7f930 | ||
|
|
989333d6ae | ||
|
|
baa12e5d24 | ||
|
|
ef75d4bef7 | ||
|
|
01dbbb746f | ||
|
|
51a3dc37da | ||
|
|
3eb5f34f54 | ||
|
|
b601371d5f | ||
|
|
6184ff007b | ||
|
|
8969f2cc99 | ||
|
|
3009440108 | ||
|
|
df5e13f95d | ||
|
|
11e1499c22 | ||
|
|
7dbad3c361 | ||
|
|
9a88a36789 | ||
|
|
0f241c975c | ||
|
|
7ebe1a1763 | ||
|
|
b759449ba8 | ||
|
|
617f399efc | ||
|
|
77258ea112 | ||
|
|
f83c321f88 | ||
|
|
1ecd094b44 | ||
|
|
54a33be9de | ||
|
|
72128bb00d | ||
|
|
65a972c033 | ||
|
|
9e6def1553 | ||
|
|
8a707cc012 | ||
|
|
bd72952cf8 | ||
|
|
b6efc0cc90 | ||
|
|
2869cd5f67 | ||
|
|
a64a25695d | ||
|
|
57f068438d | ||
|
|
528103728f | ||
|
|
d8441deead | ||
|
|
7ae0f38fd7 | ||
|
|
61ca7fe3a4 | ||
|
|
c99adb97ed | ||
|
|
6a8aced231 | ||
|
|
af008b207d | ||
|
|
6d40f13121 | ||
|
|
4546440471 | ||
|
|
4c31bdabf3 | ||
|
|
d73a286a2c | ||
|
|
dacef517fa | ||
|
|
d1ca1a5d2e | ||
|
|
1d55b355f3 | ||
|
|
bb522edb0d | ||
|
|
7f7b5c9f3e | ||
|
|
c87f99dd81 | ||
|
|
065499c2ef | ||
|
|
9f7b2c8d0a | ||
|
|
2c003ec71d | ||
|
|
e02e823ef7 | ||
|
|
70d6903053 | ||
|
|
4bff2b6370 | ||
|
|
81894ec8ca | ||
|
|
bfbf823ca1 | ||
|
|
ce01b20a4d | ||
|
|
7a587d7fa6 | ||
|
|
35e454a8f6 | ||
|
|
75eb342f53 | ||
|
|
5881981f79 | ||
|
|
6290b6cd6e | ||
|
|
a0e7f9eaf2 | ||
|
|
6275840a7f | ||
|
|
25f6093283 | ||
|
|
7ec17ba1be | ||
|
|
f755f3b539 | ||
|
|
5f9a2db39b | ||
|
|
f31f5ea1f1 | ||
|
|
20308e6f87 | ||
|
|
cecda47c48 | ||
|
|
824cc12ac3 | ||
|
|
b77dc06a7e | ||
|
|
1848d78d60 | ||
|
|
da0086e304 | ||
|
|
0297b21b03 | ||
|
|
40631e3b9e | ||
|
|
68b77674e2 | ||
|
|
4a0b4f41ed | ||
|
|
7a1f63fde6 | ||
|
|
29b1ac19c9 | ||
|
|
71e34edce2 | ||
|
|
1ecb6e59de | ||
|
|
17ba402d80 | ||
|
|
ded02bc115 | ||
|
|
585f244aed | ||
|
|
23cc371009 | ||
|
|
ce6fa810dd | ||
|
|
bff42f3540 | ||
|
|
076bab44f6 | ||
|
|
75f2ac15bd | ||
|
|
44e1854943 | ||
|
|
53cc8a61dc | ||
|
|
6717bcb8b6 | ||
|
|
d82d780e42 | ||
|
|
13bc35face | ||
|
|
8df98444c1 | ||
|
|
d63841057e | ||
|
|
dc98767858 | ||
|
|
472f0820d3 | ||
|
|
2ad05ee764 | ||
|
|
32ded2e340 | ||
|
|
d80d33b053 | ||
|
|
04c9f2f442 | ||
|
|
c0f0ff02fc | ||
|
|
a8c9ef3b66 | ||
|
|
31f480c436 | ||
|
|
6df5f69b26 | ||
|
|
94ec04bfdb | ||
|
|
a5184ed8ed | ||
|
|
4087eba140 | ||
|
|
2ef68dc530 | ||
|
|
64f9c2de6f | ||
|
|
2f373a9ad4 | ||
|
|
c51c60988b | ||
|
|
f333a19c3a | ||
|
|
abf46116ef | ||
|
|
ec590ad3eb | ||
|
|
dc534a8d3f | ||
|
|
835c26154c | ||
|
|
03be2643f5 | ||
|
|
f69128c70a | ||
|
|
ac12ebc375 | ||
|
|
595b7821e3 | ||
|
|
409c0a7c2d | ||
|
|
a9658665bf | ||
|
|
4fd89f9b11 | ||
|
|
0707345b89 | ||
|
|
0bb83d064d | ||
|
|
3115d3a0c0 | ||
|
|
8c27e2adf9 | ||
|
|
f8e9a15ed7 | ||
|
|
d1bd30f22d | ||
|
|
1c57af4dc0 | ||
|
|
85cecac278 |
No files matched your search
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"name": "roslyn",
|
||||
"url": "git://github.com/mono/roslyn.git",
|
||||
"rev": "7a840bd5697ef6ea41f554a09d837636fba9d88d",
|
||||
"rev": "6bfcd4e770609a38b8523e83ce1ec943162f30bb",
|
||||
"remote-branch": "origin/mono-testing",
|
||||
"branch": "mono-testing",
|
||||
"directory": "roslyn"
|
||||
|
||||
@@ -574,6 +574,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ilasm", "mcs/ilasm/ilasm.cs
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "al", "mcs/tools/al/al.csproj", "{0A20671F-CCA9-457D-886C-0828C7D64128}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "aprofutil", "mcs/tools/aprofutil/aprofutil.csproj", "{658B566B-CED1-4C42-9926-C1AA930BA368}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "monolinker", "mcs/tools/linker/monolinker.csproj", "{D60432F1-3C12-4235-A1CC-4CA5575403BD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "culevel", "mcs/tools/culevel/culevel.csproj", "{E8E246BD-CD0C-4734-A3C2-7F44796EC47B}"
|
||||
@@ -4012,24 +4014,42 @@ Global
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|net_4_x.Build.0 = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|net_4_x.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|net_4_x.Build.0 = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monodroid.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monodroid.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_tv.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_tv.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_watch.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_watch.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|orbis.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|orbis.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|unreal.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|unreal.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|wasm.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|wasm.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|winaot.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|winaot.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|xammac.ActiveCfg = Debug|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|xammac.ActiveCfg = Release|net_4_x
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monodroid.ActiveCfg = Debug|monodroid
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monodroid.Build.0 = Debug|monodroid
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monodroid.ActiveCfg = Release|monodroid
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monodroid.Build.0 = Release|monodroid
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch.ActiveCfg = Debug|monotouch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch.Build.0 = Debug|monotouch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch.ActiveCfg = Release|monotouch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch.Build.0 = Release|monotouch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_tv.ActiveCfg = Debug|monotouch_tv
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_tv.Build.0 = Debug|monotouch_tv
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_tv.ActiveCfg = Release|monotouch_tv
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_tv.Build.0 = Release|monotouch_tv
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_watch.ActiveCfg = Debug|monotouch_watch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|monotouch_watch.Build.0 = Debug|monotouch_watch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_watch.ActiveCfg = Release|monotouch_watch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|monotouch_watch.Build.0 = Release|monotouch_watch
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|orbis.ActiveCfg = Debug|orbis
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|orbis.Build.0 = Debug|orbis
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|orbis.ActiveCfg = Release|orbis
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|orbis.Build.0 = Release|orbis
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|unreal.ActiveCfg = Debug|unreal
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|unreal.Build.0 = Debug|unreal
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|unreal.ActiveCfg = Release|unreal
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|unreal.Build.0 = Release|unreal
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|wasm.ActiveCfg = Debug|wasm
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|wasm.Build.0 = Debug|wasm
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|wasm.ActiveCfg = Release|wasm
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|wasm.Build.0 = Release|wasm
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|winaot.ActiveCfg = Debug|winaot
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|winaot.Build.0 = Debug|winaot
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|winaot.ActiveCfg = Release|winaot
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|winaot.Build.0 = Release|winaot
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|xammac.ActiveCfg = Debug|xammac
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Debug|xammac.Build.0 = Debug|xammac
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|xammac.ActiveCfg = Release|xammac
|
||||
{AC3AC4DA-7C10-4AE9-A131-6DBBE61432E3}.Release|xammac.Build.0 = Release|xammac
|
||||
{7C660E7A-C89B-4ACA-9458-492B6D14B168}.Debug|net_4_x.ActiveCfg = Debug|net_4_x
|
||||
{7C660E7A-C89B-4ACA-9458-492B6D14B168}.Debug|net_4_x.Build.0 = Debug|net_4_x
|
||||
{7C660E7A-C89B-4ACA-9458-492B6D14B168}.Release|net_4_x.ActiveCfg = Release|net_4_x
|
||||
@@ -10100,6 +10120,28 @@ Global
|
||||
{0A20671F-CCA9-457D-886C-0828C7D64128}.Release|winaot.ActiveCfg = Release|net_4_x
|
||||
{0A20671F-CCA9-457D-886C-0828C7D64128}.Debug|xammac.ActiveCfg = Debug|net_4_x
|
||||
{0A20671F-CCA9-457D-886C-0828C7D64128}.Release|xammac.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|net_4_x.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|net_4_x.Build.0 = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|net_4_x.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|net_4_x.Build.0 = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|monodroid.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|monodroid.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|monotouch.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|monotouch.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|monotouch_tv.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|monotouch_tv.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|monotouch_watch.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|monotouch_watch.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|orbis.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|orbis.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|unreal.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|unreal.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|wasm.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|wasm.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|winaot.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|winaot.ActiveCfg = Release|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Debug|xammac.ActiveCfg = Debug|net_4_x
|
||||
{658B566B-CED1-4C42-9926-C1AA930BA368}.Release|xammac.ActiveCfg = Release|net_4_x
|
||||
{D60432F1-3C12-4235-A1CC-4CA5575403BD}.Debug|net_4_x.ActiveCfg = Debug|net_4_x
|
||||
{D60432F1-3C12-4235-A1CC-4CA5575403BD}.Debug|net_4_x.Build.0 = Debug|net_4_x
|
||||
{D60432F1-3C12-4235-A1CC-4CA5575403BD}.Release|net_4_x.ActiveCfg = Release|net_4_x
|
||||
|
||||
+58
-56
@@ -4,7 +4,7 @@
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
AC_INIT(mono, [6.5.0],
|
||||
AC_INIT(mono, [6.6.0],
|
||||
[https://github.com/mono/mono/issues/new])
|
||||
|
||||
AC_CONFIG_SRCDIR([README.md])
|
||||
@@ -62,7 +62,7 @@ MONO_VERSION_BUILD=`echo $VERSION | cut -d . -f 3`
|
||||
# This line is parsed by tools besides autoconf, such as msvc/mono.winconfig.targets.
|
||||
# It should remain in the format they expect.
|
||||
#
|
||||
MONO_CORLIB_VERSION=2cfaeda3-94a9-44e5-8fcb-51979a3398c9
|
||||
MONO_CORLIB_VERSION=A144A63D-652C-4CCF-A9EE-8E5A091547F1
|
||||
|
||||
#
|
||||
# Put a quoted #define in config.h.
|
||||
@@ -692,12 +692,12 @@ AC_CHECK_HEADERS(linux/serial.h)
|
||||
case "$host" in
|
||||
# Use bundled zlib on Windows to be sure it is static.
|
||||
*-mingw*|*-cygwin*)
|
||||
have_zlib=no
|
||||
have_sys_zlib=no
|
||||
zlib_msg="bundled zlib"
|
||||
;;
|
||||
default)
|
||||
AC_CHECK_HEADER(zlib.h, [have_zlib=yes], [have_zlib=no])
|
||||
if test x$have_zlib = xyes; then
|
||||
*)
|
||||
AC_CHECK_HEADER(zlib.h, [have_sys_zlib=yes], [have_sys_zlib=no])
|
||||
if test x$have_sys_zlib = xyes; then
|
||||
AC_TRY_COMPILE([#include <zlib.h>], [
|
||||
#if defined(ZLIB_VERNUM) && (ZLIB_VERNUM >= 0x1230)
|
||||
#else
|
||||
@@ -706,12 +706,16 @@ case "$host" in
|
||||
],[
|
||||
AC_MSG_RESULT(Using system zlib)
|
||||
zlib_msg="system zlib"
|
||||
AC_DEFINE(HAVE_SYS_ZLIB,1,[Have system zlib])
|
||||
have_sys_zlib=yes
|
||||
],[
|
||||
AC_MSG_RESULT(Using embedded zlib)
|
||||
have_zlib=no
|
||||
AC_MSG_RESULT(zlib too old, using embedded zlib)
|
||||
have_sys_zlib=no
|
||||
zlib_msg="bundled zlib"
|
||||
])
|
||||
else
|
||||
AC_MSG_RESULT(zlib not found, using embedded zlib)
|
||||
have_sys_zlib=no
|
||||
zlib_msg="bundled zlib"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@@ -719,13 +723,19 @@ esac
|
||||
AC_ARG_WITH(static-zlib, [ --with-static-zlib=PATH use the specified static zlib instead of -lz],[STATIC_ZLIB_PATH=$with_static_zlib],[STATIC_ZLIB_PATH=])
|
||||
if test "x$STATIC_ZLIB_PATH" != "x"; then
|
||||
have_static_zlib=yes
|
||||
have_sys_zlib=no
|
||||
zlib_msg="static zlib from $STATIC_ZLIB_PATH"
|
||||
AC_SUBST(STATIC_ZLIB_PATH)
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(HAVE_STATIC_ZLIB, test x$have_static_zlib = xyes)
|
||||
AM_CONDITIONAL(HAVE_ZLIB, test x$have_zlib = xyes)
|
||||
AC_DEFINE(HAVE_ZLIB,1,[Have system zlib])
|
||||
|
||||
AM_CONDITIONAL(HAVE_SYS_ZLIB, test x$have_sys_zlib = xyes)
|
||||
if test x$have_static_zlib = xyes; then
|
||||
AC_DEFINE(HAVE_STATIC_ZLIB, 1, [Use static zlib])
|
||||
fi
|
||||
if test x$have_sys_zlib = xyes; then
|
||||
AC_DEFINE(HAVE_SYS_ZLIB, 1, [Use OS-provided zlib])
|
||||
fi
|
||||
# for mono/metadata/debug-symfile.c
|
||||
AC_CHECK_HEADERS(elf.h)
|
||||
|
||||
@@ -1324,10 +1334,9 @@ with_wasm_default=no
|
||||
with_bitcode_default=no
|
||||
enable_cooperative_suspend_default=no
|
||||
enable_hybrid_suspend_default=no
|
||||
enable_copy_stack_data_default=yes
|
||||
|
||||
# For the sake of clearer error messages, these numbers should all be different from each other.
|
||||
INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=10000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4400,nftnptr-arg-trampolines=4000
|
||||
INVARIANT_AOT_OPTIONS=nimt-trampolines=2000,ntrampolines=10000,nrgctx-fetch-trampolines=256,ngsharedvt-trampolines=4400,nftnptr-arg-trampolines=4000,nrgctx-trampolines=21000
|
||||
|
||||
AOT_BUILD_ATTRS=$INVARIANT_AOT_OPTIONS
|
||||
|
||||
@@ -3382,13 +3391,29 @@ if test x$host_win32 = xno; then
|
||||
AC_CHECK_DECL(ICANON, [AC_DEFINE(HAVE_ICANON, 1, [ICANON])], [], [[#include <termios.h>]])
|
||||
AC_CHECK_DECL(TCSANOW, [AC_DEFINE(HAVE_TCSANOW, 1, [TCSANOW])], [], [[#include <termios.h>]])
|
||||
|
||||
AC_CHECK_MEMBER(struct stat.st_birthtimespec, [AC_DEFINE(HAVE_STAT_BIRTHTIME, 1, [struct stat.st_birthtime])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
|
||||
AC_CHECK_MEMBER(struct stat.st_atimespec, [AC_DEFINE(HAVE_STAT_TIMESPEC, 1, [struct stat.st_atimespec])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
|
||||
AC_CHECK_MEMBER(struct stat.st_atim, [AC_DEFINE(HAVE_STAT_TIM, 1, [struct stat.st_atim])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
|
||||
AC_CHECK_MEMBER(struct stat.st_atimensec, [AC_DEFINE(HAVE_STAT_NSEC, 1, [struct stat.st_atimensec])], [], [[#include <sys/types.h>], [#include <sys/stat.h>]])
|
||||
AC_CHECK_MEMBER(struct dirent.d_namlen, [AC_DEFINE(HAVE_DIRENT_NAME_LEN, 1, [struct dirent.d_namlen])], [], [[#include <dirent.h>]])
|
||||
AC_CHECK_MEMBER(struct statfs.f_fstypename, [AC_DEFINE(HAVE_STATFS_FSTYPENAME, 1, [struct statfs.f_fstypename])], [], [[#include <sys/mount.h>]])
|
||||
AC_CHECK_MEMBER(struct statvfs.f_fstypename, [AC_DEFINE(HAVE_STATVFS_FSTYPENAME, 1, [struct statvfs.f_fstypename])], [], [[#include <sys/mount.h>]])
|
||||
AC_CHECK_MEMBER(struct stat.st_birthtimespec,
|
||||
[AC_DEFINE(HAVE_STAT_BIRTHTIME, 1, [struct stat.st_birthtimespec])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/stat.h>])
|
||||
AC_CHECK_MEMBER(struct stat.st_atimespec,
|
||||
[AC_DEFINE(HAVE_STAT_TIMESPEC, 1, [struct stat.st_atimespec])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/stat.h>])
|
||||
AC_CHECK_MEMBER(struct stat.st_atim,
|
||||
[AC_DEFINE(HAVE_STAT_TIM, 1, [struct stat.st_atim])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/stat.h>])
|
||||
AC_CHECK_MEMBER(struct stat.st_atimensec,
|
||||
[AC_DEFINE(HAVE_STAT_NSEC, 1, [struct stat.st_atimensec])],
|
||||
[],
|
||||
[#include <sys/types.h>
|
||||
#include <sys/stat.h>])
|
||||
AC_CHECK_MEMBER(struct dirent.d_namlen, [AC_DEFINE(HAVE_DIRENT_NAME_LEN, 1, [struct dirent.d_namlen])], [], [#include <dirent.h>])
|
||||
AC_CHECK_MEMBER(struct statfs.f_fstypename, [AC_DEFINE(HAVE_STATFS_FSTYPENAME, 1, [struct statfs.f_fstypename])], [], [#include <sys/mount.h>])
|
||||
AC_CHECK_MEMBER(struct statvfs.f_fstypename, [AC_DEFINE(HAVE_STATVFS_FSTYPENAME, 1, [struct statvfs.f_fstypename])], [], [#include <sys/mount.h>])
|
||||
|
||||
AC_MSG_CHECKING(for struct statfs)
|
||||
AC_TRY_COMPILE([
|
||||
@@ -3753,6 +3778,7 @@ if test x$host_win32 = xno; then
|
||||
AC_DEFINE(HAVE_GSSFW_HEADERS, 1, [GSS/GSS.h])
|
||||
AC_DEFINE(HAVE_GSS_SPNEGO_MECHANISM, 1, [GSS_SPNEGO_MECHANISM])
|
||||
enable_gss=yes
|
||||
AC_DEFINE(ENABLE_GSS, 1, [ENABLE_GSS])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
@@ -3764,6 +3790,7 @@ if test x$host_win32 = xno; then
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
enable_gss=yes
|
||||
AC_DEFINE(ENABLE_GSS, 1, [ENABLE_GSS])
|
||||
], [
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
@@ -4597,6 +4624,7 @@ if test "x$host" != "x$target"; then
|
||||
aarch64*darwin*_ilp32)
|
||||
TARGET=ARM6432;
|
||||
AC_DEFINE(MONO_ARCH_ILP32, 1, [64 bit mode with 4 byte longs and pointers])
|
||||
sizeof_register=8
|
||||
AC_DEFINE(TARGET_WATCHOS, 1, [...])
|
||||
;;
|
||||
aarch64-*)
|
||||
@@ -5647,38 +5675,6 @@ AM_CONDITIONAL([ENABLE_HYBRID_SUSPEND], [test x$enable_hybrid_suspend != xno])
|
||||
|
||||
dnl End of thread suspend policy
|
||||
|
||||
dnl *******************************
|
||||
dnl *** Copy stack data support ***
|
||||
dnl *******************************
|
||||
|
||||
dnl Disable copy_stack_data on platforms supporting full context and
|
||||
dnl having access to full stack of running threads.
|
||||
if test x$enable_copy_stack_data_default != xno; then
|
||||
case $HOST in
|
||||
X86 | AMD64)
|
||||
if test x$target_osx = xyes; then
|
||||
dnl Some host/target confusion, there's no host_osx (and
|
||||
dnl host_darwin would be true on iOS not just macOS).
|
||||
enable_copy_stack_data_default=no
|
||||
elif test x$host_linux = xyes -o x$host_win32 = xyes; then
|
||||
enable_copy_stack_data_default=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
AC_ARG_ENABLE(copy_stack_data, [ --enable-copy-stack-data Enable copy_stack_data feature for hybrid/cooperative suspend scenarios, (defaults to yes)], [], [enable_copy_stack_data=default])
|
||||
|
||||
if test x$enable_copy_stack_data = xdefault; then
|
||||
enable_copy_stack_data=$enable_copy_stack_data_default
|
||||
fi
|
||||
|
||||
if test x$enable_copy_stack_data != xno ; then
|
||||
AC_DEFINE(ENABLE_COPY_STACK_DATA,1,[Enable copy_stack_data feature for hybrid/cooperative suspend scenarios])
|
||||
fi
|
||||
|
||||
dnl End of Copy stack data support
|
||||
|
||||
dnl ***************************
|
||||
dnl *** feature experiments ***
|
||||
dnl ***************************
|
||||
@@ -6030,8 +6026,8 @@ fi
|
||||
AC_SUBST(mono_runtime)
|
||||
AC_SUBST(mono_runtime_wrapper)
|
||||
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.1.0-release/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.1.0-release/VBCSCompiler.exe
|
||||
CSC_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.4.0/csc.exe
|
||||
VBCS_LOCATION=`cd $srcdir && pwd`/external/roslyn-binaries/Microsoft.Net.Compilers/3.4.0/VBCSCompiler.exe
|
||||
|
||||
if test $csc_compiler = mcs; then
|
||||
CSC=$mcs_topdir/class/lib/build/mcs.exe
|
||||
@@ -6068,6 +6064,7 @@ AC_CONFIG_FILES([po/mcs/Makefile.in])
|
||||
AC_CONFIG_FILES([acceptance-tests/microbench-perf.sh],[chmod +x acceptance-tests/microbench-perf.sh])
|
||||
AC_CONFIG_FILES([runtime/mono-wrapper],[chmod +x runtime/mono-wrapper])
|
||||
AC_CONFIG_FILES([runtime/monodis-wrapper],[chmod +x runtime/monodis-wrapper])
|
||||
AC_CONFIG_FILES([runtime/bin/mono-hang-watchdog],[chmod +x runtime/bin/mono-hang-watchdog])
|
||||
|
||||
AC_CONFIG_COMMANDS([runtime/etc/mono/1.0/machine.config],
|
||||
[ depth=../../../..
|
||||
@@ -6396,7 +6393,11 @@ elif test x$host_linux = xyes; then
|
||||
MONO_NATIVE_CXXFLAGS=$CXXFLAGS
|
||||
MONO_NATIVE_CFLAGS=$CFLAGS
|
||||
MONO_NATIVE_LDFLAGS=$LDFLAGS
|
||||
|
||||
if test x$enable_gss = xyes; then
|
||||
MONO_NATIVE_LDFLAGS="$MONO_NATIVE_LDFLAGS -lgssapi_krb5"
|
||||
else
|
||||
AC_MSG_WARN([GSS is not enabled, it requires libkrb5-dev package])
|
||||
fi
|
||||
mono_native=yes
|
||||
mono_native_compat=no
|
||||
MONO_NATIVE_PLATFORM=linux
|
||||
@@ -6722,6 +6723,7 @@ tools/Makefile
|
||||
tools/locale-builder/Makefile
|
||||
tools/sgen/Makefile
|
||||
tools/pedump/Makefile
|
||||
tools/mono-hang-watchdog/Makefile
|
||||
runtime/Makefile
|
||||
msvc/Makefile
|
||||
po/Makefile
|
||||
|
||||
@@ -18,6 +18,27 @@ convert.exe: $(srcdir)/convert.cs AgilityPack.dll
|
||||
AgilityPack.dll:
|
||||
$(CSCOMPILE) -r:$(topdir)/class/lib/$(PROFILE)/mscorlib.dll -r:$(topdir)/class/lib/$(PROFILE)/System.dll -r:$(topdir)/class/lib/$(PROFILE)/System.Xml.dll -target:library -out:$@ $(srcdir)/HtmlAgilityPack/*.cs
|
||||
|
||||
ifdef MCS_MODE
|
||||
monoapi.zip:
|
||||
touch $@
|
||||
|
||||
monoapi.tree: monoapi.zip
|
||||
touch $@
|
||||
|
||||
mono-tools.zip:
|
||||
touch $@
|
||||
|
||||
mono-tools.tree: mono-tools.zip
|
||||
touch $@
|
||||
|
||||
mono-file-formats.zip:
|
||||
touch $@
|
||||
|
||||
mono-file-formats.tree: mono-file-formats.zip
|
||||
touch $@
|
||||
|
||||
else
|
||||
|
||||
monoapi.zip: monoapi.tree
|
||||
@test -f $@ || { rm -f $< && $(MAKE) $<; }
|
||||
|
||||
@@ -36,5 +57,7 @@ mono-file-formats.zip: mono-file-formats.tree
|
||||
mono-file-formats.tree: $(srcdir)/mono-file-formats.config $(srcdir)/docs.make
|
||||
$(MDOC) assemble -o mono-file-formats -f man $<
|
||||
|
||||
endif
|
||||
|
||||
.doc-stamp:
|
||||
|
||||
Vendored
+1
-1
Submodule external/api-doc-tools updated: d03e819838...5da8127af9.
Vendored
+1
-1
Submodule external/api-snapshot updated: fc50bc4f8f...7753b25789.
Vendored
+1
-1
Submodule external/binary-reference-assemblies updated: e5173a5531...4e3d4446a3.
Vendored
+1
-1
Submodule external/bockbuild updated: ebd7067a49...a6beda3f67.
Vendored
+1
-1
Submodule external/cecil updated: a6c8f5e107...cb6c1ca9aa.
Vendored
+1
-1
Submodule external/corefx updated: e4f7102bf7...ce3063888d.
Vendored
+1
-1
Submodule external/ikvm updated: 847e05fced...9f805dcf8a.
Vendored
+1
-1
Submodule external/linker updated: ebe2a1f4b9...1f87de35a9.
Vendored
+1
-1
Submodule external/roslyn-binaries updated: 38979ff887...419b2452de.
+1
-1
@@ -12,7 +12,7 @@ endif
|
||||
if HAVE_STATIC_ZLIB
|
||||
llvm_extra_libs = $(STATIC_ZLIB_PATH)
|
||||
else
|
||||
if HAVE_ZLIB
|
||||
if HAVE_SYS_ZLIB
|
||||
llvm_extra_libs=-lz
|
||||
else
|
||||
llvm_extra_libs=
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
man_MANS = \
|
||||
al.1 \
|
||||
aprofutil.1 \
|
||||
cert2spc.1 \
|
||||
certmgr.1 \
|
||||
cert-sync.1 \
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
.TH aprofutil 1
|
||||
.SH NAME
|
||||
aprofutil \- Mono's AOT profile tool
|
||||
.SH SYNOPSIS
|
||||
.B aprofutil
|
||||
\fR[\fIoptions\fR] <\fIyour-aot-profile.aotprofile\fR>
|
||||
.SH DESCRIPTION
|
||||
AOT profile tool is a tool to inspect AOT profiler files.
|
||||
.PP
|
||||
It can be used to show, filter and write the profiler file content in readable text form.
|
||||
.SH OPTIONS
|
||||
.nf
|
||||
.RS
|
||||
-h, --help, -? Show this message and exit
|
||||
-a, --all Show modules, types and methods in the profile
|
||||
-d, --modules Show modules in the profile
|
||||
--filter-method=VALUE Filter by method with regex VALUE
|
||||
--filter-module=VALUE Filter by module with regex VALUE
|
||||
--filter-type=VALUE Filter by type with regex VALUE
|
||||
-m, --methods Show methods in the profile
|
||||
-o, --output=VALUE Write profile to OUTPUT file
|
||||
-s, --summary Show summary of the profile
|
||||
-t, --types Show types in the profile
|
||||
-v, --verbose Output information about progress during the run
|
||||
of the tool
|
||||
.RE
|
||||
.fi
|
||||
.SH EXAMPLES
|
||||
Display modules and summary of XA startup profile
|
||||
.PP
|
||||
.nf
|
||||
.RS
|
||||
mono aprofutil.exe -sd startup.aotprofile
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
Output:
|
||||
.PP
|
||||
.nf
|
||||
.RS
|
||||
Modules:
|
||||
41C38B0A-2032-45CE-8638-0299CED65330 mscorlib
|
||||
0326DF03-2158-4F7A-9A2B-B7A9419F021D Mono.Android
|
||||
8FB63BB4-1195-4173-A9ED-0EC341B07C32 System
|
||||
74C06E06-C1C7-4A4C-B64E-EAC7DBB08BBC Java.Interop
|
||||
11E2319F-6A26-461C-9C46-C972248BEE4B System.Core
|
||||
7999CC4B-D566-4ECA-8A72-469344172CA3 Xamarin.Forms.Platform.Android
|
||||
C5089213-328B-451D-BA87-D6585C120780 Xamarin.Forms.Performance.Integration.Droid
|
||||
D754F8AE-503C-41C8-B16F-647FC662507A Xamarin.Android.Support.v7.AppCompat
|
||||
929ECB6D-1171-4C66-8470-DD32AC608969 Xamarin.Android.Support.Fragment
|
||||
F841E23B-59A8-4AE2-9A84-D2FC1D891B4A Xamarin.Forms.Core
|
||||
945CCBF8-C2DB-468B-B3BD-D7ACA37B69AD Xamarin.Forms.Performance.Integration
|
||||
AF20FA19-F07E-4BD4-B5ED-104706EA660E Xamarin.Forms.Xaml
|
||||
629C84F8-0988-42EF-8BC5-872173A0A71F FormsViewGroup
|
||||
60398815-8E62-487E-A553-781F56A0849D Xamarin.Android.Support.Design
|
||||
F0C550D7-665A-40B5-A307-8E9B49976D87 Xamarin.Android.Support.Core.UI
|
||||
23A34485-DE75-440E-BA9D-E235F664E990 Xamarin.Android.Support.Compat
|
||||
Summary:
|
||||
Modules: 16
|
||||
Types: 907
|
||||
Methods: 4,230
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
Filter Java.Interop.Runtime type in XA startup profile
|
||||
.PP
|
||||
.nf
|
||||
.RS
|
||||
mono aprofutil.exe --filter-type Java.Interop.Runtime -sa startup.aotprofile
|
||||
.fi
|
||||
.RE
|
||||
.PP
|
||||
Output:
|
||||
.PP
|
||||
.nf
|
||||
.RS
|
||||
Modules:
|
||||
0326DF03-2158-4F7A-9A2B-B7A9419F021D Mono.Android
|
||||
Types:
|
||||
Java.Interop.Runtime
|
||||
Methods:
|
||||
bool Java.Interop.Runtime:IsGCUserPeer (Android.Runtime.IJavaObject)
|
||||
bool Java.Interop.Runtime:IsGCUserPeer (intptr)
|
||||
Summary:
|
||||
Modules: 1 (of 16)
|
||||
Types: 1 (of 907)
|
||||
Methods: 2 (of 4230)
|
||||
.fi
|
||||
.RE
|
||||
.SH SEE ALSO
|
||||
\fBmono-profilers\fR(1)
|
||||
+20
-17
@@ -1179,23 +1179,26 @@ If set, tells mono to attempt using native asynchronous I/O services. If not
|
||||
set, a default select/poll implementation is used. Currently epoll and kqueue
|
||||
are supported.
|
||||
.TP
|
||||
\fBMONO_THREADS_SUSPEND\fR
|
||||
Selects a mechanism that Mono will use to suspend threads. May be set to
|
||||
"preemptive", "coop", or "hybrid". Threads may need to be suspended by the
|
||||
debugger, or using some .NET threading APIs, and most commonly when the SGen
|
||||
garbage collector needs to stop all threads during a critical phase of garbage
|
||||
collection. Preemptive mode is the mode that Mono has used historically, going
|
||||
back to the Boehm days, where the garbage collector would run at any point and
|
||||
suspend execution of all threads as required to perform a garbage collection.
|
||||
The cooperative mode on the other hand requires the cooperation of all threads
|
||||
to stop at a safe point. This makes for an easier to debug garbage collector.
|
||||
As of Mono 4.3.0 it is a work in progress, and while it works, it has not been
|
||||
used extensively. This option enables the feature and allows us to find spots
|
||||
that need to be tuned for this mode of operation. Hybrid mode is a combination
|
||||
of the two that retains better compatability with scenarios where Mono is
|
||||
embedded in another application: threads that are running managed code or code
|
||||
that comprises the Mono runtime will be cooperatively suspended, while threads
|
||||
running embedder code will be preemptively suspended.
|
||||
\fBMONO_THREADS_SUSPEND\fR Selects a mechanism that Mono will use to suspend
|
||||
threads. May be set to "preemptive", "coop", or "hybrid". Threads may need to
|
||||
be suspended by the debugger, or using some .NET threading APIs, and most
|
||||
commonly when the SGen garbage collector needs to stop all threads during a
|
||||
critical phase of garbage collection. Preemptive mode is the mode that Mono
|
||||
has used historically, going back to the Boehm days, where the garbage
|
||||
collector would run at any point and suspend execution of all threads as
|
||||
required to perform a garbage collection. The cooperative mode on the other
|
||||
hand requires the cooperation of all threads to stop at a safe point. This
|
||||
makes for an easier to debug garbage collector and it improves the stability of
|
||||
the runtime because threads are not suspended when accessing critical
|
||||
resources. In scenarios where Mono is embedded in another application,
|
||||
cooperative suspend requires the embedder code to follow coding guidelines in
|
||||
order to cooperate with the garbage collector. Cooperative suspend in embedded
|
||||
Mono is currently experimental. Hybrid mode is a combination of the two that
|
||||
retains better compatability with scenarios where Mono is embedded in another
|
||||
application: threads that are running managed code or code that comprises the
|
||||
Mono runtime will be cooperatively suspended, while threads running embedder
|
||||
code will be preemptively suspended. Hybrid suspend is the default on some
|
||||
desktop platforms.
|
||||
|
||||
Alternatively, coop and hybrid mode can be enabled at compile time by using the
|
||||
--enable-cooperative-suspend or --enable-hybrid-suspend flags, respectively,
|
||||
|
||||
@@ -38,5 +38,6 @@ NO_CONSOLE = yes
|
||||
ifdef PLATFORM_WIN32
|
||||
PROFILE_MCS_FLAGS += -d:MOBILE_DESKTOP_HOST -d:WIN_PLATFORM
|
||||
endif
|
||||
ENABLE_GSS=1
|
||||
|
||||
PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking PKITS InetAccess AndroidNotWorking
|
||||
@@ -8,7 +8,7 @@ MCS = $(BOOTSTRAP_MCS)
|
||||
profile-check:
|
||||
@:
|
||||
|
||||
TARGET_NET_REFERENCE = v4.6
|
||||
TARGET_NET_REFERENCE = v4.7
|
||||
DEFAULT_REFERENCES = mscorlib
|
||||
|
||||
PROFILE_MCS_FLAGS = -d:NET_4_6 -d:MONO -d:MONODROID_TOOLS -d:WIN_PLATFORM -nowarn:1699 -nostdlib $(PLATFORM_DEBUG_FLAGS)
|
||||
|
||||
@@ -25,3 +25,7 @@ ifdef PLATFORM_MACOS
|
||||
MONO_FEATURE_APPLETLS=1
|
||||
ENABLE_GSS=1
|
||||
endif
|
||||
|
||||
ifeq ($(HOST_PLATFORM),linux)
|
||||
ENABLE_GSS=1
|
||||
endif
|
||||
@@ -128,7 +128,7 @@ $(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
|
||||
@if test -f $@; then :; else rm -f $<; $(MAKE) $<; fi
|
||||
|
||||
$(topdir)/build/deps/nunit-$(PROFILE).stamp:
|
||||
cd ${topdir}/tools/nunit-lite && $(MAKE)
|
||||
$(MAKE) -C ${topdir}/tools/nunit-lite
|
||||
echo "stamp" >$@
|
||||
|
||||
tests_CLEAN_FILES += $(topdir)/build/deps/nunit-$(PROFILE).stamp
|
||||
@@ -378,5 +378,3 @@ $(xtest_makefrag): $(xtest_response)
|
||||
|
||||
endif
|
||||
|
||||
|
||||
.PHONY: patch-nunitlite-appconfig
|
||||
@@ -38,7 +38,7 @@ doc-update-recursive:
|
||||
@echo "do not recurse the Facades folder"
|
||||
|
||||
System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Numerics.Vectors System.Runtime.Serialization System.Transactions System.Xml \
|
||||
System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.IO.Compression.FileSystem System.Runtime.InteropServices.RuntimeInformation \
|
||||
System.ComponentModel.Composition System.ServiceModel System.Xml.Linq System.Data System.Data.DataSetExtensions System.IO.Compression.FileSystem System.Runtime.InteropServices.RuntimeInformation \
|
||||
System.ServiceProcess System.Security System.Net.Http.WebRequest System.Net.Http System.ServiceProcess System.IO.Compression System.IdentityModel System.Web \
|
||||
Facades/System.Drawing.Primitives Facades/System.Drawing.Common System.Drawing System.Web.Services:
|
||||
|
||||
|
||||
@@ -29,72 +29,72 @@
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
|
||||
<OutputPath>./../../../class/lib/monodroid/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
|
||||
<OutputPath>./../../../class/lib/monotouch/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch' ">
|
||||
<OutputPath>./../../../class/lib/monotouch_watch/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_tv' ">
|
||||
<OutputPath>./../../../class/lib/monotouch_tv/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;MONOTOUCH_TV</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;MONOTOUCH_TV;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full_interp' ">
|
||||
<OutputPath>./../../../class/lib/testing_aot_full_interp/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_INTERP;DISABLE_COM</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_INTERP;DISABLE_COM;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_hybrid' ">
|
||||
<OutputPath>./../../../class/lib/testing_aot_hybrid/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;MOBILE_DYNAMIC</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;MOBILE_DYNAMIC;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
|
||||
<OutputPath>./../../../class/lib/testing_aot_full/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_COM</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_COM;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'winaot' ">
|
||||
<OutputPath>./../../../class/lib/winaot/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_winaot_interp' ">
|
||||
<OutputPath>./../../../class/lib/testing_winaot_interp/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_INTERP;DISABLE_SECURITY;DISABLE_REMOTING</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_INTERP;DISABLE_SECURITY;DISABLE_REMOTING;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'xammac' ">
|
||||
<OutputPath>./../../../class/lib/xammac/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_DYNAMIC;XAMMAC;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;XAMARIN_MODERN</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_DYNAMIC;XAMMAC;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;XAMARIN_MODERN;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'xammac_net_4_5' ">
|
||||
<OutputPath>./../../../class/lib/xammac_net_4_5/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;NO_SYSTEM_DRAWING_DEPENDENCY;NO_WINFORMS_DEPENDENCY;NO_SYSTEM_WEB_DEPENDENCY;XAMMAC_4_5;XAMARIN_MODERN</DefineConstants>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;NO_SYSTEM_DRAWING_DEPENDENCY;NO_WINFORMS_DEPENDENCY;NO_SYSTEM_WEB_DEPENDENCY;XAMMAC_4_5;XAMARIN_MODERN;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'orbis' ">
|
||||
<OutputPath>./../../../class/lib/orbis/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;ORBIS;DISABLE_COM</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;ORBIS;DISABLE_COM;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'unreal' ">
|
||||
<OutputPath>./../../../class/lib/unreal/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;MOBILE;MOBILE_DYNAMIC;NET_3_5;NET_4_0;NET_4_5;MONO</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;MOBILE;MOBILE_DYNAMIC;NET_3_5;NET_4_0;NET_4_5;MONO;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'wasm' ">
|
||||
<OutputPath>./../../../class/lib/wasm/Facades</OutputPath>
|
||||
<IntermediateOutputPath>./../../../class/obj/$(AssemblyName)-Facades</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_COM;FEATURE_NO_BSD_SOCKETS;DISABLE_REMOTING;DISABLE_SECURITY</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_COM;FEATURE_NO_BSD_SOCKETS;DISABLE_REMOTING;DISABLE_SECURITY;FEATURE_TYPECONVERTER</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<!-- @ALL_PROFILE_PROPERTIES@ -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
|
||||
@@ -13,7 +13,7 @@ KEYFILE = ../../Open.snk
|
||||
LIBRARY_SNK = $(KEYFILE)
|
||||
SIGN_FLAGS = /delaysign /nowarn:1616,1699
|
||||
LIB_REFS = System
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS)
|
||||
LIB_MCS_FLAGS = $(SIGN_FLAGS) $(EXTRA_LIB_MCS_FLAGS) -d:FEATURE_TYPECONVERTER
|
||||
|
||||
ifneq (,$(filter build net_4_x, $(PROFILE)))
|
||||
$(error This profile shouldn't build System.Drawing.Common.dll, it already has System.Drawing.dll)
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
<ProjectReference Include="../../System.Transactions/System.Transactions.csproj" />
|
||||
<ProjectReference Include="../../System.Runtime.Serialization/System.Runtime.Serialization.csproj" />
|
||||
<ProjectReference Include="../../System.Data/System.Data.csproj" />
|
||||
<ProjectReference Include="../../System.Data.DataSetExtensions/System.Data.DataSetExtensions.csproj" />
|
||||
<ProjectReference Include="../../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
|
||||
|
||||
@@ -22,13 +22,13 @@ ifeq ($(PROFILE),build)
|
||||
LIB_MCS_FLAGS += -d:SYSTEM_WEB_IMPLEMENTATION
|
||||
else ifeq ($(PROFILE),wasm)
|
||||
LIB_MCS_FLAGS += -d:SYSTEM_WEB_IMPLEMENTATION -unsafe
|
||||
LIB_REFS += System.Transactions System.Runtime.Serialization System.Data
|
||||
LIB_REFS += System.Transactions System.Runtime.Serialization System.Data System.Data.DataSetExtensions
|
||||
else ifeq ($(PROFILE),xammac_net_4_5)
|
||||
LIB_REFS += System.Web.Services System.Transactions System.Runtime.Serialization System.Data
|
||||
LIB_REFS += System.Web.Services System.Transactions System.Runtime.Serialization System.Data System.Data.DataSetExtensions
|
||||
else ifeq (2.1, $(FRAMEWORK_VERSION))
|
||||
LIB_REFS += System.Web.Services System.Transactions System.Runtime.Serialization System.Data
|
||||
LIB_REFS += System.Web.Services System.Transactions System.Runtime.Serialization System.Data System.Data.DataSetExtensions
|
||||
else
|
||||
LIB_REFS += System.Web System.Transactions System.Runtime.Serialization System.Data
|
||||
LIB_REFS += System.Web System.Transactions System.Runtime.Serialization System.Data System.Data.DataSetExtensions
|
||||
endif
|
||||
|
||||
ifneq (,$(filter build net_4_x, $(PROFILE)))
|
||||
|
||||
@@ -764,6 +764,16 @@
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.SqlTypes.SqlTypeException))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.SqlTypes.SqlXml))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.SqlTypes.StorageState))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.DataRowComparer))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.DataRowComparer<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.DataRowExtensions))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.DataTableExtensions))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.EnumerableRowCollection))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.EnumerableRowCollection<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.EnumerableRowCollectionExtensions))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.OrderedEnumerableRowCollection<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.TypedTableBase<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Data.TypedTableBaseExtensions))]
|
||||
#endif
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.BooleanSwitch))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.ConditionalAttribute))]
|
||||
@@ -821,6 +831,15 @@
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.TraceSwitch))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.SuppressMessageAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.AllowNullAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.DisallowNullAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.MaybeNullAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.NotNullAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.MaybeNullWhenAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.NotNullWhenAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.NotNullIfNotNullAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.DoesNotReturnAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.CodeAnalysis.DoesNotReturnIfAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.Contract))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.ContractAbbreviatorAttribute))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Diagnostics.Contracts.ContractArgumentValidatorAttribute))]
|
||||
@@ -2443,6 +2462,9 @@
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySpanAction<,>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequence<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ReadOnlySequenceSegment<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.ArrayBufferWriter<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.SequenceReader<>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.SequenceReaderExtensions))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.SpanAction<,>))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.StandardFormat))]
|
||||
[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Buffers.Binary.BinaryPrimitives))]
|
||||
|
||||
@@ -111,19 +111,19 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Xml.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Xml.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Xml.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -77,6 +77,7 @@ mobile_common_dirs_parallel := \
|
||||
System.Numerics \
|
||||
System.Numerics.Vectors \
|
||||
System.Data \
|
||||
System.Data.DataSetExtensions \
|
||||
Mono.Data.Sqlite \
|
||||
System.Data.Services.Client \
|
||||
System.IO.Compression \
|
||||
@@ -179,6 +180,7 @@ wasm_dirs_parallel := \
|
||||
System.ServiceModel.Internals \
|
||||
System.Runtime.Serialization \
|
||||
System.Data \
|
||||
System.Data.DataSetExtensions \
|
||||
System.Xml.Linq \
|
||||
System.Numerics \
|
||||
System.Numerics.Vectors \
|
||||
@@ -213,6 +215,7 @@ xammac_4_5_dirs_parallel := \
|
||||
System.Transactions \
|
||||
System.EnterpriseServices \
|
||||
System.Data \
|
||||
System.Data.DataSetExtensions \
|
||||
System.Runtime.Serialization \
|
||||
System.Xml.Linq \
|
||||
Mono.Data.Sqlite \
|
||||
|
||||
@@ -71,14 +71,14 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -199,19 +199,19 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Core.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Core.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Core.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
+4
-4
@@ -89,14 +89,14 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -149,19 +149,19 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Core.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Core.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Core.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -307,8 +307,15 @@ namespace Mono.Debugger.Soft
|
||||
public bool Subclasses {
|
||||
get; set;
|
||||
}
|
||||
public bool NotFilteredFeature {
|
||||
get; set;
|
||||
}
|
||||
public bool EverythingElse {
|
||||
get; set;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class AssemblyModifier : Modifier {
|
||||
public long[] Assemblies {
|
||||
get; set;
|
||||
@@ -429,7 +436,7 @@ namespace Mono.Debugger.Soft
|
||||
* with newer runtimes, and vice versa.
|
||||
*/
|
||||
internal const int MAJOR_VERSION = 2;
|
||||
internal const int MINOR_VERSION = 53;
|
||||
internal const int MINOR_VERSION = 54;
|
||||
|
||||
enum WPSuspendPolicy {
|
||||
NONE = 0,
|
||||
@@ -1311,6 +1318,8 @@ namespace Mono.Debugger.Soft
|
||||
protected abstract int TransportSend (byte[] buf, int buf_offset, int len);
|
||||
protected abstract void TransportSetTimeouts (int send_timeout, int receive_timeout);
|
||||
protected abstract void TransportClose ();
|
||||
// Shutdown breaks all communication, resuming blocking waits
|
||||
protected abstract void TransportShutdown ();
|
||||
|
||||
internal VersionInfo Version;
|
||||
|
||||
@@ -1427,6 +1436,7 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
internal void Close () {
|
||||
closed = true;
|
||||
TransportShutdown ();
|
||||
}
|
||||
|
||||
internal bool IsClosed {
|
||||
@@ -2632,6 +2642,10 @@ namespace Mono.Debugger.Soft
|
||||
} else if (!em.Subclasses) {
|
||||
throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
|
||||
}
|
||||
if (Version.MajorVersion > 2 || Version.MinorVersion >= 54) {
|
||||
w.WriteBool (em.NotFilteredFeature);
|
||||
w.WriteBool (em.EverythingElse);
|
||||
}
|
||||
} else if (mod is AssemblyModifier) {
|
||||
w.WriteByte ((byte)ModifierKind.ASSEMBLY_ONLY);
|
||||
var amod = (mod as AssemblyModifier);
|
||||
@@ -2854,6 +2868,11 @@ namespace Mono.Debugger.Soft
|
||||
{
|
||||
socket.Close ();
|
||||
}
|
||||
|
||||
protected override void TransportShutdown ()
|
||||
{
|
||||
socket.Shutdown (SocketShutdown.Both);
|
||||
}
|
||||
}
|
||||
|
||||
/* This is the interface exposed by the debugger towards the debugger agent */
|
||||
|
||||
@@ -6,9 +6,9 @@ namespace Mono.Debugger.Soft
|
||||
public sealed class ExceptionEventRequest : EventRequest {
|
||||
|
||||
TypeMirror exc_type;
|
||||
bool caught, uncaught, subclasses;
|
||||
bool caught, uncaught, subclasses, not_filtered_feature, everything_else;
|
||||
|
||||
internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught) : base (vm, EventType.Exception) {
|
||||
internal ExceptionEventRequest (VirtualMachine vm, TypeMirror exc_type, bool caught, bool uncaught, bool not_filtered_feature = false, bool everything_else = false) : base (vm, EventType.Exception) {
|
||||
if (exc_type != null) {
|
||||
CheckMirror (vm, exc_type);
|
||||
TypeMirror exception_type = vm.RootDomain.Corlib.GetType ("System.Exception", false, false);
|
||||
@@ -19,6 +19,8 @@ namespace Mono.Debugger.Soft
|
||||
this.caught = caught;
|
||||
this.uncaught = uncaught;
|
||||
this.subclasses = true;
|
||||
this.not_filtered_feature = not_filtered_feature;
|
||||
this.everything_else = everything_else;
|
||||
}
|
||||
|
||||
public TypeMirror ExceptionType {
|
||||
@@ -41,7 +43,7 @@ namespace Mono.Debugger.Soft
|
||||
|
||||
public override void Enable () {
|
||||
var mods = new List <Modifier> ();
|
||||
mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses });
|
||||
mods.Add (new ExceptionModifier () { Type = exc_type != null ? exc_type.Id : 0, Caught = caught, Uncaught = uncaught, Subclasses = subclasses, NotFilteredFeature = not_filtered_feature, EverythingElse = everything_else });
|
||||
SendReq (mods);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -150,8 +150,11 @@ namespace Mono.Debugger.Soft
|
||||
}
|
||||
|
||||
public void Detach () {
|
||||
conn.Close ();
|
||||
// Notify the application that we are detaching
|
||||
conn.VM_Dispose ();
|
||||
// Close the connection. No further messages can be sent
|
||||
// over the connection after this point.
|
||||
conn.Close ();
|
||||
notify_vm_event (EventType.VMDisconnect, SuspendPolicy.None, 0, 0, null, 0);
|
||||
}
|
||||
|
||||
@@ -277,6 +280,13 @@ namespace Mono.Debugger.Soft
|
||||
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
|
||||
}
|
||||
|
||||
public ExceptionEventRequest CreateExceptionRequest (TypeMirror exc_type, bool caught, bool uncaught, bool everything_else) {
|
||||
if (Version.AtLeast (2, 54))
|
||||
return new ExceptionEventRequest (this, exc_type, caught, uncaught, true, everything_else);
|
||||
else
|
||||
return new ExceptionEventRequest (this, exc_type, caught, uncaught);
|
||||
}
|
||||
|
||||
public AssemblyLoadEventRequest CreateAssemblyLoadRequest () {
|
||||
return new AssemblyLoadEventRequest (this);
|
||||
}
|
||||
|
||||
@@ -350,6 +350,17 @@ class TestIfaces : ITest
|
||||
}
|
||||
}
|
||||
|
||||
public class RuntimeInvokeWithThrowClass
|
||||
{
|
||||
public RuntimeInvokeWithThrowClass()
|
||||
{
|
||||
}
|
||||
public void RuntimeInvokeThrowMethod()
|
||||
{
|
||||
throw new Exception("thays");
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class DebuggerTaskScheduler : TaskScheduler, IDisposable
|
||||
{
|
||||
private readonly BlockingCollection<Task> _tasks = new BlockingCollection<Task>();
|
||||
@@ -507,6 +518,10 @@ public class Tests : TestsBase, ITest2
|
||||
unhandled_exception_wrapper ();
|
||||
return 0;
|
||||
}
|
||||
if (args.Length >0 && args [0] == "unhandled-exception-perform-wait-callback") {
|
||||
unhandled_exception_perform_wait_callback ();
|
||||
return 0;
|
||||
}
|
||||
if (args.Length >0 && args [0] == "unhandled-exception-endinvoke") {
|
||||
unhandled_exception_endinvoke ();
|
||||
return 0;
|
||||
@@ -539,6 +554,10 @@ public class Tests : TestsBase, ITest2
|
||||
run_step_out_void_async();
|
||||
return 0;
|
||||
}
|
||||
if (args.Length > 0 && args [0] == "runtime_invoke_hybrid_exceptions") {
|
||||
runtime_invoke_hybrid_exceptions();
|
||||
return 0;
|
||||
}
|
||||
assembly_load ();
|
||||
breakpoints ();
|
||||
single_stepping ();
|
||||
@@ -584,6 +603,7 @@ public class Tests : TestsBase, ITest2
|
||||
inspect_enumerator_in_generic_struct();
|
||||
if_property_stepping();
|
||||
fixed_size_array();
|
||||
test_new_exception_filter();
|
||||
return 3;
|
||||
}
|
||||
|
||||
@@ -595,6 +615,11 @@ public class Tests : TestsBase, ITest2
|
||||
}
|
||||
}
|
||||
|
||||
public class MyException : Exception {
|
||||
public MyException(string message) : base(message) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void if_property_stepping() {
|
||||
var test = new TestClass();
|
||||
if (test.OneLineProperty == "someInvalidValue6049e709-7271-41a1-bc0a-f1f1b80d4125")
|
||||
@@ -827,6 +852,57 @@ public class Tests : TestsBase, ITest2
|
||||
n.Buffer2 = new char4('a', 'b', 'c', 'd');
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void test_new_exception_filter () {
|
||||
test_new_exception_filter1();
|
||||
test_new_exception_filter2();
|
||||
test_new_exception_filter3();
|
||||
test_new_exception_filter4();
|
||||
}
|
||||
|
||||
|
||||
public static void test_new_exception_filter1 () {
|
||||
try {
|
||||
throw new Exception("excp");
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void test_new_exception_filter2 () {
|
||||
try {
|
||||
throw new MyException("excp");
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void test_new_exception_filter3 () {
|
||||
try {
|
||||
throw new ArgumentException();
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
throw new Exception("excp");
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
public static void test_new_exception_filter4 () {
|
||||
try {
|
||||
throw new ArgumentException();
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
try {
|
||||
throw new Exception("excp");
|
||||
}
|
||||
catch (Exception e) {
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void inspect_enumerator_in_generic_struct() {
|
||||
TestEnumeratorInsideGenericStruct<String, String> generic_struct = new TestEnumeratorInsideGenericStruct<String, String>(new KeyValuePair<string, string>("0", "f1"));
|
||||
@@ -1592,6 +1668,24 @@ public class Tests : TestsBase, ITest2
|
||||
public static void unhandled_exception_endinvoke_2 () {
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void unhandled_exception_perform_wait_callback () {
|
||||
try
|
||||
{
|
||||
var results = ResolveAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
catch (SocketException sockEx)
|
||||
{
|
||||
//Console.WriteLine("correctly handled");
|
||||
}
|
||||
}
|
||||
|
||||
public static async Task<List<string>> ResolveAsync()
|
||||
{
|
||||
var addresses = await System.Net.Dns.GetHostAddressesAsync("foo.bar.baz");
|
||||
return new List<string>(addresses.Select(addr => addr.ToString()));
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void unhandled_exception_endinvoke () {
|
||||
Action action = new Action (() =>
|
||||
@@ -2112,6 +2206,16 @@ public class Tests : TestsBase, ITest2
|
||||
public static ref BlittableStruct get_ref_struct() {
|
||||
return ref ref_return_struct;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.NoInlining)]
|
||||
public static void runtime_invoke_hybrid_exceptions () {
|
||||
Type rtType = Type.GetType("RuntimeInvokeWithThrowClass");
|
||||
ConstructorInfo rtConstructor = rtType.GetConstructor(Type.EmptyTypes);
|
||||
object rtObject = rtConstructor.Invoke(new object[] { });
|
||||
MethodInfo rtMethod = rtType.GetMethod("RuntimeInvokeThrowMethod");
|
||||
rtMethod.Invoke(rtObject, new object[] { });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public class SentinelClass : MarshalByRefObject {
|
||||
|
||||
@@ -1767,7 +1767,7 @@ public class DebuggerTests
|
||||
t = frame.Method.GetParameters ()[7].ParameterType;
|
||||
Assert.AreEqual ("Tests", t.Name);
|
||||
var nested = (from nt in t.GetNestedTypes () where nt.IsNestedPublic select nt).ToArray ();
|
||||
Assert.AreEqual (1, nested.Length);
|
||||
Assert.AreEqual (2, nested.Length);
|
||||
Assert.AreEqual ("NestedClass", nested [0].Name);
|
||||
Assert.IsTrue (t.BaseType.IsAssignableFrom (t));
|
||||
Assert.IsTrue (!t.IsAssignableFrom (t.BaseType));
|
||||
@@ -4233,8 +4233,6 @@ public class DebuggerTests
|
||||
var e = run_until ("unhandled_exception_endinvoke");
|
||||
vm.Resume ();
|
||||
|
||||
var e1 = GetNextEvent (); //this should be the exception
|
||||
vm.Resume ();
|
||||
var e2 = GetNextEvent ();
|
||||
Assert.IsFalse (e2 is ExceptionEvent);
|
||||
|
||||
@@ -4281,6 +4279,23 @@ public class DebuggerTests
|
||||
vm = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void UnhandledException4 () {
|
||||
vm.Exit (0);
|
||||
|
||||
Start (dtest_app_path, "unhandled-exception-perform-wait-callback");
|
||||
|
||||
var req = vm.CreateExceptionRequest (null, false, true);
|
||||
req.Enable ();
|
||||
|
||||
var e = run_until ("unhandled_exception_perform_wait_callback");
|
||||
vm.Resume ();
|
||||
|
||||
var e2 = GetNextEvent ();
|
||||
Assert.IsTrue (e2 is VMDeathEvent);
|
||||
vm = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void GCWhileSuspended () {
|
||||
// Check that objects are kept alive during suspensions
|
||||
@@ -5086,6 +5101,58 @@ public class DebuggerTests
|
||||
Assert.AreEqual("d", min.Value);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestExceptionFilterWin () {
|
||||
Event e = run_until ("test_new_exception_filter1");
|
||||
var req2 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.Exception"), true, true, false);
|
||||
req2.Enable ();
|
||||
vm.Resume ();
|
||||
Event ev = GetNextEvent ();
|
||||
var l = ev.Thread.GetFrames ()[0].Location;
|
||||
|
||||
Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
|
||||
req2.Disable ();
|
||||
run_until ("test_new_exception_filter2");
|
||||
req2 = vm.CreateExceptionRequest (null, true, true, false);
|
||||
req2.Enable ();
|
||||
vm.Resume ();
|
||||
ev = GetNextEvent ();
|
||||
|
||||
Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
|
||||
req2.Disable ();
|
||||
run_until ("test_new_exception_filter3");
|
||||
var req3 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.ArgumentException"), false, true, false);
|
||||
req3.Enable ();
|
||||
req2 = vm.CreateExceptionRequest (null, true, true, true);
|
||||
req2.Enable ();
|
||||
vm.Resume ();
|
||||
ev = GetNextEvent ();
|
||||
|
||||
Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
|
||||
req2.Disable ();
|
||||
req3.Disable ();
|
||||
run_until ("test_new_exception_filter4");
|
||||
req2 = vm.CreateExceptionRequest (null, true, true, true);
|
||||
req2.Enable ();
|
||||
req2 = vm.CreateExceptionRequest (vm.RootDomain.Corlib.GetType ("System.ArgumentException"), false, true, false);
|
||||
req2.Enable ();
|
||||
vm.Resume ();
|
||||
ev = GetNextEvent ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestRuntimeInvokeHybridSuspendExceptions () {
|
||||
TearDown ();
|
||||
Start (dtest_app_path, "runtime_invoke_hybrid_exceptions", forceExit: true);
|
||||
var req2 = vm.CreateExceptionRequest (null, false, true, false);
|
||||
req2.Enable ();
|
||||
vm.Resume ();
|
||||
var ev = GetNextEvent ();
|
||||
Assert.IsInstanceOfType (typeof (ExceptionEvent), ev);
|
||||
vm.Exit (0);
|
||||
vm = null;
|
||||
}
|
||||
|
||||
#endif
|
||||
} // class DebuggerTests
|
||||
} // namespace
|
||||
@@ -1,3 +1,5 @@
|
||||
using System.Text;
|
||||
|
||||
namespace Mono.Profiler.Aot
|
||||
{
|
||||
//
|
||||
@@ -31,6 +33,11 @@ namespace Mono.Profiler.Aot
|
||||
public string Mvid {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
|
||||
public class GenericInstRecord : ProfileRecord
|
||||
@@ -43,6 +50,27 @@ namespace Mono.Profiler.Aot
|
||||
public TypeRecord[] Types {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
if (Types == null || Types.Length <= 0)
|
||||
return "";
|
||||
|
||||
var sb = new StringBuilder ("<");
|
||||
var first = true;
|
||||
foreach (var type in Types) {
|
||||
if (!first)
|
||||
sb.Append (", ");
|
||||
else
|
||||
first = false;
|
||||
|
||||
sb.Append (type.ToString ());
|
||||
}
|
||||
|
||||
sb.Append (">");
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
}
|
||||
|
||||
public class TypeRecord : ProfileRecord
|
||||
@@ -62,9 +90,27 @@ namespace Mono.Profiler.Aot
|
||||
get; set;
|
||||
}
|
||||
|
||||
public string FullName {
|
||||
get {
|
||||
string prefix;
|
||||
|
||||
if (Name.Length > 0 && Name [0] == '.')
|
||||
prefix = Module.ToString ();
|
||||
else
|
||||
prefix = "";
|
||||
|
||||
return $"{prefix}{Name}{GenericInst}";
|
||||
}
|
||||
}
|
||||
|
||||
public GenericInstRecord GenericInst {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return FullName;
|
||||
}
|
||||
}
|
||||
|
||||
public class MethodRecord : ProfileRecord
|
||||
@@ -97,5 +143,10 @@ namespace Mono.Profiler.Aot
|
||||
public int ParamCount {
|
||||
get; set;
|
||||
}
|
||||
|
||||
public override string ToString ()
|
||||
{
|
||||
return $"{Signature.Replace ("(", $" {Type}:{Name} (")}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -88,19 +88,19 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Core.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Core.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Core.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -30,6 +30,76 @@
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-net_4_x-$(HostPlatform)</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
|
||||
<OutputPath>./../../class/lib/monodroid</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monodroid</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
|
||||
<OutputPath>./../../class/lib/monotouch</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monotouch</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_watch' ">
|
||||
<OutputPath>./../../class/lib/monotouch_watch</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monotouch_watch</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;FEATURE_NO_BSD_SOCKETS;MONOTOUCH_WATCH;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch_tv' ">
|
||||
<OutputPath>./../../class/lib/monotouch_tv</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monotouch_tv</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MOBILE;MOBILE_LEGACY;MONO;MONOTOUCH;DISABLE_COM;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;FULL_AOT_RUNTIME;MONOTOUCH_TV;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full_interp' ">
|
||||
<OutputPath>./../../class/lib/testing_aot_full_interp</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-testing_aot_full_interp</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_INTERP;DISABLE_COM;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_hybrid' ">
|
||||
<OutputPath>./../../class/lib/testing_aot_hybrid</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-testing_aot_hybrid</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;MOBILE_DYNAMIC;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
|
||||
<OutputPath>./../../class/lib/testing_aot_full</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-testing_aot_full</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_REMOTING;DISABLE_SECURITY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;DISABLE_COM;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'winaot' ">
|
||||
<OutputPath>./../../class/lib/winaot</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-winaot</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'testing_winaot_interp' ">
|
||||
<OutputPath>./../../class/lib/testing_winaot_interp</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-testing_winaot_interp</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;DISABLE_COM;WIN_PLATFORM;WINAOT;FULL_AOT_INTERP;DISABLE_SECURITY;DISABLE_REMOTING;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'xammac' ">
|
||||
<OutputPath>./../../class/lib/xammac</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-xammac</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_DYNAMIC;XAMMAC;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;XAMARIN_MODERN;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'xammac_net_4_5' ">
|
||||
<OutputPath>./../../class/lib/xammac_net_4_5</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-xammac_net_4_5</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;FEATURE_INTERCEPTABLE_THREADPOOL_CALLBACK;NO_SYSTEM_DRAWING_DEPENDENCY;NO_WINFORMS_DEPENDENCY;NO_SYSTEM_WEB_DEPENDENCY;XAMMAC_4_5;XAMARIN_MODERN;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'orbis' ">
|
||||
<OutputPath>./../../class/lib/orbis</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-orbis</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;ORBIS;DISABLE_COM;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'unreal' ">
|
||||
<OutputPath>./../../class/lib/unreal</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-unreal</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;MOBILE;MOBILE_DYNAMIC;NET_3_5;NET_4_0;NET_4_5;MONO;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'wasm' ">
|
||||
<OutputPath>./../../class/lib/wasm</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-wasm</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;FULL_AOT_DESKTOP;FULL_AOT_RUNTIME;WASM;DISABLE_COM;FEATURE_NO_BSD_SOCKETS;DISABLE_REMOTING;DISABLE_SECURITY;COREFX</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<!-- @ALL_PROFILE_PROPERTIES@ -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
@@ -69,14 +139,37 @@
|
||||
</ItemGroup>
|
||||
<!--End of common files-->
|
||||
<!-- @ALL_SOURCES@ -->
|
||||
<!-- @COMMON_PROJECT_REFERENCES@ -->
|
||||
<ItemGroup Condition=" '$(Platform)' == 'net_4_x' ">
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../System.Core/System.Core.csproj" />
|
||||
<ProjectReference Include="../System/System.csproj" />
|
||||
<ProjectReference Include="../System.Data/System.Data.csproj" />
|
||||
<ProjectReference Include="../System.XML/System.Xml.csproj" />
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_full_interp' ">
|
||||
<Reference Include="nunitlite">
|
||||
<HintPath>..\lib\testing_aot_full_interp\nunitlite.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_hybrid' ">
|
||||
<Reference Include="nunitlite">
|
||||
<HintPath>..\lib\testing_aot_hybrid\nunitlite.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'testing_aot_full' ">
|
||||
<Reference Include="nunitlite">
|
||||
<HintPath>..\lib\testing_aot_full\nunitlite.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'testing_winaot_interp' ">
|
||||
<Reference Include="nunitlite">
|
||||
<HintPath>..\lib\testing_winaot_interp\nunitlite.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<!-- @ALL_REFERENCES@ -->
|
||||
<!-- @ALL_RESOURCES@ -->
|
||||
<PropertyGroup>
|
||||
|
||||
@@ -55,7 +55,7 @@ namespace System.Drawing.Design
|
||||
public override object EditValue (ITypeDescriptorContext context,
|
||||
IServiceProvider provider, object value)
|
||||
{
|
||||
if (context != null && provider != null) {
|
||||
if (provider != null) {
|
||||
editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
|
||||
if (editorService != null) {
|
||||
if (editor_control == null)
|
||||
|
||||
@@ -12,6 +12,10 @@ namespace System.Net.Http
|
||||
return true;
|
||||
#endif
|
||||
|
||||
// Mono URI handling which does not distinguish between file and url absolute paths without scheme
|
||||
if (uri.Scheme == Uri.UriSchemeFile && uri.OriginalString.StartsWith ("/", StringComparison.Ordinal))
|
||||
return true;
|
||||
|
||||
return HttpUtilities.IsHttpUri (uri);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -375,8 +375,7 @@ namespace MonoTests.System.Net.Http
|
||||
Assert.AreEqual (response, client.SendAsync (request).Result, "#1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")]
|
||||
[Test]
|
||||
public void Send_BaseAddress ()
|
||||
{
|
||||
var mh = new HttpMessageHandlerMock ();
|
||||
|
||||
@@ -6215,9 +6215,9 @@ namespace System.Windows.Forms {
|
||||
|
||||
XSetWMNormalHints(DisplayHandle, hwnd.whole_window, ref size_hints);
|
||||
|
||||
int[] atoms = new int[2];
|
||||
atoms [0] = 1; // Version 1
|
||||
atoms [1] = 1; // we want to be mapped
|
||||
IntPtr[] atoms = new IntPtr[2];
|
||||
atoms [0] = (IntPtr)1; // Version 1
|
||||
atoms [1] = (IntPtr)1; // we want to be mapped
|
||||
|
||||
// This line cost me 3 days...
|
||||
XChangeProperty(DisplayHandle, hwnd.whole_window, _XEMBED_INFO, _XEMBED_INFO, 32, PropertyMode.Replace, atoms, 2);
|
||||
|
||||
@@ -204,9 +204,11 @@ namespace System.Xml.Serialization
|
||||
{
|
||||
if (isNullable && ReadNull()) return null;
|
||||
|
||||
if (checkType) {
|
||||
System.Xml.XmlQualifiedName t = GetXsiType();
|
||||
if (t != null) {
|
||||
if (checkType)
|
||||
{
|
||||
System.Xml.XmlQualifiedName t = GetXsiType();
|
||||
if (t != null)
|
||||
{
|
||||
XmlTypeMapping realMap = typeMap.GetRealElementMap (t.Name, t.Namespace);
|
||||
if (realMap == null) {
|
||||
if (typeMap.TypeData.Type == typeof(object))
|
||||
@@ -219,12 +221,7 @@ namespace System.Xml.Serialization
|
||||
}
|
||||
else if (typeMap.TypeData.Type == typeof(object))
|
||||
return ReadTypedPrimitive (AnyType);
|
||||
else {
|
||||
XmlTypeMapping realMap = typeMap.GetRealElementMap (Reader.LocalName, Reader.NamespaceURI);
|
||||
if (realMap != null && realMap != typeMap)
|
||||
return ReadObject(realMap, false, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
object ob = CreateInstance (typeMap.TypeData.Type, true);
|
||||
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace System.Xml.Serialization
|
||||
return (XmlTypeMapMemberAttribute)_attributeMembers [BuildKey (name,ns, -1)];
|
||||
}
|
||||
|
||||
public XmlTypeMapElementInfo GetElement (string name, string ns, int minimalOrder)
|
||||
public XmlTypeMapElementInfo GetElement(string name, string ns, int minimalOrder)
|
||||
{
|
||||
if (_elements == null)
|
||||
return null;
|
||||
@@ -404,38 +404,22 @@ namespace System.Xml.Serialization
|
||||
selected = info;
|
||||
}
|
||||
}
|
||||
else if (info.MappedType != null && info.MappedType.DerivedTypes.Count > 0) {
|
||||
foreach (XmlTypeMapping derrivedInfo in info.MappedType.DerivedTypes) {
|
||||
if (derrivedInfo.ElementName == name && derrivedInfo.Namespace == ns) {
|
||||
if (info.ExplicitOrder < minimalOrder)
|
||||
continue;
|
||||
|
||||
if (selected == null || selected.ExplicitOrder > info.ExplicitOrder) {
|
||||
selected = info;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return selected;
|
||||
}
|
||||
|
||||
public XmlTypeMapElementInfo GetElement (string name, string ns)
|
||||
public XmlTypeMapElementInfo GetElement(string name, string ns)
|
||||
{
|
||||
if (_elements == null) return null;
|
||||
|
||||
foreach (XmlTypeMapElementInfo info in _elements.Values)
|
||||
if (info.ElementName == name && info.Namespace == ns)
|
||||
return info;
|
||||
else if (info.MappedType != null && info.MappedType.DerivedTypes.Count > 0) {
|
||||
foreach (XmlTypeMapping derrivedInfo in info.MappedType.DerivedTypes)
|
||||
if (derrivedInfo.ElementName == name && derrivedInfo.Namespace == ns)
|
||||
return info;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
public XmlTypeMapElementInfo GetElement (int index)
|
||||
{
|
||||
if (_elements == null) return null;
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using NUnit.Framework;
|
||||
@@ -1686,28 +1687,40 @@ namespace MonoTests.System.XmlSerialization
|
||||
Assert.AreEqual ("b", d.Extra[1]);
|
||||
}
|
||||
|
||||
[Test] // PR #11194
|
||||
public void TestDerrivedClassProperty ()
|
||||
// https://github.com/mono/mono/issues/16918
|
||||
[Test]
|
||||
public void Bug16918 ()
|
||||
{
|
||||
var data = "<layout width=\".25\" height =\".25\" x=\"0\" y=\"0\" id=\"portrait\" class=\"render\"><background color=\"white\"><div x=\".03\" y=\".05\" width=\".94\" height =\".9\" layout=\"proportional_rows\" paddingX=\".01\" paddingY=\".02\"><background color=\"black\"></background><background color=\"gray\" padding=\".1\"><label color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">Test UI</label></background><br brSize=\"1\" /><background class=\"back,Lab\" color=\"green\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">GREEN</label></background><background color=\"red\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">RED</label></background><background color=\"blue\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">TLUE</label></background><background color=\"blue\"><label class=\"Lab\" color=\"white\" font=\"emulogic.ttf\" fontSize=\"15\">BLUE</label></background></div></background></layout>";
|
||||
PropertiesWithSameNameAsTheirType testObject = new PropertiesWithSameNameAsTheirType ()
|
||||
{
|
||||
E1 = E1.Two,
|
||||
E2 = E2.Two,
|
||||
E3 = E3.Two,
|
||||
E4 = E4.Two,
|
||||
E5 = E5.Two
|
||||
};
|
||||
|
||||
XmlAttributeOverrides overrides = PR11194.GenerateLayoutOverrides<PR11194ChildLo>();
|
||||
XmlSerializer serializer = new XmlSerializer (typeof (PropertiesWithSameNameAsTheirType));
|
||||
|
||||
var result = Deserialize(typeof(PR11194ChildLo), data, overrides) as PR11194ChildLo;
|
||||
// serialize
|
||||
string serializedObject;
|
||||
using (MemoryStream memoryStream = new MemoryStream ())
|
||||
{
|
||||
serializer.Serialize (memoryStream, testObject);
|
||||
serializedObject = Encoding.UTF8.GetString (memoryStream.ToArray ());
|
||||
}
|
||||
|
||||
PR11194Parent2 child;
|
||||
Assert.IsNotNull(result, "#11194_1");
|
||||
Assert.AreEqual(1, result.children.Count, "#11194_2");
|
||||
child = result.children[0] as PR11194Parent2;
|
||||
Assert.IsNotNull(child, "#11194_3");
|
||||
Assert.AreEqual(1, child.children.Count, "#11194_4");
|
||||
child = child.children[0] as PR11194Parent2;
|
||||
Assert.IsNotNull(child, "#11194_5");
|
||||
Assert.AreEqual(7, child.children.Count, "#11194_6");
|
||||
child = child.children[1] as PR11194Parent2;
|
||||
Assert.IsNotNull(child, "#11194_7");
|
||||
Assert.AreEqual(1, child.children.Count, "#11194_8");
|
||||
Assert.AreEqual("PR11194ChildL", child.children[0].GetType().Name, "#11194_9");
|
||||
PropertiesWithSameNameAsTheirType deserializedObject;
|
||||
using (MemoryStream memoryStream = new MemoryStream (Encoding.UTF8.GetBytes (serializedObject)))
|
||||
{
|
||||
deserializedObject = (PropertiesWithSameNameAsTheirType)serializer.Deserialize (memoryStream);
|
||||
}
|
||||
|
||||
Assert.AreEqual (testObject.E1, deserializedObject.E1, "#1");
|
||||
Assert.AreEqual (testObject.E2, deserializedObject.E2, "#2");
|
||||
Assert.AreEqual (testObject.E3, deserializedObject.E3, "#3");
|
||||
Assert.AreEqual (testObject.E4, deserializedObject.E4, "#4");
|
||||
Assert.AreEqual (testObject.E5, deserializedObject.E5, "#5");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,8 +12,6 @@
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
@@ -1207,157 +1205,54 @@ namespace MonoTests.System.Xml.TestClasses
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region PR_11194
|
||||
|
||||
#region PR_11194_GenerateOverrides
|
||||
public static class PR11194
|
||||
[Serializable]
|
||||
public class PropertiesWithSameNameAsTheirType
|
||||
{
|
||||
public static XmlAttributeOverrides GenerateLayoutOverrides<T>()
|
||||
public PropertiesWithSameNameAsTheirType ()
|
||||
{
|
||||
Type tType = typeof(T);
|
||||
|
||||
TypeInfo tTypeInfo = tType.GetTypeInfo();
|
||||
|
||||
IEnumerable<PropertyInfo> props = tType.GetRuntimeProperties();
|
||||
|
||||
XmlAttributeOverrides overrides = new XmlAttributeOverrides();
|
||||
|
||||
foreach (PropertyInfo prop in props) {
|
||||
XmlDerrivedAttribute attr = prop.GetCustomAttribute<XmlDerrivedAttribute>();
|
||||
|
||||
if (attr == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Type dType = prop.DeclaringType;
|
||||
|
||||
Type pType = prop.PropertyType;
|
||||
TypeInfo pTypeInfo = pType.GetTypeInfo();
|
||||
|
||||
Type enumType = typeof(IEnumerable<>);
|
||||
|
||||
if (pTypeInfo.IsGenericType
|
||||
&& pTypeInfo.ImplementedInterfaces.Any(t =>
|
||||
(t.GetTypeInfo().IsGenericType && t.GetGenericTypeDefinition() == enumType))) {
|
||||
pType = pType.GenericTypeArguments[0];
|
||||
}
|
||||
|
||||
XmlAttributes overrideAttributes = GenerateOverrideAttributes(dType, pType, attr);
|
||||
|
||||
overrides.Add(dType, prop.Name, overrideAttributes);
|
||||
}
|
||||
|
||||
return overrides;
|
||||
}
|
||||
|
||||
private static XmlAttributes GenerateOverrideAttributes (Type declaringType, Type propertyType, XmlDerrivedAttribute attr)
|
||||
{
|
||||
XmlAttributes xAttrs = new XmlAttributes();
|
||||
public object obj1 { get; set; }
|
||||
public object obj2 { get; set; }
|
||||
public object obj3 { get; set; }
|
||||
public object obj4 { get; set; }
|
||||
public object obj5 { get; set; }
|
||||
|
||||
Assembly a = declaringType.GetTypeInfo().Assembly;
|
||||
TypeInfo interfaceType = propertyType.GetTypeInfo();
|
||||
IEnumerable<Type> types = a.ExportedTypes.Where(t => interfaceType.IsAssignableFrom(t.GetTypeInfo()) && !t.GetTypeInfo().IsAbstract);
|
||||
|
||||
foreach (Type t in types) {
|
||||
string name = NameBySourceType(t, attr.SrcType);// t.GetTypeInfo().GetCustomAttribute<XmlTypeAttribute>().TypeName;
|
||||
XmlElementAttribute xAttr = new XmlElementAttribute();
|
||||
xAttr.ElementName = name;
|
||||
xAttr.Type = t;
|
||||
xAttrs.XmlElements.Add(xAttr);
|
||||
}
|
||||
|
||||
return xAttrs;
|
||||
}
|
||||
|
||||
private static string NameBySourceType (Type derrivedType, XmlDerrivedSourceType srcType)
|
||||
{
|
||||
string name = null;
|
||||
switch (srcType)
|
||||
{
|
||||
case XmlDerrivedSourceType.ByXmlType:
|
||||
name = derrivedType.GetTypeInfo().GetCustomAttribute<XmlTypeAttribute>().TypeName;
|
||||
break;
|
||||
}
|
||||
return name;
|
||||
}
|
||||
public E1 E1 { get; set; }
|
||||
public E2 E2 { get; set; }
|
||||
public E3 E3 { get; set; }
|
||||
public E4 E4 { get; set; }
|
||||
public E5 E5 { get; set; }
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region helperAttribute
|
||||
public enum XmlDerrivedSourceType
|
||||
public enum E1
|
||||
{
|
||||
ByXmlType
|
||||
One,
|
||||
Two,
|
||||
}
|
||||
|
||||
public class XmlDerrivedAttribute : Attribute
|
||||
public enum E2
|
||||
{
|
||||
public XmlDerrivedSourceType SrcType { get; set; }
|
||||
|
||||
public XmlDerrivedAttribute(XmlDerrivedSourceType srcType)
|
||||
{
|
||||
SrcType = srcType;
|
||||
}
|
||||
One,
|
||||
Two,
|
||||
}
|
||||
#endregion
|
||||
|
||||
public abstract class PR11194Parent
|
||||
public enum E5
|
||||
{
|
||||
[XmlIgnore]
|
||||
public PR11194Parent Parent { get; set; }
|
||||
One,
|
||||
Two,
|
||||
}
|
||||
|
||||
public abstract class PR11194Parent2 : PR11194Parent
|
||||
public enum E3
|
||||
{
|
||||
[XmlAttribute]
|
||||
public float width { get; set; }
|
||||
[XmlAttribute]
|
||||
public float height { get; set; }
|
||||
[XmlAttribute]
|
||||
public float x { get; set; }
|
||||
[XmlAttribute]
|
||||
public float y { get; set; }
|
||||
[XmlAttribute]
|
||||
public string id { get; set; }
|
||||
[XmlElement]
|
||||
[XmlDerrived(XmlDerrivedSourceType.ByXmlType)]
|
||||
public List<PR11194Parent> children { get; set; }
|
||||
One,
|
||||
Two,
|
||||
}
|
||||
|
||||
[XmlType("background")]
|
||||
public class PR11194ChildB : PR11194Parent2
|
||||
public enum E4
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string image { get; set; }
|
||||
One,
|
||||
Two,
|
||||
}
|
||||
|
||||
[XmlType("br")]
|
||||
public class PR11194ChildBr : PR11194Parent
|
||||
{
|
||||
[XmlAttribute("brSize")]
|
||||
public int breaks { get; set; }
|
||||
}
|
||||
|
||||
[XmlType("div")]
|
||||
public class PR11194ChildD : PR11194ChildLo
|
||||
{
|
||||
}
|
||||
|
||||
[XmlType("label")]
|
||||
public class PR11194ChildL : PR11194Parent2
|
||||
{
|
||||
[XmlAttribute]
|
||||
public string font { get; set; }
|
||||
[XmlAttribute]
|
||||
public int fontSize { get; set; }
|
||||
[XmlText]
|
||||
public string Text { get; set; }
|
||||
}
|
||||
|
||||
[XmlType("layout")]
|
||||
public class PR11194ChildLo : PR11194Parent2
|
||||
{
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
@@ -198,7 +198,14 @@ namespace Mono.Btls
|
||||
set {
|
||||
if (nativePrivateKey != null)
|
||||
nativePrivateKey.Dispose ();
|
||||
nativePrivateKey = null;
|
||||
try {
|
||||
// FIXME: there doesn't seem to be a public API to check whether it actually
|
||||
// contains a private key (apart from RSAManaged.PublicOnly).
|
||||
if (value != null)
|
||||
nativePrivateKey = MonoBtlsKey.CreateFromRSAPrivateKey ((RSA)value);
|
||||
} catch {
|
||||
nativePrivateKey = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -120,25 +120,21 @@ namespace Mono.Net.Security
|
||||
ServicePointManager.CheckCertificateRevocationList).ConfigureAwait (false);
|
||||
|
||||
status = WebExceptionStatus.Success;
|
||||
|
||||
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
|
||||
} catch (Exception ex) {
|
||||
WebConnection.Debug ($"MONO TLS STREAM ERROR: {socket.ID} {socket.CleanedUp} {ex.Message}");
|
||||
if (socket.CleanedUp)
|
||||
status = WebExceptionStatus.RequestCanceled;
|
||||
else if (CertificateValidationFailed)
|
||||
status = WebExceptionStatus.TrustFailure;
|
||||
else
|
||||
status = WebExceptionStatus.SecureChannelFailure;
|
||||
throw;
|
||||
} finally {
|
||||
WebConnection.Debug ($"MONO TLS STREAM CREATE STREAM DONE: {socket.ID} {socket.CleanedUp}");
|
||||
if (CertificateValidationFailed)
|
||||
status = WebExceptionStatus.TrustFailure;
|
||||
|
||||
if (status == WebExceptionStatus.Success)
|
||||
request.ServicePoint.UpdateClientCertificate (sslStream.InternalLocalCertificate);
|
||||
else {
|
||||
request.ServicePoint.UpdateClientCertificate (null);
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
}
|
||||
request.ServicePoint.UpdateClientCertificate (null);
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
throw;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -146,6 +142,7 @@ namespace Mono.Net.Security
|
||||
await sslStream.WriteAsync (tunnel.Data, 0, tunnel.Data.Length, cancellationToken).ConfigureAwait (false);
|
||||
} catch {
|
||||
status = WebExceptionStatus.SendFailure;
|
||||
sslStream.Dispose ();
|
||||
sslStream = null;
|
||||
throw;
|
||||
}
|
||||
|
||||
@@ -111,7 +111,7 @@ namespace System.IO.Compression
|
||||
if (disposing)
|
||||
GC.SuppressFinalize (this);
|
||||
|
||||
native.Dispose (disposing);
|
||||
native?.Dispose (disposing);
|
||||
|
||||
if (disposing && !disposed) {
|
||||
disposed = true;
|
||||
@@ -140,12 +140,15 @@ namespace System.IO.Compression
|
||||
|
||||
internal ValueTask<int> ReadAsyncMemory (Memory<byte> destination, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
return base.ReadAsync(destination, cancellationToken);
|
||||
}
|
||||
|
||||
internal int ReadCore (Span<byte> destination)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
var buffer = new byte [destination.Length];
|
||||
int count = Read(buffer, 0, buffer.Length);
|
||||
buffer.AsSpan(0, count).CopyTo(destination);
|
||||
return count;
|
||||
}
|
||||
|
||||
public override int Read (byte[] array, int offset, int count)
|
||||
@@ -180,12 +183,12 @@ namespace System.IO.Compression
|
||||
|
||||
internal ValueTask WriteAsyncMemory (ReadOnlyMemory<byte> source, CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
return base.WriteAsync(source, cancellationToken);
|
||||
}
|
||||
|
||||
internal void WriteCore (ReadOnlySpan<byte> source)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
Write (source.ToArray (), 0, source.Length);
|
||||
}
|
||||
|
||||
public override void Write (byte[] array, int offset, int count)
|
||||
@@ -392,11 +395,11 @@ namespace System.IO.Compression
|
||||
|
||||
io_buffer = null;
|
||||
|
||||
if (z_stream != null) {
|
||||
if (z_stream != null && !z_stream.IsInvalid) {
|
||||
z_stream.Dispose();
|
||||
}
|
||||
|
||||
if (data.IsAllocated) {
|
||||
if (data != null && data.IsAllocated) {
|
||||
data.Free ();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
//
|
||||
// System.IO.FileSystemEventArgs.cs
|
||||
//
|
||||
// Author:
|
||||
// Tim Coleman ([email protected])
|
||||
//
|
||||
// Copyright (C) Tim Coleman, 2002
|
||||
//
|
||||
|
||||
//
|
||||
// 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;
|
||||
|
||||
namespace System.IO {
|
||||
public class FileSystemEventArgs : EventArgs {
|
||||
|
||||
#region Fields
|
||||
|
||||
WatcherChangeTypes changeType;
|
||||
string directory;
|
||||
string name;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
#region Constructors
|
||||
|
||||
public FileSystemEventArgs (WatcherChangeTypes changeType, string directory, string name)
|
||||
{
|
||||
this.changeType = changeType;
|
||||
this.directory = directory;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
internal void SetName (string name)
|
||||
{
|
||||
this.name = name;
|
||||
}
|
||||
#endregion // Constructors
|
||||
|
||||
#region Properties
|
||||
|
||||
public WatcherChangeTypes ChangeType {
|
||||
get { return changeType; }
|
||||
}
|
||||
|
||||
public string FullPath {
|
||||
get { return Path.Combine (directory, name); }
|
||||
}
|
||||
|
||||
public string Name {
|
||||
get { return name; }
|
||||
}
|
||||
|
||||
#endregion // Properties
|
||||
}
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
//
|
||||
// System.IO.FileSystemEventHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Tim Coleman ([email protected])
|
||||
//
|
||||
// Copyright (C) Tim Coleman, 2002
|
||||
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
namespace System.IO {
|
||||
|
||||
public delegate void FileSystemEventHandler (object sender, FileSystemEventArgs e);
|
||||
}
|
||||
@@ -61,7 +61,7 @@ namespace System.IO {
|
||||
SearchPattern2 pattern;
|
||||
bool disposed;
|
||||
string mangledFilter;
|
||||
static IFileWatcher watcher;
|
||||
IFileWatcher watcher;
|
||||
object watcher_handle;
|
||||
static object lockobj = new object ();
|
||||
|
||||
|
||||
@@ -999,7 +999,7 @@ namespace System.Net.Sockets
|
||||
}
|
||||
});
|
||||
|
||||
public IAsyncResult BeginConnect (string host, int port, AsyncCallback requestCallback, object state)
|
||||
public IAsyncResult BeginConnect (string host, int port, AsyncCallback callback, object state)
|
||||
{
|
||||
ThrowIfDisposedAndClosed ();
|
||||
|
||||
@@ -1012,32 +1012,23 @@ namespace System.Net.Sockets
|
||||
if (is_listening)
|
||||
throw new InvalidOperationException ();
|
||||
|
||||
var callback = new AsyncCallback ((result) => {
|
||||
var resultTask = ((Task<IPAddress[]>)result);
|
||||
BeginConnect (resultTask.Result, port, requestCallback, resultTask.AsyncState);
|
||||
});
|
||||
return ConvertToApm<IPAddress[]> (Dns.GetHostAddressesAsync (host), callback, state);
|
||||
}
|
||||
var sockares = new SocketAsyncResult (this, callback, state, SocketOperation.Connect) {
|
||||
Port = port
|
||||
};
|
||||
|
||||
private static IAsyncResult ConvertToApm<T> (Task<T> task, AsyncCallback callback, object state)
|
||||
{
|
||||
if (task == null)
|
||||
throw new ArgumentNullException ("task");
|
||||
|
||||
var tcs = new TaskCompletionSource<T> (state);
|
||||
task.ContinueWith (t =>
|
||||
{
|
||||
var dnsRequest = Dns.GetHostAddressesAsync (host);
|
||||
dnsRequest.ContinueWith (t => {
|
||||
if (t.IsFaulted)
|
||||
tcs.TrySetException (t.Exception.InnerExceptions);
|
||||
sockares.Complete (t.Exception.InnerException);
|
||||
else if (t.IsCanceled)
|
||||
tcs.TrySetCanceled ();
|
||||
else
|
||||
tcs.TrySetResult (t.Result);
|
||||
|
||||
if (callback != null)
|
||||
callback (tcs.Task);
|
||||
sockares.Complete (new OperationCanceledException ());
|
||||
else {
|
||||
sockares.Addresses = t.Result;
|
||||
BeginMConnect (sockares);
|
||||
}
|
||||
}, TaskScheduler.Default);
|
||||
return tcs.Task;
|
||||
|
||||
return sockares;
|
||||
}
|
||||
|
||||
public IAsyncResult BeginConnect (EndPoint remoteEP, AsyncCallback callback, object state)
|
||||
|
||||
@@ -27,12 +27,12 @@
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'net_4_x' ">
|
||||
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-net_4_x-$(HostPlatform)</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_SECURITY_ALIAS;CODEDOM;FEATURE_COMPILED;MONO_FEATURE_BTLS;CONFIGURATION_DEP</DefineConstants>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_SECURITY_ALIAS;CODEDOM;FEATURE_COMPILED;MONO_FEATURE_BTLS;ENABLE_GSS;CONFIGURATION_DEP</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monodroid' ">
|
||||
<OutputPath>./../../class/lib/monodroid</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monodroid</IntermediateOutputPath>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_SECURITY_ALIAS;FEATURE_COMPILED;MONO_FEATURE_BTLS</DefineConstants>
|
||||
<DefineConstants>NET_1_1;NET_2_0;NET_2_1;NET_3_5;NET_4_0;NET_4_5;MONO;MOBILE;MOBILE_LEGACY;MOBILE_DYNAMIC;MONODROID;ANDROID;COREFX;CONFIGURATION_2_0;SYSTEM_NET_PRIMITIVES_DLL;XML_DEP;SECURITY_DEP;FEATURE_PAL;SYSTEM_NAMESPACE;MONO;PLATFORM_UNIX;MONO_FEATURE_PROCESS_START;MONO_FEATURE_THREAD_ABORT;MONO_FEATURE_THREAD_SUSPEND_RESUME;MONO_FEATURE_MULTIPLE_APPDOMAINS;MONO_SECURITY_ALIAS;FEATURE_COMPILED;MONO_FEATURE_BTLS;ENABLE_GSS</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monotouch' ">
|
||||
<OutputPath>./../../class/lib/monotouch</OutputPath>
|
||||
@@ -412,7 +412,11 @@
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionLevel.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\CompressionMode.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.Compression\src\System\IO\Compression\GZipStream.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\FileSystemEventArgs.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\FileSystemEventHandler.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\FileSystemWatcher.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\RenamedEventArgs.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\RenamedEventHandler.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.IO.FileSystem.Watcher\src\System\IO\WaitForChangedResult.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Mail\src\System\Net\Base64Stream.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\System.Net.Mail\src\System\Net\BufferBuilder.cs" />
|
||||
@@ -866,14 +870,10 @@
|
||||
<Compile Include="System.IO.Compression\DeflateStream.cs" />
|
||||
<Compile Include="System.IO\ErrorEventArgs.cs" />
|
||||
<Compile Include="System.IO\ErrorEventHandler.cs" />
|
||||
<Compile Include="System.IO\FileSystemEventArgs.cs" />
|
||||
<Compile Include="System.IO\FileSystemEventHandler.cs" />
|
||||
<Compile Include="System.IO\IODescriptionAttribute.cs" />
|
||||
<Compile Include="System.IO\InternalBufferOverflowException.cs" />
|
||||
<Compile Include="System.IO\InvalidDataException.cs" />
|
||||
<Compile Include="System.IO\NotifyFilters.cs" />
|
||||
<Compile Include="System.IO\RenamedEventArgs.cs" />
|
||||
<Compile Include="System.IO\RenamedEventHandler.cs" />
|
||||
<Compile Include="System.IO\WatcherChangeTypes.cs" />
|
||||
<Compile Include="System.Net.Mail\AlternateView.cs" />
|
||||
<Compile Include="System.Net.Mail\AlternateViewCollection.cs" />
|
||||
|
||||
@@ -110,6 +110,9 @@ System/RemoteExecutorTests.cs
|
||||
|
||||
# System.IO.FileSystemWatcher
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/Utility/*.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/Args.ErrorEventArgs.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/tests/FileSystemWatcher.unit.cs
|
||||
../../../external/corefx/src/Common/tests/System/IO/TempFile.cs
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
@@ -109,7 +110,72 @@ namespace MonoTests.System.IO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateTwoAndDispose ()
|
||||
{
|
||||
// Create two FSW instances and dispose them. Verify
|
||||
// that the backend IFileWatcher's Dispose
|
||||
// (watcher_handle) method got called.
|
||||
|
||||
// FIXME: This only works for the
|
||||
// CoreFXFileSystemWatcherProxy not the other backends.
|
||||
|
||||
using (var tmp = new TempDirectory ()) {
|
||||
// have to use reflection to poke at the private fields of FileSystemWatcher.
|
||||
var watcherField = typeof (FileSystemWatcher).GetField ("watcher", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
Assert.IsNotNull (watcherField);
|
||||
var watcherHandleField = typeof (FileSystemWatcher).GetField ("watcher_handle", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
Assert.IsNotNull (watcherHandleField);
|
||||
var proxyType = typeof (FileSystemWatcher).Assembly.GetType ("System.IO.CoreFXFileSystemWatcherProxy");
|
||||
Assert.IsNotNull (proxyType);
|
||||
|
||||
var fsw1 = new FileSystemWatcher (tmp.Path, "*");
|
||||
var fsw2 = new FileSystemWatcher (tmp.Path, "*");
|
||||
|
||||
object handle1 = null;
|
||||
object handle2 = null;
|
||||
|
||||
// using "using" to ensure that Dispose gets called even if we throw an exception
|
||||
using (var fsw11 = fsw1)
|
||||
using (var fsw22 = fsw2) {
|
||||
// at this point watcher and watcher_handle should be set
|
||||
|
||||
var watcher = watcherField.GetValue (fsw1);
|
||||
Assert.IsNotNull (watcher);
|
||||
if (!proxyType.IsAssignableFrom (watcher.GetType ()))
|
||||
Assert.Ignore ("Testing only CoreFXFileSystemWatcherProxy FSW backend");
|
||||
|
||||
handle1 = watcherHandleField.GetValue (fsw1);
|
||||
handle2 = watcherHandleField.GetValue (fsw2);
|
||||
|
||||
Assert.IsNotNull (handle1);
|
||||
Assert.IsNotNull (handle2);
|
||||
|
||||
}
|
||||
|
||||
// Dispose was called, now watcher_handle should be null
|
||||
|
||||
Assert.IsNull (watcherHandleField.GetValue (fsw1));
|
||||
Assert.IsNull (watcherHandleField.GetValue (fsw2));
|
||||
|
||||
// and moreover, the CoreFXFileSystemWatcherProxy shouldn't have entries for either handle1 or handle2
|
||||
|
||||
var proxyTypeInternalMapField = proxyType.GetField ("internal_map", BindingFlags.Static | BindingFlags.NonPublic);
|
||||
Assert.IsNotNull (proxyTypeInternalMapField);
|
||||
var internal_map = proxyTypeInternalMapField.GetValue (null)
|
||||
as global::System.Collections.Generic.IDictionary<object, global::System.IO.CoreFX.FileSystemWatcher>;
|
||||
Assert.IsNotNull (internal_map);
|
||||
|
||||
// This pair are the critical checks: after we call Dispose on fsw1 and fsw2, the
|
||||
// backend's internal map shouldn't have anything keyed on handle1 and handle2.
|
||||
// Therefore System.IO.CoreFX.FileSystemWatcher instances will be disposed of, too.
|
||||
Assert.IsFalse (internal_map.ContainsKey (handle1));
|
||||
Assert.IsFalse (internal_map.ContainsKey (handle2));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
@@ -511,7 +511,7 @@ namespace MonoTests.System.Net.Sockets
|
||||
sock.BeginConnect (ep, new AsyncCallback(SocketError_callback),
|
||||
sock);
|
||||
|
||||
if (SocketError_event.WaitOne (2000, false) == false) {
|
||||
if (SocketError_event.WaitOne (5000, false) == false) {
|
||||
Assert.Fail ("SocketError wait timed out");
|
||||
}
|
||||
|
||||
@@ -1715,6 +1715,68 @@ namespace MonoTests.System.Net.Sockets
|
||||
listen.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void BeginConnectHostNamePortWithoutCallback ()
|
||||
{
|
||||
Socket sock = new Socket (AddressFamily.InterNetwork,
|
||||
SocketType.Stream,
|
||||
ProtocolType.Tcp);
|
||||
Socket listen = new Socket (AddressFamily.InterNetwork,
|
||||
SocketType.Stream,
|
||||
ProtocolType.Tcp);
|
||||
|
||||
listen.Bind (IPAddress.Loopback, out IPEndPoint ep);
|
||||
listen.Listen (1);
|
||||
|
||||
IAsyncResult result = sock.BeginConnect (IPAddress.Loopback.ToString (), ep.Port, null, null);
|
||||
|
||||
if (result.AsyncWaitHandle.WaitOne (2000, false) == false) {
|
||||
Assert.Fail ("BeginConnectHostNamePortWithoutCallback wait timed out");
|
||||
}
|
||||
|
||||
Assert.AreEqual (true, result.IsCompleted, "BeginConnectHostNamePortWithoutCallback #1");
|
||||
|
||||
sock.EndConnect (result);
|
||||
|
||||
sock.Close ();
|
||||
listen.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
#endif
|
||||
public void BeginConnectHostNamePortWithCallback ()
|
||||
{
|
||||
Socket sock = new Socket (AddressFamily.InterNetwork,
|
||||
SocketType.Stream,
|
||||
ProtocolType.Tcp);
|
||||
Socket listen = new Socket (AddressFamily.InterNetwork,
|
||||
SocketType.Stream,
|
||||
ProtocolType.Tcp);
|
||||
|
||||
listen.Bind (IPAddress.Loopback, out IPEndPoint ep);
|
||||
listen.Listen (1);
|
||||
|
||||
BCCalledBack.Reset ();
|
||||
|
||||
BCConnected = false;
|
||||
|
||||
IAsyncResult result = sock.BeginConnect (IPAddress.Loopback.ToString (), ep.Port, BCCallback, sock);
|
||||
|
||||
if (BCCalledBack.WaitOne (2000, false) == false) {
|
||||
Assert.Fail ("BeginConnectHostNamePortWithCallback wait timed out");
|
||||
}
|
||||
|
||||
Assert.AreEqual (true, BCConnected, "BeginConnectHostNamePortWithCallback #1");
|
||||
|
||||
sock.Close ();
|
||||
listen.Close ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
#if FEATURE_NO_BSD_SOCKETS
|
||||
[ExpectedException (typeof (PlatformNotSupportedException))]
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace MonoTests.System.Net.WebSockets
|
||||
[TestFixture]
|
||||
public class ClientWebSocketTest
|
||||
{
|
||||
const string EchoServerUrl = "ws://corefx-net.cloudapp.net/WebSocket/EchoWebSocket.ashx";
|
||||
const string EchoServerUrl = "ws://corefx-net-http11.azurewebsites.net/WebSocket/EchoWebSocket.ashx";
|
||||
|
||||
ClientWebSocket socket;
|
||||
MethodInfo headerSetMethod;
|
||||
|
||||
+4
@@ -1908,6 +1908,7 @@ WYpnKQqsKIzlSqv9wwXs7B1iA7ZdvHk3TAnSnLP1o2H7ME05UnZPKCvraONdezon
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONOTOUCH_WATCH
|
||||
private void CheckAuthenticode (X509Certificate2 x)
|
||||
{
|
||||
DateTime expectedNotAfter = new DateTime (632118306520000000,
|
||||
@@ -1975,6 +1976,7 @@ WYpnKQqsKIzlSqv9wwXs7B1iA7ZdvHk3TAnSnLP1o2H7ME05UnZPKCvraONdezon
|
||||
File.Delete (tempFile);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
private bool RunningOnWindows ()
|
||||
{
|
||||
@@ -2052,7 +2054,9 @@ WYpnKQqsKIzlSqv9wwXs7B1iA7ZdvHk3TAnSnLP1o2H7ME05UnZPKCvraONdezon
|
||||
|
||||
Assert.AreEqual (X509ContentType.Pkcs7, X509Certificate2.GetCertContentType (farscape_pkcs7), "1-Pkcs7");
|
||||
|
||||
#if !MONOTOUCH_WATCH
|
||||
Assert.AreEqual (X509ContentType.Authenticode, X509Certificate2.GetCertContentType (helloworld_signed), "Authenticode");
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -28,14 +28,10 @@ System.IO.Compression/DeflateStream.cs
|
||||
|
||||
System.IO/ErrorEventArgs.cs
|
||||
System.IO/ErrorEventHandler.cs
|
||||
System.IO/FileSystemEventArgs.cs
|
||||
System.IO/FileSystemEventHandler.cs
|
||||
System.IO/InternalBufferOverflowException.cs
|
||||
System.IO/InvalidDataException.cs
|
||||
System.IO/IODescriptionAttribute.cs
|
||||
System.IO/NotifyFilters.cs
|
||||
System.IO/RenamedEventArgs.cs
|
||||
System.IO/RenamedEventHandler.cs
|
||||
System.IO/WatcherChangeTypes.cs
|
||||
|
||||
System.Net/BasicClient.cs
|
||||
@@ -872,13 +868,17 @@ ReferenceSources/Win32Exception.cs
|
||||
../../../external/corefx/src/System.Private.Uri/src/System/UriBuilder.cs
|
||||
|
||||
../../../external/corefx/src/System.Runtime.Extensions/src/System/CodeDom/Compiler/IndentedTextWriter.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemEventArgs.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemEventHandler.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/RenamedEventArgs.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/RenamedEventHandler.cs
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/WaitForChangedResult.cs
|
||||
|
||||
../../../external/corefx/src/System.Runtime.InteropServices/src/System/Security/SecureStringMarshal.cs
|
||||
../../../external/corefx/src/System.Runtime.Extensions/src/System/StringNormalizationExtensions.cs
|
||||
../../../external/corefx/src/System.Diagnostics.StackTrace/src/System/Diagnostics/StackFrameExtensions.cs
|
||||
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/System/IO/FileSystemWatcher.cs
|
||||
|
||||
# Everything except compiled
|
||||
../../../external/corefx/src/System.Text.RegularExpressions/src/System/Text/RegularExpressions/Capture.cs
|
||||
|
||||
@@ -232,7 +232,7 @@ TEST_RESOURCES = $(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE)
|
||||
satellite_assembly1 = $(test_lib_dir)/es-ES/$(patsubst %.dll,%.resources.dll,$(test_lib))
|
||||
satellite_assembly2 = $(test_lib_dir)/nn-NO/$(patsubst %.dll,%.resources.dll,$(test_lib))
|
||||
|
||||
$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) $(test_lib_dir)
|
||||
$(test_lib_output): $(TEST_RESOURCES) $(satellite_assembly1) $(satellite_assembly2) | $(test_lib_dir)
|
||||
|
||||
mscorlib_for_profile = $(topdir)/class/lib/$(PROFILE)/mscorlib.dll
|
||||
|
||||
@@ -298,11 +298,8 @@ NO_VTS_TEST = yes
|
||||
endif
|
||||
|
||||
ifndef NO_VTS_TEST
|
||||
test: test-vts
|
||||
run-test: run-test-vts
|
||||
else
|
||||
test:
|
||||
run-test:
|
||||
test-local: test-vts
|
||||
run-test-local: run-test-vts
|
||||
endif
|
||||
|
||||
EXTRA_DISTFILES += \
|
||||
|
||||
@@ -100,7 +100,7 @@ namespace Mono {
|
||||
static extern void DisableMicrosoftTelemetry ();
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void EnableMicrosoftTelemetry_internal (IntPtr appBundleID, IntPtr appSignature, IntPtr appVersion, IntPtr merpGUIPath, IntPtr eventType, IntPtr appPath, IntPtr configDir);
|
||||
static extern void EnableMicrosoftTelemetry_internal (IntPtr appBundleID, IntPtr appSignature, IntPtr appVersion, IntPtr merpGUIPath, IntPtr appPath, IntPtr configDir);
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void SendMicrosoftTelemetry_internal (IntPtr payload, ulong portable_hash, ulong unportable_hash);
|
||||
@@ -148,18 +148,17 @@ namespace Mono {
|
||||
}
|
||||
|
||||
// All must be set except for configDir_str
|
||||
static void EnableMicrosoftTelemetry (string appBundleID_str, string appSignature_str, string appVersion_str, string merpGUIPath_str, string eventType_str, string appPath_str, string configDir_str)
|
||||
static void EnableMicrosoftTelemetry (string appBundleID_str, string appSignature_str, string appVersion_str, string merpGUIPath_str, string unused /* eventType_str */, string appPath_str, string configDir_str)
|
||||
{
|
||||
if (RuntimeInformation.IsOSPlatform (OSPlatform.OSX)) {
|
||||
using (var appBundleID_chars = RuntimeMarshal.MarshalString (appBundleID_str))
|
||||
using (var appSignature_chars = RuntimeMarshal.MarshalString (appSignature_str))
|
||||
using (var appVersion_chars = RuntimeMarshal.MarshalString (appVersion_str))
|
||||
using (var merpGUIPath_chars = RuntimeMarshal.MarshalString (merpGUIPath_str))
|
||||
using (var eventType_chars = RuntimeMarshal.MarshalString (eventType_str))
|
||||
using (var appPath_chars = RuntimeMarshal.MarshalString (appPath_str))
|
||||
using (var configDir_chars = RuntimeMarshal.MarshalString (configDir_str))
|
||||
{
|
||||
EnableMicrosoftTelemetry_internal (appBundleID_chars.Value, appSignature_chars.Value, appVersion_chars.Value, merpGUIPath_chars.Value, eventType_chars.Value, appPath_chars.Value, configDir_chars.Value);
|
||||
EnableMicrosoftTelemetry_internal (appBundleID_chars.Value, appSignature_chars.Value, appVersion_chars.Value, merpGUIPath_chars.Value, appPath_chars.Value, configDir_chars.Value);
|
||||
}
|
||||
} else {
|
||||
throw new PlatformNotSupportedException("Merp support is currently only supported on OSX.");
|
||||
@@ -193,6 +192,14 @@ namespace Mono {
|
||||
return new Tuple<String, ulong, ulong> (payload_str, portable_hash, unportable_hash);
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void RegisterReportingForAllNativeLibs_internal ();
|
||||
|
||||
static void RegisterReportingForAllNativeLibs ()
|
||||
{
|
||||
RegisterReportingForAllNativeLibs_internal ();
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void RegisterReportingForNativeLib_internal (IntPtr modulePathSuffix, IntPtr moduleName);
|
||||
|
||||
|
||||
@@ -34,6 +34,36 @@ namespace System.Globalization
|
||||
[StructLayout (LayoutKind.Sequential)]
|
||||
partial class CalendarData
|
||||
{
|
||||
private static string[] HEBREW_MONTH_NAMES = new[] {
|
||||
"\u05EA\u05E9\u05E8\u05D9",
|
||||
"\u05D7\u05E9\u05D5\u05DF",
|
||||
"\u05DB\u05E1\u05DC\u05D5",
|
||||
"\u05D8\u05D1\u05EA",
|
||||
"\u05E9\u05D1\u05D8",
|
||||
"\u05D0\u05D3\u05E8",
|
||||
"\u05D0\u05D3\u05E8\u0020\u05D1",
|
||||
"\u05E0\u05D9\u05E1\u05DF",
|
||||
"\u05D0\u05D9\u05D9\u05E8",
|
||||
"\u05E1\u05D9\u05D5\u05DF",
|
||||
"\u05EA\u05DE\u05D5\u05D6",
|
||||
"\u05D0\u05D1",
|
||||
"\u05D0\u05DC\u05D5\u05DC" };
|
||||
|
||||
private static string[] HEBREW_LEAP_MONTH_NAMES = new[] {
|
||||
"\u05EA\u05E9\u05E8\u05D9",
|
||||
"\u05D7\u05E9\u05D5\u05DF",
|
||||
"\u05DB\u05E1\u05DC\u05D5",
|
||||
"\u05D8\u05D1\u05EA",
|
||||
"\u05E9\u05D1\u05D8",
|
||||
"\u05D0\u05D3\u05E8\u0020\u05D0",
|
||||
"\u05D0\u05D3\u05E8\u0020\u05D1",
|
||||
"\u05E0\u05D9\u05E1\u05DF",
|
||||
"\u05D0\u05D9\u05D9\u05E8",
|
||||
"\u05E1\u05D9\u05D5\u05DF",
|
||||
"\u05EA\u05DE\u05D5\u05D6",
|
||||
"\u05D0\u05D1",
|
||||
"\u05D0\u05DC\u05D5\u05DC" };
|
||||
|
||||
public static int nativeGetTwoDigitYearMax (int calID)
|
||||
{
|
||||
// -1 mean OS does not override default BCL max year
|
||||
@@ -43,7 +73,17 @@ namespace System.Globalization
|
||||
static bool nativeGetCalendarData (CalendarData data, string localeName, int calendarId)
|
||||
{
|
||||
// TODO: Convert calendar-id to mono runtime calendar-id when it's used
|
||||
return data.fill_calendar_data (localeName.ToLowerInvariant (), calendarId);
|
||||
if (data.fill_calendar_data (localeName.ToLowerInvariant (), calendarId)) {
|
||||
if ((CalendarId)calendarId == CalendarId.HEBREW) {
|
||||
// HACK: Generate leap month names because the native code does not do it
|
||||
// and tests would fail to round-trip dates on leap years.
|
||||
// https://github.com/mono/mono/issues/16623
|
||||
data.saMonthNames = HEBREW_MONTH_NAMES;
|
||||
data.saLeapYearMonthNames = HEBREW_LEAP_MONTH_NAMES;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
|
||||
@@ -433,6 +433,21 @@ namespace System.IO
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
private extern static bool Cancel_internal (IntPtr handle, out MonoIOError error);
|
||||
|
||||
internal static bool Cancel (SafeHandle safeHandle, out MonoIOError error)
|
||||
{
|
||||
bool release = false;
|
||||
try {
|
||||
safeHandle.DangerousAddRef (ref release);
|
||||
return Cancel_internal (safeHandle.DangerousGetHandle (), out error);
|
||||
} finally {
|
||||
if (release)
|
||||
safeHandle.DangerousRelease ();
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
public extern static bool Close (IntPtr handle,
|
||||
out MonoIOError error);
|
||||
|
||||
@@ -75,8 +75,8 @@ namespace System.IO
|
||||
ERROR_SHARING_BUFFER_EXCEEDED = 36,
|
||||
ERROR_HANDLE_EOF = 38,
|
||||
*/ ERROR_HANDLE_DISK_FULL = 39,
|
||||
/* ERROR_NOT_SUPPORTED = 50,
|
||||
ERROR_REM_NOT_LIST = 51,
|
||||
ERROR_NOT_SUPPORTED = 50,
|
||||
/* ERROR_REM_NOT_LIST = 51,
|
||||
ERROR_DUP_NAME = 52,
|
||||
ERROR_BAD_NETPATH = 53,
|
||||
ERROR_NETWORK_BUSY = 54,
|
||||
|
||||
@@ -211,12 +211,12 @@ namespace System.Runtime.InteropServices
|
||||
else
|
||||
perform_release = true;
|
||||
|
||||
/* Attempt the update to the new state, fail and retry if the initial
|
||||
* state has been modified in the meantime. Decrement the ref count by
|
||||
* substracting SH_RefCountOne from the state then OR in the bits for
|
||||
* Dispose (if that's the reason for the Release) and closed (if the
|
||||
* initial ref count was 1). */
|
||||
new_state = (old_state & RefCount_Mask) - RefCount_One;
|
||||
// Not closed, let's propose an update (to the ref count, just add
|
||||
// StateBits.RefCountOne to the state to effectively add 1 to the ref count).
|
||||
// Continue doing this until the update succeeds (because nobody
|
||||
// modifies the state field between the read and write operations) or
|
||||
// the state moves to closed.
|
||||
new_state = old_state - RefCount_One;
|
||||
if ((old_state & RefCount_Mask) == RefCount_One)
|
||||
new_state |= (int) State.Closed;
|
||||
if (dispose)
|
||||
|
||||
@@ -1216,10 +1216,13 @@ namespace System
|
||||
return false;
|
||||
}
|
||||
|
||||
var isUtc = false;
|
||||
if (dateTime.Kind != DateTimeKind.Utc) {
|
||||
if (!TryAddTicks (date, -BaseUtcOffset.Ticks, out date, DateTimeKind.Utc))
|
||||
return false;
|
||||
}
|
||||
} else
|
||||
isUtc = true;
|
||||
|
||||
|
||||
AdjustmentRule current = GetApplicableRule (date);
|
||||
if (current != null) {
|
||||
@@ -1231,7 +1234,7 @@ namespace System
|
||||
if (forOffset)
|
||||
isDst = true;
|
||||
offset = baseUtcOffset;
|
||||
if (date >= new DateTime (tStart.Ticks + current.DaylightDelta.Ticks, DateTimeKind.Utc))
|
||||
if (isUtc || (date >= new DateTime (tStart.Ticks + current.DaylightDelta.Ticks, DateTimeKind.Utc)))
|
||||
{
|
||||
offset += current.DaylightDelta;
|
||||
isDst = true;
|
||||
|
||||
@@ -1650,6 +1650,29 @@ namespace MonoTests.System.IO
|
||||
|
||||
}
|
||||
|
||||
// See https://github.com/mono/mono/issues/16032
|
||||
[Test]
|
||||
public void DeleteOnCloseWithFileCopy ()
|
||||
{
|
||||
string source = TempFolder + DSC + "source.txt";
|
||||
string target = TempFolder + DSC + "target.txt";
|
||||
|
||||
File.WriteAllText (source, "text");
|
||||
FileStream fs = new FileStream (source, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.ReadWrite, 2048,
|
||||
FileOptions.DeleteOnClose);
|
||||
|
||||
Assert.AreEqual (true, File.Exists (source), "DCFC#1");
|
||||
|
||||
try {
|
||||
File.Copy (fs.Name, target, true);
|
||||
} finally {
|
||||
fs.Dispose();
|
||||
}
|
||||
|
||||
Assert.AreEqual (false, File.Exists (source), "DCFC#2");
|
||||
Assert.AreEqual (true, File.Exists (target), "DCFC#3");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OpenCharDeviceRepeatedly ()
|
||||
{
|
||||
|
||||
@@ -899,6 +899,40 @@ namespace MonoTests.System.Reflection.Emit
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MethodInfoGetParametersCrash () {
|
||||
// Regression test for https://github.com/mono/mono/issues/16570
|
||||
//
|
||||
// MethodInfo.GetParameters() called on a dynamic assembly would attempt to copy the custom_name and cookie, which could be junk depending
|
||||
// on how the union is being used.
|
||||
var aName = new AssemblyName("TestAssembly");
|
||||
var testAssembly = AppDomain.CurrentDomain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.RunAndSave);
|
||||
var testModule = testAssembly.DefineDynamicModule(aName.Name, aName.Name + ".dll");
|
||||
|
||||
var typeBuilder = testModule.DefineType("TestType");
|
||||
|
||||
var ctorBuilder = typeBuilder.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, Type.EmptyTypes);
|
||||
|
||||
var ctorIl = ctorBuilder.GetILGenerator();
|
||||
ctorIl.Emit(OpCodes.Ret);
|
||||
|
||||
var methodBuilder = typeBuilder.DefineMethod("TestMethod", MethodAttributes.Public, typeof(void), new[] { typeof(int[]) });
|
||||
methodBuilder.DefineParameter(0, ParameterAttributes.Retval, null);
|
||||
var paramBuilder = methodBuilder.DefineParameter(1, ParameterAttributes.None, null);
|
||||
|
||||
var attrCtor = typeof(MarshalAsAttribute).GetConstructor(new[] { typeof(UnmanagedType) });
|
||||
object[] ctorArgs = { UnmanagedType.LPArray };
|
||||
var attr = new CustomAttributeBuilder(attrCtor, ctorArgs);
|
||||
paramBuilder.SetCustomAttribute(attr);
|
||||
|
||||
var methodIl = methodBuilder.GetILGenerator();
|
||||
methodIl.Emit(OpCodes.Ret);
|
||||
|
||||
var createdType = typeBuilder.CreateType();
|
||||
|
||||
var methodInfo = createdType.GetMethod("TestMethod", BindingFlags.Instance | BindingFlags.Public);
|
||||
methodInfo.GetParameters();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,9 +29,11 @@
|
||||
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using NUnit.Framework;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MonoTests.System.Threading
|
||||
{
|
||||
@@ -496,33 +498,102 @@ namespace MonoTests.System.Threading
|
||||
}
|
||||
}
|
||||
|
||||
[Test] // https://github.com/mono/mono/issues/12421
|
||||
public void EnsurePostIsNotCalled ()
|
||||
[Test] // https://github.com/mono/mono/issues/16759
|
||||
[Category("NotWasm")]
|
||||
public void EnsureCanceledContinuationsAreOnSameThread ()
|
||||
{
|
||||
SynchronizationContext mainContext = SynchronizationContext.Current;
|
||||
var asc = new AssertSyncContext ();
|
||||
SynchronizationContext.SetSynchronizationContext (asc);
|
||||
var ct = new CancellationTokenSource ();
|
||||
var tcs = new TaskCompletionSource<bool> ();
|
||||
ct.Token.Register (() => tcs.TrySetCanceled ());
|
||||
AsyncPump.Run(async delegate {
|
||||
var _tcs = new TaskCompletionSource<bool>();
|
||||
var _cts = new CancellationTokenSource();
|
||||
|
||||
bool taskIsCancelled = false;
|
||||
Action awaitAction = async () => {
|
||||
try { await tcs.Task; }
|
||||
catch (OperationCanceledException) {
|
||||
taskIsCancelled = true;
|
||||
}
|
||||
};
|
||||
awaitAction ();
|
||||
ct.Cancel (); // should not trigger SynchronizationContext.Post
|
||||
Assert.IsTrue (taskIsCancelled);
|
||||
SynchronizationContext.SetSynchronizationContext (mainContext);
|
||||
var curThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
var taskThreadId = 0;
|
||||
var taskIsCancelled = false;
|
||||
|
||||
var task = Task.Run(() =>
|
||||
{
|
||||
taskThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
_cts.Cancel();
|
||||
});
|
||||
|
||||
_cts.Token.Register(() => _tcs.TrySetCanceled());
|
||||
try
|
||||
{
|
||||
await _tcs.Task;
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
// Continuation should run on the same thread before the task started.
|
||||
Assert.AreEqual(curThreadId, Thread.CurrentThread.ManagedThreadId, "#1");
|
||||
taskIsCancelled = true;
|
||||
}
|
||||
|
||||
Assert.IsTrue (taskIsCancelled, "#2");
|
||||
Assert.AreNotEqual(taskThreadId, curThreadId, "#3");
|
||||
});
|
||||
}
|
||||
|
||||
class AssertSyncContext : SynchronizationContext
|
||||
public static class AsyncPump
|
||||
{
|
||||
public override void Post (SendOrPostCallback d, object state) =>
|
||||
throw new InvalidOperationException ("SynchronizationContext.Post was not expected.");
|
||||
/// <summary>Runs the specified asynchronous function.</summary>
|
||||
/// <param name="func">The asynchronous function to execute.</param>
|
||||
public static void Run(Func<Task> func)
|
||||
{
|
||||
if (func == null) throw new ArgumentNullException("func");
|
||||
|
||||
var prevCtx = SynchronizationContext.Current;
|
||||
try
|
||||
{
|
||||
// Establish the new context
|
||||
var syncCtx = new SingleThreadSynchronizationContext();
|
||||
SynchronizationContext.SetSynchronizationContext(syncCtx);
|
||||
|
||||
// Invoke the function and alert the context to when it completes
|
||||
var t = func();
|
||||
if (t == null) throw new InvalidOperationException("No task provided.");
|
||||
t.ContinueWith(delegate { syncCtx.Complete(); }, TaskScheduler.Default);
|
||||
|
||||
// Pump continuations and propagate any exceptions
|
||||
syncCtx.RunOnCurrentThread();
|
||||
t.GetAwaiter().GetResult();
|
||||
}
|
||||
finally { SynchronizationContext.SetSynchronizationContext(prevCtx); }
|
||||
}
|
||||
|
||||
/// <summary>Provides a SynchronizationContext that's single-threaded.</summary>
|
||||
private sealed class SingleThreadSynchronizationContext : SynchronizationContext
|
||||
{
|
||||
/// <summary>The queue of work items.</summary>
|
||||
private readonly BlockingCollection<KeyValuePair<SendOrPostCallback, object>> m_queue =
|
||||
new BlockingCollection<KeyValuePair<SendOrPostCallback, object>>();
|
||||
/// <summary>The processing thread.</summary>
|
||||
private readonly Thread m_thread = Thread.CurrentThread;
|
||||
|
||||
/// <summary>Dispatches an asynchronous message to the synchronization context.</summary>
|
||||
/// <param name="d">The System.Threading.SendOrPostCallback delegate to call.</param>
|
||||
/// <param name="state">The object passed to the delegate.</param>
|
||||
public override void Post(SendOrPostCallback d, object state)
|
||||
{
|
||||
if (d == null) throw new ArgumentNullException("d");
|
||||
m_queue.Add(new KeyValuePair<SendOrPostCallback, object>(d, state));
|
||||
}
|
||||
|
||||
/// <summary>Not supported.</summary>
|
||||
public override void Send(SendOrPostCallback d, object state)
|
||||
{
|
||||
throw new NotSupportedException("Synchronously sending is not supported.");
|
||||
}
|
||||
|
||||
/// <summary>Runs an loop to process all queued work items.</summary>
|
||||
public void RunOnCurrentThread()
|
||||
{
|
||||
foreach (var workItem in m_queue.GetConsumingEnumerable())
|
||||
workItem.Key(workItem.Value);
|
||||
}
|
||||
|
||||
/// <summary>Notifies the context that no more work will arrive.</summary>
|
||||
public void Complete() { m_queue.CompleteAdding(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,8 +54,11 @@ namespace MonoTests.System
|
||||
return "New Zealand Standard Time";
|
||||
case "Europe/Athens":
|
||||
return "GTB Standard Time";
|
||||
case "Europe/Chisinau":
|
||||
return "E. Europe Standard Time";
|
||||
case "US/Eastern":
|
||||
return "Eastern Standard Time";
|
||||
case "America/Chicago":
|
||||
case "US/Central":
|
||||
return "Central Standard Time";
|
||||
case "US/Pacific":
|
||||
@@ -64,18 +67,57 @@ namespace MonoTests.System
|
||||
case "Australia/Melbourne":
|
||||
return "AUS Eastern Standard Time";
|
||||
case "Europe/Brussels":
|
||||
case "Europe/Copenhagen":
|
||||
case "Europe/Paris":
|
||||
case "Europe/Madrid":
|
||||
return "Romance Standard Time";
|
||||
case "Africa/Kinshasa":
|
||||
return "W. Central Africa Standard Time";
|
||||
case "Europe/Rome":
|
||||
case "Europe/Vatican":
|
||||
case "Europe/Vienna":
|
||||
case "Europe/Berlin":
|
||||
case "Europe/Luxembourg":
|
||||
case "Europe/Malta":
|
||||
case "Europe/Monaco":
|
||||
case "Europe/Amsterdam":
|
||||
case "Europe/Oslo":
|
||||
case "Europe/San_Marino":
|
||||
return "W. Europe Standard Time";
|
||||
case "Canada/Eastern":
|
||||
return "Eastern Standard Time";
|
||||
case "Asia/Tehran":
|
||||
return "Iran Standard Time";
|
||||
case "Europe/Guernsey":
|
||||
case "Europe/Dublin":
|
||||
case "Europe/Isle_of_Man":
|
||||
case "Europe/Jersey":
|
||||
case "Europe/Lisbon":
|
||||
case "Europe/London":
|
||||
return "GMT Standard Time";
|
||||
case "America/Havana":
|
||||
return "Cuba Standard Time";
|
||||
case "America/Anchorage":
|
||||
return "Alaskan Standard Time";
|
||||
case "Atlantic/Azores":
|
||||
return "Azores Standard Time";
|
||||
case "Asia/Jerusalem":
|
||||
return "Israel Standard Time";
|
||||
case "Asia/Amman":
|
||||
return "Jordan Standard Time";
|
||||
case "Europe/Tirane":
|
||||
case "Europe/Warsaw":
|
||||
return "Central European Standard Time";
|
||||
case "Europe/Sofia":
|
||||
case "Europe/Tallinn":
|
||||
case "Europe/Riga":
|
||||
case "Europe/Vilnius":
|
||||
case "Europe/Kiev":
|
||||
return "FLE Standard Time";
|
||||
case "Europe/Prague":
|
||||
case "Europe/Budapest":
|
||||
case "Europe/Bratislava":
|
||||
return "Central Europe Standard Time";
|
||||
default:
|
||||
Assert.Fail ($"No mapping defined for zone id '{id}'");
|
||||
return null;
|
||||
@@ -482,6 +524,218 @@ namespace MonoTests.System
|
||||
Assert.AreEqual (new TimeSpan (0, 0, 0), tzi.GetUtcOffset (date));
|
||||
#endif
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Bug_16395 ()
|
||||
{
|
||||
// Cuba, Havana (Cuba Standard Time): Jumps ahead at 12:00 AM on 3/8/2020 to 1:00 AM
|
||||
CheckJumpingIntoDST ("America/Havana",
|
||||
new DateTime (2020, 3, 8, 0, 0, 0), new DateTime (2020, 3, 8, 0, 30, 0), new DateTime (2020, 3, 8, 1, 0, 0),
|
||||
new TimeSpan (-5, 0, 0), new TimeSpan (-4, 0, 0));
|
||||
|
||||
// US, Kansas City, MO (US Central Time): Jumps ahead at 2:00 AM on 3/8/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("America/Chicago",
|
||||
new DateTime (2020, 3, 8, 2, 0, 0), new DateTime (2020, 3, 8, 2, 30, 0), new DateTime (2020, 3, 8, 3, 0, 0),
|
||||
new TimeSpan (-6, 0, 0), new TimeSpan (-5, 0, 0));
|
||||
|
||||
// Anchorage, AK (Alaska Time): Jumps ahead at 2:00 AM on 3/8/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("America/Anchorage",
|
||||
new DateTime (2020, 3, 8, 2, 0, 0), new DateTime (2020, 3, 8, 2, 30, 0), new DateTime (2020, 3, 8, 3, 0, 0),
|
||||
new TimeSpan (-9, 0, 0), new TimeSpan (-8, 0, 0));
|
||||
|
||||
// Azores ST (Ponta Delgada, Portugal): Jumps ahead at 12:00 AM on 3/29/2020 to 1:00 AM
|
||||
CheckJumpingIntoDST ("Atlantic/Azores",
|
||||
new DateTime (2020, 3, 29, 0, 0, 0), new DateTime (2020, 3, 29, 0, 30, 0), new DateTime (2020, 3, 29, 1, 0, 0),
|
||||
new TimeSpan (-1, 0, 0), new TimeSpan (0, 0, 0));
|
||||
|
||||
// Iran, Tehran (Iran ST): Jumps ahead at 12:00 AM on 3/21/2020 to 1:00 AM
|
||||
CheckJumpingIntoDST ("Asia/Tehran",
|
||||
new DateTime (2020, 3, 21, 0, 0, 0), new DateTime (2020, 3, 21, 0, 30, 0), new DateTime (2020, 3, 21, 1, 0, 0),
|
||||
new TimeSpan (3, 30, 0), new TimeSpan (4, 30, 0));
|
||||
|
||||
// Israel, Jerusalem (Israel ST): Jumps ahead at 2:00 AM on 3/27/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Asia/Jerusalem",
|
||||
new DateTime (2020, 3, 27, 2, 0, 0), new DateTime (2020, 3, 27, 2, 30, 0), new DateTime (2020, 3, 27, 3, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Jordan, Amman (Eastern European ST): Jumps ahead at 12:00 AM on 3/27/2020 to 1:00 AM
|
||||
CheckJumpingIntoDST ("Asia/Amman",
|
||||
new DateTime (2020, 3, 27, 0, 0, 0), new DateTime (2020, 3, 27, 0, 30, 0), new DateTime (2020, 3, 27, 1, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Albania, Tirana (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Tirane",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Austria, Vienna (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Vienna",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Belgium, Brussels (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Brussels",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Bulgaria, Sofia (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Sofia",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Czechia, Prague (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Prague",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Denmark, Copenhagen (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Copenhagen",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Estonia, Tallinn (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Tallinn",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// France, Paris (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Paris",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Germany, Berlin (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Berlin",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Greece, Athens (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Athens",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Guernsey (UK) Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Guernsey",
|
||||
new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
|
||||
// Holy See, Vatican City (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Vatican",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Hungary, Budapest (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Budapest",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// // Ireland, Dublin (Greenwich Mean Time -> Irish Standard Time): Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
// CheckJumpingIntoDST ("Europe/Dublin",
|
||||
// new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
// new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
|
||||
// UK, Douglas, Isle of Man (GMT+1:00): Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Isle_of_Man",
|
||||
new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
|
||||
// Italy, Rome (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Rome",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Jersey (UK): Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Jersey",
|
||||
new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
|
||||
// Latvia, Riga (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Riga",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Lithuania, Vilnius (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Vilnius",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Luxembourg, Luxembourg (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Luxembourg",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Malta, Valletta (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Malta",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Moldova, Chişinău (Eastern European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Chisinau",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// Monaco, Monaco (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Monaco",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Netherlands, Amsterdam (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Amsterdam",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Norway, Oslo (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Oslo",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Poland, Warsaw (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Warsaw",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Portugal, Lisbon (Western European ST): Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Lisbon",
|
||||
new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
|
||||
// San Marino, San Marino (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/San_Marino",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Slovakia, Bratislava (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Bratislava",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Spain, Madrid (Central European ST): Jumps ahead at 2:00 AM on 3/29/2020 to 3:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Madrid",
|
||||
new DateTime (2020, 3, 29, 2, 0, 0), new DateTime (2020, 3, 29, 2, 30, 0), new DateTime (2020, 3, 29, 3, 0, 0),
|
||||
new TimeSpan (1, 0, 0), new TimeSpan (2, 0, 0));
|
||||
|
||||
// Ukraine, Kiev (Eastern European ST): Jumps ahead at 3:00 AM on 3/29/2020 to 4:00 AM
|
||||
CheckJumpingIntoDST ("Europe/Kiev",
|
||||
new DateTime (2020, 3, 29, 3, 0, 0), new DateTime (2020, 3, 29, 3, 30, 0), new DateTime (2020, 3, 29, 4, 0, 0),
|
||||
new TimeSpan (2, 0, 0), new TimeSpan (3, 0, 0));
|
||||
|
||||
// United Kingdom, London (British ST): Jumps ahead at 1:00 AM on 3/29/2020 to 2:00 AM
|
||||
CheckJumpingIntoDST ("Europe/London",
|
||||
new DateTime (2020, 3, 29, 1, 0, 0), new DateTime (2020, 3, 29, 1, 30, 0), new DateTime (2020, 3, 29, 2, 0, 0),
|
||||
new TimeSpan (0, 0, 0), new TimeSpan (1, 0, 0));
|
||||
}
|
||||
|
||||
void CheckJumpingIntoDST (string tzId, DateTime dstDeltaStart, DateTime inDstDelta, DateTime dstDeltaEnd, TimeSpan baseOffset, TimeSpan dstOffset)
|
||||
{
|
||||
var tzi = TimeZoneInfo.FindSystemTimeZoneById (MapTimeZoneId (tzId));
|
||||
Assert.IsFalse (tzi.IsDaylightSavingTime (dstDeltaStart), $"{tzId}: #1");
|
||||
Assert.AreEqual (baseOffset, tzi.GetUtcOffset (dstDeltaStart), $"{tzId}: #2");
|
||||
|
||||
Assert.IsFalse (tzi.IsDaylightSavingTime (inDstDelta), $"{tzId}: #3");
|
||||
Assert.AreEqual (baseOffset, tzi.GetUtcOffset (inDstDelta), $"{tzId}: #4");
|
||||
|
||||
Assert.IsTrue (tzi.IsDaylightSavingTime (dstDeltaEnd), $"{tzId}: #5");
|
||||
Assert.AreEqual (dstOffset, tzi.GetUtcOffset (dstDeltaEnd), $"{tzId}: #6");
|
||||
}
|
||||
}
|
||||
|
||||
[TestFixture]
|
||||
|
||||
@@ -0,0 +1,185 @@
|
||||
// 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.Buffers
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a heap-based, array-backed output sink into which <typeparam name="T"/> data can be written.
|
||||
/// </summary>
|
||||
public sealed class ArrayBufferWriter<T> : IBufferWriter<T>
|
||||
{
|
||||
private T[] _buffer;
|
||||
private int _index;
|
||||
|
||||
private const int DefaultInitialBufferSize = 256;
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with the default initial capacity.
|
||||
/// </summary>
|
||||
public ArrayBufferWriter()
|
||||
{
|
||||
_buffer = Array.Empty<T>();
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates an instance of an <see cref="ArrayBufferWriter{T}"/>, in which data can be written to,
|
||||
/// with an initial capacity specified.
|
||||
/// </summary>
|
||||
/// <param name="initialCapacity">The minimum capacity with which to initialize the underlying buffer.</param>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="initialCapacity"/> is not positive (i.e. less than or equal to 0).
|
||||
/// </exception>
|
||||
public ArrayBufferWriter(int initialCapacity)
|
||||
{
|
||||
if (initialCapacity <= 0)
|
||||
throw new ArgumentException(nameof(initialCapacity));
|
||||
|
||||
_buffer = new T[initialCapacity];
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlyMemory{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlyMemory<T> WrittenMemory => _buffer.AsMemory(0, _index);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the data written to the underlying buffer so far, as a <see cref="ReadOnlySpan{T}"/>.
|
||||
/// </summary>
|
||||
public ReadOnlySpan<T> WrittenSpan => _buffer.AsSpan(0, _index);
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of data written to the underlying buffer so far.
|
||||
/// </summary>
|
||||
public int WrittenCount => _index;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the total amount of space within the underlying buffer.
|
||||
/// </summary>
|
||||
public int Capacity => _buffer.Length;
|
||||
|
||||
/// <summary>
|
||||
/// Returns the amount of space available that can still be written into without forcing the underlying buffer to grow.
|
||||
/// </summary>
|
||||
public int FreeCapacity => _buffer.Length - _index;
|
||||
|
||||
/// <summary>
|
||||
/// Clears the data written to the underlying buffer.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// You must clear the <see cref="ArrayBufferWriter{T}"/> before trying to re-use it.
|
||||
/// </remarks>
|
||||
public void Clear()
|
||||
{
|
||||
Debug.Assert(_buffer.Length >= _index);
|
||||
_buffer.AsSpan(0, _index).Clear();
|
||||
_index = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies <see cref="IBufferWriter{T}"/> that <paramref name="count"/> amount of data was written to the output <see cref="Span{T}"/>/<see cref="Memory{T}"/>
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="count"/> is negative.
|
||||
/// </exception>
|
||||
/// <exception cref="InvalidOperationException">
|
||||
/// Thrown when attempting to advance past the end of the underlying buffer.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public void Advance(int count)
|
||||
{
|
||||
if (count < 0)
|
||||
throw new ArgumentException(nameof(count));
|
||||
|
||||
if (_index > _buffer.Length - count)
|
||||
ThrowInvalidOperationException_AdvancedTooFar(_buffer.Length);
|
||||
|
||||
_index += count;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Memory{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Memory{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Memory<T> GetMemory(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > _index);
|
||||
return _buffer.AsMemory(_index);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a <see cref="Span{T}"/> to write to that is at least the requested length (specified by <paramref name="sizeHint"/>).
|
||||
/// If no <paramref name="sizeHint"/> is provided (or it's equal to <code>0</code>), some non-empty buffer is returned.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentException">
|
||||
/// Thrown when <paramref name="sizeHint"/> is negative.
|
||||
/// </exception>
|
||||
/// <remarks>
|
||||
/// This will never return an empty <see cref="Span{T}"/>.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// There is no guarantee that successive calls will return the same buffer or the same-sized buffer.
|
||||
/// </remarks>
|
||||
/// <remarks>
|
||||
/// You must request a new buffer after calling Advance to continue writing more data and cannot write to a previously acquired buffer.
|
||||
/// </remarks>
|
||||
public Span<T> GetSpan(int sizeHint = 0)
|
||||
{
|
||||
CheckAndResizeBuffer(sizeHint);
|
||||
Debug.Assert(_buffer.Length > _index);
|
||||
return _buffer.AsSpan(_index);
|
||||
}
|
||||
|
||||
private void CheckAndResizeBuffer(int sizeHint)
|
||||
{
|
||||
if (sizeHint < 0)
|
||||
throw new ArgumentException(nameof(sizeHint));
|
||||
|
||||
if (sizeHint == 0)
|
||||
{
|
||||
sizeHint = 1;
|
||||
}
|
||||
|
||||
if (sizeHint > FreeCapacity)
|
||||
{
|
||||
int growBy = Math.Max(sizeHint, _buffer.Length);
|
||||
|
||||
if (_buffer.Length == 0)
|
||||
{
|
||||
growBy = Math.Max(growBy, DefaultInitialBufferSize);
|
||||
}
|
||||
|
||||
int newSize = checked(_buffer.Length + growBy);
|
||||
|
||||
Array.Resize(ref _buffer, newSize);
|
||||
}
|
||||
|
||||
Debug.Assert(FreeCapacity > 0 && FreeCapacity >= sizeHint);
|
||||
}
|
||||
|
||||
private static void ThrowInvalidOperationException_AdvancedTooFar(int capacity)
|
||||
{
|
||||
throw new InvalidOperationException(SR.Format(SR.BufferWriterAdvancedTooFar, capacity));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// 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.
|
||||
|
||||
namespace System.Diagnostics.CodeAnalysis
|
||||
{
|
||||
/// <summary>Specifies that null is allowed as an input even if the corresponding type disallows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class AllowNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>Specifies that null is disallowed as an input even if the corresponding type allows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class DisallowNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>Specifies that an output may be null even if the corresponding type disallows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class MaybeNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>Specifies that an output will not be null even if the corresponding type allows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class NotNullAttribute : Attribute { }
|
||||
|
||||
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter may be null even if the corresponding type disallows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class MaybeNullWhenAttribute : Attribute
|
||||
{
|
||||
/// <summary>Initializes the attribute with the specified return value condition.</summary>
|
||||
/// <param name="returnValue">
|
||||
/// The return value condition. If the method returns this value, the associated parameter may be null.
|
||||
/// </param>
|
||||
public MaybeNullWhenAttribute(bool returnValue) => ReturnValue = returnValue;
|
||||
|
||||
/// <summary>Gets the return value condition.</summary>
|
||||
public bool ReturnValue { get; }
|
||||
}
|
||||
|
||||
/// <summary>Specifies that when a method returns <see cref="ReturnValue"/>, the parameter will not be null even if the corresponding type allows it.</summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class NotNullWhenAttribute : Attribute
|
||||
{
|
||||
/// <summary>Initializes the attribute with the specified return value condition.</summary>
|
||||
/// <param name="returnValue">
|
||||
/// The return value condition. If the method returns this value, the associated parameter will not be null.
|
||||
/// </param>
|
||||
public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue;
|
||||
|
||||
/// <summary>Gets the return value condition.</summary>
|
||||
public bool ReturnValue { get; }
|
||||
}
|
||||
|
||||
/// <summary>Specifies that the output will be non-null if the named parameter is non-null.</summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter | AttributeTargets.Property | AttributeTargets.ReturnValue, AllowMultiple = true, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class NotNullIfNotNullAttribute : Attribute
|
||||
{
|
||||
/// <summary>Initializes the attribute with the associated parameter name.</summary>
|
||||
/// <param name="parameterName">
|
||||
/// The associated parameter name. The output will be non-null if the argument to the parameter specified is non-null.
|
||||
/// </param>
|
||||
public NotNullIfNotNullAttribute(string parameterName) => ParameterName = parameterName;
|
||||
|
||||
/// <summary>Gets the associated parameter name.</summary>
|
||||
public string ParameterName { get; }
|
||||
}
|
||||
|
||||
/// <summary>Applied to a method that will never return under any circumstance.</summary>
|
||||
[AttributeUsage(AttributeTargets.Method, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class DoesNotReturnAttribute : Attribute { }
|
||||
|
||||
/// <summary>Specifies that the method will not return if the associated Boolean parameter is passed the specified value.</summary>
|
||||
[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]
|
||||
#if INTERNAL_NULLABLE_ATTRIBUTES
|
||||
internal
|
||||
#else
|
||||
public
|
||||
#endif
|
||||
sealed class DoesNotReturnIfAttribute : Attribute
|
||||
{
|
||||
/// <summary>Initializes the attribute with the specified parameter value.</summary>
|
||||
/// <param name="parameterValue">
|
||||
/// The condition parameter value. Code after the method will be considered unreachable by diagnostics if the argument to
|
||||
/// the associated parameter matches this value.
|
||||
/// </param>
|
||||
public DoesNotReturnIfAttribute(bool parameterValue) => ParameterValue = parameterValue;
|
||||
|
||||
/// <summary>Gets the condition parameter value.</summary>
|
||||
public bool ParameterValue { get; }
|
||||
}
|
||||
}
|
||||
@@ -26,4 +26,7 @@ partial class SR
|
||||
public const string Arg_SwitchExpressionException = "Non-exhaustive switch expression failed to match its input.";
|
||||
public const string SwitchExpressionException_UnmatchedValue = "Unmatched value was {0}.";
|
||||
public const string Argument_InvalidRandomRange = "Range of random number does not contain at least one possibility.";
|
||||
public const string BufferWriterAdvancedTooFar = "Cannot advance past the end of the buffer, which has a size of {0}.";
|
||||
public const string net_gssapi_operation_failed_detailed_majoronly = "GSSAPI operation failed with error - {0}.";
|
||||
public const string net_gssapi_operation_failed_majoronly = "SSAPI operation failed with status: {0}.";
|
||||
}
|
||||
@@ -0,0 +1,778 @@
|
||||
// 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;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Buffers
|
||||
{
|
||||
#if __MonoCS__
|
||||
public ref partial struct SequenceReader<T> where T : IEquatable<T>
|
||||
#else
|
||||
public ref partial struct SequenceReader<T> where T : unmanaged, IEquatable<T>
|
||||
#endif
|
||||
{
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiter"/>.
|
||||
/// </summary>
|
||||
/// <param name="span">The read data, if any.</param>
|
||||
/// <param name="delimiter">The delimiter to look for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryReadTo(out ReadOnlySpan<T> span, T delimiter, bool advancePastDelimiter = true)
|
||||
{
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
int index = remaining.IndexOf(delimiter);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
span = index == 0 ? default : remaining.Slice(0, index);
|
||||
AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
return TryReadToSlow(out span, delimiter, advancePastDelimiter);
|
||||
}
|
||||
|
||||
private bool TryReadToSlow(out ReadOnlySpan<T> span, T delimiter, bool advancePastDelimiter)
|
||||
{
|
||||
if (!TryReadToInternal(out ReadOnlySequence<T> sequence, delimiter, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex))
|
||||
{
|
||||
span = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiter"/>, ignoring delimiters that are
|
||||
/// preceded by <paramref name="delimiterEscape"/>.
|
||||
/// </summary>
|
||||
/// <param name="span">The read data, if any.</param>
|
||||
/// <param name="delimiter">The delimiter to look for.</param>
|
||||
/// <param name="delimiterEscape">If found prior to <paramref name="delimiter"/> it will skip that occurrence.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryReadTo(out ReadOnlySpan<T> span, T delimiter, T delimiterEscape, bool advancePastDelimiter = true)
|
||||
{
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
int index = remaining.IndexOf(delimiter);
|
||||
|
||||
if ((index > 0 && !remaining[index - 1].Equals(delimiterEscape)) || index == 0)
|
||||
{
|
||||
span = remaining.Slice(0, index);
|
||||
AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
// This delimiter might be skipped, go down the slow path
|
||||
return TryReadToSlow(out span, delimiter, delimiterEscape, index, advancePastDelimiter);
|
||||
}
|
||||
|
||||
private bool TryReadToSlow(out ReadOnlySpan<T> span, T delimiter, T delimiterEscape, int index, bool advancePastDelimiter)
|
||||
{
|
||||
if (!TryReadToSlow(out ReadOnlySequence<T> sequence, delimiter, delimiterEscape, index, advancePastDelimiter))
|
||||
{
|
||||
span = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
Debug.Assert(sequence.Length > 0);
|
||||
span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
private bool TryReadToSlow(out ReadOnlySequence<T> sequence, T delimiter, T delimiterEscape, int index, bool advancePastDelimiter)
|
||||
{
|
||||
SequenceReader<T> copy = this;
|
||||
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
bool priorEscape = false;
|
||||
|
||||
do
|
||||
{
|
||||
if (index >= 0)
|
||||
{
|
||||
if (index == 0 && priorEscape)
|
||||
{
|
||||
// We were in the escaped state, so skip this delimiter
|
||||
priorEscape = false;
|
||||
Advance(index + 1);
|
||||
remaining = UnreadSpan;
|
||||
goto Continue;
|
||||
}
|
||||
else if (index > 0 && remaining[index - 1].Equals(delimiterEscape))
|
||||
{
|
||||
// This delimiter might be skipped
|
||||
|
||||
// Count our escapes
|
||||
int escapeCount = 1;
|
||||
int i = index - 2;
|
||||
for (; i >= 0; i--)
|
||||
{
|
||||
if (!remaining[i].Equals(delimiterEscape))
|
||||
break;
|
||||
}
|
||||
if (i < 0 && priorEscape)
|
||||
{
|
||||
// Started and ended with escape, increment once more
|
||||
escapeCount++;
|
||||
}
|
||||
escapeCount += index - 2 - i;
|
||||
|
||||
if ((escapeCount & 1) != 0)
|
||||
{
|
||||
// An odd escape count means we're currently escaped,
|
||||
// skip the delimiter and reset escaped state.
|
||||
Advance(index + 1);
|
||||
priorEscape = false;
|
||||
remaining = UnreadSpan;
|
||||
goto Continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Found the delimiter. Move to it, slice, then move past it.
|
||||
AdvanceCurrentSpan(index);
|
||||
|
||||
sequence = Sequence.Slice(copy.Position, Position);
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// No delimiter, need to check the end of the span for odd number of escapes then advance
|
||||
if (remaining.Length > 0 && remaining[remaining.Length - 1].Equals(delimiterEscape))
|
||||
{
|
||||
int escapeCount = 1;
|
||||
int i = remaining.Length - 2;
|
||||
for (; i >= 0; i--)
|
||||
{
|
||||
if (!remaining[i].Equals(delimiterEscape))
|
||||
break;
|
||||
}
|
||||
|
||||
escapeCount += remaining.Length - 2 - i;
|
||||
if (i < 0 && priorEscape)
|
||||
priorEscape = (escapeCount & 1) == 0; // equivalent to incrementing escapeCount before setting priorEscape
|
||||
else
|
||||
priorEscape = (escapeCount & 1) != 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
priorEscape = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Nothing in the current span, move to the end, checking for the skip delimiter
|
||||
AdvanceCurrentSpan(remaining.Length);
|
||||
remaining = CurrentSpan;
|
||||
|
||||
Continue:
|
||||
index = remaining.IndexOf(delimiter);
|
||||
} while (!End);
|
||||
|
||||
// Didn't find anything, reset our original state.
|
||||
this = copy;
|
||||
sequence = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiter"/>.
|
||||
/// </summary>
|
||||
/// <param name="sequence">The read data, if any.</param>
|
||||
/// <param name="delimiter">The delimiter to look for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryReadTo(out ReadOnlySequence<T> sequence, T delimiter, bool advancePastDelimiter = true)
|
||||
{
|
||||
return TryReadToInternal(out sequence, delimiter, advancePastDelimiter);
|
||||
}
|
||||
|
||||
private bool TryReadToInternal(out ReadOnlySequence<T> sequence, T delimiter, bool advancePastDelimiter, int skip = 0)
|
||||
{
|
||||
Debug.Assert(skip >= 0);
|
||||
SequenceReader<T> copy = this;
|
||||
if (skip > 0)
|
||||
Advance(skip);
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
|
||||
while (_moreData)
|
||||
{
|
||||
int index = remaining.IndexOf(delimiter);
|
||||
if (index != -1)
|
||||
{
|
||||
// Found the delimiter. Move to it, slice, then move past it.
|
||||
if (index > 0)
|
||||
{
|
||||
AdvanceCurrentSpan(index);
|
||||
}
|
||||
|
||||
sequence = Sequence.Slice(copy.Position, Position);
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(remaining.Length);
|
||||
remaining = CurrentSpan;
|
||||
}
|
||||
|
||||
// Didn't find anything, reset our original state.
|
||||
this = copy;
|
||||
sequence = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiter"/>, ignoring delimiters that are
|
||||
/// preceded by <paramref name="delimiterEscape"/>.
|
||||
/// </summary>
|
||||
/// <param name="sequence">The read data, if any.</param>
|
||||
/// <param name="delimiter">The delimiter to look for.</param>
|
||||
/// <param name="delimiterEscape">If found prior to <paramref name="delimiter"/> it will skip that occurrence.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryReadTo(out ReadOnlySequence<T> sequence, T delimiter, T delimiterEscape, bool advancePastDelimiter = true)
|
||||
{
|
||||
SequenceReader<T> copy = this;
|
||||
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
bool priorEscape = false;
|
||||
|
||||
while (_moreData)
|
||||
{
|
||||
int index = remaining.IndexOf(delimiter);
|
||||
if (index != -1)
|
||||
{
|
||||
if (index == 0 && priorEscape)
|
||||
{
|
||||
// We were in the escaped state, so skip this delimiter
|
||||
priorEscape = false;
|
||||
Advance(index + 1);
|
||||
remaining = UnreadSpan;
|
||||
continue;
|
||||
}
|
||||
else if (index > 0 && remaining[index - 1].Equals(delimiterEscape))
|
||||
{
|
||||
// This delimiter might be skipped
|
||||
|
||||
// Count our escapes
|
||||
int escapeCount = 0;
|
||||
for (int i = index; i > 0 && remaining[i - 1].Equals(delimiterEscape); i--, escapeCount++)
|
||||
;
|
||||
if (escapeCount == index && priorEscape)
|
||||
{
|
||||
// Started and ended with escape, increment once more
|
||||
escapeCount++;
|
||||
}
|
||||
|
||||
priorEscape = false;
|
||||
if ((escapeCount & 1) != 0)
|
||||
{
|
||||
// Odd escape count means we're in the escaped state, so skip this delimiter
|
||||
Advance(index + 1);
|
||||
remaining = UnreadSpan;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Found the delimiter. Move to it, slice, then move past it.
|
||||
if (index > 0)
|
||||
{
|
||||
Advance(index);
|
||||
}
|
||||
|
||||
sequence = Sequence.Slice(copy.Position, Position);
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// No delimiter, need to check the end of the span for odd number of escapes then advance
|
||||
{
|
||||
int escapeCount = 0;
|
||||
for (int i = remaining.Length; i > 0 && remaining[i - 1].Equals(delimiterEscape); i--, escapeCount++)
|
||||
;
|
||||
if (priorEscape && escapeCount == remaining.Length)
|
||||
{
|
||||
escapeCount++;
|
||||
}
|
||||
priorEscape = escapeCount % 2 != 0;
|
||||
}
|
||||
|
||||
// Nothing in the current span, move to the end, checking for the skip delimiter
|
||||
Advance(remaining.Length);
|
||||
remaining = CurrentSpan;
|
||||
}
|
||||
|
||||
// Didn't find anything, reset our original state.
|
||||
this = copy;
|
||||
sequence = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiters"/>.
|
||||
/// </summary>
|
||||
/// <param name="span">The read data, if any.</param>
|
||||
/// <param name="delimiters">The delimiters to look for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the first found instance of any of the given <paramref name="delimiters"/>.</param>
|
||||
/// <returns>True if any of the <paramref name="delimiters"/> were found.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryReadToAny(out ReadOnlySpan<T> span, ReadOnlySpan<T> delimiters, bool advancePastDelimiter = true)
|
||||
{
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
int index = delimiters.Length == 2
|
||||
? remaining.IndexOfAny(delimiters[0], delimiters[1])
|
||||
: remaining.IndexOfAny(delimiters);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
span = remaining.Slice(0, index);
|
||||
Advance(index + (advancePastDelimiter ? 1 : 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
return TryReadToAnySlow(out span, delimiters, advancePastDelimiter);
|
||||
}
|
||||
|
||||
private bool TryReadToAnySlow(out ReadOnlySpan<T> span, ReadOnlySpan<T> delimiters, bool advancePastDelimiter)
|
||||
{
|
||||
if (!TryReadToAnyInternal(out ReadOnlySequence<T> sequence, delimiters, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex))
|
||||
{
|
||||
span = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read everything up to the given <paramref name="delimiters"/>.
|
||||
/// </summary>
|
||||
/// <param name="sequence">The read data, if any.</param>
|
||||
/// <param name="delimiters">The delimiters to look for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the first found instance of any of the given <paramref name="delimiters"/>.</param>
|
||||
/// <returns>True if any of the <paramref name="delimiters"/> were found.</returns>
|
||||
public bool TryReadToAny(out ReadOnlySequence<T> sequence, ReadOnlySpan<T> delimiters, bool advancePastDelimiter = true)
|
||||
{
|
||||
return TryReadToAnyInternal(out sequence, delimiters, advancePastDelimiter);
|
||||
}
|
||||
|
||||
private bool TryReadToAnyInternal(out ReadOnlySequence<T> sequence, ReadOnlySpan<T> delimiters, bool advancePastDelimiter, int skip = 0)
|
||||
{
|
||||
SequenceReader<T> copy = this;
|
||||
if (skip > 0)
|
||||
Advance(skip);
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
|
||||
while (!End)
|
||||
{
|
||||
int index = delimiters.Length == 2
|
||||
? remaining.IndexOfAny(delimiters[0], delimiters[1])
|
||||
: remaining.IndexOfAny(delimiters);
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
// Found one of the delimiters. Move to it, slice, then move past it.
|
||||
if (index > 0)
|
||||
{
|
||||
AdvanceCurrentSpan(index);
|
||||
}
|
||||
|
||||
sequence = Sequence.Slice(copy.Position, Position);
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Advance(remaining.Length);
|
||||
remaining = CurrentSpan;
|
||||
}
|
||||
|
||||
// Didn't find anything, reset our original state.
|
||||
this = copy;
|
||||
sequence = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Try to read data until the entire given <paramref name="delimiter"/> matches.
|
||||
/// </summary>
|
||||
/// <param name="sequence">The read data, if any.</param>
|
||||
/// <param name="delimiter">The multi (T) delimiter.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryReadTo(out ReadOnlySequence<T> sequence, ReadOnlySpan<T> delimiter, bool advancePastDelimiter = true)
|
||||
{
|
||||
if (delimiter.Length == 0)
|
||||
{
|
||||
sequence = default;
|
||||
return true;
|
||||
}
|
||||
|
||||
SequenceReader<T> copy = this;
|
||||
|
||||
bool advanced = false;
|
||||
while (!End)
|
||||
{
|
||||
if (!TryReadTo(out sequence, delimiter[0], advancePastDelimiter: false))
|
||||
{
|
||||
this = copy;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (delimiter.Length == 1)
|
||||
{
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
if (IsNext(delimiter))
|
||||
{
|
||||
// Probably a faster way to do this, potentially by avoiding the Advance in the previous TryReadTo call
|
||||
if (advanced)
|
||||
{
|
||||
sequence = copy.Sequence.Slice(copy.Consumed, Consumed - copy.Consumed);
|
||||
}
|
||||
|
||||
if (advancePastDelimiter)
|
||||
{
|
||||
Advance(delimiter.Length);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
Advance(1);
|
||||
advanced = true;
|
||||
}
|
||||
}
|
||||
|
||||
this = copy;
|
||||
sequence = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance until the given <paramref name="delimiter"/>, if found.
|
||||
/// </summary>
|
||||
/// <param name="delimiter">The delimiter to search for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the <paramref name="delimiter"/> if found.</param>
|
||||
/// <returns>True if the given <paramref name="delimiter"/> was found.</returns>
|
||||
public bool TryAdvanceTo(T delimiter, bool advancePastDelimiter = true)
|
||||
{
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
int index = remaining.IndexOf(delimiter);
|
||||
if (index != -1)
|
||||
{
|
||||
Advance(advancePastDelimiter ? index + 1 : index);
|
||||
return true;
|
||||
}
|
||||
|
||||
return TryReadToInternal(out _, delimiter, advancePastDelimiter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance until any of the given <paramref name="delimiters"/>, if found.
|
||||
/// </summary>
|
||||
/// <param name="delimiters">The delimiters to search for.</param>
|
||||
/// <param name="advancePastDelimiter">True to move past the first found instance of any of the given <paramref name="delimiters"/>.</param>
|
||||
/// <returns>True if any of the given <paramref name="delimiters"/> were found.</returns>
|
||||
public bool TryAdvanceToAny(ReadOnlySpan<T> delimiters, bool advancePastDelimiter = true)
|
||||
{
|
||||
ReadOnlySpan<T> remaining = UnreadSpan;
|
||||
int index = remaining.IndexOfAny(delimiters);
|
||||
if (index != -1)
|
||||
{
|
||||
AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0));
|
||||
return true;
|
||||
}
|
||||
|
||||
return TryReadToAnyInternal(out _, delimiters, advancePastDelimiter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance past consecutive instances of the given <paramref name="value"/>.
|
||||
/// </summary>
|
||||
/// <returns>How many positions the reader has been advanced.</returns>
|
||||
public long AdvancePast(T value)
|
||||
{
|
||||
long start = Consumed;
|
||||
|
||||
do
|
||||
{
|
||||
// Advance past all matches in the current span
|
||||
int i;
|
||||
for (i = CurrentSpanIndex; i < CurrentSpan.Length && CurrentSpan[i].Equals(value); i++)
|
||||
{
|
||||
}
|
||||
|
||||
int advanced = i - CurrentSpanIndex;
|
||||
if (advanced == 0)
|
||||
{
|
||||
// Didn't advance at all in this span, exit.
|
||||
break;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(advanced);
|
||||
|
||||
// If we're at postion 0 after advancing and not at the End,
|
||||
// we're in a new span and should continue the loop.
|
||||
} while (CurrentSpanIndex == 0 && !End);
|
||||
|
||||
return Consumed - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Skip consecutive instances of any of the given <paramref name="values"/>.
|
||||
/// </summary>
|
||||
/// <returns>How many positions the reader has been advanced.</returns>
|
||||
public long AdvancePastAny(ReadOnlySpan<T> values)
|
||||
{
|
||||
long start = Consumed;
|
||||
|
||||
do
|
||||
{
|
||||
// Advance past all matches in the current span
|
||||
int i;
|
||||
for (i = CurrentSpanIndex; i < CurrentSpan.Length && values.IndexOf(CurrentSpan[i]) != -1; i++)
|
||||
{
|
||||
}
|
||||
|
||||
int advanced = i - CurrentSpanIndex;
|
||||
if (advanced == 0)
|
||||
{
|
||||
// Didn't advance at all in this span, exit.
|
||||
break;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(advanced);
|
||||
|
||||
// If we're at postion 0 after advancing and not at the End,
|
||||
// we're in a new span and should continue the loop.
|
||||
} while (CurrentSpanIndex == 0 && !End);
|
||||
|
||||
return Consumed - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance past consecutive instances of any of the given values.
|
||||
/// </summary>
|
||||
/// <returns>How many positions the reader has been advanced.</returns>
|
||||
public long AdvancePastAny(T value0, T value1, T value2, T value3)
|
||||
{
|
||||
long start = Consumed;
|
||||
|
||||
do
|
||||
{
|
||||
// Advance past all matches in the current span
|
||||
int i;
|
||||
for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++)
|
||||
{
|
||||
T value = CurrentSpan[i];
|
||||
if (!value.Equals(value0) && !value.Equals(value1) && !value.Equals(value2) && !value.Equals(value3))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int advanced = i - CurrentSpanIndex;
|
||||
if (advanced == 0)
|
||||
{
|
||||
// Didn't advance at all in this span, exit.
|
||||
break;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(advanced);
|
||||
|
||||
// If we're at postion 0 after advancing and not at the End,
|
||||
// we're in a new span and should continue the loop.
|
||||
} while (CurrentSpanIndex == 0 && !End);
|
||||
|
||||
return Consumed - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance past consecutive instances of any of the given values.
|
||||
/// </summary>
|
||||
/// <returns>How many positions the reader has been advanced.</returns>
|
||||
public long AdvancePastAny(T value0, T value1, T value2)
|
||||
{
|
||||
long start = Consumed;
|
||||
|
||||
do
|
||||
{
|
||||
// Advance past all matches in the current span
|
||||
int i;
|
||||
for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++)
|
||||
{
|
||||
T value = CurrentSpan[i];
|
||||
if (!value.Equals(value0) && !value.Equals(value1) && !value.Equals(value2))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int advanced = i - CurrentSpanIndex;
|
||||
if (advanced == 0)
|
||||
{
|
||||
// Didn't advance at all in this span, exit.
|
||||
break;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(advanced);
|
||||
|
||||
// If we're at postion 0 after advancing and not at the End,
|
||||
// we're in a new span and should continue the loop.
|
||||
} while (CurrentSpanIndex == 0 && !End);
|
||||
|
||||
return Consumed - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Advance past consecutive instances of any of the given values.
|
||||
/// </summary>
|
||||
/// <returns>How many positions the reader has been advanced.</returns>
|
||||
public long AdvancePastAny(T value0, T value1)
|
||||
{
|
||||
long start = Consumed;
|
||||
|
||||
do
|
||||
{
|
||||
// Advance past all matches in the current span
|
||||
int i;
|
||||
for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++)
|
||||
{
|
||||
T value = CurrentSpan[i];
|
||||
if (!value.Equals(value0) && !value.Equals(value1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int advanced = i - CurrentSpanIndex;
|
||||
if (advanced == 0)
|
||||
{
|
||||
// Didn't advance at all in this span, exit.
|
||||
break;
|
||||
}
|
||||
|
||||
AdvanceCurrentSpan(advanced);
|
||||
|
||||
// If we're at postion 0 after advancing and not at the End,
|
||||
// we're in a new span and should continue the loop.
|
||||
} while (CurrentSpanIndex == 0 && !End);
|
||||
|
||||
return Consumed - start;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if the given <paramref name="next"/> value is next.
|
||||
/// </summary>
|
||||
/// <param name="next">The value to compare the next items to.</param>
|
||||
/// <param name="advancePast">Move past the <paramref name="next"/> value if found.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IsNext(T next, bool advancePast = false)
|
||||
{
|
||||
if (End)
|
||||
return false;
|
||||
|
||||
if (CurrentSpan[CurrentSpanIndex].Equals(next))
|
||||
{
|
||||
if (advancePast)
|
||||
{
|
||||
AdvanceCurrentSpan(1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if the given <paramref name="next"/> values are next.
|
||||
/// </summary>
|
||||
/// <param name="next">The span to compare the next items to.</param>
|
||||
/// <param name="advancePast">Move past the <paramref name="next"/> values if found.</param>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool IsNext(ReadOnlySpan<T> next, bool advancePast = false)
|
||||
{
|
||||
ReadOnlySpan<T> unread = UnreadSpan;
|
||||
if (unread.StartsWith(next))
|
||||
{
|
||||
if (advancePast)
|
||||
{
|
||||
AdvanceCurrentSpan(next.Length);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Only check the slow path if there wasn't enough to satisfy next
|
||||
return unread.Length < next.Length && IsNextSlow(next, advancePast);
|
||||
}
|
||||
|
||||
private unsafe bool IsNextSlow(ReadOnlySpan<T> next, bool advancePast)
|
||||
{
|
||||
ReadOnlySpan<T> currentSpan = UnreadSpan;
|
||||
|
||||
// We should only come in here if we need more data than we have in our current span
|
||||
Debug.Assert(currentSpan.Length < next.Length);
|
||||
|
||||
int fullLength = next.Length;
|
||||
SequencePosition nextPosition = _nextPosition;
|
||||
|
||||
while (next.StartsWith(currentSpan))
|
||||
{
|
||||
if (next.Length == currentSpan.Length)
|
||||
{
|
||||
// Fully matched
|
||||
if (advancePast)
|
||||
{
|
||||
Advance(fullLength);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Need to check the next segment
|
||||
while (true)
|
||||
{
|
||||
if (!Sequence.TryGet(ref nextPosition, out ReadOnlyMemory<T> nextSegment, advance: true))
|
||||
{
|
||||
// Nothing left
|
||||
return false;
|
||||
}
|
||||
|
||||
if (nextSegment.Length > 0)
|
||||
{
|
||||
next = next.Slice(currentSpan.Length);
|
||||
currentSpan = nextSegment.Span;
|
||||
if (currentSpan.Length > next.Length)
|
||||
{
|
||||
currentSpan = currentSpan.Slice(0, next.Length);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,449 @@
|
||||
// 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;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using Internal.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Buffers
|
||||
{
|
||||
#if __MonoCS__
|
||||
public ref partial struct SequenceReader<T> where T : IEquatable<T>
|
||||
#else
|
||||
public ref partial struct SequenceReader<T> where T : unmanaged, IEquatable<T>
|
||||
#endif
|
||||
{
|
||||
private SequencePosition _currentPosition;
|
||||
private SequencePosition _nextPosition;
|
||||
private bool _moreData;
|
||||
#if __MonoCS__
|
||||
private long _length;
|
||||
#else
|
||||
private readonly long _length;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Create a <see cref="SequenceReader{T}"/> over the given <see cref="ReadOnlySequence{T}"/>.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public SequenceReader(ReadOnlySequence<T> sequence)
|
||||
{
|
||||
CurrentSpanIndex = 0;
|
||||
Consumed = 0;
|
||||
Sequence = sequence;
|
||||
_currentPosition = sequence.Start;
|
||||
_length = -1;
|
||||
|
||||
sequence.GetFirstSpan(out ReadOnlySpan<T> first, out _nextPosition);
|
||||
CurrentSpan = first;
|
||||
_moreData = first.Length > 0;
|
||||
|
||||
if (!_moreData && !sequence.IsSingleSegment)
|
||||
{
|
||||
_moreData = true;
|
||||
GetNextSpan();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// True when there is no more data in the <see cref="Sequence"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public bool End => !_moreData;
|
||||
#else
|
||||
public readonly bool End => !_moreData;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The underlying <see cref="ReadOnlySequence{T}"/> for the reader.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public ReadOnlySequence<T> Sequence { get; }
|
||||
#else
|
||||
public readonly ReadOnlySequence<T> Sequence { get; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The current position in the <see cref="Sequence"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public SequencePosition Position
|
||||
=> Sequence.GetPosition(CurrentSpanIndex, _currentPosition);
|
||||
#else
|
||||
public readonly SequencePosition Position
|
||||
=> Sequence.GetPosition(CurrentSpanIndex, _currentPosition);
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The current segment in the <see cref="Sequence"/> as a span.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public ReadOnlySpan<T> CurrentSpan { get; private set; }
|
||||
#else
|
||||
public ReadOnlySpan<T> CurrentSpan { readonly get; private set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The index in the <see cref="CurrentSpan"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public int CurrentSpanIndex { get; private set; }
|
||||
#else
|
||||
public int CurrentSpanIndex { readonly get; private set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The unread portion of the <see cref="CurrentSpan"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public ReadOnlySpan<T> UnreadSpan
|
||||
#else
|
||||
public readonly ReadOnlySpan<T> UnreadSpan
|
||||
#endif
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
get => CurrentSpan.Slice(CurrentSpanIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The total number of <typeparamref name="T"/>'s processed by the reader.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public long Consumed { get; private set; }
|
||||
#else
|
||||
public long Consumed { readonly get; private set; }
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Remaining <typeparamref name="T"/>'s in the reader's <see cref="Sequence"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public long Remaining => Length - Consumed;
|
||||
#else
|
||||
public readonly long Remaining => Length - Consumed;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Count of <typeparamref name="T"/> in the reader's <see cref="Sequence"/>.
|
||||
/// </summary>
|
||||
#if __MonoCS__
|
||||
public long Length
|
||||
#else
|
||||
public readonly long Length
|
||||
#endif
|
||||
{
|
||||
get
|
||||
{
|
||||
if (_length < 0)
|
||||
{
|
||||
unsafe {
|
||||
fixed (long* lenPtr = &_length)
|
||||
// Cast-away readonly to initialize lazy field
|
||||
Volatile.Write(ref Unsafe.AsRef<long>(lenPtr), Sequence.Length);
|
||||
}
|
||||
}
|
||||
return _length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Peeks at the next value without advancing the reader.
|
||||
/// </summary>
|
||||
/// <param name="value">The next value or default if at the end.</param>
|
||||
/// <returns>False if at the end of the reader.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
#if __MonoCS__
|
||||
public bool TryPeek(out T value)
|
||||
#else
|
||||
public readonly bool TryPeek(out T value)
|
||||
#endif
|
||||
{
|
||||
if (_moreData)
|
||||
{
|
||||
value = CurrentSpan[CurrentSpanIndex];
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Read the next value and advance the reader.
|
||||
/// </summary>
|
||||
/// <param name="value">The next value or default if at the end.</param>
|
||||
/// <returns>False if at the end of the reader.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public bool TryRead(out T value)
|
||||
{
|
||||
if (End)
|
||||
{
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
value = CurrentSpan[CurrentSpanIndex];
|
||||
CurrentSpanIndex++;
|
||||
Consumed++;
|
||||
|
||||
if (CurrentSpanIndex >= CurrentSpan.Length)
|
||||
{
|
||||
GetNextSpan();
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the reader back the specified number of items.
|
||||
/// </summary>
|
||||
/// <exception cref="ArgumentOutOfRangeException">
|
||||
/// Thrown if trying to rewind a negative amount or more than <see cref="Consumed"/>.
|
||||
/// </exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Rewind(long count)
|
||||
{
|
||||
if ((ulong)count > (ulong)Consumed)
|
||||
{
|
||||
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
|
||||
}
|
||||
|
||||
Consumed -= count;
|
||||
|
||||
if (CurrentSpanIndex >= count)
|
||||
{
|
||||
CurrentSpanIndex -= (int)count;
|
||||
_moreData = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Current segment doesn't have enough data, scan backward through segments
|
||||
RetreatToPreviousSpan(Consumed);
|
||||
}
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||
private void RetreatToPreviousSpan(long consumed)
|
||||
{
|
||||
ResetReader();
|
||||
Advance(consumed);
|
||||
}
|
||||
|
||||
private void ResetReader()
|
||||
{
|
||||
CurrentSpanIndex = 0;
|
||||
Consumed = 0;
|
||||
_currentPosition = Sequence.Start;
|
||||
_nextPosition = _currentPosition;
|
||||
|
||||
if (Sequence.TryGet(ref _nextPosition, out ReadOnlyMemory<T> memory, advance: true))
|
||||
{
|
||||
_moreData = true;
|
||||
|
||||
if (memory.Length == 0)
|
||||
{
|
||||
CurrentSpan = default;
|
||||
// No data in the first span, move to one with data
|
||||
GetNextSpan();
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSpan = memory.Span;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// No data in any spans and at end of sequence
|
||||
_moreData = false;
|
||||
CurrentSpan = default;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the next segment with available data, if any.
|
||||
/// </summary>
|
||||
private void GetNextSpan()
|
||||
{
|
||||
if (!Sequence.IsSingleSegment)
|
||||
{
|
||||
SequencePosition previousNextPosition = _nextPosition;
|
||||
while (Sequence.TryGet(ref _nextPosition, out ReadOnlyMemory<T> memory, advance: true))
|
||||
{
|
||||
_currentPosition = previousNextPosition;
|
||||
if (memory.Length > 0)
|
||||
{
|
||||
CurrentSpan = memory.Span;
|
||||
CurrentSpanIndex = 0;
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
CurrentSpan = default;
|
||||
CurrentSpanIndex = 0;
|
||||
previousNextPosition = _nextPosition;
|
||||
}
|
||||
}
|
||||
}
|
||||
_moreData = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Move the reader ahead the specified number of items.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Advance(long count)
|
||||
{
|
||||
const long TooBigOrNegative = unchecked((long)0xFFFFFFFF80000000);
|
||||
if ((count & TooBigOrNegative) == 0 && CurrentSpan.Length - CurrentSpanIndex > (int)count)
|
||||
{
|
||||
CurrentSpanIndex += (int)count;
|
||||
Consumed += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Can't satisfy from the current span
|
||||
AdvanceToNextSpan(count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Unchecked helper to avoid unnecessary checks where you know count is valid.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void AdvanceCurrentSpan(long count)
|
||||
{
|
||||
Debug.Assert(count >= 0);
|
||||
|
||||
Consumed += count;
|
||||
CurrentSpanIndex += (int)count;
|
||||
if (CurrentSpanIndex >= CurrentSpan.Length)
|
||||
GetNextSpan();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Only call this helper if you know that you are advancing in the current span
|
||||
/// with valid count and there is no need to fetch the next one.
|
||||
/// </summary>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal void AdvanceWithinSpan(long count)
|
||||
{
|
||||
Debug.Assert(count >= 0);
|
||||
|
||||
Consumed += count;
|
||||
CurrentSpanIndex += (int)count;
|
||||
|
||||
Debug.Assert(CurrentSpanIndex < CurrentSpan.Length);
|
||||
}
|
||||
|
||||
private void AdvanceToNextSpan(long count)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
|
||||
}
|
||||
|
||||
Consumed += count;
|
||||
while (_moreData)
|
||||
{
|
||||
int remaining = CurrentSpan.Length - CurrentSpanIndex;
|
||||
|
||||
if (remaining > count)
|
||||
{
|
||||
CurrentSpanIndex += (int)count;
|
||||
count = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
// As there may not be any further segments we need to
|
||||
// push the current index to the end of the span.
|
||||
CurrentSpanIndex += remaining;
|
||||
count -= remaining;
|
||||
Debug.Assert(count >= 0);
|
||||
|
||||
GetNextSpan();
|
||||
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (count != 0)
|
||||
{
|
||||
// Not enough data left- adjust for where we actually ended and throw
|
||||
Consumed -= count;
|
||||
ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument.count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copies data from the current <see cref="Position"/> to the given <paramref name="destination"/> span if there
|
||||
/// is enough data to fill it.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This API is used to copy a fixed amount of data out of the sequence if possible. It does not advance
|
||||
/// the reader. To look ahead for a specific stream of data <see cref="IsNext(ReadOnlySpan{T}, bool)"/> can be used.
|
||||
/// </remarks>
|
||||
/// <param name="destination">Destination span to copy to.</param>
|
||||
/// <returns>True if there is enough data to completely fill the <paramref name="destination"/> span.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
#if __MonoCS__
|
||||
public bool TryCopyTo(Span<T> destination)
|
||||
#else
|
||||
public readonly bool TryCopyTo(Span<T> destination)
|
||||
#endif
|
||||
{
|
||||
// This API doesn't advance to facilitate conditional advancement based on the data returned.
|
||||
// We don't provide an advance option to allow easier utilizing of stack allocated destination spans.
|
||||
// (Because we can make this method readonly we can guarantee that we won't capture the span.)
|
||||
|
||||
ReadOnlySpan<T> firstSpan = UnreadSpan;
|
||||
if (firstSpan.Length >= destination.Length)
|
||||
{
|
||||
firstSpan.Slice(0, destination.Length).CopyTo(destination);
|
||||
return true;
|
||||
}
|
||||
|
||||
// Not enough in the current span to satisfy the request, fall through to the slow path
|
||||
return TryCopyMultisegment(destination);
|
||||
}
|
||||
|
||||
#if __MonoCS__
|
||||
internal bool TryCopyMultisegment(Span<T> destination)
|
||||
#else
|
||||
internal readonly bool TryCopyMultisegment(Span<T> destination)
|
||||
#endif
|
||||
{
|
||||
// If we don't have enough to fill the requested buffer, return false
|
||||
if (Remaining < destination.Length)
|
||||
return false;
|
||||
|
||||
ReadOnlySpan<T> firstSpan = UnreadSpan;
|
||||
Debug.Assert(firstSpan.Length < destination.Length);
|
||||
firstSpan.CopyTo(destination);
|
||||
int copied = firstSpan.Length;
|
||||
|
||||
SequencePosition next = _nextPosition;
|
||||
while (Sequence.TryGet(ref next, out ReadOnlyMemory<T> nextSegment, true))
|
||||
{
|
||||
if (nextSegment.Length > 0)
|
||||
{
|
||||
ReadOnlySpan<T> nextSpan = nextSegment.Span;
|
||||
int toCopy = Math.Min(nextSpan.Length, destination.Length - copied);
|
||||
nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied));
|
||||
copied += toCopy;
|
||||
if (copied >= destination.Length)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,187 @@
|
||||
// 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.Buffers.Binary;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using Internal.Runtime.CompilerServices;
|
||||
|
||||
namespace System.Buffers
|
||||
{
|
||||
#if !__MonoCS__
|
||||
public static partial class SequenceReaderExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary
|
||||
/// structs- see remarks for full details.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of it's members to
|
||||
/// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit
|
||||
/// overloads such as <see cref="TryReadLittleEndian(ref SequenceReader{byte}, out short)"/>
|
||||
/// </remarks>
|
||||
/// <returns>
|
||||
/// True if successful. <paramref name="value"/> will be default if failed (due to lack of space).
|
||||
/// </returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
internal static unsafe bool TryRead<T>(ref this SequenceReader<byte> reader, out T value) where T : unmanaged
|
||||
{
|
||||
ReadOnlySpan<byte> span = reader.UnreadSpan;
|
||||
if (span.Length < sizeof(T))
|
||||
return TryReadMultisegment(ref reader, out value);
|
||||
|
||||
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(span));
|
||||
reader.Advance(sizeof(T));
|
||||
return true;
|
||||
}
|
||||
|
||||
private static unsafe bool TryReadMultisegment<T>(ref SequenceReader<byte> reader, out T value) where T : unmanaged
|
||||
{
|
||||
Debug.Assert(reader.UnreadSpan.Length < sizeof(T));
|
||||
|
||||
// Not enough data in the current segment, try to peek for the data we need.
|
||||
T buffer = default;
|
||||
Span<byte> tempSpan = new Span<byte>(&buffer, sizeof(T));
|
||||
|
||||
if (!reader.TryCopyTo(tempSpan))
|
||||
{
|
||||
value = default;
|
||||
return false;
|
||||
}
|
||||
|
||||
value = Unsafe.ReadUnaligned<T>(ref MemoryMarshal.GetReference(tempSpan));
|
||||
reader.Advance(sizeof(T));
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="short"/> as little endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="short"/>.</returns>
|
||||
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out short value)
|
||||
{
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="short"/> as big endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="short"/>.</returns>
|
||||
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out short value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out short value)
|
||||
{
|
||||
if (reader.TryRead(out value))
|
||||
{
|
||||
value = BinaryPrimitives.ReverseEndianness(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="int"/> as little endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="int"/>.</returns>
|
||||
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out int value)
|
||||
{
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="int"/> as big endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="int"/>.</returns>
|
||||
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out int value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out int value)
|
||||
{
|
||||
if (reader.TryRead(out value))
|
||||
{
|
||||
value = BinaryPrimitives.ReverseEndianness(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="long"/> as little endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="long"/>.</returns>
|
||||
public static bool TryReadLittleEndian(ref this SequenceReader<byte> reader, out long value)
|
||||
{
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads an <see cref="long"/> as big endian.
|
||||
/// </summary>
|
||||
/// <returns>False if there wasn't enough data for an <see cref="long"/>.</returns>
|
||||
public static bool TryReadBigEndian(ref this SequenceReader<byte> reader, out long value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
{
|
||||
return reader.TryRead(out value);
|
||||
}
|
||||
|
||||
return TryReadReverseEndianness(ref reader, out value);
|
||||
}
|
||||
|
||||
private static bool TryReadReverseEndianness(ref SequenceReader<byte> reader, out long value)
|
||||
{
|
||||
if (reader.TryRead(out value))
|
||||
{
|
||||
value = BinaryPrimitives.ReverseEndianness(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
#else
|
||||
public static partial class SequenceReaderExtensions
|
||||
{
|
||||
public static bool TryReadBigEndian(this System.Buffers.SequenceReader<byte> reader, out short value) => throw new PlatformNotSupportedException();
|
||||
public static bool TryReadBigEndian(this System.Buffers.SequenceReader<byte> reader, out int value) => throw new PlatformNotSupportedException();
|
||||
public static bool TryReadBigEndian(this System.Buffers.SequenceReader<byte> reader, out long value) => throw new PlatformNotSupportedException();
|
||||
public static bool TryReadLittleEndian(this System.Buffers.SequenceReader<byte> reader, out short value) => throw new PlatformNotSupportedException();
|
||||
public static bool TryReadLittleEndian(this System.Buffers.SequenceReader<byte> reader, out int value) => throw new PlatformNotSupportedException();
|
||||
public static bool TryReadLittleEndian(this System.Buffers.SequenceReader<byte> reader, out long value) => throw new PlatformNotSupportedException();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -336,6 +336,7 @@
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\DaylightTime.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\DigitShapes.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\GlobalizationExtensions.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\HebrewNumber.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\InternalGlobalizationHelper.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\NumberStyles.cs" />
|
||||
<Compile Include="..\..\..\external\corefx\src\Common\src\CoreLib\System\Globalization\SortVersion.cs" />
|
||||
@@ -1072,7 +1073,6 @@
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\gregoriancalendarhelper.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\gregoriancalendartypes.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\hebrewcalendar.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\hebrewnumber.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\hijricalendar.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\japanesecalendar.cs" />
|
||||
<Compile Include="..\referencesource\mscorlib\system\globalization\japaneselunisolarcalendar.cs" />
|
||||
@@ -1861,6 +1861,7 @@
|
||||
<Compile Include="coreclr\SorterArray.cs" />
|
||||
<Compile Include="corefx\AesCcm.cs" />
|
||||
<Compile Include="corefx\AesGcm.cs" />
|
||||
<Compile Include="corefx\ArrayBufferWriter.cs" />
|
||||
<Compile Include="corefx\AwaitTaskContinuation.cs" />
|
||||
<Compile Include="corefx\BinaryEnums.cs" />
|
||||
<Compile Include="corefx\CompareInfo.cs" />
|
||||
@@ -1879,6 +1880,7 @@
|
||||
<Compile Include="corefx\IncrementingPollingCounter.cs" />
|
||||
<Compile Include="corefx\MethodInfo.cs" />
|
||||
<Compile Include="corefx\MonoLinqHelper.cs" />
|
||||
<Compile Include="corefx\NullableAttributes.cs" />
|
||||
<Compile Include="corefx\PbeEncryptionAlgorithm.cs" />
|
||||
<Compile Include="corefx\PbeParameters.cs" />
|
||||
<Compile Include="corefx\PollingCounter.cs" />
|
||||
@@ -1887,6 +1889,9 @@
|
||||
<Compile Include="corefx\RuntimeImports.cs" />
|
||||
<Compile Include="corefx\SR.cs" />
|
||||
<Compile Include="corefx\SR.missing.cs" />
|
||||
<Compile Include="corefx\SequenceReader.Search.cs" />
|
||||
<Compile Include="corefx\SequenceReader.cs" />
|
||||
<Compile Include="corefx\SequenceReaderExtensions.Binary.cs" />
|
||||
<Compile Include="corefx\Stream.cs" />
|
||||
<Compile Include="corefx\SwitchExpressionException.cs" />
|
||||
<Compile Include="corefx\SynchronizationContext.cs" />
|
||||
|
||||
@@ -1105,7 +1105,7 @@ ReferenceSources/AppContextDefaultValues.cs
|
||||
../referencesource/mscorlib/system/globalization/gregoriancalendarhelper.cs
|
||||
../referencesource/mscorlib/system/globalization/gregoriancalendartypes.cs
|
||||
../referencesource/mscorlib/system/globalization/hebrewcalendar.cs
|
||||
../referencesource/mscorlib/system/globalization/hebrewnumber.cs
|
||||
../../../external/corefx/src/Common/src/CoreLib/System/Globalization/HebrewNumber.cs
|
||||
../referencesource/mscorlib/system/globalization/hijricalendar.cs
|
||||
../referencesource/mscorlib/system/globalization/japanesecalendar.cs
|
||||
../referencesource/mscorlib/system/globalization/japaneselunisolarcalendar.cs
|
||||
@@ -1631,6 +1631,11 @@ corefx/AesGcm.cs
|
||||
corefx/IncrementingEventCounter.cs
|
||||
corefx/IncrementingPollingCounter.cs
|
||||
corefx/PollingCounter.cs
|
||||
corefx/NullableAttributes.cs
|
||||
corefx/ArrayBufferWriter.cs
|
||||
corefx/SequenceReader.cs
|
||||
corefx/SequenceReader.Search.cs
|
||||
corefx/SequenceReaderExtensions.Binary.cs
|
||||
|
||||
corert/DependencyReductionRootAttribute.cs
|
||||
corert/AddrofIntrinsics.cs
|
||||
|
||||
@@ -547,34 +547,34 @@
|
||||
<ProjectReference Include="../corlib/corlib.csproj" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Core.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Core.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Core.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Core.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Xml.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Xml.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Xml.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Xml.Linq.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Xml.Linq.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Xml.Linq.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Xml.Linq.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/System.Configuration.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/System.Configuration.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/System.Configuration.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/System.Configuration.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll">
|
||||
<Reference Include="./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.6/mscorlib.dll</HintPath>
|
||||
<HintPath>./../../../external/binary-reference-assemblies/v4.7/mscorlib.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -22,6 +22,7 @@ install-local:
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7.1-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7.2-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.8-api
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.5-api/Facades
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.5.1-api/Facades
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.5.2-api/Facades
|
||||
@@ -31,6 +32,7 @@ install-local:
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7-api/Facades
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7.1-api/Facades
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.7.2-api/Facades
|
||||
$(MKINSTALLDIRS) $(PROFILE_DIR)/4.8-api/Facades
|
||||
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/*.dll $(PROFILE_DIR)/2.0-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/*.dll $(PROFILE_DIR)/3.5-api
|
||||
@@ -44,6 +46,7 @@ install-local:
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7/*.dll $(PROFILE_DIR)/4.7-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7.1/*.dll $(PROFILE_DIR)/4.7.1-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7.2/*.dll $(PROFILE_DIR)/4.7.2-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.8/*.dll $(PROFILE_DIR)/4.8-api
|
||||
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll $(PROFILE_DIR)/4.5-api/Facades
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5.1/Facades/*.dll $(PROFILE_DIR)/4.5.1-api/Facades
|
||||
@@ -54,6 +57,7 @@ install-local:
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7/Facades/*.dll $(PROFILE_DIR)/4.7-api/Facades
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7.1/Facades/*.dll $(PROFILE_DIR)/4.7.1-api/Facades
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.7.2/Facades/*.dll $(PROFILE_DIR)/4.7.2-api/Facades
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.8/Facades/*.dll $(PROFILE_DIR)/4.8-api/Facades
|
||||
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/2.0-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.0-api
|
||||
@@ -65,9 +69,11 @@ install-local:
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.6.2-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.7-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.7.1-api
|
||||
rm -f $(PROFILE_DIR)/4.7.1-api/ICSharpCode.SharpZipLib.dll
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.7.2-api
|
||||
$(INSTALL_LIB) ../../../external/binary-reference-assemblies/mono/*.dll $(PROFILE_DIR)/4.8-api
|
||||
rm -f $(PROFILE_DIR)/4.7.1-api/ICSharpCode.SharpZipLib.dll
|
||||
rm -f $(PROFILE_DIR)/4.7.2-api/ICSharpCode.SharpZipLib.dll
|
||||
rm -f $(PROFILE_DIR)/4.8-api/ICSharpCode.SharpZipLib.dll
|
||||
|
||||
# Unfortunately, a few programs (most notably NUnit and FSharp) have hardcoded checks for <prefix>/lib/mono/4.0/mscorlib.dll or Mono.Posix.dll,
|
||||
# so we need to place something there or those tools break. We decided to symlink to the reference assembly for now.
|
||||
@@ -77,6 +83,7 @@ install-local:
|
||||
ln -sf ../4.0-api/Mono.Posix.dll $(PROFILE_DIR)/4.0/Mono.Posix.dll
|
||||
|
||||
DISTFILES = \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.8/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7.2/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7.1/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7/Facades/*.dll) \
|
||||
@@ -86,6 +93,7 @@ DISTFILES = \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.5.2/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.5.1/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.5/Facades/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.8/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7.2/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7.1/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v4.7/*.dll) \
|
||||
@@ -99,6 +107,7 @@ DISTFILES = \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v3.5/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/v2.0/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/mono/*.dll) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.8/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7.2/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7.1/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7/Facades/*.cs) \
|
||||
@@ -108,6 +117,7 @@ DISTFILES = \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.5.2/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.5.1/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.5/Facades/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.8/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7.2/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7.1/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v4.7/*.cs) \
|
||||
@@ -121,6 +131,7 @@ DISTFILES = \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v3.5/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/v2.0/*.cs) \
|
||||
$(wildcard ../../../external/binary-reference-assemblies/src/mono/*.cs) \
|
||||
../../../external/binary-reference-assemblies/v4.8/Makefile \
|
||||
../../../external/binary-reference-assemblies/v4.7.2/Makefile \
|
||||
../../../external/binary-reference-assemblies/v4.7.1/Makefile \
|
||||
../../../external/binary-reference-assemblies/v4.7/Makefile \
|
||||
|
||||
+47
-14
@@ -19,8 +19,9 @@ namespace System.Diagnostics {
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using System.Threading;
|
||||
using System.Collections;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
internal delegate void UserCallBack(String data);
|
||||
|
||||
@@ -58,10 +59,10 @@ namespace System.Diagnostics {
|
||||
|
||||
// Cache the last position scanned in sb when searching for lines.
|
||||
private int currentLinePos;
|
||||
|
||||
#if MONO
|
||||
//users to coordinate between Dispose and BeginReadLine
|
||||
private object syncObject = new Object ();
|
||||
//users to coordinate between Dispose and ReadBuffer
|
||||
private object syncObject = new Object ();
|
||||
private IAsyncResult asyncReadResult = null;
|
||||
#endif
|
||||
|
||||
internal AsyncStreamReader(Process process, Stream stream, UserCallBack callback, Encoding encoding)
|
||||
@@ -115,8 +116,31 @@ namespace System.Diagnostics {
|
||||
lock (syncObject) {
|
||||
#endif
|
||||
if (disposing) {
|
||||
if (stream != null)
|
||||
if (stream != null) {
|
||||
#if MONO
|
||||
if (asyncReadResult != null && !asyncReadResult.IsCompleted) {
|
||||
// Closing underlying stream when having pending async read request in progress is
|
||||
// not portable and racy by design. Try to cancel pending async read before closing stream.
|
||||
// We are still holding lock that will prevent new async read requests to queue up
|
||||
// before we have closed and invalidated the stream.
|
||||
if (stream is FileStream) {
|
||||
SafeHandle tmpStreamHandle = ((FileStream)stream).SafeFileHandle;
|
||||
while (!asyncReadResult.IsCompleted) {
|
||||
MonoIOError error;
|
||||
if (!MonoIO.Cancel (tmpStreamHandle, out error) && error == MonoIOError.ERROR_NOT_SUPPORTED) {
|
||||
// Platform don't support canceling pending IO requests on stream. If an async pending read
|
||||
// is still in flight when closing stream, it could trigger a race condition.
|
||||
break;
|
||||
}
|
||||
|
||||
// Wait for a short time for pending async read to cancel/complete/fail.
|
||||
asyncReadResult.AsyncWaitHandle.WaitOne (200);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
stream.Close();
|
||||
}
|
||||
}
|
||||
if (stream != null) {
|
||||
stream = null;
|
||||
@@ -151,7 +175,11 @@ namespace System.Diagnostics {
|
||||
|
||||
if( sb == null ) {
|
||||
sb = new StringBuilder(DefaultBufferSize);
|
||||
#if MONO
|
||||
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback (ReadBuffer), null);
|
||||
#else
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
FlushMessageQueue();
|
||||
@@ -169,12 +197,17 @@ namespace System.Diagnostics {
|
||||
|
||||
try {
|
||||
#if MONO
|
||||
var stream = this.stream;
|
||||
if (stream == null)
|
||||
byteLen = 0;
|
||||
else
|
||||
#endif
|
||||
lock (syncObject) {
|
||||
Debug.Assert (ar.IsCompleted);
|
||||
asyncReadResult = null;
|
||||
if (this.stream == null)
|
||||
byteLen = 0;
|
||||
else
|
||||
byteLen = stream.EndRead (ar);
|
||||
}
|
||||
#else
|
||||
byteLen = stream.EndRead(ar);
|
||||
#endif
|
||||
}
|
||||
catch (IOException ) {
|
||||
// We should ideally consume errors from operations getting cancelled
|
||||
@@ -242,10 +275,10 @@ retry_dispose:
|
||||
byteLen = 0;
|
||||
goto retry_dispose;
|
||||
}
|
||||
#endif
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#if MONO
|
||||
asyncReadResult = stream.BeginRead (byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
}
|
||||
#else
|
||||
stream.BeginRead(byteBuffer, 0 , byteBuffer.Length, new AsyncCallback(ReadBuffer), null);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2858,17 +2858,24 @@ namespace System
|
||||
return candidates;
|
||||
}
|
||||
|
||||
// Note the following assumptions on name:
|
||||
// 1. Callers assume that null == "*"
|
||||
// 2. FilterHelper chops off "*"
|
||||
//
|
||||
private ListBuilder<ConstructorInfo> GetConstructorCandidates(
|
||||
string name, BindingFlags bindingAttr, CallingConventions callConv,
|
||||
Type[] types, bool allowPrefixLookup)
|
||||
{
|
||||
bool prefixLookup, ignoreCase;
|
||||
MemberListType listType;
|
||||
|
||||
RuntimeType.FilterHelper(bindingAttr, ref name, allowPrefixLookup, out prefixLookup, out ignoreCase, out listType);
|
||||
|
||||
#if MONO
|
||||
if (!string.IsNullOrEmpty (name) && name != ConstructorInfo.ConstructorName && name != ConstructorInfo.TypeConstructorName)
|
||||
#if MONO
|
||||
if ((!prefixLookup && name?.Length == 0) ||
|
||||
(!string.IsNullOrEmpty (name) && name != ConstructorInfo.ConstructorName && name != ConstructorInfo.TypeConstructorName)) {
|
||||
return new ListBuilder<ConstructorInfo> (0);
|
||||
}
|
||||
RuntimeConstructorInfo[] cache = GetConstructors_internal (bindingAttr, this);
|
||||
#else
|
||||
RuntimeConstructorInfo[] cache = Cache.GetConstructorList(listType, name);
|
||||
|
||||
@@ -1316,11 +1316,7 @@ namespace System.Threading
|
||||
{
|
||||
// capture the sync context
|
||||
if (0 == (options & CaptureOptions.IgnoreSyncCtx))
|
||||
#if MONO
|
||||
syncCtxNew = ecCurrent.SynchronizationContext;
|
||||
#else
|
||||
syncCtxNew = (ecCurrent.SynchronizationContext == null) ? null : ecCurrent.SynchronizationContext.CreateCopy();
|
||||
#endif
|
||||
|
||||
#if FEATURE_REMOTING
|
||||
// copy over the Logical Call Context
|
||||
|
||||
@@ -38,6 +38,10 @@ DISABLE_MCS_DOCS = yes
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef MCS_MODE
|
||||
DISABLE_MCS_DOCS = yes
|
||||
endif
|
||||
|
||||
csproj-local test-local run-test-local run-test-ondotnet-local doc-update:
|
||||
|
||||
clean-local:
|
||||
|
||||
@@ -257,6 +257,7 @@ namespace Mono.CSharp
|
||||
sdk_directory.Add ("4.7", new string [] { "4.7-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.7.1", new string [] { "4.7.1-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.7.2", new string [] { "4.7.2-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.8", new string [] { "4.8-api", "v4.0.30319" });
|
||||
sdk_directory.Add ("4.x", new string [] { "4.5", "net_4_x", "v4.0.30319" });
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ ROSLYN_FILES_TO_COPY_FOR_MSBUILD = \
|
||||
$(ROSLYN_CSC_DIR)/Microsoft.Build.Tasks.CodeAnalysis.dll \
|
||||
$(ROSLYN_CSC_DIR)/Microsoft.CSharp.Core.targets \
|
||||
$(ROSLYN_CSC_DIR)/Microsoft.Managed.Core.targets \
|
||||
$(ROSLYN_CSC_DIR)/Microsoft.Managed.EditorConfig.targets \
|
||||
$(ROSLYN_CSC_DIR)/Microsoft.VisualBasic.Core.targets
|
||||
|
||||
DISTFILES = $(ROSLYN_FILES_FOR_MONO) $(ROSLYN_FILES_TO_COPY_FOR_MSBUILD) csi-test.csx
|
||||
|
||||
+4
-1
@@ -2,6 +2,7 @@ thisdir = tools
|
||||
|
||||
net_4_5_dirs := \
|
||||
al \
|
||||
aprofutil \
|
||||
linker \
|
||||
culevel \
|
||||
genxs \
|
||||
@@ -53,13 +54,15 @@ net_4_5_dirs := \
|
||||
build_SUBDIRS =
|
||||
build_PARALLEL_SUBDIRS := resgen gacutil security culevel upload-to-sentry mono-helix-client commoncryptogenerator resx2sr linker cil-strip corcompare mono-api-diff mono-api-html
|
||||
monodroid_tools_SUBDIRS =
|
||||
monodroid_tools_PARALLEL_SUBDIRS = cil-strip linker-analyzer mkbundle mdoc mono-symbolicate corcompare mono-api-diff mono-api-html pdb2mdb nunit-lite
|
||||
monodroid_tools_PARALLEL_SUBDIRS = aprofutil cil-strip linker-analyzer mkbundle mdoc mono-symbolicate corcompare mono-api-diff mono-api-html pdb2mdb nunit-lite
|
||||
monodroid_SUBDIRS = nunit-lite
|
||||
monotouch_SUBDIRS = nunit-lite
|
||||
monotouch_tv_SUBDIRS = nunit-lite
|
||||
monotouch_watch_SUBDIRS = nunit-lite
|
||||
monotouch_tools_SUBDIRS =
|
||||
monotouch_tools_PARALLEL_SUBDIRS = corcompare mono-api-html
|
||||
xammac_SUBDIRS = nunit-lite
|
||||
xammac_net_4_5_SUBDIRS = nunit-lite
|
||||
net_4_x_SUBDIRS =
|
||||
net_4_x_PARALLEL_SUBDIRS = $(net_4_5_dirs)
|
||||
wasm_tools_SUBDIRS =
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
thisdir = tools/aprofutil
|
||||
include ../../build/rules.make
|
||||
|
||||
PROGRAM = aprofutil.exe
|
||||
|
||||
LIB_REFS = System System.Core Mono.Profiler.Log
|
||||
|
||||
include ../../build/executable.make
|
||||
@@ -0,0 +1,299 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Net.Sockets;
|
||||
using System.Text.RegularExpressions;
|
||||
using Mono.Options;
|
||||
using Mono.Profiler.Aot;
|
||||
|
||||
using static System.Console;
|
||||
|
||||
namespace aotprofiletool {
|
||||
class MainClass {
|
||||
static readonly string Name = "aotprofile-tool";
|
||||
|
||||
static bool AdbForward;
|
||||
static bool Methods;
|
||||
static bool Modules;
|
||||
static bool Summary;
|
||||
static bool Types;
|
||||
static bool Verbose;
|
||||
|
||||
static Regex FilterMethod;
|
||||
static Regex FilterModule;
|
||||
static Regex FilterType;
|
||||
|
||||
static string Output;
|
||||
|
||||
static int Port = -1;
|
||||
|
||||
static string ProcessArguments (string [] args)
|
||||
{
|
||||
var help = false;
|
||||
var options = new OptionSet {
|
||||
$"Usage: {Name}.exe OPTIONS* <aotprofile-file>",
|
||||
"",
|
||||
"Processes AOTPROFILE files created by Mono's AOT Profiler",
|
||||
"",
|
||||
"Copyright 2019 Microsoft Corporation",
|
||||
"",
|
||||
"Options:",
|
||||
{ "h|help|?",
|
||||
"Show this message and exit",
|
||||
v => help = v != null },
|
||||
{ "a|all",
|
||||
"Show modules, types and methods in the profile",
|
||||
v => Modules = Types = Methods = true },
|
||||
{ "d|modules",
|
||||
"Show modules in the profile",
|
||||
v => Modules = true },
|
||||
{ "f|adb-forward",
|
||||
"Set adb socket forwarding for Android",
|
||||
v => AdbForward = true },
|
||||
{ "filter-method=",
|
||||
"Filter by method with regex {VALUE}",
|
||||
v => FilterMethod = new Regex (v) },
|
||||
{ "filter-module=",
|
||||
"Filter by module with regex {VALUE}",
|
||||
v => FilterModule = new Regex (v) },
|
||||
{ "filter-type=",
|
||||
"Filter by type with regex {VALUE}",
|
||||
v => FilterType = new Regex (v) },
|
||||
{ "m|methods",
|
||||
"Show methods in the profile",
|
||||
v => Methods = true },
|
||||
{ "o|output=",
|
||||
"Write profile to {OUTPUT} file",
|
||||
v => Output = v },
|
||||
{ "p|port=",
|
||||
"Read profile from aot profiler using local connection on {PORT}",
|
||||
v => int.TryParse (v, out Port) },
|
||||
{ "s|summary",
|
||||
"Show summary of the profile",
|
||||
v => Summary = true },
|
||||
{ "t|types",
|
||||
"Show types in the profile",
|
||||
v => Types = true },
|
||||
{ "v|verbose",
|
||||
"Output information about progress during the run of the tool",
|
||||
v => Verbose = true },
|
||||
"",
|
||||
"If no other option than -v is used then --all is used by default"
|
||||
};
|
||||
|
||||
var remaining = options.Parse (args);
|
||||
|
||||
if (help || args.Length < 1) {
|
||||
options.WriteOptionDescriptions (Out);
|
||||
|
||||
Environment.Exit (0);
|
||||
}
|
||||
|
||||
if (remaining.Count != 1 && Port < 0) {
|
||||
Error ("Please specify one <aotprofile-file> to process or network PORT with -p.");
|
||||
Environment.Exit (2);
|
||||
}
|
||||
|
||||
return remaining.Count > 0 ? remaining [0] : null;
|
||||
}
|
||||
|
||||
static ProfileData ReadProfileFromPort (ProfileReader reader)
|
||||
{
|
||||
ProfileData pd;
|
||||
|
||||
if (AdbForward) {
|
||||
var cmdArgs = $"forward tcp:{Port} tcp:{Port}";
|
||||
if (Verbose)
|
||||
ColorWriteLine ($"Calling 'adb {cmdArgs}'...", ConsoleColor.Yellow);
|
||||
|
||||
System.Diagnostics.Process.Start ("adb", cmdArgs);
|
||||
}
|
||||
|
||||
using (var client = new TcpClient ("127.0.0.1", Port)) {
|
||||
using (var stream = client.GetStream ()) {
|
||||
var msgData = System.Text.Encoding.ASCII.GetBytes ("save\n");
|
||||
|
||||
stream.Write (msgData, 0, msgData.Length);
|
||||
|
||||
if (Verbose)
|
||||
ColorWriteLine ($"Reading from '127.0.0.1:{Port}'...", ConsoleColor.Yellow);
|
||||
|
||||
using (var memoryStream = new MemoryStream (128 * 1024)) {
|
||||
var data = new byte [4 * 1024];
|
||||
int len;
|
||||
|
||||
while ((len = stream.Read (data, 0, data.Length)) > 0) {
|
||||
memoryStream.Write (data, 0, len);
|
||||
|
||||
if (Verbose)
|
||||
ColorWrite ($"Read {len} bytes...\r", ConsoleColor.Yellow);
|
||||
}
|
||||
|
||||
if (Verbose)
|
||||
ColorWriteLine ($"Read total {memoryStream.Length} bytes...", ConsoleColor.Yellow);
|
||||
|
||||
memoryStream.Seek (0, SeekOrigin.Begin);
|
||||
|
||||
pd = reader.ReadAllData (memoryStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return pd;
|
||||
}
|
||||
|
||||
public static void Main (string [] args)
|
||||
{
|
||||
var path = ProcessArguments (args);
|
||||
|
||||
if (args.Length == 1) {
|
||||
Modules = Types = Methods = true;
|
||||
}
|
||||
|
||||
var reader = new ProfileReader ();
|
||||
ProfileData pd = null;
|
||||
|
||||
if (path == null) {
|
||||
if (Port < 0) {
|
||||
Error ($"You should specify path or -p PORT to read the profile.");
|
||||
Environment.Exit (4);
|
||||
} else {
|
||||
try {
|
||||
pd = ReadProfileFromPort (reader);
|
||||
} catch (Exception e) {
|
||||
Error ($"Unable to read profile through local port: {Port}.\n{e}");
|
||||
Environment.Exit (5);
|
||||
}
|
||||
}
|
||||
} else if (!File.Exists (path)) {
|
||||
Error ($"'{path}' doesn't exist.");
|
||||
Environment.Exit (3);
|
||||
} else {
|
||||
using (var stream = new FileStream (path, FileMode.Open)) {
|
||||
if (Verbose)
|
||||
ColorWriteLine ($"Reading '{path}'...", ConsoleColor.Yellow);
|
||||
|
||||
pd = reader.ReadAllData (stream);
|
||||
}
|
||||
}
|
||||
|
||||
List<MethodRecord> methods = new List<MethodRecord> (pd.Methods);
|
||||
ICollection<TypeRecord> types = new List<TypeRecord> (pd.Types);
|
||||
ICollection<ModuleRecord> modules = new List<ModuleRecord> (pd.Modules);
|
||||
|
||||
if (FilterMethod != null || FilterType != null || FilterModule != null) {
|
||||
methods = new List<MethodRecord> ();
|
||||
types = new HashSet<TypeRecord> ();
|
||||
modules = new HashSet<ModuleRecord> ();
|
||||
|
||||
foreach (var method in pd.Methods) {
|
||||
|
||||
var type = method.Type;
|
||||
var module = type.Module;
|
||||
|
||||
if (FilterModule != null) {
|
||||
var match = FilterModule.Match (module.ToString ());
|
||||
|
||||
if (!match.Success)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (FilterType != null) {
|
||||
var match = FilterType.Match (method.Type.ToString ());
|
||||
|
||||
if (!match.Success)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (FilterMethod != null) {
|
||||
var match = FilterMethod.Match (method.ToString ());
|
||||
|
||||
if (!match.Success)
|
||||
continue;
|
||||
}
|
||||
|
||||
methods.Add (method);
|
||||
types.Add (type);
|
||||
modules.Add (module);
|
||||
}
|
||||
}
|
||||
|
||||
if (FilterMethod == null && FilterType != null) {
|
||||
foreach (var type in pd.Types) {
|
||||
if (types.Contains (type))
|
||||
continue;
|
||||
|
||||
var match = FilterType.Match (type.ToString ());
|
||||
|
||||
if (!match.Success)
|
||||
continue;
|
||||
|
||||
types.Add (type);
|
||||
}
|
||||
}
|
||||
|
||||
if (Modules) {
|
||||
ColorWriteLine ($"Modules:", ConsoleColor.Green);
|
||||
|
||||
foreach (var module in modules)
|
||||
WriteLine ($"\t{module.Mvid} {module.ToString ()}");
|
||||
}
|
||||
|
||||
if (Types) {
|
||||
ColorWriteLine ($"Types:", ConsoleColor.Green);
|
||||
|
||||
foreach (var type in types)
|
||||
WriteLine ($"\t{type}");
|
||||
}
|
||||
|
||||
if (Methods) {
|
||||
ColorWriteLine ($"Methods:", ConsoleColor.Green);
|
||||
|
||||
foreach (var method in methods)
|
||||
WriteLine ($"\t{method}");
|
||||
}
|
||||
|
||||
if (Summary) {
|
||||
ColorWriteLine ($"Summary:", ConsoleColor.Green);
|
||||
WriteLine ($"\tModules: {modules.Count.ToString ("N0"),10}{(modules.Count != pd.Modules.Length ? $" (of {pd.Modules.Length})" : "" )}");
|
||||
WriteLine ($"\tTypes: {types.Count.ToString ("N0"),10}{(types.Count != pd.Types.Length ? $" (of {pd.Types.Length})" : "")}");
|
||||
WriteLine ($"\tMethods: {methods.Count.ToString ("N0"),10}{(methods.Count != pd.Methods.Length ? $" (of {pd.Methods.Length})" : "")}");
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty (Output)) {
|
||||
if (Verbose)
|
||||
ColorWriteLine ($"Going to write the profile to '{Output}'", ConsoleColor.Yellow);
|
||||
var modulesArray = new ModuleRecord [modules.Count];
|
||||
modules.CopyTo (modulesArray, 0);
|
||||
var typesArray = new TypeRecord [types.Count];
|
||||
types.CopyTo (typesArray, 0);
|
||||
var updatedPD = new ProfileData (modulesArray, typesArray, methods.ToArray ());
|
||||
|
||||
using (var stream = new FileStream (Output, FileMode.Create)) {
|
||||
var writer = new ProfileWriter ();
|
||||
writer.WriteAllData (stream, updatedPD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void ColorMessage (string message, ConsoleColor color, TextWriter writer, bool writeLine = true)
|
||||
{
|
||||
ForegroundColor = color;
|
||||
|
||||
if (writeLine)
|
||||
writer.WriteLine (message);
|
||||
else
|
||||
writer.Write (message);
|
||||
|
||||
ResetColor ();
|
||||
}
|
||||
|
||||
public static void ColorWriteLine (string message, ConsoleColor color) => ColorMessage (message, color, Out);
|
||||
|
||||
public static void ColorWrite (string message, ConsoleColor color) => ColorMessage (message, color, Out, false);
|
||||
|
||||
public static void Error (string message) => ColorMessage ($"Error: {Name}: {message}", ConsoleColor.Red, Console.Error);
|
||||
|
||||
public static void Warning (string message) => ColorMessage ($"Warning: {Name}: {message}", ConsoleColor.Yellow, Console.Error);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
**aprofutil** is a tool to inspect AOT profiler files
|
||||
|
||||
```
|
||||
Usage: aprofutil.exe OPTIONS* <aotprofile-file>
|
||||
|
||||
Processes AOTPROFILE files created by Mono's AOT Profiler
|
||||
|
||||
Copyright 2019 Microsoft Corporation
|
||||
|
||||
Options:
|
||||
-h, --help, -? Show this message and exit
|
||||
-a, --all Show modules, types and methods in the profile
|
||||
-d, --modules Show modules in the profile
|
||||
--filter-method=VALUE Filter by method with regex VALUE
|
||||
--filter-module=VALUE Filter by module with regex VALUE
|
||||
--filter-type=VALUE Filter by type with regex VALUE
|
||||
-m, --methods Show methods in the profile
|
||||
-s, --summary Show summary of the profile
|
||||
-t, --types Show types in the profile
|
||||
-v, --verbose Output information about progress during the run
|
||||
of the tool
|
||||
|
||||
If no other option than -v is used then --all is used by default
|
||||
```
|
||||
|
||||
It can be use to show and filter the profiler file content in readable text form.
|
||||
|
||||
### Example usage
|
||||
|
||||
Display modules and summary of XA startup profile
|
||||
```
|
||||
mono aprofutil.exe -sd startup.aotprofile
|
||||
Modules:
|
||||
41C38B0A-2032-45CE-8638-0299CED65330 mscorlib
|
||||
0326DF03-2158-4F7A-9A2B-B7A9419F021D Mono.Android
|
||||
8FB63BB4-1195-4173-A9ED-0EC341B07C32 System
|
||||
74C06E06-C1C7-4A4C-B64E-EAC7DBB08BBC Java.Interop
|
||||
11E2319F-6A26-461C-9C46-C972248BEE4B System.Core
|
||||
7999CC4B-D566-4ECA-8A72-469344172CA3 Xamarin.Forms.Platform.Android
|
||||
C5089213-328B-451D-BA87-D6585C120780 Xamarin.Forms.Performance.Integration.Droid
|
||||
D754F8AE-503C-41C8-B16F-647FC662507A Xamarin.Android.Support.v7.AppCompat
|
||||
929ECB6D-1171-4C66-8470-DD32AC608969 Xamarin.Android.Support.Fragment
|
||||
F841E23B-59A8-4AE2-9A84-D2FC1D891B4A Xamarin.Forms.Core
|
||||
945CCBF8-C2DB-468B-B3BD-D7ACA37B69AD Xamarin.Forms.Performance.Integration
|
||||
AF20FA19-F07E-4BD4-B5ED-104706EA660E Xamarin.Forms.Xaml
|
||||
629C84F8-0988-42EF-8BC5-872173A0A71F FormsViewGroup
|
||||
60398815-8E62-487E-A553-781F56A0849D Xamarin.Android.Support.Design
|
||||
F0C550D7-665A-40B5-A307-8E9B49976D87 Xamarin.Android.Support.Core.UI
|
||||
23A34485-DE75-440E-BA9D-E235F664E990 Xamarin.Android.Support.Compat
|
||||
Summary:
|
||||
Modules: 16
|
||||
Types: 907
|
||||
Methods: 4,230
|
||||
```
|
||||
|
||||
Filter Java.Interop.Runtime type in XA startup profile:
|
||||
```
|
||||
mono aprofutil.exe --filter-type Java.Interop.Runtime -sa startup.aotprofile
|
||||
Modules:
|
||||
0326DF03-2158-4F7A-9A2B-B7A9419F021D Mono.Android
|
||||
Types:
|
||||
Java.Interop.Runtime
|
||||
Methods:
|
||||
bool Java.Interop.Runtime:IsGCUserPeer (Android.Runtime.IJavaObject)
|
||||
bool Java.Interop.Runtime:IsGCUserPeer (intptr)
|
||||
Summary:
|
||||
Modules: 1 (of 16)
|
||||
Types: 1 (of 907)
|
||||
Methods: 2 (of 4230)
|
||||
```
|
||||
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- WARNING: this file is autogenerated, don't modify it. Edit the .sources file of the corresponding assembly instead if you want to add/remove C# source files. -->
|
||||
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">net_4_x</Platform>
|
||||
<ProjectGuid>{658B566B-CED1-4C42-9926-C1AA930BA368}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<NoWarn>1699</NoWarn>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Windows_NT'">win32</HostPlatform>
|
||||
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix' and $([System.IO.File]::Exists('/usr/lib/libc.dylib'))">macos</HostPlatform>
|
||||
<HostPlatform Condition=" '$(HostPlatform)' == '' and '$(OS)' == 'Unix'">linux</HostPlatform>
|
||||
<GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
|
||||
<NoStdLib>False</NoStdLib>
|
||||
<NoConfig>True</NoConfig>
|
||||
<AssemblyName>aprofutil</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<!-- Set AddAdditionalExplicitAssemblyReferences to false, otherwise if targetting .NET4.0,
|
||||
Microsoft.NETFramework.props will force a dependency on the assembly System.Core. This
|
||||
is a problem to compile the Mono mscorlib.dll -->
|
||||
<AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'net_4_x' ">
|
||||
<OutputPath>./../../class/lib/net_4_x-$(HostPlatform)</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-net_4_x-$(HostPlatform)</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_0;NET_4_5;NET_4_6;MONO;WIN_PLATFORM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Platform)' == 'monodroid_tools' ">
|
||||
<OutputPath>./../../class/lib/monodroid_tools</OutputPath>
|
||||
<IntermediateOutputPath>./../../class/obj/$(AssemblyName)-monodroid_tools</IntermediateOutputPath>
|
||||
<DefineConstants>NET_4_6;MONO;MONODROID_TOOLS;WIN_PLATFORM</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<!-- @ALL_PROFILE_PROPERTIES@ -->
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<!-- TRACE is set only for Debug configuration, so inherit from platform-specific value -->
|
||||
<DefineConstants>TRACE;$(DefineConstants)</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- @BUILT_SOURCES@ -->
|
||||
<!--Common files-->
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\class\Mono.Options\Mono.Options\Options.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
</ItemGroup>
|
||||
<!--End of common files-->
|
||||
<!-- @ALL_SOURCES@ -->
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="../../class/System/System.csproj" />
|
||||
<ProjectReference Include="../../class/System.Core/System.Core.csproj" />
|
||||
<ProjectReference Include="../../class/Mono.Profiler.Log/Mono.Profiler.Log.csproj" />
|
||||
</ItemGroup>
|
||||
<!-- @ALL_REFERENCES@ -->
|
||||
<!-- @ALL_RESOURCES@ -->
|
||||
<PropertyGroup>
|
||||
<!-- Force the pre-build event to run after references have been resolved. The default
|
||||
behavior is to run them before resolving references, which can cause things like
|
||||
culevel.exe to be used before they have been built. -->
|
||||
<PreBuildEventDependsOn>ResolveReferences</PreBuildEventDependsOn>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,2 @@
|
||||
Program.cs
|
||||
../../class/Mono.Options/Mono.Options/Options.cs
|
||||
@@ -586,9 +586,9 @@ namespace Mono.ApiTools {
|
||||
|
||||
writer.WriteStartElement ("generic-parameter-constraints");
|
||||
|
||||
foreach (TypeReference constraint in constraints) {
|
||||
foreach (GenericParameterConstraint constraint in constraints) {
|
||||
writer.WriteStartElement ("generic-parameter-constraint");
|
||||
writer.WriteAttributeString ("name", Utils.CleanupTypeName (constraint));
|
||||
writer.WriteAttributeString ("name", Utils.CleanupTypeName (constraint.ConstraintType));
|
||||
writer.WriteEndElement (); // generic-parameter-constraint
|
||||
}
|
||||
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\BaseStep.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\BlacklistStep.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\CleanStep.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\ClearInitLocals.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\CodeRewriterStep.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\IStep.cs" />
|
||||
<Compile Include="..\..\..\external\linker\src\linker\Linker.Steps\LoadI18nAssemblies.cs" />
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
../../../external/linker/src/linker/Linker/TypeReferenceExtensions.cs
|
||||
../../../external/linker/src/linker/Linker/XApiReader.cs
|
||||
../../../external/linker/src/linker/Linker.Steps/BaseStep.cs
|
||||
../../../external/linker/src/linker/Linker.Steps/ClearInitLocals.cs
|
||||
../../../external/linker/src/linker/Linker.Steps/LoadReferencesStep.cs
|
||||
../../../external/linker/src/linker/Linker.Steps/LoadI18nAssemblies.cs
|
||||
../../../external/linker/src/linker/Linker.Steps/ResolveFromXmlStep.cs
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/Test/en.*/
|
||||
/Test/html.*/
|
||||
/Test/DocTest.*
|
||||
/Test/DocTest-DropNS-classic.xml
|
||||
/.v2.txt
|
||||
/.v0.txt
|
||||
Loaded 100 of 332 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user