mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-16 11:21:08 -10:00
Compare commits
227
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef79d2e0eb | ||
|
|
3d6ebf929e | ||
|
|
ea3575cfaa | ||
|
|
3130eb18ce | ||
|
|
9d3d8a5c53 | ||
|
|
716b78c578 | ||
|
|
5644d157c8 | ||
|
|
2c7265d6b9 | ||
|
|
fb033c5301 | ||
|
|
d1b51438d1 | ||
|
|
014f882aea | ||
|
|
b464556d05 | ||
|
|
da058bf8a4 | ||
|
|
87f59dce24 | ||
|
|
4de9aa838b | ||
|
|
1cc51f63ee | ||
|
|
fbf1077afd | ||
|
|
38d9679d82 | ||
|
|
66acb4f3e1 | ||
|
|
fccff0d9bb | ||
|
|
3c1147121e | ||
|
|
672a02e177 | ||
|
|
4f2e8dfddd | ||
|
|
f8de60d964 | ||
|
|
d67dd77506 | ||
|
|
9347782b8b | ||
|
|
939fa90ceb | ||
|
|
e94e5e5ac1 | ||
|
|
01f892bdb5 | ||
|
|
d1c8e68397 | ||
|
|
c544d330dd | ||
|
|
c9c80ce2ce | ||
|
|
383daff454 | ||
|
|
281934e127 | ||
|
|
567834db69 | ||
|
|
2cee8a135e | ||
|
|
2729751fcf | ||
|
|
f37be5d96b | ||
|
|
20c5941b4c | ||
|
|
b9e6127506 | ||
|
|
df8abf4920 | ||
|
|
6b7a11a77b | ||
|
|
40c30b5288 | ||
|
|
3ad76e42b2 | ||
|
|
b3e8e1fa20 | ||
|
|
59b80fb93b | ||
|
|
e52d20ed7d | ||
|
|
c5375566d5 | ||
|
|
09edaaf4d4 | ||
|
|
c12c27a9a9 | ||
|
|
7e7fce7bf1 | ||
|
|
f256f515de | ||
|
|
937c7233d2 | ||
|
|
8bf7d26eaa | ||
|
|
c6fb27e6e9 | ||
|
|
0f2444e940 | ||
|
|
698e12809f | ||
|
|
95b1a5bbf9 | ||
|
|
63dce7b8e3 | ||
|
|
ba7b9fc562 | ||
|
|
49b7ef4442 | ||
|
|
6dea3629f7 | ||
|
|
e8412d602f | ||
|
|
d55bb757b3 | ||
|
|
4c8d5ee138 | ||
|
|
49c48add7b | ||
|
|
eecf7a8ab5 | ||
|
|
09bd838116 | ||
|
|
d07e74a3f1 | ||
|
|
afc92f22dc | ||
|
|
20523739f8 | ||
|
|
4f237e0ce1 | ||
|
|
06b8128992 | ||
|
|
7bd3bd73d5 | ||
|
|
e12085b4c9 | ||
|
|
1624ec14c3 | ||
|
|
b87d9685bb | ||
|
|
537665b54e | ||
|
|
3639ee61f1 | ||
|
|
fbfe8518ce | ||
|
|
597183658e | ||
|
|
6299445e81 | ||
|
|
09d16b7265 | ||
|
|
3d293f5a71 | ||
|
|
4697ef6e77 | ||
|
|
a32054ece9 | ||
|
|
cdfb430b48 | ||
|
|
789517f878 | ||
|
|
b486e8372e | ||
|
|
363e4bb2a6 | ||
|
|
2ef2b0d754 | ||
|
|
c6b845ea23 | ||
|
|
0526aa45e0 | ||
|
|
4fe5a46e55 | ||
|
|
532420cc64 | ||
|
|
50e286b2e7 | ||
|
|
60d83a46e7 | ||
|
|
83fac07316 | ||
|
|
7b59f2dcf1 | ||
|
|
734b0e9d32 | ||
|
|
fcfb6c2935 | ||
|
|
dc139819ea | ||
|
|
38f2bff71d | ||
|
|
b82016bf29 | ||
|
|
eed64a2729 | ||
|
|
9ddd46b890 | ||
|
|
31b2d60549 | ||
|
|
c09cd684b4 | ||
|
|
5dd3347588 | ||
|
|
5a2ef1b76f | ||
|
|
e6c3ff7551 | ||
|
|
4d12ed3356 | ||
|
|
a18dffad0d | ||
|
|
3aa7f41bed | ||
|
|
412ed8153a | ||
|
|
25e04fa019 | ||
|
|
458c9456f0 | ||
|
|
a8c183ac63 | ||
|
|
a87062a145 | ||
|
|
7f0da57a65 | ||
|
|
7c024c1d5a | ||
|
|
b7a8bfc7ad | ||
|
|
7e056cd346 | ||
|
|
1af68a199e | ||
|
|
0d1555dbd5 | ||
|
|
fb3468e61c | ||
|
|
ab1c14290f | ||
|
|
690a646c5e | ||
|
|
bbfb0e86f3 | ||
|
|
a255b522cb | ||
|
|
7d319221f1 | ||
|
|
e19f539121 | ||
|
|
730d0ccd6f | ||
|
|
0442cdbc19 | ||
|
|
59d2397abc | ||
|
|
c97100c88d | ||
|
|
de3ff228dc | ||
|
|
3664e4c5a7 | ||
|
|
db2381da04 | ||
|
|
367d417207 | ||
|
|
e1900d6dc2 | ||
|
|
bf39f5aec0 | ||
|
|
edb931dfb9 | ||
|
|
e41c4efed5 | ||
|
|
8a1db154e1 | ||
|
|
ba998de3c9 | ||
|
|
b9061f8807 | ||
|
|
9bf45cc5ba | ||
|
|
d69d4c2472 | ||
|
|
9ed222bd75 | ||
|
|
2ba7fb3a36 | ||
|
|
b479e83275 | ||
|
|
72bd6b96fb | ||
|
|
5479dd7e38 | ||
|
|
ef8f07687d | ||
|
|
47287a6784 | ||
|
|
363302f71f | ||
|
|
ed65bc251d | ||
|
|
570cb1a10a | ||
|
|
b324cecd4f | ||
|
|
d8aad87c88 | ||
|
|
1ea6921beb | ||
|
|
2a11a2f11b | ||
|
|
d51f34fd21 | ||
|
|
9522723493 | ||
|
|
53cd89d23a | ||
|
|
f34e6426f9 | ||
|
|
82cfc3ea31 | ||
|
|
fe265502cc | ||
|
|
f6da6fa9ea | ||
|
|
f812f43d2e | ||
|
|
d3ee9252da | ||
|
|
c84d28ca73 | ||
|
|
fc02486d6a | ||
|
|
9bb11ade6d | ||
|
|
b160f1e3b7 | ||
|
|
92c91d75f0 | ||
|
|
1c6da6b912 | ||
|
|
7b4bd74b4d | ||
|
|
e5fc5450dd | ||
|
|
09308892bd | ||
|
|
57feacab95 | ||
|
|
716c7ad122 | ||
|
|
0afdce4e37 | ||
|
|
5c23f1e15d | ||
|
|
b11044a9a6 | ||
|
|
e4d8f21cf6 | ||
|
|
661430fd1f | ||
|
|
3fd4901a23 | ||
|
|
100ecb4f0f | ||
|
|
000c018169 | ||
|
|
f85a6bc77c | ||
|
|
f05e658a2d | ||
|
|
dbfee6a340 | ||
|
|
bf6fea51af | ||
|
|
74d2172cd1 | ||
|
|
b40386d4f4 | ||
|
|
7c162f952c | ||
|
|
3c533de4a8 | ||
|
|
5eec4d0c84 | ||
|
|
45fc2e14fd | ||
|
|
03494c7387 | ||
|
|
ef13507552 | ||
|
|
6af7989628 | ||
|
|
f269254917 | ||
|
|
112079b844 | ||
|
|
ac1dcc6ade | ||
|
|
dacc3f8c5d | ||
|
|
6a738caa5a | ||
|
|
bd715a7c5e | ||
|
|
c265540e76 | ||
|
|
d585381555 | ||
|
|
41981cdca1 | ||
|
|
b7b94a8024 | ||
|
|
d35449e99b | ||
|
|
f1108aabba | ||
|
|
5d869be794 | ||
|
|
ab361102db | ||
|
|
dd68e53636 | ||
|
|
950d9c8a56 | ||
|
|
30ec69fd50 | ||
|
|
6a249a5611 | ||
|
|
eeac252404 | ||
|
|
bbbe1e52d3 | ||
|
|
707051b342 | ||
|
|
2d420bfb7a | ||
|
|
554d6abf4c |
No files matched your search
@@ -25,3 +25,6 @@
|
||||
[submodule "external/ikdasm"]
|
||||
path = external/ikdasm
|
||||
url = git://github.com/mono/ikdasm.git
|
||||
[submodule "external/referencesource"]
|
||||
path = external/referencesource
|
||||
url = git://github.com/mono/referencesource
|
||||
+3
-13
@@ -1,7 +1,7 @@
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
#AC_PREREQ([2.62])
|
||||
|
||||
AC_INIT(mono, [3.12.0],
|
||||
AC_INIT(mono, [3.12.1],
|
||||
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
|
||||
|
||||
AC_CONFIG_SRCDIR([README.md])
|
||||
@@ -578,6 +578,7 @@ else
|
||||
fi
|
||||
CFLAGS="$CFLAGS -g $WARN"
|
||||
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
|
||||
CPPFLAGS="$CPPFLAGS -g $WARN"
|
||||
|
||||
# Where's the 'mcs' source tree?
|
||||
if test -d $srcdir/mcs; then
|
||||
@@ -2459,8 +2460,6 @@ if test "x$enable_llvm" = "xyes"; then
|
||||
|
||||
# Should be something like '2.6' or '2.7svn'
|
||||
llvm_version=`$LLVM_CONFIG --version`
|
||||
major_version=`echo $llvm_version | cut -c 1`
|
||||
minor_version=`echo $llvm_version | cut -c 3`
|
||||
llvm_api_version=`$LLVM_CONFIG --mono-api-version 2>/dev/null`
|
||||
AC_MSG_CHECKING(LLVM version)
|
||||
AC_MSG_RESULT($llvm_version)
|
||||
@@ -2481,14 +2480,8 @@ if test "x$enable_llvm" = "xyes"; then
|
||||
AC_MSG_ERROR([Compiling with stock LLVM is not supported, please use the Mono LLVM repo at https://github.com/mono/llvm, with the GIT branch which matches this version of mono, i.e. 'mono-2-10' for Mono 2.10.])
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(LLVM_MAJOR_VERSION, $major_version, [Major version of LLVM libraries])
|
||||
AC_DEFINE_UNQUOTED(LLVM_MINOR_VERSION, $minor_version, [Minor version of LLVM libraries])
|
||||
AC_DEFINE_UNQUOTED(LLVM_VERSION, "$llvm_version", [Full version of LLVM libraties])
|
||||
|
||||
# Have to pass these on the command line since mini-llvm-cpp.h already includes
|
||||
# llvm's config.h
|
||||
LLVM_CXXFLAGS="$LLVM_CXXFLAGS -DLLVM_MAJOR_VERSION=$major_version -DLLVM_MINOR_VERSION=$minor_version"
|
||||
|
||||
AC_SUBST(LLVM_CFLAGS)
|
||||
AC_SUBST(LLVM_CXXFLAGS)
|
||||
AC_SUBST(LLVM_LIBS)
|
||||
@@ -3206,7 +3199,7 @@ case "x$libgc" in
|
||||
;;
|
||||
esac
|
||||
|
||||
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=yes])
|
||||
AC_ARG_WITH(profile2, [ --with-profile2=yes,no If you want to install the 2.0/3.5 FX (defaults to yes)], [], [with_profile2=no])
|
||||
AC_ARG_WITH(profile4, [ --with-profile4=yes,no If you want to install the 4.0 FX (defaults to yes)], [], [with_profile4=yes])
|
||||
AC_ARG_WITH(profile4_5,[ --with-profile4_5=yes,no If you want to install the 4.5 FX (defaults to yes)], [], [with_profile4_5=yes])
|
||||
AC_ARG_WITH(monodroid, [ --with-monodroid=yes,no If you want to build the MonoDroid assemblies (defaults to no)], [], [with_monodroid=no])
|
||||
@@ -3282,7 +3275,6 @@ dnl Consistency settings
|
||||
dnl
|
||||
if test x$cross_compiling = xyes -o x$enable_mcs_build = xno; then
|
||||
DISABLE_MCS_DOCS=yes
|
||||
with_profile2=no
|
||||
with_profile4=no
|
||||
with_profile4_5=no
|
||||
with_monodroid=no
|
||||
@@ -3306,7 +3298,6 @@ AC_SUBST(OPROFILE_LIBS)
|
||||
|
||||
libmono_ldflags="$libmono_ldflags $LIBS"
|
||||
|
||||
AM_CONDITIONAL(INSTALL_2_0, [test "x$with_profile2" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_4_0, [test "x$with_profile4" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_4_5, [test "x$with_profile4_5" = xyes])
|
||||
AM_CONDITIONAL(INSTALL_MONODROID, [test "x$with_monodroid" != "xno"])
|
||||
@@ -3751,7 +3742,6 @@ echo "
|
||||
LLVM Back End: $enable_llvm (dynamically loaded: $enable_loadedllvm)
|
||||
|
||||
Libraries:
|
||||
.NET 2.0/3.5: $with_profile2
|
||||
.NET 4.0: $with_profile4
|
||||
.NET 4.5: $with_profile4_5
|
||||
MonoDroid: $with_monodroid
|
||||
|
||||
+3
-3
@@ -99,14 +99,14 @@ mono-file-formats.tree: $(srcdir)/docs.make $(srcdir)/Makefile.am $(srcdir)/depl
|
||||
deploy/.stamp: convert.exe Makefile.am
|
||||
$(mkdir_p) html
|
||||
runtimedir=`cd ../runtime && pwd`; export runtimedir; \
|
||||
MONO_PATH=../mcs/class/lib/net_2_0 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
|
||||
MONO_PATH=../mcs/class/lib/net_4_5 perl $(srcdir)/exdoc -h $(srcdir) -t . $(srcdir)/../mono/*/*.c
|
||||
touch $@
|
||||
|
||||
extract: deploy/.stamp
|
||||
|
||||
convert.exe: convert.cs AgilityPack.dll
|
||||
$(TOOL_MAKE) PROFILE=net_2_0 convert.exe
|
||||
$(TOOL_MAKE) PROFILE=net_4_5 convert.exe
|
||||
|
||||
AgilityPack.dll:
|
||||
$(TOOL_MAKE) PROFILE=net_2_0 AgilityPack.dll
|
||||
$(TOOL_MAKE) PROFILE=net_4_5 AgilityPack.dll
|
||||
|
||||
+1
-2
@@ -135,7 +135,6 @@ AC_CHECK_SIZEOF(void *)
|
||||
AC_CHECK_SIZEOF(long)
|
||||
AC_CHECK_SIZEOF(long long)
|
||||
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
|
||||
AC_CHECK_FUNCS(getrlimit)
|
||||
|
||||
#
|
||||
# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
|
||||
@@ -180,7 +179,7 @@ if test "x$have_iso_varargs" = "xyes"; then
|
||||
fi
|
||||
AC_SUBST(G_HAVE_ISO_VARARGS)
|
||||
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h sys/resource.h)
|
||||
AC_CHECK_HEADERS(getopt.h sys/select.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localcharset.h sys/types.h)
|
||||
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
|
||||
AC_SUBST(HAVE_ALLOCA_H)
|
||||
|
||||
|
||||
@@ -176,6 +176,7 @@ typedef struct _GMemChunk GMemChunk;
|
||||
/*
|
||||
* Misc.
|
||||
*/
|
||||
#define g_atexit(func) ((void) atexit (func))
|
||||
|
||||
const gchar * g_getenv(const gchar *variable);
|
||||
gboolean g_setenv(const gchar *variable, const gchar *value, gboolean overwrite);
|
||||
|
||||
+2
-23
@@ -53,10 +53,6 @@
|
||||
#include <sys/wait.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#ifdef G_OS_WIN32
|
||||
#include <io.h>
|
||||
#include <winsock2.h>
|
||||
@@ -217,23 +213,6 @@ write_all (int fd, const void *vbuf, size_t n)
|
||||
return nwritten;
|
||||
}
|
||||
|
||||
#ifndef G_OS_WIN32
|
||||
static int
|
||||
g_getdtablesize (void)
|
||||
{
|
||||
#ifdef HAVE_GETRLIMIT
|
||||
struct rlimit limit;
|
||||
int res;
|
||||
|
||||
res = getrlimit (RLIMIT_NOFILE, &limit);
|
||||
g_assert (res == 0);
|
||||
return limit.rlim_cur;
|
||||
#else
|
||||
return getdtablesize ();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
gboolean
|
||||
g_spawn_command_line_sync (const gchar *command_line,
|
||||
gchar **standard_output,
|
||||
@@ -277,7 +256,7 @@ g_spawn_command_line_sync (const gchar *command_line,
|
||||
close (stderr_pipe [0]);
|
||||
dup2 (stderr_pipe [1], STDERR_FILENO);
|
||||
}
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
|
||||
/* G_SPAWN_SEARCH_PATH is always enabled for g_spawn_command_line_sync */
|
||||
@@ -438,7 +417,7 @@ g_spawn_async_with_pipes (const gchar *working_directory,
|
||||
}
|
||||
|
||||
if ((flags & G_SPAWN_LEAVE_DESCRIPTORS_OPEN) != 0) {
|
||||
for (i = g_getdtablesize () - 1; i >= 3; i--)
|
||||
for (i = getdtablesize () - 1; i >= 3; i--)
|
||||
close (i);
|
||||
}
|
||||
|
||||
|
||||
+1
Submodule external/referencesource added at 4e6dea7a9c.
@@ -32,7 +32,7 @@
|
||||
# define GC_LINUX_THREADS
|
||||
#endif
|
||||
#if defined(WIN32_THREADS)
|
||||
# define GC_WIN32_THREADS
|
||||
# define GC_WIN32_THREADS 1
|
||||
#endif
|
||||
#if defined(USE_LD_WRAP)
|
||||
# define GC_USE_LD_WRAP
|
||||
|
||||
+3
-5
@@ -6,17 +6,16 @@ SUBDIRS := build jay mcs class nunit24 ilasm tools tests errors docs
|
||||
|
||||
basic_SUBDIRS := build jay mcs class
|
||||
build_SUBDIRS := build class mcs class/aot-compiler tools
|
||||
net_2_0_SUBDIRS := build class nunit24 ilasm tools tests errors docs
|
||||
monodroid_SUBDIRS := build class
|
||||
monotouch_SUBDIRS := build class
|
||||
monotouch_runtime_SUBDIRS := build class
|
||||
xammac_SUBDIRS := build class
|
||||
mobile_SUBDIRS := build class
|
||||
mobile_static_SUBDIRS := build class
|
||||
net_3_5_SUBDIRS := build class tools/xbuild
|
||||
net_4_0_SUBDIRS := build class
|
||||
net_4_5_SUBDIRS := build mcs class nunit24 ilasm tools tests errors docs
|
||||
xbuild_12_SUBDIRS := build class tools/xbuild
|
||||
xbuild_14_SUBDIRS := build class tools/xbuild
|
||||
|
||||
# List of test subdirs that should pass 100%
|
||||
centum_tests := \
|
||||
@@ -87,7 +86,7 @@ dir-check:
|
||||
|
||||
# fun specialty targets
|
||||
|
||||
PROFILES = net_2_0 net_3_5 net_4_0 net_4_5 xbuild_12
|
||||
PROFILES = net_3_5 net_4_0 net_4_5 xbuild_12 xbuild_14
|
||||
|
||||
.PHONY: all-profiles $(STD_TARGETS:=-profiles)
|
||||
all-profiles $(STD_TARGETS:=-profiles): %-profiles: profiles-do--%
|
||||
@@ -106,17 +105,16 @@ profiles-do--run-test:
|
||||
|
||||
# Orchestrate the bootstrap here.
|
||||
_boot_ = all clean install
|
||||
$(_boot_:%=profile-do--xbuild_14--%): profile-do--xbuild_14--%: profile-do--net_4_5--%
|
||||
$(_boot_:%=profile-do--xbuild_12--%): profile-do--xbuild_12--%: profile-do--net_4_5--%
|
||||
$(_boot_:%=profile-do--net_4_5--%): profile-do--net_4_5--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_4_0--%): profile-do--net_4_0--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_3_5--%): profile-do--net_3_5--%: profile-do--net_2_0--%
|
||||
$(_boot_:%=profile-do--monodroid--%): profile-do--monodroid--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--monotouch--%): profile-do--monotouch--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--monotouch_runtime--%): profile-do--monotouch_runtime--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--xammac--%): profile-do--xammac--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--mobile--%): profile-do--mobile--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--mobile_static--%): profile-do--mobile_static--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--net_2_0--%): profile-do--net_2_0--%: profile-do--build--%
|
||||
$(_boot_:%=profile-do--build--%): profile-do--build--%: profile-do--basic--%
|
||||
|
||||
testcorlib:
|
||||
|
||||
+2
-1
@@ -22,7 +22,8 @@ PROFILES = \
|
||||
net_3_5 \
|
||||
net_4_0 \
|
||||
net_4_5 \
|
||||
xbuild_12
|
||||
xbuild_12 \
|
||||
xbuild_14
|
||||
|
||||
COMMON_SRCS = \
|
||||
Consts.cs.in \
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
BOOTSTRAP_PROFILE = build
|
||||
BOOTSTRAP_MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
|
||||
# nuttzing!
|
||||
|
||||
profile-check:
|
||||
@:
|
||||
|
||||
DEFAULT_REFERENCES = -r:mscorlib.dll
|
||||
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
|
||||
|
||||
FRAMEWORK_VERSION = 2.0
|
||||
XBUILD_VERSION = 2.0
|
||||
@@ -1,20 +0,0 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
BOOTSTRAP_PROFILE = build
|
||||
|
||||
MCS = MONO_PATH="$(topdir)/class/lib/$(BOOTSTRAP_PROFILE)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(INTERNAL_GMCS)
|
||||
|
||||
# nuttzing!
|
||||
|
||||
profile-check:
|
||||
@:
|
||||
|
||||
DEFAULT_REFERENCES = -r:mscorlib.dll
|
||||
PROFILE_MCS_FLAGS = -d:NET_1_1 -d:NET_2_0 -d:NET_3_5 -nowarn:1699 -nostdlib -lib:$(topdir)/class/lib/$(PROFILE) -lib:$(topdir)/class/lib/net_2_0 $(DEFAULT_REFERENCES) $(PLATFORM_DEBUG_FLAGS)
|
||||
|
||||
FRAMEWORK_VERSION = 3.5
|
||||
XBUILD_VERSION = 3.5
|
||||
|
||||
TEST_HARNESS = $(topdir)/class/lib/net_2_0/nunit-console.exe
|
||||
TEST_MONO_PATH = $(topdir)/class/lib/net_2_0
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
# -*- makefile -*-
|
||||
|
||||
include $(topdir)/build/profiles/net_4_5.make
|
||||
|
||||
PROFILE_MCS_FLAGS := $(PROFILE_MCS_FLAGS) -d:XBUILD_12 -d:XBUILD_14 -lib:$(topdir)/class/lib/net_4_5
|
||||
|
||||
XBUILD_VERSION = 14.0
|
||||
+2
-3
@@ -33,6 +33,7 @@ net_2_0_dirs := \
|
||||
System.EnterpriseServices \
|
||||
Mono.Data.Tds \
|
||||
System.Data \
|
||||
System.ComponentModel.DataAnnotations \
|
||||
Accessibility \
|
||||
Mono.WebBrowser \
|
||||
System.Runtime.Serialization.Formatters.Soap \
|
||||
@@ -81,7 +82,6 @@ net_2_0_dirs := \
|
||||
System.ServiceModel \
|
||||
System.Web.Extensions \
|
||||
System.Web.Extensions.Design \
|
||||
System.ComponentModel.DataAnnotations \
|
||||
System.Web.DynamicData \
|
||||
System.Web.Mvc2 \
|
||||
Mono.C5 \
|
||||
@@ -231,17 +231,16 @@ xbuild_4_0_dirs := \
|
||||
$(xbuild_2_0_dirs) \
|
||||
Microsoft.Build
|
||||
|
||||
net_2_0_SUBDIRS := $(net_2_0_dirs) $(net_2_0_only_dirs) $(xbuild_2_0_dirs) aot-compiler
|
||||
monodroid_SUBDIRS := $(monodroid_dirs)
|
||||
monotouch_SUBDIRS := $(monotouch_dirs)
|
||||
monotouch_runtime_SUBDIRS := $(monotouch_runtime_dirs)
|
||||
mobile_static_SUBDIRS := $(mobile_static_dirs)
|
||||
mobile_SUBDIRS := $(mobile_dynamic_dirs)
|
||||
xammac_SUBDIRS := $(xammac_dirs)
|
||||
net_3_5_SUBDIRS := $(xbuild_2_0_dirs)
|
||||
net_4_0_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_0_only_dirs) $(xbuild_4_0_dirs)
|
||||
net_4_5_SUBDIRS := $(net_2_0_dirs) $(net_4_0_dirs) $(net_4_5_dirs) $(xbuild_4_0_dirs) aot-compiler
|
||||
xbuild_12_SUBDIRS := $(xbuild_4_0_dirs)
|
||||
xbuild_14_SUBDIRS := $(xbuild_4_0_dirs)
|
||||
|
||||
include ../build/rules.make
|
||||
|
||||
|
||||
@@ -28,9 +28,14 @@
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
|
||||
namespace System.Windows.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// http://msdn.microsoft.com/en-us/library/System.Windows.Forms.Help(v=vs.110).aspx
|
||||
/// </summary>
|
||||
public class Help
|
||||
{
|
||||
#region Constructor
|
||||
@@ -42,7 +47,7 @@ namespace System.Windows.Forms
|
||||
#region Public Static Methods
|
||||
public static void ShowHelp (Control parent, string url)
|
||||
{
|
||||
ShowHelp(parent, url, HelpNavigator.TableOfContents, null);
|
||||
ShowHelp (parent, url, null);
|
||||
}
|
||||
|
||||
public static void ShowHelp (Control parent, string url, HelpNavigator navigator)
|
||||
@@ -57,9 +62,7 @@ namespace System.Windows.Forms
|
||||
|
||||
public static void ShowHelp (Control parent, string url, string keyword)
|
||||
{
|
||||
if (keyword == null || keyword == String.Empty)
|
||||
ShowHelp (parent, url, HelpNavigator.TableOfContents, null);
|
||||
ShowHelp (parent, url, HelpNavigator.Topic, keyword);
|
||||
ShowHelpTopic (url, keyword);
|
||||
}
|
||||
|
||||
public static void ShowHelpIndex (Control parent, string url)
|
||||
@@ -72,5 +75,55 @@ namespace System.Windows.Forms
|
||||
{
|
||||
}
|
||||
#endregion // Public Static Methods
|
||||
|
||||
/// <summary>
|
||||
/// Show a help file and topic using a help viewer
|
||||
/// </summary>
|
||||
/// <param name="helpFile">path to a .chm help file</param>
|
||||
/// <param name="helpTopic">path to a topic in helpFile, or null</param>
|
||||
private static void ShowHelpTopic (string helpFile, string helpTopic)
|
||||
{
|
||||
if (helpFile == null)
|
||||
throw new ArgumentNullException ();
|
||||
if (helpFile == String.Empty)
|
||||
throw new ArgumentException ();
|
||||
|
||||
// Use forward slashes in helpFile path if needed
|
||||
helpFile = helpFile.Replace (@"\", Path.DirectorySeparatorChar.ToString ());
|
||||
|
||||
string helpViewer = Environment.GetEnvironmentVariable ("MONO_HELP_VIEWER") ?? "chmsee";
|
||||
string arguments = String.Format ("\"{0}\"", helpFile);
|
||||
if (!String.IsNullOrEmpty (helpTopic)) {
|
||||
if (!helpTopic.StartsWith ("/"))
|
||||
helpTopic = "/" + helpTopic;
|
||||
helpTopic = helpTopic.TrimEnd (' ');
|
||||
arguments = String.Format ("\"{0}::{1}\"", helpFile, helpTopic);
|
||||
}
|
||||
|
||||
try {
|
||||
RunNonblockingProcess (helpViewer, arguments);
|
||||
} catch (Exception e) {
|
||||
// Don't crash if the help viewer couldn't be launched. There
|
||||
// won't be an exception thrown if the help viewer can't find
|
||||
// the help file; it's up to the help viewer to display such an error.
|
||||
string message = String.Format ("The help viewer could not load. Maybe you don't have {0} installed or haven't set MONO_HELP_VIEWER. The specific error message was: {1}", helpViewer, e.Message);
|
||||
Console.Error.WriteLine (message);
|
||||
MessageBox.Show (message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <remarks>
|
||||
/// throws exception from Process.Start() if there was a problem starting
|
||||
/// </remarks>
|
||||
private static void RunNonblockingProcess (string command, string arguments)
|
||||
{
|
||||
using (Process process = new Process ()) {
|
||||
process.StartInfo.FileName = command;
|
||||
process.StartInfo.Arguments = arguments;
|
||||
process.StartInfo.UseShellExecute = false;
|
||||
|
||||
process.Start ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -492,9 +492,6 @@ namespace System.Windows.Forms
|
||||
r.X += 2;
|
||||
r.Width -= 2;
|
||||
}
|
||||
if ((flags & TextFormatFlags.WordEllipsis) == TextFormatFlags.WordEllipsis || (flags & TextFormatFlags.EndEllipsis) == TextFormatFlags.EndEllipsis || (flags & TextFormatFlags.WordBreak) == TextFormatFlags.WordBreak) {
|
||||
r.Width -= 4;
|
||||
}
|
||||
if ((flags & TextFormatFlags.VerticalCenter) == TextFormatFlags.VerticalCenter && XplatUI.RunningOnUnix) {
|
||||
r.Y -= 1;
|
||||
}
|
||||
|
||||
@@ -369,22 +369,24 @@ namespace System.Windows.Forms
|
||||
Image image = button.Image;
|
||||
string text = button.Text;
|
||||
Rectangle content_rect = button.PaddingClientRectangle;
|
||||
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags | TextFormatFlags.NoPadding, button.UseCompatibleTextRendering);
|
||||
Size text_size = TextRenderer.MeasureTextInternal (g, text, button.Font, content_rect.Size, button.TextFormatFlags, button.UseCompatibleTextRendering);
|
||||
Size image_size = image == null ? Size.Empty : image.Size;
|
||||
|
||||
textRectangle = Rectangle.Inflate (content_rect, -4, -4);
|
||||
imageRectangle = Rectangle.Empty;
|
||||
|
||||
bool displayEllipsis = (button.TextFormatFlags & (TextFormatFlags.EndEllipsis | TextFormatFlags.PathEllipsis | TextFormatFlags.WordEllipsis)) != 0;
|
||||
|
||||
switch (button.TextImageRelation) {
|
||||
case TextImageRelation.Overlay:
|
||||
// Overlay is easy, text always goes here
|
||||
|
||||
// Image is dependent on ImageAlign
|
||||
if (image == null) {
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
|
||||
// Image is dependent on ImageAlign
|
||||
if (image == null)
|
||||
return;
|
||||
}
|
||||
|
||||
int image_x = 0;
|
||||
int image_y = 0;
|
||||
@@ -437,10 +439,10 @@ namespace System.Windows.Forms
|
||||
imageRectangle = new Rectangle (image_x, image_y, image_width, image_height);
|
||||
break;
|
||||
case TextImageRelation.ImageAboveText:
|
||||
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextAboveImage:
|
||||
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, displayEllipsis, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.ImageBeforeText:
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
@@ -449,6 +451,8 @@ namespace System.Windows.Forms
|
||||
LayoutTextBeforeOrAfterImage (textRectangle, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
}
|
||||
if (button.Pressed)
|
||||
textRectangle.Offset (1, 1);
|
||||
}
|
||||
|
||||
private void LayoutTextBeforeOrAfterImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
|
||||
@@ -496,7 +500,7 @@ namespace System.Windows.Forms
|
||||
imageRect = final_image_rect;
|
||||
}
|
||||
|
||||
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, out Rectangle textRect, out Rectangle imageRect)
|
||||
private void LayoutTextAboveOrBelowImage (Rectangle totalArea, bool textFirst, Size textSize, Size imageSize, System.Drawing.ContentAlignment textAlign, System.Drawing.ContentAlignment imageAlign, bool displayEllipsis, out Rectangle textRect, out Rectangle imageRect)
|
||||
{
|
||||
int element_spacing = 0; // Spacing between the Text and the Image
|
||||
int total_height = textSize.Height + element_spacing + imageSize.Height;
|
||||
@@ -545,6 +549,12 @@ namespace System.Windows.Forms
|
||||
final_text_rect.Y = totalArea.Top;
|
||||
}
|
||||
|
||||
if (displayEllipsis) {
|
||||
// Don't use more space than is available otherwise ellipsis won't show
|
||||
if (final_text_rect.Height > totalArea.Bottom)
|
||||
final_text_rect.Height = totalArea.Bottom - final_text_rect.Top;
|
||||
}
|
||||
|
||||
textRect = final_text_rect;
|
||||
imageRect = final_image_rect;
|
||||
}
|
||||
@@ -1092,11 +1102,11 @@ namespace System.Windows.Forms
|
||||
break;
|
||||
case TextImageRelation.ImageAboveText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (content_rect, false, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.TextAboveImage:
|
||||
content_rect.Inflate (-4, -4);
|
||||
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, out textRectangle, out imageRectangle);
|
||||
LayoutTextAboveOrBelowImage (content_rect, true, text_size, image_size, button.TextAlign, button.ImageAlign, false, out textRectangle, out imageRectangle);
|
||||
break;
|
||||
case TextImageRelation.ImageBeforeText:
|
||||
content_rect.Inflate (-4, -4);
|
||||
|
||||
@@ -560,11 +560,8 @@ namespace Microsoft.Build.BuildEngine {
|
||||
get {
|
||||
// This is used as the fall back version if the
|
||||
// project can't find a version to use
|
||||
// Hard-coded to 2.0, so it allows even vs2005 projects
|
||||
// to build correctly, as they won't have a ToolsVersion
|
||||
// set!
|
||||
return String.IsNullOrEmpty (defaultToolsVersion)
|
||||
? "2.0"
|
||||
? "4.0"
|
||||
: defaultToolsVersion;
|
||||
}
|
||||
set {
|
||||
|
||||
@@ -39,7 +39,9 @@ public static class Consts {
|
||||
public static string BinPath {
|
||||
get {
|
||||
if (RunningOnMono ()) {
|
||||
#if XBUILD_12
|
||||
#if XBUILD_14
|
||||
string profile = "xbuild_14";
|
||||
#elif XBUILD_12
|
||||
string profile = "xbuild_12";
|
||||
#elif NET_4_5
|
||||
string profile = "net_4_5";
|
||||
@@ -54,7 +56,9 @@ public static class Consts {
|
||||
var lib = Path.GetDirectoryName (Path.GetDirectoryName (corlib));
|
||||
return Path.Combine (lib, profile);
|
||||
} else {
|
||||
#if XBUILD_12
|
||||
#if XBUILD_14
|
||||
return ToolLocationHelper.GetPathToBuildTools ("14.0");
|
||||
#elif XBUILD_12
|
||||
return ToolLocationHelper.GetPathToBuildTools ("12.0");
|
||||
#elif NET_4_5
|
||||
return ToolLocationHelper.GetPathToDotNetFramework (TargetDotNetFrameworkVersion.Version45);
|
||||
@@ -71,7 +75,9 @@ public static class Consts {
|
||||
|
||||
public static string ToolsVersionString {
|
||||
get {
|
||||
#if XBUILD_12
|
||||
#if XBUILD_14
|
||||
return " ToolsVersion='14.0'";
|
||||
#elif XBUILD_12
|
||||
return " ToolsVersion='12.0'";
|
||||
#elif NET_4_0
|
||||
return " ToolsVersion='4.0'";
|
||||
@@ -85,7 +91,9 @@ public static class Consts {
|
||||
|
||||
public static string GetTasksAsmPath ()
|
||||
{
|
||||
#if XBUILD_12
|
||||
#if XBUILD_14
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.Core.dll");
|
||||
#elif XBUILD_12
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v12.0.dll");
|
||||
#elif NET_4_0
|
||||
return Path.Combine (BinPath, "Microsoft.Build.Tasks.v4.0.dll");
|
||||
|
||||
+6
-1
@@ -53,8 +53,13 @@ namespace Microsoft.Build.Utilities
|
||||
#if XBUILD_12
|
||||
Version451,
|
||||
#endif
|
||||
#if XBUILD_14
|
||||
Version453,
|
||||
#endif
|
||||
|
||||
#if XBUILD_12
|
||||
#if XBUILD_14
|
||||
VersionLatest = Version453
|
||||
#elif XBUILD_12
|
||||
VersionLatest = Version451
|
||||
#elif NET_4_5
|
||||
VersionLatest = Version45
|
||||
|
||||
+11
-2
@@ -233,11 +233,20 @@ namespace Microsoft.Build.Utilities
|
||||
|
||||
public static string GetPathToBuildTools (string toolsVersion)
|
||||
{
|
||||
if (toolsVersion != "12.0")
|
||||
string path;
|
||||
switch (toolsVersion) {
|
||||
case "12.0":
|
||||
path = "xbuild_12";
|
||||
break;
|
||||
case "14.0":
|
||||
path = "xbuild_14";
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
if (Environment.GetEnvironmentVariable ("TESTING_MONO") != null)
|
||||
return Path.Combine (lib_mono_dir, "xbuild_12");
|
||||
return Path.Combine (lib_mono_dir, path);
|
||||
|
||||
if (runningOnDotNet) {
|
||||
//see http://msdn.microsoft.com/en-us/library/vstudio/bb397428(v=vs.120).aspx
|
||||
|
||||
@@ -263,6 +263,9 @@ namespace Microsoft.Build.Evaluation
|
||||
#endif
|
||||
#if XBUILD_12
|
||||
AddToolset (new Toolset ("12.0", ToolLocationHelper.GetPathToBuildTools ("12.0"), this, null));
|
||||
#endif
|
||||
#if XBUILD_14
|
||||
AddToolset (new Toolset ("14.0", ToolLocationHelper.GetPathToBuildTools ("14.0"), this, null));
|
||||
#endif
|
||||
default_tools_version = toolsets.First ().ToolsVersion;
|
||||
}
|
||||
|
||||
@@ -146,6 +146,15 @@ namespace MonoTests.EvaluatorTest
|
||||
Assert.IsTrue (Evaluator.Run ("x();"), "#2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CapturedLocalVariable ()
|
||||
{
|
||||
Evaluator.Run ("using System;");
|
||||
|
||||
var res = Evaluator.Evaluate("var x = 123; Action a = () => x++; a(); x;");
|
||||
Assert.AreEqual (124, res);
|
||||
}
|
||||
|
||||
#if NET_4_0
|
||||
[Test]
|
||||
public void DynamicStatement ()
|
||||
|
||||
@@ -104,7 +104,15 @@ namespace MonoTests.EvaluatorTest
|
||||
{
|
||||
Evaluator.Run ("class A { class B { } }");
|
||||
Evaluator.Run ("var x = new A ();");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void DelegateType ()
|
||||
{
|
||||
Evaluator.Run ("public delegate int D();");
|
||||
Evaluator.Run ("D d = delegate () { return 7; };");
|
||||
object res = Evaluator.Evaluate ("d();");
|
||||
Assert.AreEqual (7, res);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,4 @@ LIB_MCS_FLAGS = /r:$(corlib) -keyfile:$(LIBRARY_SNK) -r:System.Core.dll -d:NET_3
|
||||
|
||||
NO_TEST = yes
|
||||
|
||||
ifneq (net_2_0, $(PROFILE))
|
||||
NO_INSTALL = yes
|
||||
endif
|
||||
|
||||
include ../../build/library.make
|
||||
@@ -195,6 +195,11 @@ namespace Mono.Unix.Native {
|
||||
return FromTimeT (time);
|
||||
}
|
||||
|
||||
public static DateTime ToDateTime (long time, long nanoTime)
|
||||
{
|
||||
return FromTimeT (time).AddMilliseconds (nanoTime / 1000);
|
||||
}
|
||||
|
||||
public static long FromDateTime (DateTime time)
|
||||
{
|
||||
return ToTimeT (time);
|
||||
|
||||
@@ -192,7 +192,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastAccessTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_atime, stat.st_atime_nsec);}
|
||||
}
|
||||
|
||||
public DateTime LastAccessTimeUtc {
|
||||
@@ -200,7 +200,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastWriteTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_mtime, stat.st_mtime_nsec);}
|
||||
}
|
||||
|
||||
public DateTime LastWriteTimeUtc {
|
||||
@@ -208,7 +208,7 @@ namespace Mono.Unix {
|
||||
}
|
||||
|
||||
public DateTime LastStatusChangeTime {
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime);}
|
||||
get {AssertValid (); return Native.NativeConvert.ToDateTime (stat.st_ctime, stat.st_ctime_nsec);}
|
||||
}
|
||||
|
||||
public DateTime LastStatusChangeTimeUtc {
|
||||
|
||||
@@ -26,7 +26,7 @@ using System;
|
||||
using System.Collections;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Net;
|
||||
|
||||
using Mono.Security.Protocol.Tls.Handshake;
|
||||
|
||||
namespace Mono.Security.Protocol.Tls
|
||||
@@ -683,9 +683,6 @@ namespace Mono.Security.Protocol.Tls
|
||||
|
||||
public void SendAlert(Alert alert)
|
||||
{
|
||||
if (ServicePointManager.Mono_Suppress_TLS_Alerts)
|
||||
return;
|
||||
|
||||
AlertLevel level;
|
||||
AlertDescription description;
|
||||
bool close;
|
||||
|
||||
@@ -428,8 +428,7 @@ namespace Mono.Security.Protocol.Tls
|
||||
private void NegotiateAsyncWorker (IAsyncResult result)
|
||||
{
|
||||
NegotiateAsyncResult negotiate = result.AsyncState as NegotiateAsyncResult;
|
||||
var state = negotiate.State;
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
switch (negotiate.State)
|
||||
@@ -590,23 +589,12 @@ namespace Mono.Security.Protocol.Tls
|
||||
catch (TlsException ex)
|
||||
{
|
||||
// FIXME: should the send alert also be done asynchronously here and below?
|
||||
Console.WriteLine ("TlsException when handling state {1}: {0}", ex, state);
|
||||
try {
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
} catch (Exception ex2) {
|
||||
Console.WriteLine ("TLS: Send Alert raised an exception: {0}", ex2);
|
||||
}
|
||||
|
||||
this.protocol.SendAlert(ex.Alert);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine ("General Exception: {0} when handling state {1}", ex, state);
|
||||
try {
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
} catch (Exception ex2) {
|
||||
Console.WriteLine ("TLS: Send Alert raised an exception: {0}", ex2);
|
||||
}
|
||||
this.protocol.SendAlert(AlertDescription.InternalError);
|
||||
negotiate.SetComplete (new IOException("The authentication or decryption has failed.", ex));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ NO_TEST = yes
|
||||
|
||||
|
||||
# This is a .NET 2.0+ only assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-Mono.Simd.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -72,3 +72,22 @@ csproj-local:
|
||||
$(MAKE) csproj-local intermediate=plaincore/
|
||||
endif
|
||||
endif
|
||||
|
||||
#
|
||||
# Android TimeZoneInfo testing....
|
||||
#
|
||||
|
||||
tzi.exe: ../corlib/System/AndroidPlatform.cs $(wildcard System/TimeZone*.cs) ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
mcs /debug+ /out:$@ /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" $^
|
||||
|
||||
android-pull-tzdb:
|
||||
mkdir -p android/tzdb/usr/share/zoneinfo
|
||||
mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
|
||||
android_root=`adb shell echo '$$ANDROID_ROOT' | tr -d "\r"` ; \
|
||||
android_data=`adb shell echo '$$ANDROID_DATA' | tr -d "\r"` ; \
|
||||
adb $(ADB_TARGET) pull $$android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo ; \
|
||||
adb $(ADB_TARGET) pull $$android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
|
||||
mkdir -p android/tzdb/
|
||||
|
||||
android-dump-tzdata: tzi.exe android-pull-tzdb
|
||||
__XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
|
||||
@@ -246,6 +246,7 @@ namespace System {
|
||||
tzdataPath, offset, length, r, buffer.Length));
|
||||
}
|
||||
|
||||
TimeZoneInfo.DumpTimeZoneDataToFile (id, buffer);
|
||||
return buffer;
|
||||
}
|
||||
}
|
||||
@@ -581,21 +582,37 @@ namespace System {
|
||||
* Compile:
|
||||
* mcs /debug+ /out:tzi.exe /unsafe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" ../corlib/System/AndroidPlatform.cs System/TimeZone*.cs ../../build/common/Consts.cs ../Mono.Options/Mono.Options/Options.cs
|
||||
* Prep:
|
||||
* mkdir -p usr/share/zoneinfo
|
||||
* mkdir -p misc/zoneinfo/zoneinfo
|
||||
* mkdir -p android/tzdb/usr/share/zoneinfo
|
||||
* mkdir -p android/tzdb/misc/zoneinfo/zoneinfo
|
||||
* android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
|
||||
* android_data=`adb shell echo '$ANDROID_DATA' | tr -d "\r"`
|
||||
* adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
|
||||
* adb pull $android_data/misc/zoneinfo/tzdata misc/zoneinfo
|
||||
* adb pull $android_root/usr/share/zoneinfo android/tzdb/usr/share/zoneinfo
|
||||
* adb pull $android_data/misc/zoneinfo/tzdata android/tzdb/misc/zoneinfo
|
||||
* Run:
|
||||
* # Dump all timezone names
|
||||
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe --offset=1969-01-01
|
||||
*
|
||||
* # Dump TimeZone data to files under path `tzdata`
|
||||
* __XA_OVERRIDE_TIMEZONE_ID__=America/New_York ANDROID_ROOT=`pwd` ANDROID_DATA=`pwd` mono --debug tzi.exe -o android/tzdata
|
||||
*
|
||||
* # Dump TimeZone rules for specific timezone data (as dumped above)
|
||||
* mono tzi.exe --offset=2012-10-24 -i=tzdata/Asia/Amman
|
||||
*/
|
||||
static void Main (string[] args)
|
||||
{
|
||||
DateTime? offset = null;
|
||||
Func<IAndroidTimeZoneDB> c = () => GetDefaultTimeZoneDB ();
|
||||
bool dump_rules = false;
|
||||
Mono.Options.OptionSet p = null;
|
||||
p = new Mono.Options.OptionSet () {
|
||||
{ "i=",
|
||||
"TimeZone data {FILE} to parse and dump",
|
||||
v => DumpTimeZoneFile (v, offset)
|
||||
},
|
||||
{ "o=",
|
||||
"Write TimeZone data files to {PATH}",
|
||||
v => TimeZoneInfo.TimeZoneDataExportPath = v
|
||||
},
|
||||
{ "T=", "Create AndroidTzData from {PATH}.", v => {
|
||||
c = () => new AndroidTzData (v);
|
||||
} },
|
||||
@@ -606,6 +623,9 @@ namespace System {
|
||||
offset = DateTime.Parse (v);
|
||||
Console.WriteLine ("Using DateTime Offset: {0}", offset);
|
||||
} },
|
||||
{ "R|dump-rules",
|
||||
"Show timezone info offset for DateTime {OFFSET}.",
|
||||
v => dump_rules = v != null },
|
||||
{ "help", "Show this message and exit", v => {
|
||||
p.WriteOptionDescriptions (Console.Out);
|
||||
Environment.Exit (0);
|
||||
@@ -623,6 +643,9 @@ namespace System {
|
||||
if (offset.HasValue) {
|
||||
Console.Write ("From Offset: {0}", zone.GetUtcOffset (offset.Value));
|
||||
}
|
||||
if (dump_rules) {
|
||||
WriteZoneRules (zone);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Console.Write (" ERROR:null");
|
||||
@@ -634,6 +657,53 @@ namespace System {
|
||||
Console.WriteLine ();
|
||||
}
|
||||
}
|
||||
|
||||
static void WriteZoneRules (TimeZoneInfo zone)
|
||||
{
|
||||
var rules = zone.GetAdjustmentRules ();
|
||||
for (int i = 0; i < rules.Length; ++i) {
|
||||
var rule = rules [i];
|
||||
Console.WriteLine ();
|
||||
Console.Write ("\tAdjustmentRules[{0,3}]: DaylightDelta={1}; DateStart={2:yyyy-MM}; DateEnd={3:yyyy-MM}; DaylightTransitionStart={4:D2}-{5:D2}T{6}; DaylightTransitionEnd={7:D2}-{8:D2}T{9}",
|
||||
i,
|
||||
rule.DaylightDelta,
|
||||
rule.DateStart, rule.DateEnd,
|
||||
rule.DaylightTransitionStart.Month, rule.DaylightTransitionStart.Day, rule.DaylightTransitionStart.TimeOfDay.TimeOfDay,
|
||||
rule.DaylightTransitionEnd.Month, rule.DaylightTransitionEnd.Day, rule.DaylightTransitionEnd.TimeOfDay.TimeOfDay);
|
||||
}
|
||||
}
|
||||
|
||||
static void DumpTimeZoneFile (string path, DateTime? time)
|
||||
{
|
||||
var buffer = File.ReadAllBytes (path);
|
||||
var zone = ParseTZBuffer (path, buffer, buffer.Length);
|
||||
Console.Write ("Rules for: {0}", path);
|
||||
WriteZoneRules (zone);
|
||||
Console.WriteLine ();
|
||||
if (time.HasValue) {
|
||||
var offset = zone.GetUtcOffset (time.Value);
|
||||
var isDst = zone.IsDaylightSavingTime (time.Value);
|
||||
Console.WriteLine ("\tDate({0}): Offset({1}) IsDST({2})", time.Value, offset, isDst);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if SELF_TEST
|
||||
static string TimeZoneDataExportPath;
|
||||
#endif
|
||||
|
||||
internal static void DumpTimeZoneDataToFile (string id, byte[] buffer)
|
||||
{
|
||||
#if SELF_TEST
|
||||
int p = id.LastIndexOf ('/');
|
||||
var o = Path.Combine (TimeZoneDataExportPath,
|
||||
p >= 0 ? id.Substring (0, p) : id);
|
||||
if (p >= 0)
|
||||
o = Path.Combine (o, id.Substring (p+1));
|
||||
Directory.CreateDirectory (Path.GetDirectoryName (o));
|
||||
using (var f = File.OpenWrite (o))
|
||||
f.Write (buffer, 0, buffer.Length);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1179,9 +1179,9 @@ namespace System
|
||||
DateTime ttime = pair.Key;
|
||||
TimeType ttype = pair.Value;
|
||||
if (!ttype.IsDst) {
|
||||
if (standardDisplayName != ttype.Name || baseUtcOffset.TotalSeconds != ttype.Offset) {
|
||||
if (standardDisplayName != ttype.Name)
|
||||
standardDisplayName = ttype.Name;
|
||||
daylightDisplayName = null;
|
||||
if (baseUtcOffset.TotalSeconds != ttype.Offset) {
|
||||
baseUtcOffset = new TimeSpan (0, 0, ttype.Offset);
|
||||
if (adjustmentRules.Count > 0) // We ignore AdjustmentRules but store transitions.
|
||||
storeTransition = true;
|
||||
@@ -1217,10 +1217,11 @@ namespace System
|
||||
}
|
||||
dst_observed = false;
|
||||
} else {
|
||||
if (daylightDisplayName != ttype.Name || dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds) {
|
||||
if (daylightDisplayName != ttype.Name)
|
||||
daylightDisplayName = ttype.Name;
|
||||
if (dstDelta.TotalSeconds != ttype.Offset - baseUtcOffset.TotalSeconds)
|
||||
dstDelta = new TimeSpan(0, 0, ttype.Offset) - baseUtcOffset;
|
||||
}
|
||||
|
||||
dst_start = ttime;
|
||||
dst_observed = true;
|
||||
}
|
||||
|
||||
@@ -12,17 +12,12 @@ LIB_MCS_FLAGS = \
|
||||
/resource:./src/DbLinq/Schema/Dbml/DbmlSchema.xsd,DbLinq.Schema.Dbml.DbmlSchema.xsd \
|
||||
/d:MONO_STRICT /d:MONO_DEPLOY -warn:1
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5 -nowarn:1720
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES = src/DbLinq/Schema/Dbml/DbmlSchema.xsd
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Data.Linq.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -43,6 +43,7 @@ namespace System.Data.Common {
|
||||
readonly IDataReader reader;
|
||||
readonly bool closeReader;
|
||||
readonly SchemaInfo [] schema;
|
||||
readonly object [] values;
|
||||
|
||||
#endregion // Fields
|
||||
|
||||
@@ -57,6 +58,7 @@ namespace System.Data.Common {
|
||||
{
|
||||
this.reader = reader;
|
||||
this.closeReader = closeReader;
|
||||
this.values = new object [reader.FieldCount];
|
||||
this.schema = LoadSchema (reader);
|
||||
}
|
||||
|
||||
@@ -65,13 +67,8 @@ namespace System.Data.Common {
|
||||
#region Properties
|
||||
|
||||
public object Current {
|
||||
get {
|
||||
// DbDataRecordImpl does not do copy of the array
|
||||
// and MoveNext would overwrite any previously filled data
|
||||
var values = new object [reader.FieldCount];
|
||||
get {
|
||||
reader.GetValues (values);
|
||||
|
||||
// TODO: Should not allocate on every property call
|
||||
return new DbDataRecordImpl (schema, values);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.IdentityModel.Selectors.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -26,7 +26,7 @@ EXTRA_DISTFILES = \
|
||||
Test/Resources/test.pfx \
|
||||
Test/Resources/test2.pfx
|
||||
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.IdentityModel.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -50,6 +50,7 @@
|
||||
<Compile Include="Assembly\AssemblyInfo.cs" />
|
||||
<Compile Include="System.IdentityModel\CookieTransform.cs" />
|
||||
<Compile Include="System.IdentityModel\OpenObject.cs" />
|
||||
<Compile Include="System.IdentityModel\SignatureVerificationFailedException.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\Claim.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\ClaimSet.cs" />
|
||||
<Compile Include="System.IdentityModel.Claims\ClaimTypes.cs" />
|
||||
@@ -147,9 +148,12 @@
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityToken.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenDescriptor.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenExpiredException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandler.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerCollection.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenHandlerConfiguration.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenNotYetValidException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenReplayDetectedException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenTypes.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SecurityTokenValidationException.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\SessionSecurityToken.cs" />
|
||||
@@ -170,7 +174,8 @@
|
||||
<Compile Include="System.IdentityModel.Tokens\X509SubjectKeyIdentifierClause.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\X509ThumbprintKeyIdentifierClause.cs" />
|
||||
<Compile Include="System.IdentityModel.Tokens\X509WindowsSecurityToken.cs" />
|
||||
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />␍ <Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
|
||||
<Compile Include="System.Security.Claims\AuthenticationTypes.cs" />
|
||||
<Compile Include="System.ServiceModel.Security\X509CertificateValidationMode.cs" />
|
||||
</ItemGroup>
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
@@ -180,18 +185,18 @@
|
||||
</Target>
|
||||
-->
|
||||
<PropertyGroup>
|
||||
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PreBuildEvent>
|
||||
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
<PostBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
@@ -236,4 +241,4 @@
|
||||
<Folder Include="Properties\" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// SecurityTokenExpiredException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenExpiredException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenExpiredException()
|
||||
: base("ID4181: The security token has expired.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenExpiredException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// SecurityTokenNotYetValidException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenNotYetValidException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenNotYetValidException()
|
||||
: base("ID4182: The security token is not valid yet.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenNotYetValidException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// SecurityTokenReplayDetectedException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel.Tokens
|
||||
{
|
||||
public class SecurityTokenReplayDetectedException : SecurityTokenValidationException
|
||||
{
|
||||
public SecurityTokenReplayDetectedException()
|
||||
: base("ID1070: Replay has been detected for a SecurityToken.")
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SecurityTokenReplayDetectedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -3,6 +3,7 @@
|
||||
Assembly/AssemblyInfo.cs
|
||||
System.IdentityModel/CookieTransform.cs
|
||||
System.IdentityModel/OpenObject.cs
|
||||
System.IdentityModel/SignatureVerificationFailedException.cs
|
||||
System.IdentityModel.Claims/Claim.cs
|
||||
System.IdentityModel.Claims/ClaimSet.cs
|
||||
System.IdentityModel.Claims/ClaimTypes.cs
|
||||
@@ -100,9 +101,12 @@ System.IdentityModel.Tokens/SecurityKeyUsage.cs
|
||||
System.IdentityModel.Tokens/SecurityToken.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenDescriptor.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenExpiredException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandler.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandlerCollection.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenHandlerConfiguration.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenNotYetValidException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenReplayDetectedException.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenTypes.cs
|
||||
System.IdentityModel.Tokens/SecurityTokenValidationException.cs
|
||||
System.IdentityModel.Tokens/SessionSecurityToken.cs
|
||||
@@ -124,4 +128,4 @@ System.IdentityModel.Tokens/X509SubjectKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/X509ThumbprintKeyIdentifierClause.cs
|
||||
System.IdentityModel.Tokens/X509WindowsSecurityToken.cs
|
||||
System.Security.Claims/AuthenticationTypes.cs
|
||||
System.ServiceModel.Security/X509CertificateValidationMode.cs
|
||||
System.ServiceModel.Security/X509CertificateValidationMode.cs
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
//
|
||||
// SignatureVerificationFailedException.cs
|
||||
//
|
||||
// Author:
|
||||
// Noesis Labs ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Noesis Labs, LLC https://noesislabs.com
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IdentityModel
|
||||
{
|
||||
public class SignatureVerificationFailedException : Exception
|
||||
{
|
||||
public SignatureVerificationFailedException()
|
||||
: base("ID4038: Signature verification failed.")
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(string message)
|
||||
: base(message)
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{ }
|
||||
|
||||
public SignatureVerificationFailedException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{ }
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -12,7 +12,7 @@ LOCAL_MCS_FLAGS = -lib:$(secxml_libdir) -lib:$(bare_libdir)
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -nowarn:168,169,183,219,414,1595
|
||||
|
||||
VALID_PROFILE := $(filter net_1_1 net_2_0 moonlight_raw net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter moonlight_raw net_4_0 net_4_5, $(PROFILE))
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
Test/System.Security.Cryptography.Xml/sample.pfx \
|
||||
|
||||
@@ -637,7 +637,7 @@ namespace Mono.Xml {
|
||||
else if (n2 == null)
|
||||
return 1;
|
||||
else if (n1.Prefix == n2.Prefix)
|
||||
return string.Compare (n1.LocalName, n2.LocalName);
|
||||
return string.CompareOrdinal (n1.LocalName, n2.LocalName);
|
||||
|
||||
// Attributes in the default namespace are first
|
||||
// because the default namespace is not applied to
|
||||
|
||||
@@ -213,6 +213,87 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
Assert.IsTrue (vrfy.CheckSignature (), "RSA-Compute/Verify");
|
||||
}
|
||||
|
||||
// The same as MSDNSample(), but adding a few attributes
|
||||
public SignedXml MSDNSampleMixedCaseAttributes ()
|
||||
{
|
||||
// Create example data to sign.
|
||||
XmlDocument document = new XmlDocument ();
|
||||
XmlNode node = document.CreateNode (XmlNodeType.Element, "", "MyElement", "samples");
|
||||
node.InnerText = "This is some text";
|
||||
XmlAttribute a1 = document.CreateAttribute ("Aa");
|
||||
XmlAttribute a2 = document.CreateAttribute ("Bb");
|
||||
XmlAttribute a3 = document.CreateAttribute ("aa");
|
||||
XmlAttribute a4 = document.CreateAttribute ("bb");
|
||||
a1.Value = "one";
|
||||
a2.Value = "two";
|
||||
a3.Value = "three";
|
||||
a4.Value = "four";
|
||||
node.Attributes.Append (a1);
|
||||
node.Attributes.Append (a2);
|
||||
node.Attributes.Append (a3);
|
||||
node.Attributes.Append (a4);
|
||||
document.AppendChild (node);
|
||||
|
||||
// Create the SignedXml message.
|
||||
SignedXml signedXml = new SignedXml ();
|
||||
|
||||
// Create a data object to hold the data to sign.
|
||||
DataObject dataObject = new DataObject ();
|
||||
dataObject.Data = document.ChildNodes;
|
||||
dataObject.Id = "MyObjectId";
|
||||
|
||||
// Add the data object to the signature.
|
||||
signedXml.AddObject (dataObject);
|
||||
|
||||
// Create a reference to be able to package everything into the
|
||||
// message.
|
||||
Reference reference = new Reference ();
|
||||
reference.Uri = "#MyObjectId";
|
||||
|
||||
// Add it to the message.
|
||||
signedXml.AddReference (reference);
|
||||
|
||||
return signedXml;
|
||||
}
|
||||
|
||||
public string AsymmetricRSAMixedCaseAttributes ()
|
||||
{
|
||||
SignedXml signedXml = MSDNSampleMixedCaseAttributes ();
|
||||
|
||||
RSA key = RSA.Create ();
|
||||
signedXml.SigningKey = key;
|
||||
|
||||
// Add a KeyInfo.
|
||||
KeyInfo keyInfo = new KeyInfo ();
|
||||
keyInfo.AddClause (new RSAKeyValue (key));
|
||||
signedXml.KeyInfo = keyInfo;
|
||||
|
||||
// Compute the signature.
|
||||
signedXml.ComputeSignature ();
|
||||
|
||||
// Get the XML representation of the signature.
|
||||
XmlElement xmlSignature = signedXml.GetXml ();
|
||||
|
||||
StringWriter sw = new StringWriter ();
|
||||
XmlWriter w = new XmlTextWriter (sw);
|
||||
xmlSignature.WriteTo (w);
|
||||
return sw.ToString ();
|
||||
}
|
||||
|
||||
// Example output from Windows for AsymmetricRSAMixedCaseAttributes()
|
||||
private const string AsymmetricRSAMixedCaseAttributesResult = "<Signature xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><SignedInfo><CanonicalizationMethod Algorithm=\"http://www.w3.org/TR/2001/REC-xml-c14n-20010315\" /><SignatureMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#rsa-sha1\" /><Reference URI=\"#MyObjectId\"><DigestMethod Algorithm=\"http://www.w3.org/2000/09/xmldsig#sha1\" /><DigestValue>0j1xLsePFtuRHfXEnVdTSLWtAm4=</DigestValue></Reference></SignedInfo><SignatureValue>hmrEBgns5Xx14aDhzqOyIh0qLNMUldtW8+fNPcvtD/2KtEhNZQGctnhs90CRa1NZ08TqzW2pUaEwmqvMAtF4v8KtWzC/zTuc1jH6nxQvQSQo0ABhuXdu7/hknZkXJ4yKBbdgbKjAsKfULwbWrP/PacLPoYfCO+wXSrt+wLMTTWU=</SignatureValue><KeyInfo><KeyValue><RSAKeyValue><Modulus>4h/rHDr54r6SZWk2IPCeHX7N+wR1za0VBLshuS6tq3RSWap4PY2BM8VdbKH2T9RzyZoiHufjng+1seUx430iMsXisOLUkPP+yGtMQOSZ3CQHAa+IYA+fplXipixI0rV1J1wJNXQm3HxXQqKWpIv5fkwBtj8o2k6CWMgPNgFCnxc=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue></KeyInfo><Object Id=\"MyObjectId\"><MyElement Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\" xmlns=\"samples\">This is some text</MyElement></Object></Signature>";
|
||||
|
||||
[Test]
|
||||
public void AsymmetricRSAMixedCaseAttributesVerifyWindows ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
doc.LoadXml (AsymmetricRSAMixedCaseAttributesResult);
|
||||
|
||||
SignedXml v1 = new SignedXml ();
|
||||
v1.LoadXml (doc.DocumentElement);
|
||||
Assert.IsTrue (v1.CheckSignature ());
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void AsymmetricDSASignature ()
|
||||
{
|
||||
|
||||
+13
@@ -494,6 +494,19 @@ namespace MonoTests.System.Security.Cryptography.Xml {
|
||||
Assert.AreEqual (new StreamReader (s, Encoding.UTF8).ReadToEnd (), expected);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void OrdinalSortForAttributes ()
|
||||
{
|
||||
XmlDocument doc = new XmlDocument ();
|
||||
string xml = "<foo Aa=\"one\" Bb=\"two\" aa=\"three\" bb=\"four\"><bar></bar></foo>";
|
||||
doc.LoadXml (xml);
|
||||
|
||||
transform.LoadInput (doc);
|
||||
Stream s = (Stream) transform.GetOutput ();
|
||||
string output = Stream2String (s);
|
||||
Assert.AreEqual (xml, output);
|
||||
}
|
||||
|
||||
#if NET_2_0
|
||||
[Test]
|
||||
public void PrefixlessNamespaceOutput ()
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace MonoTests.System.ServiceModel.Dispatcher
|
||||
};
|
||||
|
||||
client.GetDataAsync ();
|
||||
if (!wait.WaitOne (TimeSpan.FromSeconds (10)))
|
||||
if (!wait.WaitOne (TimeSpan.FromSeconds (20)))
|
||||
Assert.Fail ("timeout");
|
||||
} finally {
|
||||
serviceHost.Close ();
|
||||
|
||||
@@ -8,17 +8,12 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Core.dll \
|
||||
/r:System.Web.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5
|
||||
endif
|
||||
|
||||
TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.Abstractions.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -183,10 +183,9 @@ namespace System.Web
|
||||
return w.GetSection (sectionName);
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
public override object GetService (Type serviceType)
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
return ((IServiceProvider)w).GetService (serviceType);
|
||||
}
|
||||
#if NET_4_0
|
||||
public override void RemapHandler (IHttpHandler handler)
|
||||
|
||||
@@ -138,7 +138,10 @@ namespace System.Web
|
||||
|
||||
#if NET_4_5
|
||||
public virtual ReadEntityBodyMode ReadEntityBodyMode { get { NotImplemented(); return ReadEntityBodyMode.Classic; } }
|
||||
|
||||
public virtual UnvalidatedRequestValuesBase Unvalidated { get { NotImplemented (); return null; } }
|
||||
#endif
|
||||
|
||||
public virtual Uri Url { get { NotImplemented (); return null; } }
|
||||
|
||||
public virtual Uri UrlReferrer { get { NotImplemented (); return null; } }
|
||||
|
||||
@@ -208,6 +208,18 @@ namespace System.Web
|
||||
get { return w.TotalBytes; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override UnvalidatedRequestValuesBase Unvalidated {
|
||||
get { return new UnvalidatedRequestValuesWrapper (w.Unvalidated); }
|
||||
}
|
||||
#endif
|
||||
|
||||
#if NET_4_5
|
||||
public override ReadEntityBodyMode ReadEntityBodyMode {
|
||||
get { return ReadEntityBodyMode.Classic; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override Uri Url {
|
||||
get { return w.Url; }
|
||||
}
|
||||
|
||||
@@ -39,6 +39,7 @@ using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web.Caching;
|
||||
using System.Threading;
|
||||
|
||||
#if NET_4_0
|
||||
using System.Web.Routing;
|
||||
@@ -69,6 +70,10 @@ namespace System.Web
|
||||
|
||||
public virtual string Charset { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
#if NET_4_5
|
||||
public virtual CancellationToken ClientDisconnectedToken { get { NotImplemented (); return CancellationToken.None; } }
|
||||
#endif
|
||||
|
||||
public virtual Encoding ContentEncoding { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
public virtual string ContentType { get { NotImplemented (); return null; } set { NotImplemented (); } }
|
||||
|
||||
@@ -39,6 +39,7 @@ using System.Security.Permissions;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using System.Web.Caching;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
@@ -82,6 +83,12 @@ namespace System.Web
|
||||
set { w.Charset = value; }
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public override CancellationToken ClientDisconnectedToken {
|
||||
get { return CancellationToken.None; }
|
||||
}
|
||||
#endif
|
||||
|
||||
public override Encoding ContentEncoding {
|
||||
get { return w.ContentEncoding; }
|
||||
set { w.ContentEncoding = value; }
|
||||
|
||||
@@ -15,11 +15,6 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Web.Abstractions.dll \
|
||||
/r:System.Web.Routing.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5
|
||||
endif
|
||||
|
||||
ifeq (4, $(FRAMEWORK_VERSION_MAJOR))
|
||||
LIB_MCS_FLAGS += -r:System.Web.ApplicationServices.dll
|
||||
endif
|
||||
@@ -186,7 +181,7 @@ endif
|
||||
EXTRA_DISTFILES = $(foreach resource,$(TEST_RESOURCE_FILES), $(shell echo $(subst \`,\\\`,$(resource)) | cut -d ',' -f 1))
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.DynamicData.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
+5
-1
@@ -204,7 +204,11 @@ namespace System.Web.Script.Serialization
|
||||
}
|
||||
|
||||
public object Deserialize (string input, Type targetType) {
|
||||
return DeserializeObjectInternal (input);
|
||||
object obj = DeserializeObjectInternal (input);
|
||||
|
||||
if (obj == null) return null;
|
||||
|
||||
return ConvertToType (obj, targetType);
|
||||
}
|
||||
|
||||
static object Evaluate (object value) {
|
||||
|
||||
+16
@@ -415,6 +415,22 @@ namespace MonoTests.System.Web.Script.Serialization
|
||||
//object oo = ser.DeserializeObject ("{value:'Purple\\r \\n monkey\\'s:\\tdishwasher'}");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeNonGenericOverload()
|
||||
{
|
||||
JavaScriptSerializer ser = new JavaScriptSerializer();
|
||||
Assert.IsNull(ser.Deserialize("", typeof(X)));
|
||||
|
||||
X s = new X();
|
||||
s.Init();
|
||||
string x = ser.Serialize(s);
|
||||
|
||||
Assert.AreEqual("{\"z\":8,\"ch\":\"v\",\"ch_null\":null,\"str\":\"vwF59g\",\"b\":253,\"sb\":-48,\"sh\":-32740,\"ush\":65511,\"i\":-234235453,\"ui\":4294733061,\"l\":-9223372036854775780,\"ul\":18446744073709551612,\"f\":NaN,\"f1\":-Infinity,\"f2\":Infinity,\"f3\":-3.40282347E+38,\"f4\":3.40282347E+38,\"d\":NaN,\"d1\":-Infinity,\"d2\":Infinity,\"d3\":-1.7976931348623157E+308,\"d4\":1.7976931348623157E+308,\"de\":-1,\"de1\":0,\"de2\":1,\"de3\":-79228162514264337593543950335,\"de4\":79228162514264337593543950335,\"g\":\"000000ea-0002-0162-0102-030405060708\",\"nb\":null,\"dbn\":null,\"uri\":\"http://kostat@mainsoft/adfasdf/asdfasdf.aspx/asda/ads?a=b&c=d\",\"hash\":{\"mykey\":{\"BB\":10}},\"point\":{\"IsEmpty\":false,\"X\":150,\"Y\":150},\"MyEnum\":[1,10,345],\"MyEnum1\":[1,10,345],\"AA\":5,\"AA1\":[{\"BB\":10},{\"BB\":10}],\"BB\":18446744073709551610,\"YY\":[{\"BB\":10},{\"BB\":10}]}", x, "#A1");
|
||||
|
||||
X n = ser.Deserialize(x, typeof(X)) as X;
|
||||
Assert.AreEqual(s, n, "#A2");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestDeserializeTypeResolver ()
|
||||
{
|
||||
|
||||
@@ -9,11 +9,6 @@ LIB_MCS_FLAGS = \
|
||||
/r:System.Web.dll \
|
||||
/r:System.Web.Abstractions.dll
|
||||
|
||||
ifeq (2.0, $(FRAMEWORK_VERSION))
|
||||
# This is a .NET 3.5 only assembly, but built during the 2.0 build
|
||||
LIB_MCS_FLAGS += -d:NET_3_5 -d:SYSTEMCORE_DEP
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
LIB_MCS_FLAGS += -define:DEBUG
|
||||
endif
|
||||
@@ -23,7 +18,7 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS)
|
||||
EXTRA_DISTFILES =
|
||||
|
||||
# This is a .NET 3.5+ assembly
|
||||
VALID_PROFILE := $(filter net_2_0 net_4_0 net_4_5, $(PROFILE))
|
||||
VALID_PROFILE := $(filter net_4_0 net_4_5, $(PROFILE))
|
||||
ifndef VALID_PROFILE
|
||||
LIBRARY_NAME = dummy-System.Web.Routing.dll
|
||||
NO_INSTALL = yes
|
||||
|
||||
@@ -255,6 +255,7 @@ LIB_MCS_FLAGS = \
|
||||
-r:System.Xml.dll \
|
||||
-r:System.EnterpriseServices.dll \
|
||||
-r:System.Runtime.Serialization.Formatters.Soap \
|
||||
-r:System.ComponentModel.DataAnnotations.dll \
|
||||
$(OTHER_LIB_MCS_FLAGS) \
|
||||
$(RESX_RES:%=/resource:%) \
|
||||
$(OTHER_RES:%=/resource:%)
|
||||
@@ -271,10 +272,6 @@ TEST_MCS_FLAGS = $(LIB_MCS_FLAGS) -doc:$(test_lib:.dll=.xml) -nowarn:219,169,159
|
||||
$(foreach file,$(NUNIT_APP_CODE_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_Code/\2 ;g')) \
|
||||
$(foreach file,$(NUNIT_APP_GLOBALRESOURCES_FILES),$(shell echo $(file) | sed -e 's;\(.*\)/\(.*\);/resource:\1/\2,App_GlobalResources/\2 ;g'))
|
||||
|
||||
ifeq (net_2_0, $(PROFILE))
|
||||
TEST_MCS_FLAGS += -r:System.Web.Extensions.dll -d:TEST
|
||||
endif
|
||||
|
||||
EXTRA_DISTFILES = \
|
||||
$(RESOURCE_FILES_4) \
|
||||
$(RESOURCE_FILES_2) \
|
||||
@@ -447,4 +444,4 @@ ifneq ($(PROFILE),basic)
|
||||
csproj-local:
|
||||
$(MAKE) csproj-local intermediate=plainweb/
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
@@ -1249,6 +1249,7 @@
|
||||
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\DefaultHttpHandler.cs" />
|
||||
<Compile Include="System.Web\EndEventHandler.cs" />
|
||||
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
|
||||
@@ -1294,6 +1295,7 @@
|
||||
<Compile Include="System.Web\HttpRuntime.cs" />
|
||||
<Compile Include="System.Web\HttpServerUtility.cs" />
|
||||
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
|
||||
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
|
||||
<Compile Include="System.Web\HttpUnhandledException.cs" />
|
||||
<Compile Include="System.Web\HttpUtility.cs" />
|
||||
<Compile Include="System.Web\HttpValidationStatus.cs" />
|
||||
@@ -1333,6 +1335,8 @@
|
||||
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
|
||||
<Compile Include="System.Web\StaticFileHandler.cs" />
|
||||
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
|
||||
<Compile Include="System.Web\TaskAsyncResult.cs" />
|
||||
<Compile Include="System.Web\TaskEventHandler.cs" />
|
||||
<Compile Include="System.Web\TempFileStream.cs" />
|
||||
<Compile Include="System.Web\TraceContext.cs" />
|
||||
<Compile Include="System.Web\TraceContextEventArgs.cs" />
|
||||
|
||||
@@ -1249,6 +1249,7 @@
|
||||
<Compile Include="System.Web\DefaultExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\DefaultHttpHandler.cs" />
|
||||
<Compile Include="System.Web\EndEventHandler.cs" />
|
||||
<Compile Include="System.Web\EventHandlerTaskAsyncHelper.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplate.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragment.cs" />
|
||||
<Compile Include="System.Web\ExceptionPageTemplateFragmentValue.cs" />
|
||||
@@ -1294,6 +1295,7 @@
|
||||
<Compile Include="System.Web\HttpRuntime.cs" />
|
||||
<Compile Include="System.Web\HttpServerUtility.cs" />
|
||||
<Compile Include="System.Web\HttpStaticObjectsCollection.cs" />
|
||||
<Compile Include="System.Web\HttpTaskAsyncHandler.cs" />
|
||||
<Compile Include="System.Web\HttpUnhandledException.cs" />
|
||||
<Compile Include="System.Web\HttpUtility.cs" />
|
||||
<Compile Include="System.Web\HttpValidationStatus.cs" />
|
||||
@@ -1321,6 +1323,7 @@
|
||||
<Compile Include="System.Web\ProcessShutdownReason.cs" />
|
||||
<Compile Include="System.Web\ProcessStatus.cs" />
|
||||
<Compile Include="System.Web\QueueManager.cs" />
|
||||
<Compile Include="System.Web\ReadEntityBodyMode.cs" />
|
||||
<Compile Include="System.Web\RequestNotification.cs" />
|
||||
<Compile Include="System.Web\RequestNotificationStatus.cs" />
|
||||
<Compile Include="System.Web\ServerVariablesCollection.cs" />
|
||||
@@ -1332,6 +1335,8 @@
|
||||
<Compile Include="System.Web\SiteMapResolveEventArgs.cs" />
|
||||
<Compile Include="System.Web\StaticFileHandler.cs" />
|
||||
<Compile Include="System.Web\StaticSiteMapProvider.cs" />
|
||||
<Compile Include="System.Web\TaskAsyncResult.cs" />
|
||||
<Compile Include="System.Web\TaskEventHandler.cs" />
|
||||
<Compile Include="System.Web\TempFileStream.cs" />
|
||||
<Compile Include="System.Web\TraceContext.cs" />
|
||||
<Compile Include="System.Web\TraceContextEventArgs.cs" />
|
||||
|
||||
@@ -556,6 +556,7 @@
|
||||
<Compile Include="Test\System.Web.Util\UrlUtilsTest.cs" />
|
||||
<Compile Include="Test\System.Web.Util\WorkItemCas.cs" />
|
||||
<Compile Include="Test\System.Web\AppBrowsersTest.cs" />
|
||||
<Compile Include="Test\System.Web\EventHandlerTaskAsyncHelperTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationStateCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpApplicationTest.cs" />
|
||||
@@ -591,6 +592,7 @@
|
||||
<Compile Include="Test\System.Web\HttpServerUtilityCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpServerUtilityTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpStaticObjectsCollectionCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpTaskAsyncHandlerTest.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUnhandledExceptionCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUtilityCas.cs" />
|
||||
<Compile Include="Test\System.Web\HttpUtilityTest.cs" />
|
||||
@@ -602,6 +604,7 @@
|
||||
<Compile Include="Test\System.Web\SiteMapNodeTest.cs" />
|
||||
<Compile Include="Test\System.Web\SiteMapProviderTest.cs" />
|
||||
<Compile Include="Test\System.Web\StaticSiteMapProviderTest.cs" />
|
||||
<Compile Include="Test\System.Web\TaskAsyncResultTest.cs" />
|
||||
<Compile Include="Test\System.Web\TraceContextCas.cs" />
|
||||
<Compile Include="Test\System.Web\TraceContextRecordTest.cs" />
|
||||
<Compile Include="Test\System.Web\VirtualPathUtilityTest.cs" />
|
||||
|
||||
@@ -0,0 +1,110 @@
|
||||
//
|
||||
// System.Web.Security.MembershipPasswordAttribute
|
||||
//
|
||||
// Authors:
|
||||
// Martin Thwaites ([email protected])
|
||||
//
|
||||
// (C) 2014 Martin Thwaites
|
||||
//
|
||||
//
|
||||
// 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.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace System.Web.Security
|
||||
{
|
||||
[AttributeUsageAttribute (AttributeTargets.Property|AttributeTargets.Field|AttributeTargets.Parameter, AllowMultiple = false)]
|
||||
public class MembershipPasswordAttribute : ValidationAttribute
|
||||
{
|
||||
public string MinNonAlphanumericCharactersError { get; set; }
|
||||
public string MinPasswordLengthError { get; set; }
|
||||
public int MinRequiredNonAlphanumericCharacters { get; set; }
|
||||
public int MinRequiredPasswordLength { get; set; }
|
||||
public string PasswordStrengthError { get; set; }
|
||||
public string PasswordStrengthRegularExpression { get; set; }
|
||||
public Type ResourceType { get; set; }
|
||||
|
||||
public MembershipPasswordAttribute ()
|
||||
{
|
||||
if (Membership.Provider != null)
|
||||
{
|
||||
MinRequiredNonAlphanumericCharacters = Membership.Provider.MinRequiredNonAlphanumericCharacters;
|
||||
MinRequiredPasswordLength = Membership.Provider.MinRequiredPasswordLength;
|
||||
PasswordStrengthRegularExpression = Membership.Provider.PasswordStrengthRegularExpression;
|
||||
}
|
||||
else
|
||||
{
|
||||
MinRequiredPasswordLength = 7;
|
||||
MinRequiredNonAlphanumericCharacters = 1;
|
||||
PasswordStrengthRegularExpression = @"(?=.{6,})(?=(.*\d){1,})(?=(.*\W){1,})";
|
||||
}
|
||||
MinNonAlphanumericCharactersError = "The '{0}' field is an invalid password. Password must have {1} or more non-alphanumeric characters.";
|
||||
MinPasswordLengthError = "The '{0}' field is an invalid password. Password must have {1} or more characters.";
|
||||
PasswordStrengthError = "The '{0}' field is an invalid password. It does not meet the password strength requirements";
|
||||
ErrorMessage = "The field {0} is invalid.";
|
||||
}
|
||||
|
||||
protected override ValidationResult IsValid (object value, ValidationContext validationContext)
|
||||
{
|
||||
var password = value as string;
|
||||
var isError = false;
|
||||
if (string.IsNullOrEmpty(password))
|
||||
return null;
|
||||
|
||||
var errorMessage = string.Empty;
|
||||
var parameter = 0;
|
||||
var pattern = new Regex (@"\W|_");
|
||||
|
||||
if (MinRequiredPasswordLength > 0 &&
|
||||
password.Length < MinRequiredPasswordLength) {
|
||||
errorMessage = MinPasswordLengthError;
|
||||
parameter = MinRequiredPasswordLength;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError && MinRequiredNonAlphanumericCharacters > 0 &&
|
||||
pattern.Matches (password).Count < MinRequiredNonAlphanumericCharacters) {
|
||||
errorMessage = MinNonAlphanumericCharactersError;
|
||||
parameter = MinRequiredNonAlphanumericCharacters;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (!isError && !string.IsNullOrEmpty (PasswordStrengthRegularExpression) &&
|
||||
new Regex (PasswordStrengthRegularExpression).IsMatch (password)) {
|
||||
errorMessage = PasswordStrengthError;
|
||||
isError = true;
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
if (validationContext == null)
|
||||
return new ValidationResult("error");
|
||||
|
||||
return new ValidationResult (
|
||||
string.Format (errorMessage, validationContext.DisplayName, parameter),
|
||||
new[] {validationContext.MemberName});
|
||||
}
|
||||
|
||||
return ValidationResult.Success;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
//
|
||||
// System.Web.EventHandlerTaskAsyncHelper.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public sealed class EventHandlerTaskAsyncHelper
|
||||
{
|
||||
readonly TaskEventHandler taskEventHandler;
|
||||
readonly BeginEventHandler beginEventHandler;
|
||||
static readonly EndEventHandler endEventHandler = TaskAsyncResult.Wait;
|
||||
|
||||
public BeginEventHandler BeginEventHandler {
|
||||
get { return beginEventHandler; }
|
||||
}
|
||||
|
||||
public EndEventHandler EndEventHandler {
|
||||
get { return endEventHandler; }
|
||||
}
|
||||
|
||||
public EventHandlerTaskAsyncHelper (TaskEventHandler handler)
|
||||
{
|
||||
if (handler == null)
|
||||
throw new ArgumentNullException ("handler");
|
||||
|
||||
taskEventHandler = handler;
|
||||
beginEventHandler = GetAsyncResult;
|
||||
}
|
||||
|
||||
IAsyncResult GetAsyncResult (object sender, EventArgs e, AsyncCallback callback, object state)
|
||||
{
|
||||
Task task = taskEventHandler (sender, e);
|
||||
return TaskAsyncResult.GetAsyncResult (task, callback, state);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -80,13 +80,17 @@ namespace System.Web
|
||||
string unescaped_path;
|
||||
string original_path;
|
||||
string path_info;
|
||||
string path_info_unvalidated;
|
||||
string raw_url;
|
||||
string raw_url_unvalidated;
|
||||
WebROCollection all_params;
|
||||
WebROCollection headers;
|
||||
NameValueCollection headers;
|
||||
WebROCollection headers_unvalidated;
|
||||
Stream input_stream;
|
||||
InputFilterStream input_filter;
|
||||
Stream filter;
|
||||
HttpCookieCollection cookies;
|
||||
HttpCookieCollection cookies_unvalidated;
|
||||
string http_method;
|
||||
|
||||
WebROCollection form;
|
||||
@@ -440,15 +444,25 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal HttpCookieCollection CookiesNoValidation {
|
||||
get {
|
||||
if (cookies_unvalidated == null) {
|
||||
if (worker_request == null) {
|
||||
cookies_unvalidated = new HttpCookieCollection ();
|
||||
} else {
|
||||
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
|
||||
cookies_unvalidated = new HttpCookieCollection (cookie_hv);
|
||||
}
|
||||
}
|
||||
|
||||
return cookies_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public HttpCookieCollection Cookies {
|
||||
get {
|
||||
if (cookies == null) {
|
||||
if (worker_request == null) {
|
||||
cookies = new HttpCookieCollection ();
|
||||
} else {
|
||||
string cookie_hv = worker_request.GetKnownRequestHeader (HttpWorkerRequest.HeaderCookie);
|
||||
cookies = new HttpCookieCollection (cookie_hv);
|
||||
}
|
||||
cookies = CookiesNoValidation;
|
||||
}
|
||||
|
||||
#if TARGET_J2EE
|
||||
@@ -737,10 +751,20 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal NameValueCollection HeadersNoValidation {
|
||||
get {
|
||||
if (headers_unvalidated == null) {
|
||||
headers_unvalidated = new HeadersCollection (this);
|
||||
}
|
||||
|
||||
return headers_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public NameValueCollection Headers {
|
||||
get {
|
||||
if (headers == null) {
|
||||
headers = new HeadersCollection (this);
|
||||
headers = HeadersNoValidation;
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1226,12 +1250,23 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal string PathInfoNoValidation {
|
||||
get {
|
||||
if (path_info_unvalidated == null) {
|
||||
if (worker_request == null)
|
||||
return String.Empty;
|
||||
|
||||
path_info_unvalidated = worker_request.GetPathInfo () ?? String.Empty;
|
||||
}
|
||||
|
||||
return path_info_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public string PathInfo {
|
||||
get {
|
||||
if (path_info == null) {
|
||||
if (worker_request == null)
|
||||
return String.Empty;
|
||||
path_info = worker_request.GetPathInfo () ?? String.Empty;
|
||||
path_info = PathInfoNoValidation;
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1335,16 +1370,26 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
internal string RawUrlUnvalidated {
|
||||
get {
|
||||
if (raw_url_unvalidated == null) {
|
||||
if (worker_request != null)
|
||||
raw_url_unvalidated = worker_request.GetRawUrl ();
|
||||
else
|
||||
raw_url_unvalidated = UrlComponents.Path + UrlComponents.Query;
|
||||
|
||||
if (raw_url_unvalidated == null)
|
||||
raw_url_unvalidated = String.Empty;
|
||||
}
|
||||
|
||||
return raw_url_unvalidated;
|
||||
}
|
||||
}
|
||||
|
||||
public string RawUrl {
|
||||
get {
|
||||
if (raw_url == null) {
|
||||
if (worker_request != null)
|
||||
raw_url = worker_request.GetRawUrl ();
|
||||
else
|
||||
raw_url = UrlComponents.Path + UrlComponents.Query;
|
||||
|
||||
if (raw_url == null)
|
||||
raw_url = String.Empty;
|
||||
raw_url = RawUrlUnvalidated;
|
||||
#if NET_4_0
|
||||
if (validateRequestNewMode) {
|
||||
RequestValidator validator = RequestValidator.Current;
|
||||
@@ -1398,6 +1443,26 @@ namespace System.Web
|
||||
}
|
||||
}
|
||||
|
||||
#if NET_4_5
|
||||
public UnvalidatedRequestValues Unvalidated {
|
||||
get {
|
||||
var vals = new UnvalidatedRequestValues ();
|
||||
|
||||
vals.Cookies = CookiesNoValidation;
|
||||
vals.Files = Files;
|
||||
vals.Form = FormUnvalidated;
|
||||
vals.Headers = HeadersNoValidation;
|
||||
vals.Path = PathNoValidation;
|
||||
vals.PathInfo = PathInfoNoValidation;
|
||||
vals.QueryString = QueryStringUnvalidated;
|
||||
vals.RawUrl = RawUrlUnvalidated;
|
||||
vals.Url = Url;
|
||||
|
||||
return vals;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public Uri Url {
|
||||
get {
|
||||
if (cached_url == null) {
|
||||
|
||||
@@ -0,0 +1,59 @@
|
||||
//
|
||||
// System.Web.HttpTaskAsyncHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.ComponentModel;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public abstract class HttpTaskAsyncHandler : IHttpAsyncHandler, IHttpHandler
|
||||
{
|
||||
public virtual bool IsReusable {
|
||||
get { return false; }
|
||||
}
|
||||
|
||||
[EditorBrowsable (EditorBrowsableState.Never)]
|
||||
public virtual void ProcessRequest (HttpContext context)
|
||||
{
|
||||
throw new NotSupportedException ("This handler cannot be executed synchronously.");
|
||||
}
|
||||
|
||||
public abstract Task ProcessRequestAsync (HttpContext context);
|
||||
|
||||
IAsyncResult IHttpAsyncHandler.BeginProcessRequest (HttpContext context, AsyncCallback cb, object extraData)
|
||||
{
|
||||
Task task = ProcessRequestAsync (context);
|
||||
return TaskAsyncResult.GetAsyncResult (task, cb, extraData);
|
||||
}
|
||||
|
||||
void IHttpAsyncHandler.EndProcessRequest (IAsyncResult result)
|
||||
{
|
||||
TaskAsyncResult.Wait (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,101 @@
|
||||
//
|
||||
// System.Web.TaskAsyncResult.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
sealed class TaskAsyncResult : IAsyncResult
|
||||
{
|
||||
static readonly Action<Task, object> invokeCallback = InvokeCallback;
|
||||
readonly Task task;
|
||||
readonly AsyncCallback callback;
|
||||
|
||||
public object AsyncState {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get { return ((IAsyncResult) task).AsyncWaitHandle; }
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get { return task.IsCompleted; }
|
||||
}
|
||||
|
||||
TaskAsyncResult (Task task, AsyncCallback callback, object state)
|
||||
{
|
||||
this.task = task;
|
||||
this.callback = callback;
|
||||
this.AsyncState = state;
|
||||
this.CompletedSynchronously = task.IsCompleted;
|
||||
}
|
||||
|
||||
public static IAsyncResult GetAsyncResult (Task task, AsyncCallback callback, object state)
|
||||
{
|
||||
if (task == null)
|
||||
return null;
|
||||
|
||||
var result = new TaskAsyncResult (task, callback, state);
|
||||
|
||||
if (callback != null) {
|
||||
if (result.CompletedSynchronously)
|
||||
callback (result);
|
||||
else
|
||||
task.ContinueWith (invokeCallback, result);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void Wait (IAsyncResult result)
|
||||
{
|
||||
if (result == null)
|
||||
throw new ArgumentNullException ("result");
|
||||
|
||||
var taskAsyncResult = result as TaskAsyncResult;
|
||||
if (taskAsyncResult == null)
|
||||
throw new ArgumentException ("The provided IAsyncResult is invalid.", "result");
|
||||
|
||||
taskAsyncResult.task.GetAwaiter ().GetResult ();
|
||||
}
|
||||
|
||||
static void InvokeCallback (Task task, object state)
|
||||
{
|
||||
var result = (TaskAsyncResult) state;
|
||||
result.callback (result);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// System.Web.TaskEventHandler.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// 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.Threading.Tasks;
|
||||
|
||||
namespace System.Web
|
||||
{
|
||||
public delegate Task TaskEventHandler (object sender, EventArgs e);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValues.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public sealed class UnvalidatedRequestValues {
|
||||
public HttpCookieCollection Cookies { get; internal set; }
|
||||
public HttpFileCollection Files { get; internal set; }
|
||||
public NameValueCollection Form { get; internal set; }
|
||||
public NameValueCollection Headers { get; internal set; }
|
||||
public string Path { get; internal set; }
|
||||
public string PathInfo { get; internal set; }
|
||||
public NameValueCollection QueryString { get; internal set; }
|
||||
public string RawUrl { get; internal set; }
|
||||
public Uri Url { get; internal set; }
|
||||
|
||||
public string this[string field] {
|
||||
get {
|
||||
if (Form != null && Form [field] != null) {
|
||||
return Form [field];
|
||||
}
|
||||
|
||||
if (Cookies != null && Cookies [field] != null) {
|
||||
return Cookies [field].Value;
|
||||
}
|
||||
|
||||
if (QueryString != null && QueryString [field] != null) {
|
||||
return QueryString [field];
|
||||
}
|
||||
|
||||
// msdn docs also suggest the ServerVariables are inspected by this indexer,
|
||||
// but that seems odd given what is available in this class
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValuesBase.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public abstract class UnvalidatedRequestValuesBase {
|
||||
void NotImplemented ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public virtual HttpCookieCollection Cookies
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual HttpFileCollection Files
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection Form
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection Headers
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string this[string field]
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string Path
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string PathInfo
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual NameValueCollection QueryString
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual string RawUrl
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
|
||||
public virtual Uri Url
|
||||
{
|
||||
get { NotImplemented (); return null; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
//
|
||||
// System.Web.UnvalidatedRequestValuesWrapper.cs
|
||||
//
|
||||
// Author:
|
||||
// Mike Morano <[email protected]>
|
||||
//
|
||||
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
|
||||
namespace System.Web {
|
||||
public class UnvalidatedRequestValuesWrapper : UnvalidatedRequestValuesBase {
|
||||
UnvalidatedRequestValues rv;
|
||||
|
||||
public UnvalidatedRequestValuesWrapper (UnvalidatedRequestValues requestValues)
|
||||
{
|
||||
rv = requestValues;
|
||||
}
|
||||
|
||||
public override HttpCookieCollection Cookies
|
||||
{
|
||||
get { return rv.Cookies; }
|
||||
}
|
||||
|
||||
public override HttpFileCollection Files
|
||||
{
|
||||
get { return rv.Files; }
|
||||
}
|
||||
|
||||
public override NameValueCollection Form
|
||||
{
|
||||
get { return rv.Form; }
|
||||
}
|
||||
|
||||
public override NameValueCollection Headers
|
||||
{
|
||||
get { return rv.Headers; }
|
||||
}
|
||||
|
||||
public override string this[string field]
|
||||
{
|
||||
get { return rv[field]; }
|
||||
}
|
||||
|
||||
public override string Path
|
||||
{
|
||||
get { return rv.Path; }
|
||||
}
|
||||
|
||||
public override string PathInfo
|
||||
{
|
||||
get { return rv.PathInfo; }
|
||||
}
|
||||
|
||||
public override NameValueCollection QueryString
|
||||
{
|
||||
get { return rv.QueryString; }
|
||||
}
|
||||
|
||||
public override string RawUrl
|
||||
{
|
||||
get { return rv.RawUrl; }
|
||||
}
|
||||
|
||||
public override Uri Url
|
||||
{
|
||||
get { return rv.Url; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -45,6 +45,7 @@ mainsoft/NunitWeb/NunitWeb/Tests/AuthorConverter.cs
|
||||
mainsoft/NunitWeb/NunitWeb/Tests/Book.cs
|
||||
mainsoft/NunitWeb/NunitWeb/Tests/BookType.cs
|
||||
System.Web/AppBrowsersTest.cs
|
||||
System.Web/EventHandlerTaskAsyncHelperTest.cs
|
||||
System.Web/HttpApplicationTest.cs
|
||||
System.Web/HttpBrowserCapabilitiesTest.cs
|
||||
System.Web/HttpCacheVaryByContentEncodingsTest.cs
|
||||
@@ -58,10 +59,12 @@ System.Web/HttpRequestTest.cs
|
||||
System.Web/HttpResponseTest.cs
|
||||
System.Web/HttpRuntimeTest.cs
|
||||
System.Web/HttpServerUtilityTest.cs
|
||||
System.Web/HttpTaskAsyncHandlerTest.cs
|
||||
System.Web/HttpUtilityTest.cs
|
||||
System.Web/SiteMapProviderTest.cs
|
||||
System.Web/SiteMapNodeTest.cs
|
||||
System.Web/StaticSiteMapProviderTest.cs
|
||||
System.Web/TaskAsyncResultTest.cs
|
||||
System.Web/TraceContextRecordTest.cs
|
||||
System.Web.Compilation/BuildManagerTest.cs
|
||||
System.Web.Compilation/ClientBuildManagerParameterTest.cs
|
||||
@@ -103,6 +106,7 @@ System.Web.Profile/ProfileInfoTest.cs
|
||||
System.Web.Security/FormsAuthenticationTest.cs
|
||||
System.Web.Security/FormsIdentityTest.cs
|
||||
System.Web.Security/MembershipTest.cs
|
||||
System.Web.Security/MembershipPasswordAttributeTest.cs
|
||||
System.Web.Security/MembershipProviderCollectionTest.cs
|
||||
System.Web.Security/MembershipProviderTest.cs
|
||||
System.Web.Security/MembershipUserCollectionTest.cs
|
||||
|
||||
@@ -0,0 +1,140 @@
|
||||
#if NET_4_5
|
||||
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.Linq;
|
||||
using System.Web.Security;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web.Security {
|
||||
|
||||
[TestFixture]
|
||||
public class MembershipPasswordAttributeTest
|
||||
{
|
||||
private ValidationContext _validationContext;
|
||||
|
||||
public MembershipPasswordAttributeTest ()
|
||||
{
|
||||
_validationContext = new ValidationContext (new object ())
|
||||
{
|
||||
DisplayName = "testDisplay",
|
||||
MemberName = "testMember"
|
||||
};
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
Assert.IsTrue (passwordAttribute.IsValid (""), "sending an empty password password should should be treated as valid");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsValid_with_ValidationContext ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("", _validationContext);
|
||||
Assert.IsNull (result, "sending an empty password password should return a null response");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!12345", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 7 character length and a single nonalphanumeric");
|
||||
|
||||
// test error priority
|
||||
passwordAttribute.MinRequiredPasswordLength = 4;
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 2;
|
||||
result = passwordAttribute.TestValidation ("aaa", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 4 or more characters.", result.ErrorMessage);
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MinRequiredPasswordLength ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("a!1234", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 7 or more characters.", result.ErrorMessage, "Error message not correct for lower Min characters");
|
||||
Assert.AreEqual (_validationContext.MemberName, result.MemberNames.FirstOrDefault (), "Member name not correct");
|
||||
|
||||
passwordAttribute.MinRequiredPasswordLength = 6;
|
||||
result = passwordAttribute.TestValidation ("a!1234", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!123", _validationContext);
|
||||
Assert.AreEqual("The 'testDisplay' field is an invalid password. Password must have 6 or more characters.", result.ErrorMessage, "Error message not correct for Min characters of 6");
|
||||
|
||||
|
||||
passwordAttribute.MinRequiredPasswordLength = 1;
|
||||
result = passwordAttribute.TestValidation ("!", _validationContext);
|
||||
Assert.AreEqual(ValidationResult.Success, result, "Should suceed with a 6 character length after it's reset");
|
||||
|
||||
// Note there is no test for empty password here as it returns null and is therefore in the generic test
|
||||
|
||||
// Error Message changes
|
||||
passwordAttribute.MinRequiredPasswordLength = 5;
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
|
||||
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0}";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
|
||||
|
||||
passwordAttribute.MinPasswordLengthError = "There was an error parameter1: {0} parameter2: {1}";
|
||||
result = passwordAttribute.TestValidation ("a!13", _validationContext);
|
||||
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 5", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
|
||||
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void MinRequiredNonAlphanumericCharacters ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttributeTestClass ();
|
||||
var result = passwordAttribute.TestValidation ("a!12345", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with the default 1 non alpha numeric");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 1 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without non-alphanumerics");
|
||||
|
||||
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 3;
|
||||
result = passwordAttribute.TestValidation ("a!&12345", _validationContext);
|
||||
Assert.AreEqual ("The 'testDisplay' field is an invalid password. Password must have 3 or more non-alphanumeric characters.", result.ErrorMessage, "Expected validation to fail without 3 non-alphanumerics");
|
||||
|
||||
result = passwordAttribute.TestValidation ("a!?&132154", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 3 non alpha numerics");
|
||||
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 0;
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual (ValidationResult.Success, result, "Should succeed with 0 non alpha numerics");
|
||||
|
||||
// Error Message changes
|
||||
passwordAttribute.MinRequiredNonAlphanumericCharacters = 1;
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("There was an error", result.ErrorMessage, "Error Message wasn't correct without parameters.");
|
||||
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0}";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual("There was an error parameter1: testDisplay", result.ErrorMessage, "Error Message wasn't correct with 1 parameter.");
|
||||
|
||||
passwordAttribute.MinNonAlphanumericCharactersError = "There was an error parameter1: {0} parameter2: {1}";
|
||||
result = passwordAttribute.TestValidation ("a123456", _validationContext);
|
||||
Assert.AreEqual ("There was an error parameter1: testDisplay parameter2: 1", result.ErrorMessage, "Error Message wasn't correct with 2 parameters.");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void FormatErrorMessage ()
|
||||
{
|
||||
var passwordAttribute = new MembershipPasswordAttribute ();
|
||||
Assert.AreEqual ("The field testDisplay2 is invalid.", passwordAttribute.FormatErrorMessage ("testDisplay2"));
|
||||
}
|
||||
|
||||
internal class MembershipPasswordAttributeTestClass : MembershipPasswordAttribute
|
||||
{
|
||||
public ValidationResult TestValidation (object val, ValidationContext context)
|
||||
{
|
||||
return IsValid (val, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -0,0 +1,118 @@
|
||||
//
|
||||
// MonoTests.System.Web.EventHandlerTaskAsyncHelperTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
[TestFixture]
|
||||
public sealed class EventHandlerTaskAsyncHelperTest : TaskAsyncResultTest
|
||||
{
|
||||
EventHandlerTaskAsyncHelper helper;
|
||||
object expectedSender;
|
||||
EventArgs expectedEventArgs;
|
||||
|
||||
static Task DummyTaskEventHandler (object sender, EventArgs e)
|
||||
{
|
||||
throw new AssertionException ("Should not be called.");
|
||||
}
|
||||
|
||||
protected override void SetNullArguments ()
|
||||
{
|
||||
expectedSender = null;
|
||||
expectedEventArgs = null;
|
||||
}
|
||||
|
||||
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
|
||||
{
|
||||
Assert.IsNull (helper, "GetAsyncResult#A01");
|
||||
|
||||
TaskEventHandler handler = (sender, e) => {
|
||||
Assert.AreSame (expectedSender, sender, "GetAsyncResult#A02");
|
||||
Assert.AreSame (expectedEventArgs, e, "GetAsyncResult#A03");
|
||||
|
||||
return taskFactory ();
|
||||
};
|
||||
|
||||
helper = new EventHandlerTaskAsyncHelper (handler);
|
||||
return helper.BeginEventHandler (expectedSender, expectedEventArgs, callback, state);
|
||||
}
|
||||
|
||||
protected override void Wait (IAsyncResult result)
|
||||
{
|
||||
Assert.IsNotNull (helper, "Wait#A01");
|
||||
|
||||
helper.EndEventHandler (result);
|
||||
}
|
||||
|
||||
protected override void TestSetUp ()
|
||||
{
|
||||
base.TestSetUp ();
|
||||
|
||||
helper = null;
|
||||
expectedSender = new object ();
|
||||
expectedEventArgs = new EventArgs ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Constructor ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Constructor_NullHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void BeginEventHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
|
||||
Assert.IsNotNull (helper.BeginEventHandler, "#A01");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void EndEventHandler ()
|
||||
{
|
||||
var helper = new EventHandlerTaskAsyncHelper (DummyTaskEventHandler);
|
||||
|
||||
Assert.IsNotNull (helper.EndEventHandler, "#A01");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,132 @@
|
||||
//
|
||||
// MonoTests.System.Web.HttpTaskAsyncHandlerTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
[TestFixture]
|
||||
public sealed class HttpTaskAsyncHandlerTest : TaskAsyncResultTest
|
||||
{
|
||||
sealed class DummyHttpTaskAsyncHandler : HttpTaskAsyncHandler
|
||||
{
|
||||
public DummyHttpTaskAsyncHandler ()
|
||||
{
|
||||
}
|
||||
|
||||
public override Task ProcessRequestAsync (HttpContext context)
|
||||
{
|
||||
throw new AssertionException ("Should not be called.");
|
||||
}
|
||||
}
|
||||
|
||||
sealed class TestHttpTaskAsyncHandler : HttpTaskAsyncHandler
|
||||
{
|
||||
readonly Func<Task> taskFactory;
|
||||
readonly HttpContext expectedContext;
|
||||
|
||||
public TestHttpTaskAsyncHandler (Func<Task> taskFactory, HttpContext expectedContext)
|
||||
{
|
||||
this.taskFactory = taskFactory;
|
||||
this.expectedContext = expectedContext;
|
||||
}
|
||||
|
||||
public override Task ProcessRequestAsync (HttpContext context)
|
||||
{
|
||||
Assert.AreSame (expectedContext, context, "TestHttpTaskAsyncHandler#A01");
|
||||
|
||||
return taskFactory ();
|
||||
}
|
||||
}
|
||||
|
||||
IHttpAsyncHandler handler;
|
||||
HttpContext expectedContext;
|
||||
|
||||
protected override void SetNullArguments ()
|
||||
{
|
||||
expectedContext = null;
|
||||
}
|
||||
|
||||
protected override IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state)
|
||||
{
|
||||
Assert.IsNull (handler, "GetAsyncResult#A01");
|
||||
|
||||
handler = new TestHttpTaskAsyncHandler (taskFactory, expectedContext);
|
||||
return handler.BeginProcessRequest (expectedContext, callback, state);
|
||||
}
|
||||
|
||||
protected override void Wait (IAsyncResult result)
|
||||
{
|
||||
Assert.IsNotNull (handler, "Wait#A01");
|
||||
|
||||
handler.EndProcessRequest (result);
|
||||
}
|
||||
|
||||
protected override void TestSetUp ()
|
||||
{
|
||||
base.TestSetUp ();
|
||||
|
||||
handler = null;
|
||||
|
||||
var request = new HttpRequest (string.Empty, "http://localhost/", string.Empty);
|
||||
var response = new HttpResponse (TextWriter.Null);
|
||||
expectedContext = new HttpContext (request, response);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsReusable ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
Assert.IsFalse (handler.IsReusable, "#A01");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ProcessRequest ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
handler.ProcessRequest (expectedContext);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (NotSupportedException))]
|
||||
public void ProcessRequest_NullContext ()
|
||||
{
|
||||
var handler = new DummyHttpTaskAsyncHandler ();
|
||||
handler.ProcessRequest (null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,334 @@
|
||||
//
|
||||
// MonoTests.System.Web.TaskAsyncResultTest.cs
|
||||
//
|
||||
// Author:
|
||||
// Kornel Pal ([email protected])
|
||||
//
|
||||
// Copyright (C) 2014 Kornel Pal
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
#if NET_4_5
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace MonoTests.System.Web
|
||||
{
|
||||
public abstract class TaskAsyncResultTest
|
||||
{
|
||||
sealed class TestException : Exception
|
||||
{
|
||||
public TestException ()
|
||||
: base ("Test exception")
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
sealed class DummyAsyncResult : IAsyncResult
|
||||
{
|
||||
public object AsyncState {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public WaitHandle AsyncWaitHandle {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public bool CompletedSynchronously {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
|
||||
public bool IsCompleted {
|
||||
get { throw new AssertionException ("Should not be called."); }
|
||||
}
|
||||
}
|
||||
|
||||
int testThreadId;
|
||||
int factoryCount;
|
||||
int callbackCount;
|
||||
object expectedState;
|
||||
Exception expectedException;
|
||||
TaskCompletionSource<object> taskCompletion;
|
||||
TaskCompletionSource<object> callbackCompletion;
|
||||
IAsyncResult taskAsyncResult;
|
||||
|
||||
static Task NullTaskFatory ()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
static Task CompletedTaskFatory ()
|
||||
{
|
||||
return Task.FromResult<object> (null);
|
||||
}
|
||||
|
||||
static Task FailingTaskFatory ()
|
||||
{
|
||||
throw new TestException ();
|
||||
}
|
||||
|
||||
void DummyCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.Fail ("Should not be called.");
|
||||
}
|
||||
|
||||
void FailingCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
throw new TestException ();
|
||||
}
|
||||
|
||||
protected abstract void SetNullArguments ();
|
||||
protected abstract IAsyncResult GetAsyncResult (Func<Task> taskFactory, AsyncCallback callback, object state);
|
||||
protected abstract void Wait (IAsyncResult result);
|
||||
|
||||
[SetUp]
|
||||
protected virtual void TestSetUp ()
|
||||
{
|
||||
testThreadId = Thread.CurrentThread.ManagedThreadId;
|
||||
factoryCount = 0;
|
||||
callbackCount = 0;
|
||||
expectedState = new object ();
|
||||
expectedException = null;
|
||||
taskCompletion = new TaskCompletionSource<object> ();
|
||||
callbackCompletion = new TaskCompletionSource<object> ();
|
||||
taskAsyncResult = null;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Invoke_NullArguments ()
|
||||
{
|
||||
SetNullArguments ();
|
||||
|
||||
IAsyncResult result = GetAsyncResult (CompletedTaskFatory, null, null);
|
||||
Wait (result);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Invoke_NullTask ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
|
||||
Assert.AreEqual (0, callbackCount, "#A01");
|
||||
Assert.IsNull (result, "#A02");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (TestException))]
|
||||
public void Invoke_TaskFatoryException ()
|
||||
{
|
||||
try {
|
||||
GetAsyncResult (FailingTaskFatory, DummyCallback, expectedState);
|
||||
} finally {
|
||||
Assert.AreEqual (0, callbackCount, "#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (TestException))]
|
||||
public void Invoke_CallbackException ()
|
||||
{
|
||||
try {
|
||||
GetAsyncResult (CompletedTaskFatory, FailingCallback, expectedState);
|
||||
} finally {
|
||||
Assert.AreEqual (1, callbackCount, "#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentNullException))]
|
||||
public void Invoke_NullResult ()
|
||||
{
|
||||
GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
Wait (null);
|
||||
}
|
||||
|
||||
[Test]
|
||||
[ExpectedException (typeof (ArgumentException))]
|
||||
public void Invoke_InvalidResult ()
|
||||
{
|
||||
GetAsyncResult (NullTaskFatory, DummyCallback, null);
|
||||
Wait (new DummyAsyncResult ());
|
||||
}
|
||||
|
||||
void SetTaskResult ()
|
||||
{
|
||||
if (expectedException == null)
|
||||
taskCompletion.SetResult (null);
|
||||
else
|
||||
taskCompletion.SetException (expectedException);
|
||||
}
|
||||
|
||||
void WaitTaskResult ()
|
||||
{
|
||||
if (expectedException == null) {
|
||||
Wait (taskAsyncResult);
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
Wait (taskAsyncResult);
|
||||
|
||||
Assert.Fail ("Expected exception was not thrown.");
|
||||
} catch (AssertionException) {
|
||||
throw;
|
||||
} catch (Exception ex) {
|
||||
Assert.AreSame (expectedException, ex, "WaitTaskResult#A01");
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeSync ()
|
||||
{
|
||||
InvokeSyncCore ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeSync_Failed ()
|
||||
{
|
||||
expectedException = new TestException ();
|
||||
|
||||
InvokeSyncCore ();
|
||||
}
|
||||
|
||||
void InvokeSyncCore ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (SyncTaskFatory, SyncCallback, expectedState);
|
||||
|
||||
Assert.IsNotNull (result, "InvokeSyncCore#A01");
|
||||
Assert.AreSame (taskAsyncResult, result, "InvokeSyncCore#A02");
|
||||
|
||||
WaitTaskResult ();
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeSyncCore#A03");
|
||||
Assert.AreEqual (1, callbackCount, "InvokeSyncCore#A04");
|
||||
}
|
||||
|
||||
Task SyncTaskFatory ()
|
||||
{
|
||||
Interlocked.Increment (ref factoryCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncTaskFatory#A01");
|
||||
|
||||
SetTaskResult ();
|
||||
|
||||
return taskCompletion.Task;
|
||||
}
|
||||
|
||||
void SyncCallback (IAsyncResult result)
|
||||
{
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "SyncCallback#A01");
|
||||
|
||||
Assert.IsNotNull (result, "SyncCallback#A02");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "SyncCallback#A03");
|
||||
Assert.IsTrue (result.IsCompleted, "SyncCallback#A04");
|
||||
Assert.IsTrue (result.CompletedSynchronously, "SyncCallback#A05");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "SyncCallback#A06");
|
||||
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "SyncCallback#A07");
|
||||
|
||||
taskAsyncResult = result;
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "SyncCallback#A08");
|
||||
Assert.AreEqual (1, callbackCount, "SyncCallback#A09");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeAsync ()
|
||||
{
|
||||
InvokeAsyncCore ();
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InvokeAsync_Failed ()
|
||||
{
|
||||
expectedException = new TestException ();
|
||||
|
||||
InvokeAsyncCore ();
|
||||
}
|
||||
|
||||
void InvokeAsyncCore ()
|
||||
{
|
||||
IAsyncResult result = GetAsyncResult (AsyncTaskFatory, AsyncCallback, expectedState);
|
||||
|
||||
Assert.IsNotNull (result, "InvokeAsyncCore#A01");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "InvokeAsyncCore#A02");
|
||||
Assert.IsFalse (result.IsCompleted, "InvokeAsyncCore#A03");
|
||||
Assert.IsFalse (result.CompletedSynchronously, "InvokeAsyncCore#A04");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "InvokeAsyncCore#A05");
|
||||
Assert.IsFalse (result.AsyncWaitHandle.WaitOne (0), "InvokeAsyncCore#A06");
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A07");
|
||||
Assert.AreEqual (0, callbackCount, "InvokeAsyncCore#A08");
|
||||
|
||||
taskAsyncResult = result;
|
||||
|
||||
SetTaskResult ();
|
||||
|
||||
callbackCompletion.Task.GetAwaiter ().GetResult ();
|
||||
|
||||
Assert.AreEqual (1, factoryCount, "InvokeAsyncCore#A09");
|
||||
Assert.AreEqual (1, callbackCount, "InvokeAsyncCore#A10");
|
||||
}
|
||||
|
||||
Task AsyncTaskFatory ()
|
||||
{
|
||||
Interlocked.Increment (ref factoryCount);
|
||||
|
||||
Assert.AreEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncTaskFatory#A01");
|
||||
|
||||
return taskCompletion.Task;
|
||||
}
|
||||
|
||||
void AsyncCallback (IAsyncResult result)
|
||||
{
|
||||
try {
|
||||
Interlocked.Increment (ref callbackCount);
|
||||
|
||||
Assert.AreNotEqual (testThreadId, Thread.CurrentThread.ManagedThreadId, "AsyncCallback#A01");
|
||||
|
||||
Assert.IsNotNull (result, "AsyncCallback#A02");
|
||||
Assert.AreSame (expectedState, result.AsyncState, "AsyncCallback#A03");
|
||||
Assert.IsTrue (result.IsCompleted, "AsyncCallback#A04");
|
||||
Assert.IsFalse (result.CompletedSynchronously, "AsyncCallback#A05");
|
||||
Assert.IsNotNull (result.AsyncWaitHandle, "AsyncCallback#A06");
|
||||
Assert.IsTrue (result.AsyncWaitHandle.WaitOne (0), "AsyncCallback#A07");
|
||||
|
||||
Assert.AreSame (taskAsyncResult, result, "AsyncCallback#A08");
|
||||
|
||||
WaitTaskResult ();
|
||||
|
||||
callbackCompletion.TrySetResult (null);
|
||||
} catch (Exception ex) {
|
||||
callbackCompletion.TrySetException (ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -1,5 +1,12 @@
|
||||
#include net_4_0_System.Web.dll.sources
|
||||
|
||||
System.Web/EventHandlerTaskAsyncHelper.cs
|
||||
System.Web/HttpTaskAsyncHandler.cs
|
||||
System.Web/MimeMapping.cs
|
||||
System.Web/ReadEntityBodyMode.cs
|
||||
|
||||
System.Web/UnvalidatedRequestValues.cs
|
||||
System.Web/UnvalidatedRequestValuesBase.cs
|
||||
System.Web/UnvalidatedRequestValuesWrapper.cs
|
||||
System.Web/TaskAsyncResult.cs
|
||||
System.Web/TaskEventHandler.cs
|
||||
System.Web.Security/MembershipPasswordAttribute.cs
|
||||
@@ -858,20 +858,7 @@ namespace System.Xml
|
||||
[PermissionSet (SecurityAction.InheritanceDemand, Unrestricted = true)]
|
||||
public virtual XmlNode ReadNode (XmlReader reader)
|
||||
{
|
||||
if (PreserveWhitespace)
|
||||
return ReadNodeCore (reader);
|
||||
XmlTextReader xtr = reader as XmlTextReader;
|
||||
if (xtr != null && xtr.WhitespaceHandling ==
|
||||
WhitespaceHandling.All) {
|
||||
try {
|
||||
xtr.WhitespaceHandling = WhitespaceHandling.Significant;
|
||||
return ReadNodeCore (reader);
|
||||
} finally {
|
||||
xtr.WhitespaceHandling = WhitespaceHandling.All;
|
||||
}
|
||||
}
|
||||
else
|
||||
return ReadNodeCore (reader);
|
||||
return ReadNodeCore (reader);
|
||||
}
|
||||
|
||||
XmlNode ReadNodeCore (XmlReader reader)
|
||||
|
||||
@@ -152,11 +152,17 @@ namespace System.Xml
|
||||
XmlTextReader xmlReader = new XmlTextReader (value, XmlNodeType.Element, ctx);
|
||||
xmlReader.XmlResolver = OwnerDocument.Resolver;
|
||||
|
||||
do {
|
||||
XmlNode n = OwnerDocument.ReadNode (xmlReader);
|
||||
if(n == null) break;
|
||||
AppendChild (n);
|
||||
} while (true);
|
||||
bool pw = OwnerDocument.PreserveWhitespace;
|
||||
OwnerDocument.PreserveWhitespace = true;
|
||||
try {
|
||||
do {
|
||||
XmlNode n = OwnerDocument.ReadNode (xmlReader);
|
||||
if(n == null) break;
|
||||
AppendChild (n);
|
||||
} while (true);
|
||||
} finally {
|
||||
OwnerDocument.PreserveWhitespace = pw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1433,5 +1433,43 @@ namespace MonoTests.System.Xml
|
||||
Assert.IsFalse (reader.ReadAttributeValue(), "#4");
|
||||
Assert.AreEqual (XmlNodeType.Text, reader.NodeType, "#5");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void Whitespaces ()
|
||||
{
|
||||
const string xml = "<?xml version=\"1.0\"?><test> <foo name=\"Hello\"> <value>World</value> </foo> <foo name=\"Foo\"><value>Bar</value></foo></test>";
|
||||
var reader = new XmlTextReader (new StringReader (xml));
|
||||
//reader.WhitespaceHandling = WhitespaceHandling.All;
|
||||
|
||||
reader.Read ();
|
||||
Assert.AreEqual (XmlNodeType.XmlDeclaration, reader.NodeType, "#1a");
|
||||
reader.Read ();
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#1b");
|
||||
Assert.AreEqual ("test", reader.Name, "#1c");
|
||||
|
||||
reader.Read ();
|
||||
if (reader.NodeType == XmlNodeType.Whitespace)
|
||||
reader.Read ();
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#2a");
|
||||
Assert.AreEqual ("foo", reader.Name, "#2b");
|
||||
|
||||
var doc = new XmlDocument ();
|
||||
//doc.PreserveWhitespace = true;
|
||||
doc.ReadNode (reader);
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Whitespace, reader.NodeType, "#3");
|
||||
|
||||
reader.Read ();
|
||||
if (reader.NodeType == XmlNodeType.Whitespace)
|
||||
reader.Read ();
|
||||
|
||||
Assert.AreEqual (XmlNodeType.Element, reader.NodeType, "#4");
|
||||
Assert.AreEqual ("foo", reader.Name, "#4b");
|
||||
|
||||
doc.ReadNode (reader);
|
||||
|
||||
Assert.AreEqual (XmlNodeType.EndElement, reader.NodeType, "#5");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -346,23 +346,21 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[Obsolete ("Use PagedMemorySize64")]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The number of bytes that are paged.")]
|
||||
public int PagedMemorySize {
|
||||
get {
|
||||
return(0);
|
||||
return(int)PagedMemorySize64;
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[Obsolete ("Use PagedSystemMemorySize64")]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The amount of paged system memory in bytes.")]
|
||||
public int PagedSystemMemorySize {
|
||||
get {
|
||||
return(0);
|
||||
return(int)PagedMemorySize64;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -406,23 +404,22 @@ namespace System.Diagnostics {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The number of bytes that are paged.")]
|
||||
[ComVisible (false)]
|
||||
public long PagedMemorySize64 {
|
||||
get {
|
||||
return(0);
|
||||
int error;
|
||||
return GetProcessData (pid, 12, out error);
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO]
|
||||
[DesignerSerializationVisibility (DesignerSerializationVisibility.Hidden)]
|
||||
[MonitoringDescription ("The amount of paged system memory in bytes.")]
|
||||
[ComVisible (false)]
|
||||
public long PagedSystemMemorySize64 {
|
||||
get {
|
||||
return(0);
|
||||
return PagedMemorySize64;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace System.Net.NetworkInformation {
|
||||
#else
|
||||
if (runningOnUnix) {
|
||||
try {
|
||||
if (Platform.IsMacOS)
|
||||
if (Platform.IsMacOS || Platform.IsFreeBSD)
|
||||
return MacOsNetworkInterface.ImplGetAllNetworkInterfaces ();
|
||||
else
|
||||
return LinuxNetworkInterface.ImplGetAllNetworkInterfaces ();
|
||||
|
||||
@@ -318,7 +318,7 @@ namespace System.Net.WebSockets
|
||||
var opCode = MessageTypeToWire (type);
|
||||
var length = buffer.Count;
|
||||
|
||||
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0 : 0x80));
|
||||
headerBuffer[0] = (byte)(opCode | (endOfMessage ? 0x80 : 0));
|
||||
if (length < 126) {
|
||||
headerBuffer[1] = (byte)length;
|
||||
} else if (length <= ushort.MaxValue) {
|
||||
|
||||
@@ -329,6 +329,9 @@ namespace System.Net {
|
||||
return false;
|
||||
if (InputStream.EndRead (ares) <= 0)
|
||||
return true;
|
||||
} catch (ObjectDisposedException e) {
|
||||
input_stream = null;
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -186,14 +186,6 @@ namespace System.Net
|
||||
}
|
||||
|
||||
// Properties
|
||||
|
||||
/*
|
||||
* Hack for bug #19334.
|
||||
*
|
||||
*/
|
||||
public static bool Mono_Suppress_TLS_Alerts {
|
||||
get; set;
|
||||
}
|
||||
|
||||
[Obsolete ("Use ServerCertificateValidationCallback instead", false)]
|
||||
public static ICertificatePolicy CertificatePolicy {
|
||||
|
||||
@@ -28,36 +28,56 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace System {
|
||||
internal static class Platform {
|
||||
static bool checkedOS;
|
||||
static bool isMacOS;
|
||||
static bool isFreeBSD;
|
||||
|
||||
#if MONOTOUCH || XAMMAC
|
||||
public static bool IsMacOS {
|
||||
get { return true; }
|
||||
private static void CheckOS() {
|
||||
isMacOS = true;
|
||||
checkedOS = true;
|
||||
}
|
||||
#else
|
||||
[DllImport ("libc")]
|
||||
static extern int uname (IntPtr buf);
|
||||
|
||||
static bool checkedIsMacOS;
|
||||
static bool isMacOS;
|
||||
|
||||
|
||||
private static void CheckOS() {
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix) {
|
||||
checkedOS = true;
|
||||
return;
|
||||
}
|
||||
|
||||
IntPtr buf = Marshal.AllocHGlobal (8192);
|
||||
if (uname (buf) == 0) {
|
||||
string os = Marshal.PtrToStringAnsi (buf);
|
||||
switch (os) {
|
||||
case "Darwin":
|
||||
isMacOS = true;
|
||||
break;
|
||||
case "FreeBSD":
|
||||
isFreeBSD = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
Marshal.FreeHGlobal (buf);
|
||||
checkedOS = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsMacOS {
|
||||
get {
|
||||
if (Environment.OSVersion.Platform != PlatformID.Unix)
|
||||
return false;
|
||||
|
||||
if (!checkedIsMacOS) {
|
||||
IntPtr buf = Marshal.AllocHGlobal (8192);
|
||||
if (uname (buf) == 0) {
|
||||
string os = Marshal.PtrToStringAnsi (buf);
|
||||
if (os == "Darwin")
|
||||
isMacOS = true;
|
||||
}
|
||||
Marshal.FreeHGlobal (buf);
|
||||
checkedIsMacOS = true;
|
||||
}
|
||||
|
||||
if (!checkedOS)
|
||||
CheckOS();
|
||||
return isMacOS;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
public static bool IsFreeBSD {
|
||||
get {
|
||||
if (!checkedOS)
|
||||
CheckOS();
|
||||
return isFreeBSD;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -269,15 +269,6 @@ namespace System {
|
||||
return state.remaining.Length > 0;
|
||||
}
|
||||
|
||||
if (state.elements.scheme == Uri.UriSchemeFile) {
|
||||
// under Windows all file:// URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
|
||||
#if BOOTSTRAP_BASIC
|
||||
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
|
||||
#else
|
||||
state.elements.isUnc = Environment.IsRunningOnWindows;
|
||||
#endif
|
||||
}
|
||||
|
||||
return ParseDelimiter (state);
|
||||
}
|
||||
|
||||
@@ -430,7 +421,17 @@ namespace System {
|
||||
state.elements.host = state.elements.host.ToLowerInvariant ();
|
||||
|
||||
state.remaining = part.Substring (state.elements.host.Length);
|
||||
|
||||
|
||||
if (state.elements.scheme == Uri.UriSchemeFile &&
|
||||
state.elements.host != "") {
|
||||
// under Windows all file://host URI are considered UNC, which is not the case other MacOS (e.g. Silverlight)
|
||||
#if BOOTSTRAP_BASIC
|
||||
state.elements.isUnc = (Path.DirectorySeparatorChar == '\\');
|
||||
#else
|
||||
state.elements.isUnc = Environment.IsRunningOnWindows;
|
||||
#endif
|
||||
}
|
||||
|
||||
return state.remaining.Length > 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -220,6 +220,45 @@ namespace MonoTests.System.Net.WebSockets
|
||||
Assert.Fail ("Should have thrown");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[Category ("NotWorking")] // FIXME: test relies on unimplemented HttpListenerContext.AcceptWebSocketAsync (), reenable it when the method is implemented
|
||||
public void SendAsyncEndOfMessageTest ()
|
||||
{
|
||||
var cancellationToken = new CancellationTokenSource (TimeSpan.FromSeconds (30)).Token;
|
||||
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Text, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Text, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (false, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
|
||||
SendAsyncEndOfMessageTest (true, WebSocketMessageType.Binary, cancellationToken).Wait (5000);
|
||||
}
|
||||
|
||||
public async Task SendAsyncEndOfMessageTest (bool expectedEndOfMessage, WebSocketMessageType webSocketMessageType, CancellationToken cancellationToken)
|
||||
{
|
||||
using (var client = new ClientWebSocket ()) {
|
||||
// Configure the listener.
|
||||
var serverReceive = HandleHttpWebSocketRequestAsync<WebSocketReceiveResult> (async socket => await socket.ReceiveAsync (new ArraySegment<byte> (new byte[32]), cancellationToken), cancellationToken);
|
||||
|
||||
// Connect to the listener and make the request.
|
||||
await client.ConnectAsync (new Uri ("ws://localhost:" + Port + "/"), cancellationToken);
|
||||
await client.SendAsync (new ArraySegment<byte> (Encoding.UTF8.GetBytes ("test")), webSocketMessageType, expectedEndOfMessage, cancellationToken);
|
||||
|
||||
// Wait for the listener to handle the request and return its result.
|
||||
var result = await serverReceive;
|
||||
|
||||
// Cleanup and check results.
|
||||
await client.CloseAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
|
||||
Assert.AreEqual (expectedEndOfMessage, result.EndOfMessage, "EndOfMessage should be " + expectedEndOfMessage);
|
||||
}
|
||||
}
|
||||
|
||||
async Task<T> HandleHttpWebSocketRequestAsync<T> (Func<WebSocket, Task<T>> action, CancellationToken cancellationToken)
|
||||
{
|
||||
var ctx = await this.listener.GetContextAsync ();
|
||||
var wsContext = await ctx.AcceptWebSocketAsync (null);
|
||||
var result = await action (wsContext.WebSocket);
|
||||
await wsContext.WebSocket.CloseOutputAsync (WebSocketCloseStatus.NormalClosure, "Finished", cancellationToken);
|
||||
return result;
|
||||
}
|
||||
|
||||
async Task HandleHttpRequestAsync (Action<HttpListenerRequest, HttpListenerResponse> handler)
|
||||
{
|
||||
var ctx = await listener.GetContextAsync ();
|
||||
|
||||
@@ -1529,7 +1529,7 @@ namespace MonoTests.System.Net {
|
||||
Cookie cookie = new Cookie ("name", "value")
|
||||
{
|
||||
Domain = ".example.com",
|
||||
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
|
||||
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
|
||||
HttpOnly = true,
|
||||
Secure = true,
|
||||
};
|
||||
@@ -1562,14 +1562,14 @@ namespace MonoTests.System.Net {
|
||||
Cookie cookie = new Cookie ("name", "value")
|
||||
{
|
||||
Domain = ".example.com",
|
||||
Expires = new DateTime (2100, 1, 1, 0, 0, 0, DateTimeKind.Utc),
|
||||
Expires = new DateTime (2015, 1, 1, 0, 0, 0, DateTimeKind.Utc),
|
||||
HttpOnly = true,
|
||||
Secure = true,
|
||||
};
|
||||
|
||||
Uri uri = new Uri ("https://www.example.com/path/file");
|
||||
CookieContainer container = new CookieContainer ();
|
||||
container.SetCookies (uri, "name=value; domain=.example.com; expires=Fri, 01-Jan-2100 00:00:00 GMT; HttpOnly; secure");
|
||||
container.SetCookies (uri, "name=value; domain=.example.com; expires=Thu, 01-Jan-2015 00:00:00 GMT; HttpOnly; secure");
|
||||
CookieCollection collection = container.GetCookies (uri);
|
||||
Assert.AreEqual (collection.Count, 1, "#A1");
|
||||
Cookie cloned = collection [0];
|
||||
|
||||
@@ -474,6 +474,57 @@ namespace MonoTests.System.Net {
|
||||
Event.Close ();
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ConnectionReuse ()
|
||||
{
|
||||
var uri = "http://localhost:1338/";
|
||||
|
||||
HttpListener listener = new HttpListener ();
|
||||
listener.Prefixes.Add (uri);
|
||||
listener.Start ();
|
||||
|
||||
IPEndPoint expectedIpEndPoint = CreateListenerRequest (listener, uri);
|
||||
|
||||
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse1");
|
||||
Assert.AreEqual (expectedIpEndPoint, CreateListenerRequest (listener, uri), "reuse2");
|
||||
}
|
||||
|
||||
public IPEndPoint CreateListenerRequest (HttpListener listener, string uri)
|
||||
{
|
||||
IPEndPoint ipEndPoint = null;
|
||||
listener.BeginGetContext ((result) => ipEndPoint = ListenerCallback (result), listener);
|
||||
|
||||
var request = (HttpWebRequest) WebRequest.Create (uri);
|
||||
request.Method = "POST";
|
||||
|
||||
// We need to write something
|
||||
request.GetRequestStream ().Write (new byte [] {(byte)'a'}, 0, 1);
|
||||
request.GetRequestStream ().Dispose ();
|
||||
|
||||
// Send request, socket is created or reused.
|
||||
var response = request.GetResponse ();
|
||||
|
||||
// Close response so socket can be reused.
|
||||
response.Close ();
|
||||
|
||||
return ipEndPoint;
|
||||
}
|
||||
|
||||
public static IPEndPoint ListenerCallback (IAsyncResult result)
|
||||
{
|
||||
var listener = (HttpListener) result.AsyncState;
|
||||
var context = listener.EndGetContext (result);
|
||||
var clientEndPoint = context.Request.RemoteEndPoint;
|
||||
|
||||
// Disposing InputStream should not avoid socket reuse
|
||||
context.Request.InputStream.Dispose ();
|
||||
|
||||
// Close OutputStream to send response
|
||||
context.Response.OutputStream.Close ();
|
||||
|
||||
return clientEndPoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -919,6 +919,102 @@ TextWriter sw = Console.Out;
|
||||
Assert.AreEqual ("/%3C%3E%25%22%7B%7D%7C/%5E%60;/:@&=+$,%5B%5D%3F", uri.AbsolutePath, "Special");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file:///c:/subdir/file");
|
||||
|
||||
Assert.AreEqual ("c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file:///c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual ("c:\\subdir\\file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual (String.Empty, uri.Authority, "Authority");
|
||||
Assert.AreEqual (String.Empty, uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual (String.Empty, uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Basic, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.IsFalse (uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file:///c:/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalhostWinFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file://localhost/c:/subdir/file");
|
||||
|
||||
Assert.AreEqual ("/c:/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual (isWin32 ? "\\\\localhost\\c:\\subdir\\file" : "/c:/subdir/file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("/c:/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual ("localhost", uri.Authority, "Authority");
|
||||
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual ("localhost", uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file://localhost/c:/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("c:/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void LocalhostFile ()
|
||||
{
|
||||
Uri uri = new Uri ("file://localhost/dir/subdir/file");
|
||||
|
||||
Assert.AreEqual ("/dir/subdir/file", uri.AbsolutePath, "AbsolutePath");
|
||||
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.AbsoluteUri, "AbsoluteUri");
|
||||
Assert.AreEqual (isWin32 ? "\\\\localhost\\dir\\subdir\\file" : "/dir/subdir/file", uri.LocalPath, "LocalPath");
|
||||
Assert.AreEqual ("/dir/subdir/file", uri.PathAndQuery, "PathAndQuery");
|
||||
Assert.AreEqual (String.Empty, uri.Query, "Query");
|
||||
Assert.AreEqual ("file", uri.Segments [3], "Segments [3]");
|
||||
|
||||
Assert.AreEqual ("localhost", uri.Authority, "Authority");
|
||||
Assert.AreEqual ("localhost", uri.DnsSafeHost, "DnsSafeHost");
|
||||
Assert.AreEqual (String.Empty, uri.Fragment, "Fragment");
|
||||
Assert.AreEqual ("localhost", uri.Host, "Host");
|
||||
Assert.AreEqual (UriHostNameType.Dns, uri.HostNameType, "HostNameType");
|
||||
Assert.IsTrue (uri.IsAbsoluteUri, "IsAbsoluteUri");
|
||||
Assert.IsTrue (uri.IsDefaultPort, "IsDefaultPort");
|
||||
Assert.IsTrue (uri.IsFile, "IsFile");
|
||||
Assert.IsTrue (uri.IsLoopback, "IsLoopback");
|
||||
Assert.AreEqual (isWin32, uri.IsUnc, "IsUnc");
|
||||
Assert.AreEqual ("file://localhost/dir/subdir/file", uri.OriginalString, "OriginalString");
|
||||
Assert.AreEqual (-1, uri.Port, "Port");
|
||||
Assert.AreEqual ("file", uri.Scheme, "Scheme");
|
||||
Assert.AreEqual ("/", uri.Segments [0], "Segments [0]");
|
||||
Assert.AreEqual ("dir/", uri.Segments [1], "Segments [1]");
|
||||
Assert.AreEqual ("subdir/", uri.Segments [2], "Segments [2]");
|
||||
Assert.IsFalse (uri.UserEscaped, "UserEscaped");
|
||||
Assert.AreEqual (String.Empty, uri.UserInfo, "UserInfo");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void PathReduction_2e ()
|
||||
{
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
#!/bin/sh
|
||||
|
||||
SCRIPT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5/}
|
||||
CSHARP=$SCRIPT_PATH/../lib/net_4_5/csharp.exe
|
||||
MONO=$SCRIPT_PATH/../../../mono/mini/mono
|
||||
|
||||
export MONO_PATH=${MONO_PATH:-$SCRIPT_PATH/../lib/net_4_5}
|
||||
|
||||
TZ_FAILS=0
|
||||
TZ_COUNT=0
|
||||
@@ -10,7 +13,7 @@ FORMAT="%a %b %d %T %Y"
|
||||
for tz in $(cd /usr/share/zoneinfo/; find * -type f -print); do
|
||||
TZ_COUNT=$(expr $TZ_COUNT + 1)
|
||||
SYS_DATETIME=$(date -ju -f "$FORMAT" "$(TZ=$tz date "+$FORMAT")" "+%s")
|
||||
CS_DATETIME=$(TZ=$tz csharp -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
|
||||
CS_DATETIME=$(TZ=$tz $MONO $CSHARP -e '(int)(DateTime.Now - new DateTime(1970, 1, 1)).TotalSeconds;')
|
||||
DIFF=$(expr $SYS_DATETIME - $CS_DATETIME)
|
||||
if [ "$DIFF" -gt "5" ] || [ "$DIFF" -lt "-5" ]; then
|
||||
TZ_FAILS=$(expr $TZ_FAILS + 1)
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace System.Collections.Concurrent
|
||||
{
|
||||
Node node = new Node ();
|
||||
node.Value = item;
|
||||
|
||||
|
||||
Node oldTail = null;
|
||||
Node oldNext = null;
|
||||
|
||||
@@ -71,6 +71,8 @@ namespace System.Collections.Concurrent
|
||||
while (!update) {
|
||||
oldTail = tail;
|
||||
oldNext = oldTail.Next;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
// Did tail was already updated ?
|
||||
if (tail == oldTail) {
|
||||
@@ -104,6 +106,8 @@ namespace System.Collections.Concurrent
|
||||
Node oldHead = head;
|
||||
Node oldTail = tail;
|
||||
oldNext = oldHead.Next;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
if (oldHead == head) {
|
||||
// Empty case ?
|
||||
@@ -146,6 +150,8 @@ namespace System.Collections.Concurrent
|
||||
}
|
||||
|
||||
result = oldNext.Value;
|
||||
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
//check if head has been updated
|
||||
update = head != oldHead;
|
||||
|
||||
@@ -670,7 +670,7 @@ namespace System.Globalization
|
||||
//
|
||||
// Be careful not to cause recursive CultureInfo initialization
|
||||
//
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{0:X4}) is not a supported culture.", culture.ToString (InvariantCulture));
|
||||
var msg = string.Format (InvariantCulture, "Culture ID {0} (0x{1}) is not a supported culture.", culture.ToString (InvariantCulture), culture.ToString ("X4", InvariantCulture));
|
||||
#if NET_4_0
|
||||
throw new CultureNotFoundException ("culture", msg);
|
||||
#else
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
// IErrorInfo interface
|
||||
//
|
||||
// Eberhard Beilharz ([email protected])
|
||||
//
|
||||
// Copyright (C) 2011 SIL International
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
{
|
||||
[ComImport]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[Guid ("1CF2B120-547D-101B-8E65-08002B2BD119")]
|
||||
[InterfaceType (ComInterfaceType.InterfaceIsIUnknown)]
|
||||
internal interface IErrorInfo
|
||||
{
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetGUID (out Guid pGuid);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetSource ([MarshalAs (UnmanagedType.BStr)] out string pBstrSource);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetDescription ([MarshalAs (UnmanagedType.BStr)] out string pbstrDescription);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetHelpFile ([MarshalAs (UnmanagedType.BStr)] out string pBstrHelpFile);
|
||||
|
||||
[MethodImpl (MethodImplOptions.InternalCall, MethodCodeType=MethodCodeType.Runtime)]
|
||||
[PreserveSig]
|
||||
int GetHelpContext (out uint pdwHelpContext);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// ManagedErrorInfo class
|
||||
//
|
||||
// Eberhard Beilharz ([email protected])
|
||||
//
|
||||
// Copyright (C) 2012 SIL International
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Security;
|
||||
|
||||
namespace System.Runtime.InteropServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class that allows to pass an exception as an IErrorInfo object. This is useful
|
||||
/// when we get an exception in managed code that is called from unmanaged code that is called
|
||||
/// from managed code and we want to get to the exception in the outer managed code.
|
||||
/// </summary>
|
||||
internal class ManagedErrorInfo: IErrorInfo
|
||||
{
|
||||
private Exception m_Exception;
|
||||
public ManagedErrorInfo (Exception e)
|
||||
{
|
||||
m_Exception = e;
|
||||
}
|
||||
|
||||
public Exception Exception {
|
||||
get { return m_Exception; }
|
||||
}
|
||||
|
||||
#region IErrorInfo
|
||||
public int GetGUID (out Guid guid)
|
||||
{
|
||||
// not supported
|
||||
guid = Guid.Empty;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetSource (out string source)
|
||||
{
|
||||
source = m_Exception.Source;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetDescription (out string description)
|
||||
{
|
||||
description = m_Exception.Message;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetHelpFile (out string helpFile)
|
||||
{
|
||||
helpFile = m_Exception.HelpLink;
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int GetHelpContext(out uint helpContext)
|
||||
{
|
||||
// not supported
|
||||
helpContext = 0;
|
||||
return 0;
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -414,9 +414,11 @@ namespace System.Runtime.InteropServices
|
||||
#endif // !FULL_AOT_RUNTIME
|
||||
|
||||
#if !FULL_AOT_RUNTIME
|
||||
[MonoTODO ("SetErrorInfo")]
|
||||
public static int GetHRForException (Exception e)
|
||||
{
|
||||
var errorInfo = new ManagedErrorInfo(e);
|
||||
SetErrorInfo (0, errorInfo);
|
||||
|
||||
return e.hresult;
|
||||
}
|
||||
|
||||
@@ -1314,27 +1316,314 @@ namespace System.Runtime.InteropServices
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
public static Exception GetExceptionForHR (int errorCode) {
|
||||
return GetExceptionForHR (errorCode, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static Exception GetExceptionForHR (int errorCode, IntPtr errorInfo) {
|
||||
|
||||
private static Exception ConvertHrToException (int errorCode)
|
||||
{
|
||||
const int MSEE_E_APPDOMAINUNLOADED = unchecked ((int)0x80131014L);
|
||||
const int COR_E_APPLICATION = unchecked ((int)0x80131600L);
|
||||
const int E_INVALIDARG = unchecked ((int)0x80070057);
|
||||
const int COR_E_ARGUMENTOUTOFRANGE = unchecked ((int)0x80131502L);
|
||||
const int COR_E_ARITHMETIC = unchecked ((int)0x80070216);
|
||||
const int COR_E_ARRAYTYPEMISMATCH = unchecked ((int)0x80131503L);
|
||||
const int COR_E_BADIMAGEFORMAT = unchecked ((int)0x8007000BL);
|
||||
const int ERROR_BAD_FORMAT = unchecked ((int)0x0B);
|
||||
//const int COR_E_COMEMULATE_ERROR = unchecked ((int)?);
|
||||
const int COR_E_CONTEXTMARSHAL = unchecked ((int)0x80131504L);
|
||||
//const int COR_E_CORE = unchecked ((int)?);
|
||||
const int NTE_FAIL = unchecked ((int)0x80090020L);
|
||||
const int COR_E_DIRECTORYNOTFOUND = unchecked ((int)0x80070003L);
|
||||
const int ERROR_PATH_NOT_FOUND = unchecked ((int)0x03);
|
||||
const int COR_E_DIVIDEBYZERO = unchecked ((int)0x80020012L);
|
||||
const int COR_E_DUPLICATEWAITOBJECT = unchecked ((int)0x80131529L);
|
||||
const int COR_E_ENDOFSTREAM = unchecked ((int)0x80070026L);
|
||||
const int COR_E_TYPELOAD = unchecked ((int)0x80131522L);
|
||||
const int COR_E_EXCEPTION = unchecked ((int)0x80131500L);
|
||||
const int COR_E_EXECUTIONENGINE = unchecked ((int)0x80131506L);
|
||||
const int COR_E_FIELDACCESS = unchecked ((int)0x80131507L);
|
||||
const int COR_E_FILENOTFOUND = unchecked ((int)0x80070002L);
|
||||
const int ERROR_FILE_NOT_FOUND = unchecked ((int)0x02);
|
||||
const int COR_E_FORMAT = unchecked ((int)0x80131537L);
|
||||
const int COR_E_INDEXOUTOFRANGE = unchecked ((int)0x80131508L);
|
||||
const int COR_E_INVALIDCAST = unchecked ((int)0x80004002L);
|
||||
const int COR_E_INVALIDCOMOBJECT = unchecked ((int)0x80131527L);
|
||||
const int COR_E_INVALIDFILTERCRITERIA = unchecked ((int)0x80131601L);
|
||||
const int COR_E_INVALIDOLEVARIANTTYPE = unchecked ((int)0x80131531L);
|
||||
const int COR_E_INVALIDOPERATION = unchecked ((int)0x80131509L);
|
||||
const int COR_E_IO = unchecked ((int)0x80131620L);
|
||||
const int COR_E_MEMBERACCESS = unchecked ((int)0x8013151AL);
|
||||
const int COR_E_METHODACCESS = unchecked ((int)0x80131510L);
|
||||
const int COR_E_MISSINGFIELD = unchecked ((int)0x80131511L);
|
||||
const int COR_E_MISSINGMANIFESTRESOURCE = unchecked ((int)0x80131532L);
|
||||
const int COR_E_MISSINGMEMBER = unchecked ((int)0x80131512L);
|
||||
const int COR_E_MISSINGMETHOD = unchecked ((int)0x80131513L);
|
||||
const int COR_E_MULTICASTNOTSUPPORTED = unchecked ((int)0x80131514L);
|
||||
const int COR_E_NOTFINITENUMBER = unchecked ((int)0x80131528L);
|
||||
const int E_NOTIMPL = unchecked ((int)0x80004001L);
|
||||
const int COR_E_NOTSUPPORTED = unchecked ((int)0x80131515L);
|
||||
const int COR_E_NULLREFERENCE = unchecked ((int)0x80004003L);
|
||||
const int E_OUTOFMEMORY = unchecked ((int)0x8007000EL);
|
||||
const int E_INVALIDARG = unchecked ((int)0X80070057);
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case E_OUTOFMEMORY:
|
||||
return new OutOfMemoryException ();
|
||||
case E_INVALIDARG:
|
||||
return new ArgumentException ();
|
||||
const int COR_E_OVERFLOW = unchecked ((int)0x80131516L);
|
||||
const int COR_E_PATHTOOLONG = unchecked ((int)0x800700CEL);
|
||||
const int ERROR_FILENAME_EXCED_RANGE = unchecked ((int)0xCE);
|
||||
const int COR_E_RANK = unchecked ((int)0x80131517L);
|
||||
const int COR_E_REFLECTIONTYPELOAD = unchecked ((int)0x80131602L);
|
||||
const int COR_E_REMOTING = unchecked ((int)0x8013150BL);
|
||||
const int COR_E_SAFEARRAYTYPEMISMATCH = unchecked ((int)0x80131533L);
|
||||
const int COR_E_SECURITY = unchecked ((int)0x8013150AL);
|
||||
const int COR_E_SERIALIZATION = unchecked ((int)0x8013150CL);
|
||||
const int COR_E_STACKOVERFLOW = unchecked ((int)0x800703E9L);
|
||||
const int ERROR_STACK_OVERFLOW = unchecked ((int)0x03E9);
|
||||
const int COR_E_SYNCHRONIZATIONLOCK = unchecked ((int)0x80131518L);
|
||||
const int COR_E_SYSTEM = unchecked ((int)0x80131501L);
|
||||
const int COR_E_TARGET = unchecked ((int)0x80131603L);
|
||||
const int COR_E_TARGETINVOCATION = unchecked ((int)0x80131604L);
|
||||
const int COR_E_TARGETPARAMCOUNT = unchecked ((int)0x8002000EL);
|
||||
const int COR_E_THREADABORTED = unchecked ((int)0x80131530L);
|
||||
const int COR_E_THREADINTERRUPTED = unchecked ((int)0x80131519L);
|
||||
const int COR_E_THREADSTATE = unchecked ((int)0x80131520L);
|
||||
const int COR_E_THREADSTOP = unchecked ((int)0x80131521L);
|
||||
const int COR_E_TYPEINITIALIZATION = unchecked ((int)0x80131534L);
|
||||
const int COR_E_VERIFICATION = unchecked ((int)0x8013150DL);
|
||||
//const int COR_E_WEAKREFERENCE = unchecked ((int)?);
|
||||
//const int COR_E_VTABLECALLSNOTSUPPORTED = unchecked ((int));
|
||||
|
||||
switch (errorCode) {
|
||||
case MSEE_E_APPDOMAINUNLOADED:
|
||||
return new AppDomainUnloadedException ();
|
||||
case COR_E_APPLICATION:
|
||||
return new ApplicationException ();
|
||||
case E_INVALIDARG:
|
||||
return new ArgumentException ();
|
||||
case COR_E_ARGUMENTOUTOFRANGE:
|
||||
return new ArgumentOutOfRangeException ();
|
||||
case COR_E_ARITHMETIC:
|
||||
return new ArithmeticException ();
|
||||
case COR_E_ARRAYTYPEMISMATCH:
|
||||
return new ArrayTypeMismatchException ();
|
||||
case COR_E_BADIMAGEFORMAT:
|
||||
case ERROR_BAD_FORMAT:
|
||||
return new BadImageFormatException ();
|
||||
// case COR_E_COMEMULATE_ERROR:
|
||||
// return new COMEmulateException ();
|
||||
case COR_E_CONTEXTMARSHAL:
|
||||
return new ContextMarshalException ();
|
||||
// case COR_E_CORE:
|
||||
// return new CoreException ();
|
||||
case NTE_FAIL:
|
||||
return new System.Security.Cryptography.CryptographicException ();
|
||||
case COR_E_DIRECTORYNOTFOUND:
|
||||
case ERROR_PATH_NOT_FOUND:
|
||||
return new System.IO.DirectoryNotFoundException ();
|
||||
case COR_E_DIVIDEBYZERO:
|
||||
return new DivideByZeroException ();
|
||||
case COR_E_DUPLICATEWAITOBJECT:
|
||||
return new DuplicateWaitObjectException ();
|
||||
case COR_E_ENDOFSTREAM:
|
||||
return new System.IO.EndOfStreamException ();
|
||||
case COR_E_EXCEPTION:
|
||||
return new Exception ();
|
||||
case COR_E_EXECUTIONENGINE:
|
||||
return new ExecutionEngineException ();
|
||||
case COR_E_FIELDACCESS:
|
||||
return new FieldAccessException ();
|
||||
case COR_E_FILENOTFOUND:
|
||||
case ERROR_FILE_NOT_FOUND:
|
||||
return new System.IO.FileNotFoundException ();
|
||||
case COR_E_FORMAT:
|
||||
return new FormatException ();
|
||||
case COR_E_INDEXOUTOFRANGE:
|
||||
return new IndexOutOfRangeException ();
|
||||
case COR_E_INVALIDCAST:
|
||||
// E_NOINTERFACE has same value as COR_E_INVALIDCAST
|
||||
return new InvalidCastException ();
|
||||
case COR_E_INVALIDCOMOBJECT:
|
||||
return new InvalidComObjectException ();
|
||||
case COR_E_INVALIDFILTERCRITERIA:
|
||||
return new InvalidFilterCriteriaException ();
|
||||
case COR_E_INVALIDOLEVARIANTTYPE:
|
||||
return new InvalidOleVariantTypeException ();
|
||||
case COR_E_INVALIDOPERATION:
|
||||
return new InvalidOperationException ();
|
||||
case COR_E_IO:
|
||||
return new System.IO.IOException ();
|
||||
case COR_E_MEMBERACCESS:
|
||||
return new MemberAccessException ();
|
||||
case COR_E_METHODACCESS:
|
||||
return new MethodAccessException ();
|
||||
case COR_E_MISSINGFIELD:
|
||||
return new MissingFieldException ();
|
||||
case COR_E_MISSINGMANIFESTRESOURCE:
|
||||
return new System.Resources.MissingManifestResourceException ();
|
||||
case COR_E_MISSINGMEMBER:
|
||||
return new MissingMemberException ();
|
||||
case COR_E_MISSINGMETHOD:
|
||||
return new MissingMethodException ();
|
||||
case COR_E_MULTICASTNOTSUPPORTED:
|
||||
return new MulticastNotSupportedException ();
|
||||
case COR_E_NOTFINITENUMBER:
|
||||
return new NotFiniteNumberException ();
|
||||
case E_NOTIMPL:
|
||||
return new NotImplementedException ();
|
||||
case COR_E_NOTSUPPORTED:
|
||||
return new NotSupportedException ();
|
||||
case COR_E_NULLREFERENCE:
|
||||
// E_POINTER has the same value as COR_E_NULLREFERENCE
|
||||
return new NullReferenceException ();
|
||||
case E_OUTOFMEMORY:
|
||||
// COR_E_OUTOFMEMORY has the same value as E_OUTOFMEMORY
|
||||
return new OutOfMemoryException ();
|
||||
case COR_E_OVERFLOW:
|
||||
return new OverflowException ();
|
||||
case COR_E_PATHTOOLONG:
|
||||
case ERROR_FILENAME_EXCED_RANGE:
|
||||
return new System.IO.PathTooLongException ();
|
||||
case COR_E_RANK:
|
||||
return new RankException ();
|
||||
case COR_E_REFLECTIONTYPELOAD:
|
||||
return new System.Reflection.ReflectionTypeLoadException (new Type[] { }, new Exception[] { });
|
||||
case COR_E_REMOTING:
|
||||
return new System.Runtime.Remoting.RemotingException ();
|
||||
case COR_E_SAFEARRAYTYPEMISMATCH:
|
||||
return new SafeArrayTypeMismatchException ();
|
||||
case COR_E_SECURITY:
|
||||
return new SecurityException ();
|
||||
case COR_E_SERIALIZATION:
|
||||
return new System.Runtime.Serialization.SerializationException ();
|
||||
case COR_E_STACKOVERFLOW:
|
||||
case ERROR_STACK_OVERFLOW:
|
||||
return new StackOverflowException ();
|
||||
case COR_E_SYNCHRONIZATIONLOCK:
|
||||
return new SynchronizationLockException ();
|
||||
case COR_E_SYSTEM:
|
||||
return new SystemException ();
|
||||
case COR_E_TARGET:
|
||||
return new TargetException ();
|
||||
case COR_E_TARGETINVOCATION:
|
||||
return new System.Reflection.TargetInvocationException (null);
|
||||
case COR_E_TARGETPARAMCOUNT:
|
||||
return new TargetParameterCountException ();
|
||||
// case COR_E_THREADABORTED:
|
||||
// ThreadAbortException c'tor is inaccessible
|
||||
// return new System.Threading.ThreadAbortException ();
|
||||
case COR_E_THREADINTERRUPTED:
|
||||
return new ThreadInterruptedException ();
|
||||
case COR_E_THREADSTATE:
|
||||
return new ThreadStateException ();
|
||||
// case COR_E_THREADSTOP:
|
||||
// ThreadStopException does not exist
|
||||
// return new System.Threading.ThreadStopException ();
|
||||
case COR_E_TYPELOAD:
|
||||
return new TypeLoadException ();
|
||||
// MSDN lists COR_E_TYPELOAD twice with different exceptions.
|
||||
// return new EntryPointNotFoundException ();
|
||||
case COR_E_TYPEINITIALIZATION:
|
||||
return new TypeInitializationException("", null);
|
||||
case COR_E_VERIFICATION:
|
||||
return new VerificationException ();
|
||||
// case COR_E_WEAKREFERENCE:
|
||||
// return new WeakReferenceException ();
|
||||
// case COR_E_VTABLECALLSNOTSUPPORTED:
|
||||
// return new VTableCallsNotSupportedException ();
|
||||
}
|
||||
if (errorCode < 0)
|
||||
return new COMException ("", errorCode);
|
||||
return null;
|
||||
}
|
||||
|
||||
[DllImport ("oleaut32.dll", CharSet=CharSet.Unicode, EntryPoint = "SetErrorInfo")]
|
||||
static extern int _SetErrorInfo (int dwReserved,
|
||||
[MarshalAs(UnmanagedType.Interface)] IErrorInfo pIErrorInfo);
|
||||
|
||||
[DllImport ("oleaut32.dll", CharSet=CharSet.Unicode, EntryPoint = "GetErrorInfo")]
|
||||
static extern int _GetErrorInfo (int dwReserved,
|
||||
[MarshalAs(UnmanagedType.Interface)] out IErrorInfo ppIErrorInfo);
|
||||
|
||||
static bool SetErrorInfoNotAvailable;
|
||||
static bool GetErrorInfoNotAvailable;
|
||||
|
||||
internal static int SetErrorInfo (int dwReserved, IErrorInfo errorInfo)
|
||||
{
|
||||
int retVal = 0;
|
||||
errorInfo = null;
|
||||
|
||||
if (SetErrorInfoNotAvailable)
|
||||
return -1;
|
||||
|
||||
try {
|
||||
retVal = _SetErrorInfo (dwReserved, errorInfo);
|
||||
}
|
||||
catch (Exception) {
|
||||
// ignore any exception - probably there's no suitable SetErrorInfo
|
||||
// method available.
|
||||
SetErrorInfoNotAvailable = true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
internal static int GetErrorInfo (int dwReserved, out IErrorInfo errorInfo)
|
||||
{
|
||||
int retVal = 0;
|
||||
errorInfo = null;
|
||||
|
||||
if (GetErrorInfoNotAvailable)
|
||||
return -1;
|
||||
|
||||
try {
|
||||
retVal = _GetErrorInfo (dwReserved, out errorInfo);
|
||||
}
|
||||
catch (Exception) {
|
||||
// ignore any exception - probably there's no suitable GetErrorInfo
|
||||
// method available.
|
||||
GetErrorInfoNotAvailable = true;
|
||||
}
|
||||
return retVal;
|
||||
}
|
||||
|
||||
public static Exception GetExceptionForHR (int errorCode)
|
||||
{
|
||||
return GetExceptionForHR (errorCode, IntPtr.Zero);
|
||||
}
|
||||
|
||||
public static Exception GetExceptionForHR (int errorCode, IntPtr errorInfo)
|
||||
{
|
||||
#if !MOBILE
|
||||
IErrorInfo info = null;
|
||||
if (errorInfo != (IntPtr)(-1)) {
|
||||
if (errorInfo == IntPtr.Zero) {
|
||||
if (GetErrorInfo (0, out info) != 0) {
|
||||
info = null;
|
||||
}
|
||||
} else {
|
||||
info = Marshal.GetObjectForIUnknown (errorInfo) as IErrorInfo;
|
||||
}
|
||||
}
|
||||
|
||||
if (info is ManagedErrorInfo && ((ManagedErrorInfo) info).Exception.hresult == errorCode) {
|
||||
return ((ManagedErrorInfo) info).Exception;
|
||||
}
|
||||
|
||||
Exception e = ConvertHrToException (errorCode);
|
||||
if (info != null && e != null) {
|
||||
uint helpContext;
|
||||
info.GetHelpContext (out helpContext);
|
||||
string str;
|
||||
info.GetSource (out str);
|
||||
e.Source = str;
|
||||
info.GetDescription (out str);
|
||||
e.SetMessage (str);
|
||||
info.GetHelpFile (out str);
|
||||
|
||||
if (helpContext == 0) {
|
||||
e.HelpLink = str;
|
||||
} else {
|
||||
e.HelpLink = string.Format ("{0}#{1}", str, helpContext);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
#else
|
||||
return ConvertHrToException (errorCode);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !FULL_AOT_RUNTIME
|
||||
public static int FinalReleaseComObject (object o)
|
||||
{
|
||||
|
||||
@@ -58,6 +58,9 @@ namespace System.Security.Claims {
|
||||
throw new ArgumentNullException ("type");
|
||||
if (value == null)
|
||||
throw new ArgumentNullException ("value");
|
||||
|
||||
Properties = new Dictionary <string, string> ();
|
||||
|
||||
Type = type;
|
||||
Value = value;
|
||||
ValueType = valueType == null ? ClaimValueTypes.String : valueType;
|
||||
@@ -91,4 +94,4 @@ namespace System.Security.Claims {
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
@@ -486,9 +486,7 @@ namespace System.Threading.Tasks
|
||||
}
|
||||
|
||||
if (cancellation) {
|
||||
ExceptionSlot.Exception = aggregate;
|
||||
Thread.MemoryBarrier ();
|
||||
|
||||
ExceptionSlot.SetException (aggregate);
|
||||
CancelReal ();
|
||||
} else {
|
||||
HandleGenericException (aggregate);
|
||||
@@ -619,12 +617,15 @@ namespace System.Threading.Tasks
|
||||
if (exSlot == null || exSlot.ChildExceptions == null)
|
||||
return;
|
||||
|
||||
if (ExceptionSlot.Exception == null)
|
||||
exSlot.Exception = new AggregateException ();
|
||||
var exceptions = new List<Exception> ();
|
||||
if (exSlot.Exception != null)
|
||||
exceptions.AddRange (exSlot.Exception.InnerExceptions);
|
||||
|
||||
AggregateException childEx;
|
||||
while (exSlot.ChildExceptions.TryDequeue (out childEx))
|
||||
exSlot.Exception.AddChildException (childEx);
|
||||
exceptions.Add (childEx);
|
||||
|
||||
exSlot.SetException (new AggregateException (exceptions));
|
||||
|
||||
if (isParent) {
|
||||
Status = TaskStatus.Faulted;
|
||||
@@ -655,7 +656,7 @@ namespace System.Threading.Tasks
|
||||
|
||||
void HandleGenericException (AggregateException e)
|
||||
{
|
||||
ExceptionSlot.Exception = e;
|
||||
ExceptionSlot.SetException (e);
|
||||
Thread.MemoryBarrier ();
|
||||
Status = TaskStatus.Faulted;
|
||||
|
||||
|
||||
@@ -32,22 +32,46 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Runtime.ExceptionServices;
|
||||
|
||||
namespace System.Threading.Tasks
|
||||
{
|
||||
internal class TaskExceptionSlot
|
||||
{
|
||||
public volatile AggregateException Exception;
|
||||
public volatile bool Observed;
|
||||
public ConcurrentQueue<AggregateException> ChildExceptions;
|
||||
|
||||
Task parent;
|
||||
volatile AggregateException exception;
|
||||
#if NET_4_5
|
||||
volatile ExceptionDispatchInfo dispatchInfo;
|
||||
#endif
|
||||
readonly Task parent;
|
||||
|
||||
public TaskExceptionSlot (Task parent)
|
||||
{
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public AggregateException Exception {
|
||||
get {
|
||||
return exception;
|
||||
}
|
||||
}
|
||||
|
||||
public void SetException (AggregateException exception)
|
||||
{
|
||||
#if NET_4_5
|
||||
if (dispatchInfo == null) {
|
||||
//
|
||||
// Used by task awaiter to rethrow an exception with original call stack, it's
|
||||
// needed for first exception only
|
||||
//
|
||||
dispatchInfo = ExceptionDispatchInfo.Capture (exception.InnerException);
|
||||
}
|
||||
#endif
|
||||
this.exception = exception;
|
||||
}
|
||||
|
||||
~TaskExceptionSlot ()
|
||||
{
|
||||
if (Exception != null && !Observed && !TaskScheduler.FireUnobservedEvent (parent, Exception).Observed) {
|
||||
|
||||
Loaded 100 of 313 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user