[Pkg-mono-svn-commits] [SCM] mono branch, upstream-experimental, updated. upstream/2.10.1
Jo Shields
directhex at apebox.org
Sun Feb 27 13:20:50 UTC 2011
The following commit has been merged in the upstream-experimental branch:
commit 9a320e5f988c513824c09bc1dd6414dc8d7cd942
Author: Jo Shields <directhex at apebox.org>
Date: Sun Feb 27 13:10:57 2011 +0000
Imported Upstream version 2.10.1
diff --git a/ChangeLog b/ChangeLog
index 02f20e5..7a75cec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-22 Andrew Jorgensen <ajorgensen at novell.com>
+
+ Version 2.10.1
+
2011-02-10 Andrew Jorgensen <ajorgensen at novell.com>
Mono.Debugger.Soft.dll is installed for 4.0 also.
diff --git a/configure b/configure
index 900c178..2c1c909 100755
--- a/configure
+++ b/configure
@@ -2781,7 +2781,7 @@ fi
# Define the identity of the package.
PACKAGE=mono
- VERSION=2.10
+ VERSION=2.10.1
cat >>confdefs.h <<_ACEOF
diff --git a/configure.in b/configure.in
index 0729f41..d20b1ff 100644
--- a/configure.in
+++ b/configure.in
@@ -6,7 +6,7 @@ AC_CANONICAL_SYSTEM
m4_ifdef([_A][M_PROG_TAR],[_A][M_SET_OPTION([tar-ustar])])
AM_CONFIG_HEADER(config.h)
-AM_INIT_AUTOMAKE(mono,2.10)
+AM_INIT_AUTOMAKE(mono,2.10.1)
AM_MAINTAINER_MODE
API_VER=2.0
diff --git a/eglib/ChangeLog b/eglib/ChangeLog
index f31ea41..23e4893 100644
--- a/eglib/ChangeLog
+++ b/eglib/ChangeLog
@@ -1,3 +1,37 @@
+2011-02-23 Miguel de Icaza <miguel at gnome.org>
+
+ Fix win32 build
+
+2011-02-22 Miguel de Icaza <miguel at gnome.org>
+
+ Avoid warnings, should fix OpenSUSE builds
+
+2011-02-13 Hib Eris <hib at hiberis.nl>
+
+ Fix gsize for 64-bit Windows
+
+2011-02-19 Zoltan Varga <vargaz at gmail.com>
+
+ Revert "[Win64] Compilation fix for eglib in win64"
+
+ This reverts commit 97bc578e86afdc6a16cfa129753ff110e69abe1d.
+
+2011-02-19 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ [eglib] Move definition of GPid to eglib-config.h
+
+ This new patch moves the definition of GPid from glib.h to
+ eglib-config.h and determines the the type of pid_t in configure.
+
+ Pach from Hib Eris that fixes bug #670076.
+
+2011-02-19 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ [Win64] Compilation fix for eglib in win64
+
+ Compiling for 64 bit windows breaks on incorrect gsize. Patch by
+ Hib Eris that fixes bug #673581.
+
2011-02-07 Hib Eris <hib at hiberis.nl>
Do not distribute eglib-config.h
diff --git a/eglib/Makefile.in b/eglib/Makefile.in
index 7682860..7285983 100644
--- a/eglib/Makefile.in
+++ b/eglib/Makefile.in
@@ -149,6 +149,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATHSEP = @PATHSEP@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PIDTYPE = @PIDTYPE@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SEARCHSEP = @SEARCHSEP@
diff --git a/eglib/config.h.in b/eglib/config.h.in
index 10b4188..1e1979f 100644
--- a/eglib/config.h.in
+++ b/eglib/config.h.in
@@ -97,6 +97,12 @@
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
+/* The size of `long', as computed by sizeof. */
+#undef SIZEOF_LONG
+
+/* The size of `long long', as computed by sizeof. */
+#undef SIZEOF_LONG_LONG
+
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
diff --git a/eglib/configure b/eglib/configure
index 5e43570..b71f6eb 100755
--- a/eglib/configure
+++ b/eglib/configure
@@ -808,6 +808,7 @@ TARGET_WIN32_FALSE
TARGET_WIN32_TRUE
HOST_WIN32_FALSE
HOST_WIN32_TRUE
+PIDTYPE
OS
SEARCHSEP
PATHSEP
@@ -4416,13 +4417,13 @@ if test "${lt_cv_nm_interface+set}" = set; then
else
lt_cv_nm_interface="BSD nm"
echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:4419: $ac_compile\"" >&5)
+ (eval echo "\"\$as_me:4420: $ac_compile\"" >&5)
(eval "$ac_compile" 2>conftest.err)
cat conftest.err >&5
- (eval echo "\"\$as_me:4422: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval echo "\"\$as_me:4423: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
(eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
cat conftest.err >&5
- (eval echo "\"\$as_me:4425: output\"" >&5)
+ (eval echo "\"\$as_me:4426: output\"" >&5)
cat conftest.out >&5
if $GREP 'External.*some_variable' conftest.out > /dev/null; then
lt_cv_nm_interface="MS dumpbin"
@@ -5628,7 +5629,7 @@ ia64-*-hpux*)
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '#line 5631 "configure"' > conftest.$ac_ext
+ echo '#line 5632 "configure"' > conftest.$ac_ext
if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
(eval $ac_compile) 2>&5
ac_status=$?
@@ -7481,11 +7482,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7484: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7485: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7488: \$? = $ac_status" >&5
+ echo "$as_me:7489: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7820,11 +7821,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7823: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7824: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7827: \$? = $ac_status" >&5
+ echo "$as_me:7828: \$? = $ac_status" >&5
if (exit $ac_status) && test -s "$ac_outfile"; then
# The compiler can only warn and ignore the option if not recognized
# So say no if there are warnings other than the usual output.
@@ -7925,11 +7926,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7928: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7929: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7932: \$? = $ac_status" >&5
+ echo "$as_me:7933: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -7980,11 +7981,11 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7983: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:7984: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7987: \$? = $ac_status" >&5
+ echo "$as_me:7988: \$? = $ac_status" >&5
if (exit $ac_status) && test -s out/conftest2.$ac_objext
then
# The compiler can only warn and ignore the option if not recognized
@@ -10780,7 +10781,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10783 "configure"
+#line 10784 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10876,7 +10877,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10879 "configure"
+#line 10880 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11751,17 +11752,20 @@ case $host in
PATHSEP='\\'
SEARCHSEP=';'
OS="WIN32"
+ PIDTYPE='void *'
;;
*-*darwin*)
platform_darwin=yes
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
+ PIDTYPE='int'
;;
*)
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
+ PIDTYPE='int'
;;
esac
@@ -11789,6 +11793,7 @@ esac
+
if test x$OS = xWIN32; then
HOST_WIN32_TRUE=
HOST_WIN32_FALSE='#'
@@ -12532,6 +12537,724 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of long" >&5
+$as_echo_n "checking size of long... " >&6; }
+if test "${ac_cv_sizeof_long+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long=$ac_lo;;
+'') if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+ else
+ ac_cv_sizeof_long=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (long))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (long))))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (long))))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long=`cat conftest.val`
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+ else
+ ac_cv_sizeof_long=0
+ fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long" >&5
+$as_echo "$ac_cv_sizeof_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG $ac_cv_sizeof_long
+_ACEOF
+
+
+# The cast to long int works around a bug in the HP C Compiler
+# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
+# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
+# This bug is HP SR number 8606223364.
+{ $as_echo "$as_me:$LINENO: checking size of long long" >&5
+$as_echo_n "checking size of long long... " >&6; }
+if test "${ac_cv_sizeof_long_long+set}" = set; then
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (long long))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_long_long=$ac_lo;;
+'') if test "$ac_cv_type_long_long" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+ else
+ ac_cv_sizeof_long_long=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+static long int longval () { return (long int) (sizeof (long long)); }
+static unsigned long int ulongval () { return (long int) (sizeof (long long)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (long long))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (long long))))
+ return 1;
+ fprintf (f, "%ld", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (long long))))
+ return 1;
+ fprintf (f, "%lu", i);
+ }
+ /* Do not output a trailing newline, as this causes \r\n confusion
+ on some platforms. */
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:$LINENO: $ac_try_echo\""
+$as_echo "$ac_try_echo") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_long_long=`cat conftest.val`
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_long_long" = yes; then
+ { { $as_echo "$as_me:$LINENO: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+{ { $as_echo "$as_me:$LINENO: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&5
+$as_echo "$as_me: error: cannot compute sizeof (long long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }; }
+ else
+ ac_cv_sizeof_long_long=0
+ fi
+fi
+rm -rf conftest.dSYM
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
+fi
+{ $as_echo "$as_me:$LINENO: result: $ac_cv_sizeof_long_long" >&5
+$as_echo "$ac_cv_sizeof_long_long" >&6; }
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define SIZEOF_LONG_LONG $ac_cv_sizeof_long_long
+_ACEOF
+
+
@@ -13588,16 +14311,7 @@ fi
-if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
- GPOINTER_TO_INT="((gint)(long) (ptr))"
- GPOINTER_TO_UINT="((guint)(long) (ptr))"
- GINT_TO_POINTER="((gpointer)(glong) (v))"
- GUINT_TO_POINTER="((gpointer)(gulong) (v))"
- GSIZE="long"
- GSIZE_FORMAT='"lu"'
- G_GUINT64_FORMAT='"lu"'
- G_GINT64_FORMAT='"ld"'
-else
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
GPOINTER_TO_INT="((gint) (ptr))"
GPOINTER_TO_UINT="((guint) (ptr))"
GINT_TO_POINTER="((gpointer) (v))"
@@ -13606,6 +14320,28 @@ else
GSIZE_FORMAT='"u"'
G_GUINT64_FORMAT='"llu"'
G_GINT64_FORMAT='"lld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
+ GPOINTER_TO_INT="((gint)(long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(glong) (v))"
+ GUINT_TO_POINTER="((gpointer)(gulong) (v))"
+ GSIZE="long"
+ GSIZE_FORMAT='"lu"'
+ G_GUINT64_FORMAT='"lu"'
+ G_GINT64_FORMAT='"ld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+ G_GUINT64_FORMAT='"I64u"'
+ G_GINT64_FORMAT='"I64i"'
+else
+ { { $as_echo "$as_me:$LINENO: error: unsupported pointer size" >&5
+$as_echo "$as_me: error: unsupported pointer size" >&2;}
+ { (exit 1); exit 1; }; }
fi
# Extract the first word of "pkg-config", so it can be a program name with args.
diff --git a/eglib/configure.ac b/eglib/configure.ac
index 659a4f6..d189150 100644
--- a/eglib/configure.ac
+++ b/eglib/configure.ac
@@ -46,17 +46,20 @@ case $host in
PATHSEP='\\'
SEARCHSEP=';'
OS="WIN32"
+ PIDTYPE='void *'
;;
*-*darwin*)
platform_darwin=yes
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
+ PIDTYPE='int'
;;
*)
PATHSEP='/'
SEARCHSEP=':'
OS="UNIX"
+ PIDTYPE='int'
;;
esac
@@ -84,12 +87,15 @@ AC_SUBST(CFLAGS)
AC_SUBST(PATHSEP)
AC_SUBST(SEARCHSEP)
AC_SUBST(OS)
+AC_SUBST(PIDTYPE)
AM_CONDITIONAL(HOST_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(TARGET_WIN32, test x$OS = xWIN32)
AM_CONDITIONAL(PLATFORM_DARWIN, test x$platform_darwin = xyes)
AC_CHECK_SIZEOF(int)
AC_CHECK_SIZEOF(void *)
+AC_CHECK_SIZEOF(long)
+AC_CHECK_SIZEOF(long long)
AC_CHECK_FUNCS(strndup strlcpy getpwuid_r strtok_r rewinddir vasprintf)
AM_CONDITIONAL(NEED_VASPRINTF, test x$have_vasprintf = x )
AC_CHECK_LIB(iconv, iconv_open, LIBS="$LIBS -liconv")
@@ -130,7 +136,16 @@ AC_CHECK_HEADERS(getopt.h sys/time.h sys/wait.h pwd.h langinfo.h iconv.h localch
AC_CHECK_HEADER(alloca.h, [HAVE_ALLOCA_H=1], [HAVE_ALLOCA_H=0])
AC_SUBST(HAVE_ALLOCA_H)
-if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
+if test $ac_cv_sizeof_void_p = $ac_cv_sizeof_int; then
+ GPOINTER_TO_INT="((gint) (ptr))"
+ GPOINTER_TO_UINT="((guint) (ptr))"
+ GINT_TO_POINTER="((gpointer) (v))"
+ GUINT_TO_POINTER="((gpointer) (v))"
+ GSIZE="int"
+ GSIZE_FORMAT='"u"'
+ G_GUINT64_FORMAT='"llu"'
+ G_GINT64_FORMAT='"lld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long; then
GPOINTER_TO_INT="((gint)(long) (ptr))"
GPOINTER_TO_UINT="((guint)(long) (ptr))"
GINT_TO_POINTER="((gpointer)(glong) (v))"
@@ -139,15 +154,17 @@ if test $ac_cv_sizeof_void_p != $ac_cv_sizeof_int; then
GSIZE_FORMAT='"lu"'
G_GUINT64_FORMAT='"lu"'
G_GINT64_FORMAT='"ld"'
+elif test $ac_cv_sizeof_void_p = $ac_cv_sizeof_long_long; then
+ GPOINTER_TO_INT="((gint)(long long) (ptr))"
+ GPOINTER_TO_UINT="((guint)(unsigned long long) (ptr))"
+ GINT_TO_POINTER="((gpointer)(long long) (v))"
+ GUINT_TO_POINTER="((gpointer)(unsigned long long) (v))"
+ GSIZE="long long"
+ GSIZE_FORMAT='"I64u"'
+ G_GUINT64_FORMAT='"I64u"'
+ G_GINT64_FORMAT='"I64i"'
else
- GPOINTER_TO_INT="((gint) (ptr))"
- GPOINTER_TO_UINT="((guint) (ptr))"
- GINT_TO_POINTER="((gpointer) (v))"
- GUINT_TO_POINTER="((gpointer) (v))"
- GSIZE="int"
- GSIZE_FORMAT='"u"'
- G_GUINT64_FORMAT='"llu"'
- G_GINT64_FORMAT='"lld"'
+ AC_MSG_ERROR([unsupported pointer size])
fi
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
diff --git a/eglib/src/Makefile.in b/eglib/src/Makefile.in
index c8e8696..3cc91b7 100644
--- a/eglib/src/Makefile.in
+++ b/eglib/src/Makefile.in
@@ -214,6 +214,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATHSEP = @PATHSEP@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PIDTYPE = @PIDTYPE@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SEARCHSEP = @SEARCHSEP@
diff --git a/eglib/src/eglib-config.h.in b/eglib/src/eglib-config.h.in
index 7df6919..33c7fb6 100644
--- a/eglib/src/eglib-config.h.in
+++ b/eglib/src/eglib-config.h.in
@@ -42,4 +42,6 @@ typedef signed @GSIZE@ gssize;
#define G_BREAKPOINT()
#endif
+typedef @PIDTYPE@ GPid;
+
#endif
diff --git a/eglib/src/eglib-config.hw b/eglib/src/eglib-config.hw
index 40132d8..cab2368 100644
--- a/eglib/src/eglib-config.hw
+++ b/eglib/src/eglib-config.hw
@@ -71,4 +71,6 @@ int vasprintf(char **ret, const char *fmt, va_list ap);
#pragma warning(disable:4100 4127)
#endif
-#endif
\ No newline at end of file
+typedef void * GPid;
+
+#endif
diff --git a/eglib/src/gfile-posix.c b/eglib/src/gfile-posix.c
index 1700566..70d7af9 100644
--- a/eglib/src/gfile-posix.c
+++ b/eglib/src/gfile-posix.c
@@ -33,6 +33,9 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
#ifdef _MSC_VER
#include <direct.h>
diff --git a/eglib/src/glib.h b/eglib/src/glib.h
index 3485015..8b1d3c8 100644
--- a/eglib/src/glib.h
+++ b/eglib/src/glib.h
@@ -13,14 +13,6 @@
#pragma include_alias(<eglib-config.h>, <eglib-config.hw>)
#else
#include <stdint.h>
-/* For pid_t */
-#ifndef WIN32
-#include <unistd.h>
-#else
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#endif
#endif
#include <eglib-config.h>
@@ -720,8 +712,6 @@ typedef enum {
G_SPAWN_FILE_AND_ARGV_ZERO = 1 << 6
} GSpawnFlags;
-typedef pid_t GPid;
-
typedef void (*GSpawnChildSetupFunc) (gpointer user_data);
gboolean g_spawn_command_line_sync (const gchar *command_line, gchar **standard_output, gchar **standard_error, gint *exit_status, GError **error);
diff --git a/eglib/test/Makefile.in b/eglib/test/Makefile.in
index 1a7dac3..42ae106 100644
--- a/eglib/test/Makefile.in
+++ b/eglib/test/Makefile.in
@@ -177,6 +177,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATHSEP = @PATHSEP@
PATH_SEPARATOR = @PATH_SEPARATOR@
+PIDTYPE = @PIDTYPE@
PKG_CONFIG = @PKG_CONFIG@
RANLIB = @RANLIB@
SEARCHSEP = @SEARCHSEP@
diff --git a/man/ChangeLog b/man/ChangeLog
index 11ca174..09e55fe 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-22 Ankit Jain <radical at corewars.org>
+
+ [xbuild] Use the env var $MSBuildExtensionsPath before trying
+ other paths.
+
+ Change the order of the "search paths", so that the environment
+ variable can always override it. Update the man page to reflect
+ the change.
+
2011-01-30 Miguel de Icaza <miguel at gnome.org>
[repl] Add support for -e EXPRESSION to the csharp command
diff --git a/man/xbuild.1 b/man/xbuild.1
index dd60211..2320a37 100644
--- a/man/xbuild.1
+++ b/man/xbuild.1
@@ -73,8 +73,8 @@ to $prefix/lib/mono/xbuild . When used in Import, like:
xbuild tries various values for the msbuild property $(MSBuildExtensionsPath), in order:
- 1. /Library/Frameworks/Mono.framework/External/xbuild on Mac OSX.
- 2. Paths specified in the environment variable $MSBuildExtensionsPath.
+ 1. Paths specified in the environment variable $MSBuildExtensionsPath.
+ 2. /Library/Frameworks/Mono.framework/External/xbuild on Mac OSX.
3. $XDG_CONFIG_HOME/xbuild/tasks (or Environment.SpecialFolder.ApplicationData)
4. $prefix/lib/mono/xbuild (default location)
diff --git a/mcs/build/common/Consts.cs b/mcs/build/common/Consts.cs
index 02c93bb..e4f7c26 100644
--- a/mcs/build/common/Consts.cs
+++ b/mcs/build/common/Consts.cs
@@ -34,7 +34,7 @@ static class Consts
// Use these assembly version constants to make code more maintainable.
//
- public const string MonoVersion = "2.10.0.0";
+ public const string MonoVersion = "2.10.1.0";
public const string MonoCompany = "MONO development team";
public const string MonoProduct = "MONO Common language infrastructure";
public const string MonoCopyright = "(c) various MONO Authors";
diff --git a/mcs/class/ChangeLog b/mcs/class/ChangeLog
index 1fc3f80..90a13b9 100644
--- a/mcs/class/ChangeLog
+++ b/mcs/class/ChangeLog
@@ -1,3 +1,20 @@
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Kill old IScheduler interface.
+
+ We still use the ParticipateUntil facility of IScheduler
+ internally and provide a default implementation for pure
+ TaskScheduler
+
+2011-02-17 Marek Habersack <grendel at twistedcode.net>
+
+ [asp.net,mvc3] Fix for bug #668655. Implemented a few more
+ NameValueCollection method overloads.
+
+2011-02-15 Marek Safar <marek.safar at gmail.com>
+
+ [671878] Fixes IKVM ordering of catch clauses
+
2011-02-01 Atsushi Eno <atsushi at ximian.com>
quick build workaround.
diff --git a/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs b/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs
index 0f086b2..4f7e248 100644
--- a/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs
+++ b/mcs/class/IKVM.Reflection/Emit/ILGenerator.cs
@@ -166,33 +166,21 @@ namespace IKVM.Reflection.Emit
{
return 0;
}
- if (x.tryOffset >= y.handlerOffset && x.tryOffset + x.tryLength <= y.handlerOffset + y.handlerLength)
- {
- return -1;
- }
- if (y.tryOffset >= x.handlerOffset && y.tryOffset + y.tryLength <= x.handlerOffset + x.handlerLength)
- {
- return 1;
- }
- if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
+ else if (x.tryOffset == y.tryOffset && x.tryLength == y.tryLength)
{
return x.ordinal < y.ordinal ? -1 : 1;
}
- if (x.tryOffset + x.tryLength <= y.tryOffset)
+ else if (x.tryOffset >= y.tryOffset && x.handlerOffset + x.handlerLength <= y.handlerOffset + y.handlerLength)
{
return -1;
}
- if (y.tryOffset + y.tryLength <= x.tryOffset)
+ else if (y.tryOffset >= x.tryOffset && y.handlerOffset + y.handlerLength <= x.handlerOffset + x.handlerLength)
{
return 1;
}
- if (x.tryOffset > y.tryOffset || (x.tryOffset == y.tryOffset && x.tryLength < y.tryLength))
- {
- return -1;
- }
else
{
- return 1;
+ return x.ordinal < y.ordinal ? -1 : 1;
}
}
}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs
index 7abb245..7cf3632 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs
@@ -36,13 +36,20 @@ namespace Microsoft.Build.BuildEngine {
BuildWhen otherwise;
Project project;
+ ImportedProject importedProject;
XmlElement xmlElement;
List <BuildWhen> whens;
public BuildChoose (XmlElement xmlElement, Project project)
+ : this (xmlElement, project, null)
+ {
+ }
+
+ internal BuildChoose (XmlElement xmlElement, Project project, ImportedProject importedProject)
{
this.xmlElement = xmlElement;
this.project = project;
+ this.importedProject = importedProject;
this.whens = new List <BuildWhen> ();
foreach (XmlNode xn in xmlElement.ChildNodes) {
@@ -65,6 +72,9 @@ namespace Microsoft.Build.BuildEngine {
otherwise = new BuildWhen (xe, project);
}
}
+
+ DefinedInFileName = importedProject != null ? importedProject.FullFileName :
+ project != null ? project.FullFileName : null;
}
public void Evaluate ()
@@ -85,6 +95,8 @@ namespace Microsoft.Build.BuildEngine {
get { return whens; }
set { whens = value; }
}
+
+ internal string DefinedInFileName { get; private set; }
}
}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
index fe3113b..f590cd5 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs
@@ -76,6 +76,9 @@ namespace Microsoft.Build.BuildEngine {
buildItems.Add (bi);
project.LastItemGroupContaining [bi.Name] = this;
}
+
+ DefinedInFileName = importedProject != null ? importedProject.FullFileName :
+ project != null ? project.FullFileName : null;
}
public BuildItem AddNewItem (string itemName,
@@ -303,6 +306,8 @@ namespace Microsoft.Build.BuildEngine {
}
}
+ internal string DefinedInFileName { get; private set; }
+
internal bool FromXml {
get {
return itemGroupElement != null;
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
index dd32596..ef1bf78 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
@@ -71,6 +71,9 @@ namespace Microsoft.Build.BuildEngine {
}
} else
this.propertiesByName = new Dictionary <string, BuildProperty> (StringComparer.InvariantCultureIgnoreCase);
+
+ DefinedInFileName = importedProject != null ? importedProject.FullFileName :
+ (project != null ? project.FullFileName : null);
}
public BuildProperty AddNewProperty (string propertyName,
@@ -287,7 +290,9 @@ namespace Microsoft.Build.BuildEngine {
propertiesByName [propertyName] = value;
}
}
-
+
+ internal string DefinedInFileName { get; private set; }
+
internal GroupingCollection GroupingCollection {
get { return parentCollection; }
set { parentCollection = value; }
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
index aaf93bc..ce95c4d 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/ChangeLog
@@ -1,3 +1,42 @@
+2011-02-23 Ankit Jain <radical at corewars.org>
+
+ [xbuild] Fix bug #674337.
+
+ Use appropriate path separator for handling environment variable
+ MSBuildExtensionsPath.
+
+2011-02-23 Ankit Jain <radical at corewars.org>
+
+ *
+ Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildChoose.cs:
+ *
+ Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildItemGroup.cs:
+ *
+ Microsoft.Build.Engine/Microsoft.Build.BuildEngine/BuildPropertyGroup.cs:
+ Add DefinedInFileName property.
+
+ * Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs:
+ Add a stack to keep track the "current" file, which is used to set
+ the $(MSBuildThisFile*) properties. Update the properties on
+ Push/Pop.
+
+ *
+ Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs:
+ Push/Pop the "current" file, when evaluating a property/item/etc.
+
+ * Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs:
+ Push/Pop the "current" file, when building. This ensures that the
+ references in the target definition get evaluated correctly.
+
+2011-02-22 Ankit Jain <radical at corewars.org>
+
+ [xbuild] Use the env var $MSBuildExtensionsPath before trying
+ other paths.
+
+ Change the order of the "search paths", so that the environment
+ variable can always override it. Update the man page to reflect
+ the change.
+
2011-02-11 Ankit Jain <radical at corewars.org>
* Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Utilities.cs:
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs
index 35b321d..0ebb654 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/GroupingCollection.cs
@@ -180,8 +180,13 @@ namespace Microsoft.Build.BuildEngine {
while (evaluate_iterator != null) {
if (evaluate_iterator.Value is BuildPropertyGroup) {
bpg = (BuildPropertyGroup) evaluate_iterator.Value;
- if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
- bpg.Evaluate ();
+ project.PushThisFileProperty (bpg.DefinedInFileName);
+ try {
+ if (ConditionParser.ParseAndEvaluate (bpg.Condition, project))
+ bpg.Evaluate ();
+ } finally {
+ project.PopThisFileProperty ();
+ }
}
// if it wasn't moved by adding anything because of evaluating a Import shift it
@@ -197,8 +202,13 @@ namespace Microsoft.Build.BuildEngine {
while (evaluate_iterator != null) {
if (evaluate_iterator.Value is BuildItemGroup) {
big = (BuildItemGroup) evaluate_iterator.Value;
- if (ConditionParser.ParseAndEvaluate (big.Condition, project))
- big.Evaluate ();
+ project.PushThisFileProperty (big.DefinedInFileName);
+ try {
+ if (ConditionParser.ParseAndEvaluate (big.Condition, project))
+ big.Evaluate ();
+ } finally {
+ project.PopThisFileProperty ();
+ }
}
evaluate_iterator = evaluate_iterator.Next;
@@ -210,17 +220,22 @@ namespace Microsoft.Build.BuildEngine {
while (evaluate_iterator != null) {
if (evaluate_iterator.Value is BuildChoose) {
BuildChoose bc = (BuildChoose)evaluate_iterator.Value;
- bool whenUsed = false;
- foreach (BuildWhen bw in bc.Whens) {
- if (ConditionParser.ParseAndEvaluate (bw.Condition, project)) {
- bw.Evaluate ();
- whenUsed = true;
- break;
+ project.PushThisFileProperty (bc.DefinedInFileName);
+ try {
+ bool whenUsed = false;
+ foreach (BuildWhen bw in bc.Whens) {
+ if (ConditionParser.ParseAndEvaluate (bw.Condition, project)) {
+ bw.Evaluate ();
+ whenUsed = true;
+ break;
+ }
}
- }
- if (!whenUsed && bc.Otherwise != null &&
- ConditionParser.ParseAndEvaluate (bc.Otherwise.Condition, project)) {
- bc.Otherwise.Evaluate ();
+ if (!whenUsed && bc.Otherwise != null &&
+ ConditionParser.ParseAndEvaluate (bc.Otherwise.Condition, project)) {
+ bc.Otherwise.Evaluate ();
+ }
+ } finally {
+ project.PopThisFileProperty ();
}
}
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs
index e77209c..951f4f4 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Import.cs
@@ -44,6 +44,7 @@ namespace Microsoft.Build.BuildEngine {
static string DotConfigExtensionsPath = Path.Combine (Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
Path.Combine ("xbuild", "tasks"));
const string MacOSXExternalXBuildDir = "/Library/Frameworks/Mono.framework/External/xbuild";
+ static string PathSeparatorAsString = Path.PathSeparator.ToString ();
internal Import (XmlElement importElement, Project project, ImportedProject originalProject)
{
@@ -119,14 +120,14 @@ namespace Microsoft.Build.BuildEngine {
// project.
string envvar = Environment.GetEnvironmentVariable (property_name);
- envvar = String.Join (":", new string [] {
+ envvar = String.Join (PathSeparatorAsString, new string [] {
+ (envvar ?? String.Empty),
// For mac osx, look in the 'External' dir on macosx,
// see bug #663180
MSBuildUtils.RunningOnMac ? MacOSXExternalXBuildDir : String.Empty,
- (envvar ?? String.Empty),
DotConfigExtensionsPath});
- string [] paths = envvar.Split (new char [] {':'}, StringSplitOptions.RemoveEmptyEntries);
+ string [] paths = envvar.Split (new char [] {Path.PathSeparator}, StringSplitOptions.RemoveEmptyEntries);
foreach (string path in paths) {
if (!Directory.Exists (path)) {
project.ParentEngine.LogMessage (MessageImportance.Low, "Extension path '{0}' not found, ignoring.", path);
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
index d8f0a92..6be6c21 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Project.cs
@@ -76,6 +76,11 @@ namespace Microsoft.Build.BuildEngine {
bool building;
BuildSettings current_settings;
Stack<Batch> batches;
+
+ // This is used to keep track of "current" file,
+ // which is then used to set the reserved properties
+ // $(MSBuildThisFile*)
+ Stack<string> this_file_property_stack;
ProjectLoadSettings project_load_settings;
@@ -113,6 +118,7 @@ namespace Microsoft.Build.BuildEngine {
initialTargets = new List<string> ();
defaultTargets = new string [0];
batches = new Stack<Batch> ();
+ this_file_property_stack = new Stack<string> ();
globalProperties = new BuildPropertyGroup (null, this, null, false);
foreach (BuildProperty bp in parentEngine.GlobalProperties)
@@ -463,6 +469,7 @@ namespace Microsoft.Build.BuildEngine {
"projectFileName");
this.fullFileName = Utilities.FromMSBuildPath (Path.GetFullPath (projectFileName));
+ PushThisFileProperty (fullFileName);
string filename = fullFileName;
if (String.Compare (Path.GetExtension (fullFileName), ".sln", true) == 0) {
@@ -881,7 +888,7 @@ namespace Microsoft.Build.BuildEngine {
AddPropertyGroup (xe, ip);
break;
case "Choose":
- AddChoose (xe);
+ AddChoose (xe, ip);
break;
default:
throw new InvalidProjectFileException (String.Format ("Invalid element '{0}' in project file.", xe.Name));
@@ -975,6 +982,11 @@ namespace Microsoft.Build.BuildEngine {
projectDir = Path.GetDirectoryName (FullFileName);
evaluatedProperties.AddProperty (new BuildProperty ("MSBuildProjectDirectory", projectDir, PropertyType.Reserved));
+
+ if (this_file_property_stack.Count > 0)
+ // Just re-inited the properties, but according to the stack,
+ // we should have a MSBuild*This* property set
+ SetMSBuildThisFileProperties (this_file_property_stack.Peek ());
}
// precedence:
@@ -1066,9 +1078,9 @@ namespace Microsoft.Build.BuildEngine {
PropertyGroups.Add (bpg);
}
- void AddChoose (XmlElement xmlElement)
+ void AddChoose (XmlElement xmlElement, ImportedProject importedProject)
{
- BuildChoose bc = new BuildChoose (xmlElement, this);
+ BuildChoose bc = new BuildChoose (xmlElement, this, importedProject);
groupingCollection.Add (bc);
}
@@ -1261,6 +1273,41 @@ namespace Microsoft.Build.BuildEngine {
return default (T);
}
+ // Used for MSBuild*This* set of properties
+ internal void PushThisFileProperty (string full_filename)
+ {
+ string last_file = this_file_property_stack.Count == 0 ? String.Empty : this_file_property_stack.Peek ();
+ this_file_property_stack.Push (full_filename);
+ if (last_file != full_filename)
+ // first time, or different from previous one
+ SetMSBuildThisFileProperties (full_filename);
+ }
+
+ internal void PopThisFileProperty ()
+ {
+ string last_file = this_file_property_stack.Pop ();
+ if (this_file_property_stack.Count > 0 && last_file != this_file_property_stack.Peek ())
+ SetMSBuildThisFileProperties (this_file_property_stack.Peek ());
+ }
+
+ void SetMSBuildThisFileProperties (string full_filename)
+ {
+ if (String.IsNullOrEmpty (full_filename))
+ return;
+
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFile", Path.GetFileName (full_filename), PropertyType.Reserved));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileFullPath", full_filename, PropertyType.Reserved));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileName", Path.GetFileNameWithoutExtension (full_filename), PropertyType.Reserved));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileExtension", Path.GetExtension (full_filename), PropertyType.Reserved));
+
+ string project_dir = Path.GetDirectoryName (full_filename) + Path.DirectorySeparatorChar;
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileDirectory", project_dir, PropertyType.Reserved));
+ evaluatedProperties.AddProperty (new BuildProperty ("MSBuildThisFileDirectoryNoRoot",
+ project_dir.Substring (Path.GetPathRoot (project_dir).Length),
+ PropertyType.Reserved));
+ }
+
+
internal void LogWarning (string filename, string message, params object[] messageArgs)
{
BuildWarningEventArgs bwea = new BuildWarningEventArgs (
diff --git a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
index beb7c58..439c56f 100644
--- a/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
+++ b/mcs/class/Microsoft.Build.Engine/Microsoft.Build.BuildEngine/Target.cs
@@ -123,6 +123,16 @@ namespace Microsoft.Build.BuildEngine {
bool Build (string built_targets_key, out bool executeOnErrors)
{
+ project.PushThisFileProperty (TargetFile);
+ try {
+ return BuildActual (built_targets_key, out executeOnErrors);
+ } finally {
+ project.PopThisFileProperty ();
+ }
+ }
+
+ bool BuildActual (string built_targets_key, out bool executeOnErrors)
+ {
bool result = false;
executeOnErrors = false;
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
index 5df5853..f5bcbb4 100644
--- a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
+++ b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-23 Ankit Jain <radical at corewars.org>
+
+ *
+ Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs:
+ Add corresponding test.
+
2011-01-11 Ankit Jain <radical at corewars.org>
[xbuild] Copy metadata from Project items to target outputs.
diff --git a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
index 5d92a43..3259864 100644
--- a/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
+++ b/mcs/class/Microsoft.Build.Engine/Test/Microsoft.Build.BuildEngine/ProjectTest.cs
@@ -1831,6 +1831,97 @@ namespace MonoTests.Microsoft.Build.BuildEngine {
}
}
+ [Test]
+ public void TestMSBuildThisProperties ()
+ {
+ Engine engine = new Engine (Consts.BinPath);
+ Project project = engine.CreateNewProject ();
+
+ string base_dir = Path.GetFullPath (Path.Combine ("Test", "resources")) + Path.DirectorySeparatorChar;
+ string tmp_dir = Path.GetFullPath (Path.Combine (base_dir, "tmp")) + Path.DirectorySeparatorChar;
+
+ string first_project = Path.Combine (base_dir, "first.proj");
+ string second_project = Path.Combine (tmp_dir, "second.proj");
+ string third_project = Path.Combine (tmp_dir, "third.proj");
+
+ string first = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInMain>$(MSBuildThisFileDirectory)</FooInMain>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInMain Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+ <Import Project=""tmp\second.proj""/>
+ </Project>";
+
+ string second = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInImport1>$(MSBuildThisFileDirectory)</FooInImport1>
+ </PropertyGroup>
+ <PropertyGroup>
+ <FooInImport2>$(MSBuildThisFileDirectory)</FooInImport2>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInImport1 Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+
+ <Import Project=""third.proj""/>
+ </Project>";
+
+ string third = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" " + Consts.ToolsVersionString + @">
+ <PropertyGroup>
+ <FooInTwo>$(MSBuildThisFileFullPath)</FooInTwo>
+ </PropertyGroup>
+ <ItemGroup>
+ <ItemInTwo Include=""$(MSBuildThisFileFullPath)"" />
+ </ItemGroup>
+
+ <Target Name=""TargetInTwo"">
+ <Message Text=""FooInMain: $(FooInMain)""/>
+ <Message Text=""FooInImport1: $(FooInImport1)""/>
+ <Message Text=""FooInImport2: $(FooInImport2)""/>
+ <Message Text=""FooInTwo: $(FooInTwo)""/>
+
+ <Message Text=""ItemInMain: %(ItemInMain.Identity)""/>
+ <Message Text=""ItemInImport1: %(ItemInImport1.Identity)""/>
+ <Message Text=""ItemInTwo: %(ItemInTwo.Identity)""/>
+ <Message Text=""Full path: $(MSBuildThisFileFullPath)""/>
+ </Target>
+ </Project>";
+
+ File.WriteAllText (first_project, first);
+
+ Directory.CreateDirectory (Path.Combine (base_dir, "tmp"));
+ File.WriteAllText (second_project, second);
+ File.WriteAllText (third_project, third);
+
+ MonoTests.Microsoft.Build.Tasks.TestMessageLogger logger =
+ new MonoTests.Microsoft.Build.Tasks.TestMessageLogger ();
+ engine.RegisterLogger (logger);
+
+ project.Load (first_project);
+ try {
+ Assert.IsTrue (project.Build (), "Build failed");
+
+ logger.CheckLoggedMessageHead ("FooInMain: " + base_dir, "A1");
+ logger.CheckLoggedMessageHead ("FooInImport1: " + tmp_dir, "A2");
+ logger.CheckLoggedMessageHead ("FooInImport2: " + tmp_dir, "A3");
+ logger.CheckLoggedMessageHead ("FooInTwo: " + third_project, "A4");
+ logger.CheckLoggedMessageHead ("ItemInMain: " + first_project, "A5");
+ logger.CheckLoggedMessageHead ("ItemInImport1: " + second_project, "A6");
+ logger.CheckLoggedMessageHead ("ItemInTwo: " + third_project, "A7");
+ logger.CheckLoggedMessageHead ("Full path: " + third_project, "A8");
+
+ Assert.AreEqual (0, logger.NormalMessageCount, "Unexpected extra messages found");
+ } catch {
+ logger.DumpMessages ();
+ throw;
+ } finally {
+ File.Delete (first_project);
+ File.Delete (second_project);
+ File.Delete (third_project);
+ }
+ }
[Test]
public void TestRequiredTask_String1 ()
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignTargetPath.cs b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignTargetPath.cs
index 4b71e08..abec063 100644
--- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignTargetPath.cs
+++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/AssignTargetPath.cs
@@ -54,24 +54,30 @@ namespace Microsoft.Build.Tasks {
assignedFiles = new ITaskItem [files.Length];
for (int i = 0; i < files.Length; i ++) {
string file = files [i].ItemSpec;
+ string link = files [i].GetMetadata ("Link");
string afile = null;
- //FIXME: Hack!
- string normalized_root = Path.GetFullPath (rootFolder);
- // cur dir should already be set to
- // the project dir
- file = Path.GetFullPath (file);
+ if (String.IsNullOrEmpty (link)) {
+ //FIXME: Hack!
+ string normalized_root = Path.GetFullPath (rootFolder);
- if (file.StartsWith (normalized_root)) {
- afile = Path.GetFullPath (file).Substring (
- normalized_root.Length);
- // skip over "root/"
- if (afile [0] == '\\' ||
- afile [0] == '/')
- afile = afile.Substring (1);
+ // cur dir should already be set to
+ // the project dir
+ file = Path.GetFullPath (file);
+ if (file.StartsWith (normalized_root)) {
+ afile = Path.GetFullPath (file).Substring (
+ normalized_root.Length);
+ // skip over "root/"
+ if (afile [0] == '\\' ||
+ afile [0] == '/')
+ afile = afile.Substring (1);
+
+ } else {
+ afile = Path.GetFileName (file);
+ }
} else {
- afile = Path.GetFileName (file);
+ afile = link;
}
assignedFiles [i] = new TaskItem (files [i]);
diff --git a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
index a3a51c0..fa43be2 100644
--- a/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
+++ b/mcs/class/Microsoft.Build.Tasks/Microsoft.Build.Tasks/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-15 Ankit Jain <radical at corewars.org>
+
+ [xbuild] Fix bug #671700, resource naming in presence of "Link".
+
+ AssignTargetPath.cs: If 'Link' metadata is present, then use that
+ as the target path.
+
+ Add relevant test.
+
2011-02-11 Ankit Jain <radical at corewars.org>
[xbuild] Update Utilities.FromMSBuildPath from monodevelop.
diff --git a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs
index 959c899..6524e0b 100755
--- a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs
+++ b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/AssignTargetPathTest.cs
@@ -115,6 +115,53 @@ namespace MonoTests.Microsoft.Build.Tasks
}
}
+ [Test]
+ public void TestLink ()
+ {
+ string projectText = @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <ItemGroup>
+ <FooFiles Include=""xyz.cs"">
+ <Child>Cxyz.cs</Child>
+ <Link>Test\Link\xyz.cs</Link>
+ </FooFiles>
+ <FooFiles Include=""rel\bar.resx"">
+ <Child>Crel\bar.resx</Child>
+ <Link>Test\Link\bar.resx</Link>
+ </FooFiles>
+ <FooFiles Include=""rel\qwe.txt"">
+ <Child>Crel\qwe.txt</Child>
+ <Link>..\Test\Link\qwe.txt</Link>
+ </FooFiles>
+ </ItemGroup>
+ <Target Name=""1"">
+ <AssignTargetPath Files=""@(FooFiles)"" RootFolder=""/"">
+ <Output TaskParameter=""AssignedFiles"" ItemName=""FooPath"" />
+ </AssignTargetPath>
+ </Target>
+ </Project>";
+ Engine engine = new Engine(Consts.BinPath);
+ Project project = engine.CreateNewProject();
+
+ project.LoadXml(projectText);
+
+ string id = "A";
+ Assert.IsTrue(project.Build("1"), id + "1 : Error in building");
+
+ string [] files = new string [] { "xyz.cs", "rel/bar.resx", "rel/qwe.txt"};
+ string [] assignedFiles = new string [] { "Test/Link/xyz.cs", "Test/Link/bar.resx", "../Test/Link/qwe.txt"};
+
+ BuildItemGroup include = project.GetEvaluatedItemsByName("FooPath");
+ Assert.AreEqual(files.Length, include.Count, id + "2");
+
+ for (int i = 0; i < files.Length; i++) {
+ Assert.AreEqual (files [i], include [i].FinalItemSpec, id + "3, file #" + i);
+ Assert.IsTrue (include[i].HasMetadata ("TargetPath"), id + "4, file #" + i + ", TargetPath metadata missing");
+ Assert.AreEqual (assignedFiles [i], include[i].GetMetadata("TargetPath"), id + "5, file #" + i);
+ Assert.IsTrue (include [i].HasMetadata ("Child"), id + "6, file #" + i + ", Child metadata missing");
+ Assert.AreEqual ("C" + files [i], include [i].GetMetadata ("Child"), id + "7, file #" + i + ", Child metadata value incorrect");
+ }
+ }
+
void CheckTargetPath(string[] files, string[] assignedFiles, string rootFolder, string id)
{
Engine engine = new Engine(Consts.BinPath);
diff --git a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
index 68acb50..ff581ec 100644
--- a/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
+++ b/mcs/class/Microsoft.Build.Tasks/Test/Microsoft.Build.Tasks/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-15 Ankit Jain <radical at corewars.org>
+
+ [xbuild] Fix bug #671700, resource naming in presence of "Link".
+
+ AssignTargetPath.cs: If 'Link' metadata is present, then use that
+ as the target path.
+
+ Add relevant test.
+
2011-01-05 Ankit Jain <radical at corewars.org>
[xbuild] Fix failing test in msbuild.tasks .
diff --git a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
index f2a1b61..c3d9122 100644
--- a/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
+++ b/mcs/class/Microsoft.Web.Infrastructure/Microsoft.Web.Infrastructure.DynamicValidationHelper/LazyWebROCollection.cs
@@ -23,6 +23,7 @@
// THE SOFTWARE.
using System;
+using System.Collections;
using System.Collections.Specialized;
using System.Web;
using System.Web.Util;
@@ -43,6 +44,15 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
this.wrapped = wrapped;
}
+ public string this [int index] {
+ get { return Get (index); }
+ }
+
+ public string this [string name] {
+ get { return Get (name); }
+ set{ Set (name,value); }
+ }
+
public override string Get (string name)
{
return Validate (name, wrapped.Get (name));
@@ -53,6 +63,26 @@ namespace Microsoft.Web.Infrastructure.DynamicValidationHelper
return Validate (wrapped.GetKey (index), wrapped.Get (index));
}
+ public override IEnumerator GetEnumerator ()
+ {
+ return wrapped.GetEnumerator ();
+ }
+
+ public override string GetKey (int index)
+ {
+ return wrapped.GetKey (index);
+ }
+
+ public override string[] GetValues (int index)
+ {
+ return wrapped.GetValues (index);
+ }
+
+ public override string[] GetValues (string name)
+ {
+ return wrapped.GetValues (name);
+ }
+
string Validate (string key, string value)
{
if (String.IsNullOrEmpty (value))
diff --git a/mcs/class/System.Core/System.Linq.Parallel/ChangeLog b/mcs/class/System.Core/System.Linq.Parallel/ChangeLog
index aa589e3..b37d00b 100644
--- a/mcs/class/System.Core/System.Linq.Parallel/ChangeLog
+++ b/mcs/class/System.Core/System.Linq.Parallel/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-16 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Create PLinq query tasks attached to their eventual task parent by
+ default
+
+2011-02-16 Jérémie Laval <jeremie.laval at gmail.com>
+
+ When choosing the number of Task to create for a PLinq query,
+ check if we are already in a running Task
+
2010-12-02 Jérémie Laval <jeremie.laval at gmail.com>
[PLinq] Wrap PLinq processing task body in a try/finally so that
diff --git a/mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs b/mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs
index 380f68c..ee16845 100644
--- a/mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs
+++ b/mcs/class/System.Core/System.Linq.Parallel/ParallelExecuter.cs
@@ -76,7 +76,7 @@ namespace System.Linq.Parallel
internal static int GetBestWorkerNumber (bool blocking)
{
- return blocking ? Environment.ProcessorCount + 1 : Environment.ProcessorCount;
+ return blocking && Task.CurrentId == null ? Environment.ProcessorCount + 1 : Environment.ProcessorCount;
}
internal static Task[] Process<TSource, TElement> (QueryBaseNode<TSource> node,
@@ -117,7 +117,7 @@ namespace System.Linq.Parallel
if (endAction != null)
endAction ();
}
- }, options.Token);
+ }, options.Token, TaskCreationOptions.AttachedToParent, TaskScheduler.Default);
}
return tasks;
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
index 4d1b276..95ff631 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/ChangeLog
@@ -1,3 +1,10 @@
+2010-02-14 Veerapuram Varadhan <vvaradhan at novell.com>
+
+ ** Fixes 667855
+ * OracleParameter.cs (InferSize): For Raw types, use the appropriate
+ methods to convert value to bytearray and use them to bind.
+ (Bind): Fix index parameters in call to Array.ConstrainedCopy.
+
2010-01-30 Veerapuram Varadhan <vvaradhan at novell.com>
** Fixes #667236 - Based on patch by Kalyanov.Dmitry at gmail.com
diff --git a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
index 8979761..c5973ff 100644
--- a/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
+++ b/mcs/class/System.Data.OracleClient/System.Data.OracleClient/OracleParameter.cs
@@ -763,7 +763,11 @@ namespace System.Data.OracleClient
if (direction == ParameterDirection.Input ||
direction == ParameterDirection.InputOutput) {
byteCount = 0;
- byte[] val = v as byte[];
+ byte[] val;
+ if (dbType == DbType.Guid)
+ val = ((Guid)v).ToByteArray();
+ else
+ val = v as byte[];
if (val.Length > 0) {
byteCount = val.Length;
// LONG VARRAW prepends a 4-byte length
@@ -771,7 +775,7 @@ namespace System.Data.OracleClient
byteArrayLen = BitConverter.GetBytes ((ushort) byteCount);
bytes[0] = byteArrayLen[0];
bytes[1] = byteArrayLen[1];
- Array.ConstrainedCopy (val, 2, bytes, 0, byteCount);
+ Array.ConstrainedCopy (val, 0, bytes, 2, byteCount);
}
}
}
@@ -795,7 +799,7 @@ namespace System.Data.OracleClient
bytes[1] = byteArrayLen[1];
bytes[2] = byteArrayLen[2];
bytes[3] = byteArrayLen[3];
- Array.ConstrainedCopy (val, 4, bytes, 0, byteCount);
+ Array.ConstrainedCopy (val, 0, bytes, 4, byteCount);
}
}
}
@@ -1022,6 +1026,12 @@ namespace System.Data.OracleClient
case OciDataType.RSet: // REF CURSOR
newSize = -1;
break;
+ case OciDataType.Raw:
+ if (dbType == DbType.Guid)
+ newSize = ((Guid)value).ToByteArray().Length;
+ else
+ newSize = (value as byte[]).Length;
+ break;
default:
if (value == null || value == DBNull.Value)
newSize = 0;
@@ -1107,6 +1117,7 @@ namespace System.Data.OracleClient
private void SetOracleType (OracleType type, bool inferring)
{
FreeHandle ();
+ Type valType = value.GetType ();
string exception = String.Format ("No mapping exists from OracleType {0} to a known DbType.", type);
switch (type) {
case OracleType.BFile:
@@ -1116,7 +1127,10 @@ namespace System.Data.OracleClient
break;
case OracleType.LongRaw:
case OracleType.Raw:
- dbType = DbType.Binary;
+ if (valType.FullName == "System.Guid")
+ dbType = DbType.Guid;
+ else
+ dbType = DbType.Binary;
ociType = OciDataType.Raw;
break;
case OracleType.Byte:
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
index f57364a..121786f 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/ChangeLog
@@ -1,3 +1,26 @@
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ MakXsdDataContractExporter refactoring to generally use
+ SerializationMap.XmlName.
+
+ Fixed bug #670539.
+
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ Don't reject serialization map for existing different (but
+ same-purpose) type.
+
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ xsi:type parsing is wrong in default namespace resolution.
+
+ Fixed case #3 in bug #652331.
+
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ KnownTypeCollection; recursively registered type was not added to
+ the collection while it is "registered" state.
+
2011-02-08 Atsushi Eno <atsushi at ximian.com>
There's a tricky namespace-mismatching deserialization in .NET
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
index 66fb3c5..c1d60d3 100755
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/KnownTypeCollection.cs
@@ -76,11 +76,19 @@ namespace System.Runtime.Serialization
*/
internal static class TypeExtensions
{
- public static T GetCustomAttribute<T> (this Type type, bool inherit)
+ public static T GetCustomAttribute<T> (this MemberInfo type, bool inherit)
{
var arr = type.GetCustomAttributes (typeof (T), inherit);
return arr != null && arr.Length == 1 ? (T) arr [0] : default (T);
}
+
+ public static IEnumerable<Type> GetInterfacesOrSelfInterface (this Type type)
+ {
+ if (type.IsInterface)
+ yield return type;
+ foreach (var t in type.GetInterfaces ())
+ yield return t;
+ }
}
internal sealed class KnownTypeCollection : Collection<Type>
@@ -386,8 +394,12 @@ namespace System.Runtime.Serialization
protected override void InsertItem (int index, Type type)
{
- if (!Contains (type) && TryRegister (type))
+ if (ShouldNotRegister (type))
+ return;
+ if (!Contains (type)) {
+ TryRegister (type);
base.InsertItem (index, type);
+ }
}
// FIXME: it could remove other types' dependencies.
@@ -407,6 +419,13 @@ namespace System.Runtime.Serialization
protected override void SetItem (int index, Type type)
{
+ if (ShouldNotRegister (type))
+ return;
+
+ // Since this collection is not assured to be ordered, it ignores the whole Set operation if the type already exists.
+ if (Contains (type))
+ return;
+
if (index != Count)
RemoveItem (index);
if (TryRegister (type))
@@ -420,6 +439,8 @@ namespace System.Runtime.Serialization
internal Type GetSerializedType (Type type)
{
+ if (IsPrimitiveNotEnum (type))
+ return type;
Type element = GetCollectionElementType (type);
if (element == null)
return type;
@@ -605,10 +626,15 @@ namespace System.Runtime.Serialization
return false;
}
+ bool ShouldNotRegister (Type type)
+ {
+ return IsPrimitiveNotEnum (type);
+ }
+
internal bool TryRegister (Type type)
{
// exclude predefined maps
- if (IsPrimitiveNotEnum (type))
+ if (ShouldNotRegister (type))
return false;
if (FindUserMap (type) != null)
@@ -645,10 +671,9 @@ namespace System.Runtime.Serialization
{
if (type.IsArray)
return type.GetElementType ();
-
- Type [] ifaces = type.GetInterfaces ();
+ var ifaces = type.GetInterfacesOrSelfInterface ();
foreach (Type i in ifaces)
- if (i.IsGenericType && i.GetGenericTypeDefinition ().Equals (typeof (ICollection<>)))
+ if (i.IsGenericType && i.GetGenericTypeDefinition ().Equals (typeof (IEnumerable<>)))
return i.GetGenericArguments () [0];
foreach (Type i in ifaces)
if (i == typeof (IList))
@@ -676,8 +701,12 @@ namespace System.Runtime.Serialization
QName qname = GetCollectionContractQName (type);
CheckStandardQName (qname);
- if (FindUserMap (qname) != null)
- throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, qname));
+ var map = FindUserMap (qname);
+ if (map != null) {
+ var cmap = map as CollectionContractTypeMap;
+ if (cmap == null) // The runtime type may still differ (between array and other IList; see bug #670560)
+ throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, qname));
+ }
var ret = new CollectionContractTypeMap (type, cdca, element, qname, this);
contracts.Add (ret);
@@ -697,7 +726,7 @@ namespace System.Runtime.Serialization
var map = FindUserMap (qname);
if (map != null) {
var cmap = map as CollectionTypeMap;
- if (cmap == null || cmap.RuntimeType != type)
+ if (cmap == null) // The runtime type may still differ (between array and other IList; see bug #670560)
throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, qname));
return cmap;
}
@@ -710,7 +739,7 @@ namespace System.Runtime.Serialization
static bool TypeImplementsIDictionary (Type type)
{
- foreach (var iface in type.GetInterfaces ())
+ foreach (var iface in type.GetInterfacesOrSelfInterface ())
if (iface == typeof (IDictionary) || (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IDictionary<,>)))
return true;
@@ -728,13 +757,17 @@ namespace System.Runtime.Serialization
DictionaryTypeMap ret =
new DictionaryTypeMap (type, cdca, this);
- if (FindUserMap (ret.XmlName) != null)
- throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, ret.XmlName));
- contracts.Add (ret);
-
TryRegister (ret.KeyType);
TryRegister (ret.ValueType);
+ var map = FindUserMap (ret.XmlName);
+ if (map != null) {
+ var dmap = map as DictionaryTypeMap;
+ if (dmap == null) // The runtime type may still differ (between array and other IList; see bug #670560)
+ throw new InvalidOperationException (String.Format ("Failed to add type {0} to known type collection. There already is a registered type for XML name {1}", type, ret.XmlName));
+ }
+ contracts.Add (ret);
+
return ret;
}
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.XsdExporter.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.XsdExporter.cs
index ce950f0..47fc17c 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.XsdExporter.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.XsdExporter.cs
@@ -62,7 +62,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportStandardComplexType (RuntimeType.GetCustomAttribute<DataContractAttribute> (false), RuntimeType, Members);
+ exporter.ExportStandardComplexType (RuntimeType.GetCustomAttribute<DataContractAttribute> (false), this, Members);
}
}
@@ -70,7 +70,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportStandardComplexType (null, RuntimeType, Members);
+ exporter.ExportStandardComplexType (null, this, Members);
}
}
@@ -78,7 +78,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportListContractType (a, RuntimeType);
+ exporter.ExportListContractType (a, this);
}
}
@@ -86,7 +86,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportListContractType (null, RuntimeType);
+ exporter.ExportListContractType (null, this);
}
}
@@ -94,7 +94,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportDictionaryContractType (a, RuntimeType, GetGenericDictionaryInterface (RuntimeType));
+ exporter.ExportDictionaryContractType (a, this, GetGenericDictionaryInterface (RuntimeType));
}
}
@@ -102,7 +102,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportStandardComplexType (null, RuntimeType, Members);
+ exporter.ExportStandardComplexType (null, this, Members);
}
}
@@ -110,7 +110,7 @@ namespace System.Runtime.Serialization
{
public override void ExportSchemaType (XsdDataContractExporter exporter)
{
- exporter.ExportEnumContractType (RuntimeType.GetCustomAttribute<DataContractAttribute> (false), RuntimeType);
+ exporter.ExportEnumContractType (RuntimeType.GetCustomAttribute<DataContractAttribute> (false), this);
}
}
}
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
index 2542424..e4d082f 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/SerializationMap.cs
@@ -590,8 +590,8 @@ namespace System.Runtime.Serialization
static Type GetGenericCollectionInterface (Type type)
{
- foreach (var iface in type.GetInterfaces ())
- if (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (ICollection<>))
+ foreach (var iface in type.GetInterfacesOrSelfInterface ())
+ if (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IEnumerable<>))
return iface;
return null;
@@ -731,7 +731,7 @@ namespace System.Runtime.Serialization
static Type GetGenericDictionaryInterface (Type type)
{
- foreach (var iface in type.GetInterfaces ())
+ foreach (var iface in type.GetInterfacesOrSelfInterface ())
if (iface.IsGenericType && iface.GetGenericTypeDefinition () == typeof (IDictionary<,>))
return iface;
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
index cd0123a..d697415 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XmlFormatterDeserializer.cs
@@ -110,11 +110,11 @@ namespace System.Runtime.Serialization
QName graph_qname = types.GetQName (type);
string itype = reader.GetAttribute ("type", XmlSchema.InstanceNamespace);
if (itype != null) {
- string[] parts = itype.Split (':');
+ string [] parts = itype.Split (':');
if (parts.Length > 1)
- graph_qname = new QName (parts [1], reader.LookupNamespace (reader.NameTable.Get (parts[0])));
+ graph_qname = new QName (parts [1], reader.LookupNamespace (reader.NameTable.Get (parts [0])));
else
- graph_qname = new QName (itype, reader.NamespaceURI);
+ graph_qname = new QName (itype, reader.LookupNamespace (String.Empty));
}
string label = reader.GetAttribute ("Ref", KnownTypeCollection.MSSimpleNamespace);
diff --git a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter.cs b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter.cs
index d752a4a..e2294ed 100644
--- a/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter.cs
+++ b/mcs/class/System.Runtime.Serialization/System.Runtime.Serialization/XsdDataContractExporter.cs
@@ -47,16 +47,6 @@ using QName = System.Xml.XmlQualifiedName;
namespace System.Runtime.Serialization
{
- static class TypeExtension
- {
- public static T GetCustomAttribute<T> (this MemberInfo mi, bool inherit)
- {
- foreach (T att in mi.GetCustomAttributes (typeof (T), inherit))
- return att;
- return default (T);
- }
- }
-
public class XsdDataContractExporter
{
class TypeImportInfo
@@ -227,9 +217,10 @@ namespace System.Runtime.Serialization
return true;
}
- internal void ExportDictionaryContractType (CollectionDataContractAttribute attr, Type type, Type dicType)
+ internal void ExportDictionaryContractType (CollectionDataContractAttribute attr, SerializationMap map, Type dicType)
{
- var qname = GetSchemaTypeName (type);
+ var type = map.RuntimeType;
+ var qname = map.XmlName;
var typeArgs = dicType.IsGenericType ? dicType.GetGenericArguments () : null;
var keyType = typeArgs != null ? typeArgs [0] : typeof (object);
@@ -265,9 +256,10 @@ namespace System.Runtime.Serialization
dictSeq.Items.Add (new XmlSchemaElement () { Name = valueName, SchemaTypeName = GetSchemaTypeName (valueType), IsNillable = true });
}
- internal void ExportListContractType (CollectionDataContractAttribute attr, Type type)
+ internal void ExportListContractType (CollectionDataContractAttribute attr, CollectionTypeMap map)
{
- var qname = attr != null && attr.Name != null ? new QName (attr.Name, attr.Namespace ?? GetXmlNamespace (type)) : GetSchemaTypeName (type);
+ Type type = map.RuntimeType;
+ var qname = map.XmlName;
var typeArgs = type.IsGenericType ? type.GetGenericArguments () : null;
if (typeArgs != null && typeArgs.Length != 1)
@@ -299,9 +291,10 @@ namespace System.Runtime.Serialization
*/
}
- internal void ExportEnumContractType (DataContractAttribute attr, Type type)
+ internal void ExportEnumContractType (DataContractAttribute attr, SerializationMap map)
{
- var qname = attr != null && attr.Name != null ? new QName (attr.Name, attr.Namespace ?? GetXmlNamespace (type)) : GetSchemaTypeName (type);
+ Type type = map.RuntimeType;
+ var qname = map.XmlName;
var st = CreateSimpleType (qname, type);
if (type.GetCustomAttribute<FlagsAttribute> (false) != null) {
var list = new XmlSchemaSimpleTypeList ();
@@ -327,9 +320,10 @@ namespace System.Runtime.Serialization
return r;
}
- internal void ExportStandardComplexType (DataContractAttribute attr, Type type, List<DataMemberInfo> members)
+ internal void ExportStandardComplexType (DataContractAttribute attr, SerializationMap map, List<DataMemberInfo> members)
{
- var qname = attr != null && attr.Name != null ? new QName (attr.Name, attr.Namespace ?? GetXmlNamespace (type)) : GetSchemaTypeName (type);
+ Type type = map.RuntimeType;
+ var qname = map.XmlName;
var ct = CreateComplexType (qname, type);
if (type.BaseType != null && type.BaseType != typeof (object)) {
@@ -433,7 +427,11 @@ namespace System.Runtime.Serialization
string GetXmlTypeName (Type type)
{
var qname = KnownTypeCollection.GetPrimitiveTypeName (type);
- return qname.Equals (QName.Empty) ? type.Name : qname.Name;
+ if (!qname.Equals (QName.Empty))
+ return qname.Name;
+ var ret = type.Name;
+ int idx = ret.IndexOf ('`');
+ return idx < 0 ? ret : ret.Substring (0, idx);
}
string GetXmlNamespace (Type type)
@@ -479,6 +477,13 @@ namespace System.Runtime.Serialization
if (info != null && info.SchemaTypeName != null)
return info.SchemaTypeName;
+ known_types.Add (type);
+ var map = known_types.FindUserMap (type);
+ if (map != null)
+ return map.XmlName;
+
+ // The following lines would be mostly redundant (legacy code now that it widely uses SerializationMap.XmlName for consistency...)
+
var cdca = type.GetCustomAttribute<CollectionDataContractAttribute> (false);
if (cdca != null)
return new QName (cdca.Name ?? GetXmlTypeName (type), cdca.Namespace ?? GetXmlNamespace (type));
diff --git a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/ChangeLog b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/ChangeLog
index 548b1bc..6cc57c5 100644
--- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/ChangeLog
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ MakXsdDataContractExporter refactoring to generally use
+ SerializationMap.XmlName.
+
+ Fixed bug #670539.
+
2011-02-08 Atsushi Eno <atsushi at ximian.com>
There's a tricky namespace-mismatching deserialization in .NET
diff --git a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractExporterTest.cs b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractExporterTest.cs
index a8fcf98..21dadac 100644
--- a/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractExporterTest.cs
+++ b/mcs/class/System.Runtime.Serialization/Test/System.Runtime.Serialization/XsdDataContractExporterTest.cs
@@ -45,6 +45,13 @@ namespace MonoTests.System.Runtime.Serialization
[TestFixture]
public class XsdDataContractExporterTest
{
+ internal const string MSSimpleNamespace =
+ "http://schemas.microsoft.com/2003/10/Serialization/";
+ internal const string MSArraysNamespace =
+ "http://schemas.microsoft.com/2003/10/Serialization/Arrays";
+ internal const string DefaultClrNamespaceBase =
+ "http://schemas.datacontract.org/2004/07/";
+
[Test]
public void Ctor1 ()
{
@@ -153,6 +160,14 @@ namespace MonoTests.System.Runtime.Serialization
CheckDcFull (xdce.Schemas);
}
+ [Test]
+ public void GetSchemaTypeName ()
+ {
+ var xdce = new XsdDataContractExporter ();
+ // bug #670539
+ Assert.AreEqual (new XmlQualifiedName ("ArrayOfstring", MSArraysNamespace), xdce.GetSchemaTypeName (typeof (IEnumerable<string>)), "#1");
+ }
+
//Helper methods
XmlSchemas GetSchemas (XmlSchemaSet set)
diff --git a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/ChangeLog b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/ChangeLog
index 6610dca..eb93990 100644
--- a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/ChangeLog
+++ b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ To header seems mandatory in April2005, so fill it.
+
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ April2005 AppSequence needs default constructor for
+ deserialization.
+
2011-02-10 Atsushi Eno <atsushi at ximian.com>
Fix a couple of addressing namespace fixes (found in April2005
diff --git a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/DiscoveryMessageSequenceApril2005.cs b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/DiscoveryMessageSequenceApril2005.cs
index 8783f1d..6ef4fa7 100755
--- a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/DiscoveryMessageSequenceApril2005.cs
+++ b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/DiscoveryMessageSequenceApril2005.cs
@@ -60,6 +60,11 @@ namespace System.ServiceModel.Discovery.VersionApril2005
return new XmlQualifiedName ("AppSequenceType", version.Namespace);
}
+ // for deserialization
+ DiscoveryMessageSequenceApril2005 ()
+ {
+ }
+
internal DiscoveryMessageSequenceApril2005 (DiscoveryMessageSequence source)
{
this.source = source;
diff --git a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/MessageContractsApril2005.cs b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/MessageContractsApril2005.cs
index 760202f..38d18a5 100644
--- a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/MessageContractsApril2005.cs
+++ b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery.VersionApril2005/MessageContractsApril2005.cs
@@ -43,12 +43,21 @@ namespace System.ServiceModel.Discovery.VersionApril2005
public const string ProbeMatchAction = NS + "/ProbeMatches";
public const string ResolveAction = NS + "/Resolve";
public const string ResolveMatchAction = NS + "/ResolveMatches";
+ public const string ToUrn = "urn:schemas-xmlsoap-org:ws:2005:04:discovery";
[MessageContract (IsWrapped = false)]
public class OnlineAnnouncement
{
+ public OnlineAnnouncement ()
+ {
+ To = new Uri (MessageContractsApril2005.ToUrn);
+ }
+
[MessageHeader (Name = "AppSequence", Namespace = NS)]
public DiscoveryMessageSequenceApril2005 MessageSequence { get; set; }
+ [MessageHeader (Name = "To", Namespace = "http://schemas.xmlsoap.org/ws/2004/08/addressing")]
+ public Uri To { get; set; }
+
[MessageBodyMember (Name = "Hello", Namespace = NS)]
public EndpointDiscoveryMetadataApril2005 EndpointDiscoveryMetadata { get; set; }
}
@@ -56,8 +65,15 @@ namespace System.ServiceModel.Discovery.VersionApril2005
[MessageContract (IsWrapped = false)]
public class OfflineAnnouncement
{
+ public OfflineAnnouncement ()
+ {
+ To = new Uri (MessageContractsApril2005.ToUrn);
+ }
+
[MessageHeader (Name = "AppSequence", Namespace = NS)]
public DiscoveryMessageSequenceApril2005 MessageSequence { get; set; }
+ [MessageHeader (Name = "To", Namespace = "http://schemas.xmlsoap.org/ws/2004/08/addressing")]
+ public Uri To { get; set; }
[MessageBodyMember (Name = "Bye", Namespace = NS)]
public EndpointDiscoveryMetadataApril2005 EndpointDiscoveryMetadata { get; set; }
}
diff --git a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/ChangeLog b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/ChangeLog
index 52ba81d..2ed8999 100644
--- a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/ChangeLog
+++ b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/ChangeLog
@@ -1,3 +1,11 @@
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ Fix infinite loop in DiscoveryMessageSequence equality comparison.
+
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ Fix wrong element name (AppSequenceType->AppSequence).
+
2011-02-15 Atsushi Eno <atsushi at ximian.com>
support UdpTranspoerSettings.MulticastInterfaceId. This should fix
diff --git a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryMessageSequence.cs b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryMessageSequence.cs
index 2a04e3c..007a770 100755
--- a/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryMessageSequence.cs
+++ b/mcs/class/System.ServiceModel.Discovery/System.ServiceModel.Discovery/DiscoveryMessageSequence.cs
@@ -84,19 +84,19 @@ namespace System.ServiceModel.Discovery
public static bool operator == (DiscoveryMessageSequence messageSequence1, DiscoveryMessageSequence messageSequence2)
{
- return messageSequence1 != null ? messageSequence1.Equals (messageSequence2) : messageSequence2 == null;
+ return object.ReferenceEquals (messageSequence1, null) ? object.ReferenceEquals (messageSequence2, null) : messageSequence1.Equals (messageSequence2);
}
public static bool operator != (DiscoveryMessageSequence messageSequence1, DiscoveryMessageSequence messageSequence2)
{
- return messageSequence1 == null ? messageSequence2 != null : !messageSequence1.Equals (messageSequence2);
+ return object.ReferenceEquals (messageSequence1, null) ? !object.ReferenceEquals (messageSequence2, null) : !messageSequence1.Equals (messageSequence2);
}
internal static DiscoveryMessageSequence ReadXml (XmlReader reader, DiscoveryVersion version)
{
if (reader == null)
throw new ArgumentNullException ("reader");
- if (reader.LocalName != "AppSequenceType" || reader.NamespaceURI != version.Namespace)
+ if (reader.LocalName != "AppSequence" || reader.NamespaceURI != version.Namespace)
throw new ArgumentException (String.Format ("AppSequenceType element in namespace '{0}' was expected. Got '{1}' element in '{2}' namespace", version.Namespace, reader.LocalName, reader.NamespaceURI));
var instId = reader.GetAttribute ("InstanceId");
diff --git a/mcs/class/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/ChangeLog
index e04fdb3..d7f4955 100644
--- a/mcs/class/System.ServiceModel/ChangeLog
+++ b/mcs/class/System.ServiceModel/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ xsi:type parsing is wrong in default namespace resolution.
+
+ Fixed case #3 in bug #652331.
+
2011-02-09 Atsushi Eno <atsushi at ximian.com>
Support ServiceKnownTypes. Fixed another case on bug #652331.
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/ChangeLog
index a7da49e..ea2588a 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ HTTP authentication in HttpListener had dropped during
+ refactoring. Now it's back.
+
2010-11-09 Marek Habersack <grendel at twistedcode.net>
[wcf] AJAX GET requests work now.
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpChannelListener.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpChannelListener.cs
index 55b523b..26f6bbd 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpChannelListener.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpChannelListener.cs
@@ -127,7 +127,7 @@ namespace System.ServiceModel.Channels.Http
{
listener_manager = GetOrCreateListenerManager ();
Properties.Add (listener_manager);
- listener_manager.RegisterListener (ChannelDispatcher, timeout);
+ listener_manager.RegisterListener (ChannelDispatcher, Source, timeout);
}
protected override void OnAbort ()
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManager.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManager.cs
index 2d1b592..df7b8b7 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManager.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpListenerManager.cs
@@ -50,7 +50,7 @@ namespace System.ServiceModel.Channels.Http
public List<HttpChannelListenerEntry> Entries { get; private set; }
- public abstract void RegisterListener (ChannelDispatcher channel, TimeSpan timeout);
+ public abstract void RegisterListener (ChannelDispatcher channel, HttpTransportBindingElement element, TimeSpan timeout);
public abstract void UnregisterListener (ChannelDispatcher channel, TimeSpan timeout);
protected void RegisterListenerCommon (ChannelDispatcher channel, TimeSpan timeout)
@@ -125,13 +125,22 @@ namespace System.ServiceModel.Channels.Http
Thread loop;
// FIXME: use timeout
- public override void RegisterListener (ChannelDispatcher channel, TimeSpan timeout)
+ public override void RegisterListener (ChannelDispatcher channel, HttpTransportBindingElement element, TimeSpan timeout)
{
RegisterListenerCommon (channel, timeout);
if (Entries.Count != 1)
return;
+ if (element != null) {
+ var l = listener;
+ l.AuthenticationSchemeSelectorDelegate = delegate (HttpListenerRequest req) {
+ return element.AuthenticationScheme;
+ };
+ l.Realm = element.Realm;
+ l.UnsafeConnectionNtlmAuthentication = element.UnsafeConnectionNtlmAuthentication;
+ }
+
// Start here. It is shared between channel listeners
// that share the same listen Uri. So there is no other appropriate place.
#if USE_SEPARATE_LOOP // this cannot be enabled because it causes infinite loop when ChannelDispatcher is not involved.
@@ -190,7 +199,7 @@ namespace System.ServiceModel.Channels.Http
{
}
- public override void RegisterListener (ChannelDispatcher channel, TimeSpan timeout)
+ public override void RegisterListener (ChannelDispatcher channel, HttpTransportBindingElement element, TimeSpan timeout)
{
RegisterListenerCommon (channel, timeout);
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
index 916c06a..b1a45e0 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels.Http/HttpReplyChannel.cs
@@ -28,9 +28,12 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
+using System.IdentityModel.Selectors;
+using System.IdentityModel.Tokens;
using System.IO;
using System.Net;
using System.ServiceModel;
+using System.ServiceModel.Security;
using System.Text;
using System.Threading;
@@ -40,11 +43,18 @@ namespace System.ServiceModel.Channels.Http
{
HttpChannelListener<IReplyChannel> source;
RequestContext reqctx;
+ SecurityTokenAuthenticator security_token_authenticator;
+ SecurityTokenResolver security_token_resolver;
public HttpReplyChannel (HttpChannelListener<IReplyChannel> listener)
: base (listener)
{
this.source = listener;
+
+ if (listener.SecurityTokenManager != null) {
+ var str = new SecurityTokenRequirement () { TokenType = SecurityTokenTypes.UserName };
+ security_token_authenticator = listener.SecurityTokenManager.CreateSecurityTokenAuthenticator (str, out security_token_resolver);
+ }
}
public MessageEncoder Encoder {
@@ -139,6 +149,19 @@ namespace System.ServiceModel.Channels.Http
if (ctxi == null)
return true; // returning true, yet context is null. This happens at closing phase.
+ if (source.Source.AuthenticationScheme != AuthenticationSchemes.Anonymous) {
+ if (security_token_authenticator != null)
+ // FIXME: use return value?
+ try {
+ security_token_authenticator.ValidateToken (new UserNameSecurityToken (ctxi.User, ctxi.Password));
+ } catch (Exception) {
+ ctxi.ReturnUnauthorized ();
+ }
+ else {
+ ctxi.ReturnUnauthorized ();
+ }
+ }
+
Message msg = null;
if (ctxi.Request.HttpMethod == "POST") {
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
index 727c687..2f9fa62 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/ChangeLog
@@ -1,3 +1,14 @@
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ Almost eliminate wrong use of Constants.WsaNamespace.
+
+ They should be addressing-version-aware.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ PeeDuplex ChannelFactory must be opened in prior to create
+ channels.
+
2011-01-21 Atsushi Eno <atsushi at ximian.com>
Avoid possible list modification error during close process.
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs
index 9923878..d15df9b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeader.cs
@@ -205,9 +205,8 @@ namespace System.ServiceModel.Channels
public override bool Relay { get { return default_relay; }}
- internal class RawMessageHeader : MessageHeader
+ internal class XmlMessageHeader : MessageHeader
{
- string soap_ns;
bool is_ref, must_understand, relay;
string actor;
#if NET_2_1
@@ -221,18 +220,20 @@ namespace System.ServiceModel.Channels
string local_name;
string namespace_uri;
- public RawMessageHeader (XmlReader reader, string soap_ns)
+ public XmlMessageHeader (XmlReader reader, MessageVersion version)
{
+ var soapNS = version.Envelope.Namespace;
+ var addrNS = version.Addressing.Namespace;
Prefix = reader.Prefix;
Id = reader.GetAttribute ("Id", Constants.WsuNamespace);
- string s = reader.GetAttribute ("relay", soap_ns);
+ string s = reader.GetAttribute ("relay", soapNS);
relay = s != null ? XmlConvert.ToBoolean (s) : false;
- s = reader.GetAttribute ("mustUnderstand", soap_ns);
+ s = reader.GetAttribute ("mustUnderstand", soapNS);
must_understand = s != null ? XmlConvert.ToBoolean (s) : false;
- actor = reader.GetAttribute ("actor", soap_ns) ?? String.Empty;
+ actor = reader.GetAttribute ("actor", soapNS) ?? String.Empty;
- s = reader.GetAttribute ("IsReferenceParameter", Constants.WsaNamespace);
+ s = reader.GetAttribute ("IsReferenceParameter", addrNS);
is_ref = s != null ? XmlConvert.ToBoolean (s) : false;
local_name = reader.LocalName;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs
index a883150..4060586 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageHeaders.cs
@@ -210,8 +210,8 @@ namespace System.ServiceModel.Channels
MessageHeader item = (MessageHeader) l [index];
XmlReader reader =
- item is MessageHeader.RawMessageHeader ?
- ((MessageHeader.RawMessageHeader) item).CreateReader () :
+ item is MessageHeader.XmlMessageHeader ?
+ ((MessageHeader.XmlMessageHeader) item).CreateReader () :
XmlReader.Create (
new StringReader (item.ToString ()),
reader_settings);
@@ -323,7 +323,6 @@ namespace System.ServiceModel.Channels
void AddEndpointAddressHeader (string name, string ns, EndpointAddress address)
{
- RemoveAll ("FaultTo", Constants.WsaNamespace);
if (address == null)
return;
if (MessageVersion.Addressing.Equals (AddressingVersion.WSAddressing10))
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs
index cf71855..b99365a 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/MessageImpl.cs
@@ -171,7 +171,7 @@ namespace System.ServiceModel.Channels
if (reader.NodeType == XmlNodeType.Element) {
if (nHeaders++ == max_headers)
throw new InvalidOperationException (String.Format ("Message header size has exceeded the maximum header size {0}", max_headers));
- headers.Add (new MessageHeader.RawMessageHeader (reader, envNS));
+ headers.Add (new MessageHeader.XmlMessageHeader (reader, Version));
}
else
reader.Skip ();
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs
index 21f63bb..580d01c 100755
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Channels/PeerDuplexChannel.cs
@@ -207,8 +207,13 @@ namespace System.ServiceModel.Channels
var binding = new NetTcpBinding ();
binding.Security.Mode = SecurityMode.None;
var channel_factory = new DuplexChannelFactory<IPeerConnectorClient> (conn.Instance, binding);
+ channel_factory.Open ();
- return channel_factory.CreateChannel (new EndpointAddress ("net.p2p://" + node.MeshId + "/"), conn.Address.EndpointAddress.Uri);
+ var ch = channel_factory.CreateChannel (new EndpointAddress ("net.p2p://" + node.MeshId + "/"), conn.Address.EndpointAddress.Uri);
+ ch.Closed += delegate {
+ channel_factory.Close ();
+ };
+ return ch;
}
public override void Send (Message message, TimeSpan timeout)
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
index e3a3fe8..a9e3a51 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ get out from NET_4_0.
+
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ Fill a couple of missing ServiceAuthorizationElement
+ implementation.
+
2011-02-01 Atsushi Eno <atsushi at ximian.com>
standard endpoint and protocol mapping support were lacking at
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
index aec08d4..5f78ac8 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ConfigUtil.cs
@@ -98,6 +98,17 @@ namespace System.ServiceModel.Configuration
return b;
}
+ public static Type GetTypeFromConfigString (string name)
+ {
+ Type type = Type.GetType (name);
+ if (type != null)
+ return type;
+ foreach (var ass in AppDomain.CurrentDomain.GetAssemblies ())
+ if ((type = ass.GetType (name)) != null)
+ return type;
+ return null;
+ }
+
#if NET_4_0
public static Binding GetBindingByProtocolMapping (Uri address)
{
@@ -131,17 +142,6 @@ namespace System.ServiceModel.Configuration
return inst;
}
- public static Type GetTypeFromConfigString (string name)
- {
- Type type = Type.GetType (name);
- if (type != null)
- return type;
- foreach (var ass in AppDomain.CurrentDomain.GetAssemblies ())
- if ((type = ass.GetType (name)) != null)
- return type;
- return null;
- }
-
public static ServiceEndpoint ConfigureStandardEndpoint (ContractDescription cd, ServiceEndpointElement element)
{
string kind = element.Kind;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceAuthorizationElement.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceAuthorizationElement.cs
index 8564ceb..b140c78 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceAuthorizationElement.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Configuration/ServiceAuthorizationElement.cs
@@ -117,10 +117,34 @@ namespace System.ServiceModel.Configuration
}
[MonoTODO]
- protected internal override object CreateBehavior () {
- throw new NotImplementedException ();
- }
+ protected internal override object CreateBehavior ()
+ {
+ var b = new ServiceAuthorizationBehavior ();
+ if (!String.IsNullOrEmpty (ServiceAuthorizationManagerType))
+ b.ServiceAuthorizationManager = (ServiceAuthorizationManager) Activator.CreateInstance (ConfigUtil.GetTypeFromConfigString (ServiceAuthorizationManagerType));
+
+ foreach (var apte in AuthorizationPolicies)
+ throw new NotImplementedException ();
+
+ if (!String.IsNullOrEmpty (RoleProviderName))
+ throw new NotImplementedException ();
+ b.ImpersonateCallerForAllOperations = ImpersonateCallerForAllOperations;
+ b.PrincipalPermissionMode = PrincipalPermissionMode;
+
+ return b;
+ }
+
+ public override void CopyFrom (ServiceModelExtensionElement from)
+ {
+ var e = (ServiceAuthorizationElement) from;
+ foreach (AuthorizationPolicyTypeElement ae in e.AuthorizationPolicies)
+ AuthorizationPolicies.Add (new AuthorizationPolicyTypeElement (ae.PolicyType));
+ ImpersonateCallerForAllOperations = e.ImpersonateCallerForAllOperations;
+ PrincipalPermissionMode = e.PrincipalPermissionMode;
+ RoleProviderName = e.RoleProviderName;
+ ServiceAuthorizationManagerType = e.ServiceAuthorizationManagerType;
+ }
}
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
index 26ad0f9..1f0ce63 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ChangeLog
@@ -1,3 +1,28 @@
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ Only use non-null values in ServiceAuthorizationBehavior.
+
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ Operation interface methods also have ServiceKnownType attributes.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ Async MessageContract pattern needs more sophisticated contract
+ validity check.
+
+ It totally killed discovery.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ ServiceDescription.cs does not exist in moonlight, so move
+ TypeExtension.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ MessageHeaderDescription were not filled in message contract.
+ Reject wrong contracts.
+
2011-02-03 Atsushi Eno <atsushi at ximian.com>
Now operations are collected per corresponding
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
index a5951a4..24e1482 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescription.cs
@@ -39,6 +39,16 @@ using System.ServiceModel.Dispatcher;
namespace System.ServiceModel.Description
{
+ internal static class Extensions
+ {
+ public static T GetCustomAttribute<T> (this MemberInfo mi, bool inherit) where T : Attribute
+ {
+ foreach (T att in mi.GetCustomAttributes (typeof (T), inherit))
+ return att;
+ return null;
+ }
+ }
+
public class ContractDescription
{
[MonoTODO]
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
index 91f084d..8801eb8 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ContractDescriptionGenerator.cs
@@ -276,13 +276,18 @@ namespace System.ServiceModel.Description
od.IsOneWay = oca.IsOneWay;
if (oca.HasProtectionLevel)
od.ProtectionLevel = oca.ProtectionLevel;
+
+ if (HasInvalidMessageContract (mi, oca.AsyncPattern))
+ throw new InvalidOperationException (String.Format ("The operation {0} contains more than one parameters and one or more of them are marked with MessageContractAttribute, but the attribute must be used within an operation that has only one parameter.", od.Name));
+
od.Messages.Add (GetMessage (od, mi, oca, true, isCallback, null));
if (!od.IsOneWay)
od.Messages.Add (GetMessage (od, mi, oca, false, isCallback, asyncReturnType));
- foreach (ServiceKnownTypeAttribute a in cd.ContractType.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false))
- foreach (Type t in a.GetTypes ())
- od.KnownTypes.Add (t);
- foreach (ServiceKnownTypeAttribute a in serviceMethod.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false))
+ var knownTypeAtts =
+ cd.ContractType.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false).Union (
+ mi.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false)).Union (
+ serviceMethod.GetCustomAttributes (typeof (ServiceKnownTypeAttribute), false));
+ foreach (ServiceKnownTypeAttribute a in knownTypeAtts)
foreach (Type t in a.GetTypes ())
od.KnownTypes.Add (t);
foreach (FaultContractAttribute a in mi.GetCustomAttributes (typeof (FaultContractAttribute), false)) {
@@ -330,6 +335,23 @@ namespace System.ServiceModel.Description
return od;
}
+ static bool HasInvalidMessageContract (MethodInfo mi, bool async)
+ {
+ var pars = mi.GetParameters ();
+ if (async) {
+ if (pars.Length > 3) {
+ if (pars.Take (pars.Length - 2).Any (par => par.ParameterType.GetCustomAttribute<MessageContractAttribute> (true) != null))
+ return true;
+ }
+ } else {
+ if (pars.Length > 1) {
+ if (pars.Any (par => par.ParameterType.GetCustomAttribute<MessageContractAttribute> (true) != null))
+ return true;
+ }
+ }
+ return false;
+ }
+
static MessageDescription GetMessage (
OperationDescription od, MethodInfo mi,
OperationContractAttribute oca, bool isRequest,
@@ -401,15 +423,22 @@ namespace System.ServiceModel.Description
else
continue;
- MessageBodyMemberAttribute mba = GetMessageBodyMemberAttribute (bmi);
- if (mba == null)
- continue;
-
- MessagePartDescription pd = CreatePartCore (mba, mname, defaultNamespace);
- pd.Index = index++;
- pd.Type = MessageFilterOutByRef (mtype);
- pd.MemberInfo = bmi;
- mb.Parts.Add (pd);
+ var mha = bmi.GetCustomAttribute<MessageHeaderAttribute> (false);
+ if (mha != null) {
+ var pd = CreateHeaderDescription (mha, mname, defaultNamespace);
+ pd.Type = MessageFilterOutByRef (mtype);
+ pd.MemberInfo = bmi;
+ md.Headers.Add (pd);
+ }
+ var mba = GetMessageBodyMemberAttribute (bmi);
+ if (mba != null) {
+ var pd = CreatePartCore (mba, mname, defaultNamespace);
+ if (pd.Index <= 0)
+ pd.Index = index++;
+ pd.Type = MessageFilterOutByRef (mtype);
+ pd.MemberInfo = bmi;
+ mb.Parts.Add (pd);
+ }
}
// FIXME: fill headers and properties.
@@ -463,9 +492,18 @@ namespace System.ServiceModel.Description
return md;
}
- public static void FillMessageBodyDescriptionByContract (
- Type messageType, MessageBodyDescription mb)
+// public static void FillMessageBodyDescriptionByContract (
+// Type messageType, MessageBodyDescription mb)
+// {
+// }
+
+ static MessageHeaderDescription CreateHeaderDescription (MessageHeaderAttribute mha, string defaultName, string defaultNamespace)
{
+ var ret = CreatePartCore<MessageHeaderDescription> (mha, defaultName, defaultNamespace, delegate (string n, string ns) { return new MessageHeaderDescription (n, ns); });
+ ret.Actor = mha.Actor;
+ ret.MustUnderstand = mha.MustUnderstand;
+ ret.Relay = mha.Relay;
+ return ret;
}
static MessagePartDescription CreatePartCore (
@@ -480,9 +518,14 @@ namespace System.ServiceModel.Description
return new MessagePartDescription (pname, defaultNamespace);
}
- static MessagePartDescription CreatePartCore (
- MessageBodyMemberAttribute mba, string defaultName,
- string defaultNamespace)
+ static MessagePartDescription CreatePartCore (MessageBodyMemberAttribute mba, string defaultName, string defaultNamespace)
+ {
+ var ret = CreatePartCore<MessagePartDescription> (mba, defaultName, defaultNamespace, delegate (string n, string ns) { return new MessagePartDescription (n, ns); });
+ ret.Index = mba.Order;
+ return ret;
+ }
+
+ static T CreatePartCore<T> (MessageContractMemberAttribute mba, string defaultName, string defaultNamespace, Func<string,string,T> creator)
{
string pname = null, pns = null;
if (mba != null) {
@@ -496,7 +539,7 @@ namespace System.ServiceModel.Description
if (pns == null)
pns = defaultNamespace;
- return new MessagePartDescription (pname, pns);
+ return creator (pname, pns);
}
static Type MessageFilterOutByRef (Type type)
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceAuthorizationBehavior.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceAuthorizationBehavior.cs
index 2a6bfa0..c3ab04e 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceAuthorizationBehavior.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceAuthorizationBehavior.cs
@@ -91,11 +91,14 @@ namespace System.ServiceModel.Description
continue;
foreach (var ed in cd.Endpoints) {
var dr = ed.DispatchRuntime;
- dr.ExternalAuthorizationPolicies = ExternalAuthorizationPolicies;
+ if (ExternalAuthorizationPolicies !=null)
+ dr.ExternalAuthorizationPolicies = ExternalAuthorizationPolicies;
dr.ImpersonateCallerForAllOperations = ImpersonateCallerForAllOperations;
dr.PrincipalPermissionMode = PrincipalPermissionMode;
- dr.RoleProvider = RoleProvider;
- dr.ServiceAuthorizationManager = ServiceAuthorizationManager;
+ if (RoleProvider != null)
+ dr.RoleProvider = RoleProvider;
+ if (ServiceAuthorizationManager != null)
+ dr.ServiceAuthorizationManager = ServiceAuthorizationManager;
}
}
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDescription.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDescription.cs
index afaba6e..4235e39 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDescription.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Description/ServiceDescription.cs
@@ -35,16 +35,6 @@ using System.ServiceModel.Channels;
namespace System.ServiceModel.Description
{
- internal static class Extensions
- {
- public static T GetCustomAttribute<T> (this MemberInfo mi, bool inherit) where T : Attribute
- {
- foreach (T att in mi.GetCustomAttributes (typeof (T), inherit))
- return att;
- return null;
- }
- }
-
public class ServiceDescription
{
ServiceEndpointCollection endpoints = new ServiceEndpointCollection ();
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
index 79af8ae..1c38395 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs
@@ -29,6 +29,7 @@
//
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
using System.Runtime.Serialization;
using System.ServiceModel;
@@ -161,6 +162,7 @@ namespace System.ServiceModel.Dispatcher
protected abstract Message PartsToMessage (
MessageDescription md, MessageVersion version, string action, object [] parts);
protected abstract object [] MessageToParts (MessageDescription md, Message message);
+ protected abstract Dictionary<MessageHeaderDescription,object> MessageToHeaderObjects (MessageDescription md, Message message);
public Message SerializeRequest (
MessageVersion version, object [] parameters)
@@ -171,15 +173,20 @@ namespace System.ServiceModel.Dispatcher
md = mdi;
object [] parts = CreatePartsArray (md.Body);
+ var headers = md.Headers.Count > 0 ? new Dictionary<MessageHeaderDescription,object> () : null;
if (md.MessageType != null)
- MessageObjectToParts (md, parameters [0], parts);
+ MessageObjectToParts (md, parameters [0], headers, parts);
else {
int index = 0;
foreach (ParameterInfo pi in requestMethodParams)
if (!pi.IsOut)
parts [index++] = parameters [pi.Position];
}
- return PartsToMessage (md, version, md.Action, parts);
+ var msg = PartsToMessage (md, version, md.Action, parts);
+ if (headers != null)
+ foreach (var pair in headers)
+ msg.Headers.Add (MessageHeader.CreateHeader (pair.Key.Name, pair.Key.Namespace, pair.Value));
+ return msg;
}
public Message SerializeReply (
@@ -193,8 +200,9 @@ namespace System.ServiceModel.Dispatcher
md = mdi;
object [] parts = CreatePartsArray (md.Body);
+ var headers = md.Headers.Count > 0 ? new Dictionary<MessageHeaderDescription,object> () : null;
if (md.MessageType != null)
- MessageObjectToParts (md, result, parts);
+ MessageObjectToParts (md, result, headers, parts);
else {
if (HasReturnValue (md.Body))
parts [0] = result;
@@ -205,7 +213,12 @@ namespace System.ServiceModel.Dispatcher
parts [index++] = parameters [paramsIdx++];
}
string action = version.Addressing == AddressingVersion.None ? null : md.Action;
- return PartsToMessage (md, version, action, parts);
+ var msg = PartsToMessage (md, version, action, parts);
+ if (headers != null)
+ foreach (var pair in headers)
+ if (pair.Value != null)
+ msg.Headers.Add (MessageHeader.CreateHeader (pair.Key.Name, pair.Key.Namespace, pair.Value));
+ return msg;
}
public void DeserializeRequest (Message message, object [] parameters)
@@ -215,6 +228,7 @@ namespace System.ServiceModel.Dispatcher
if (md == null)
throw new ActionNotSupportedException (String.Format ("Action '{0}' is not supported by this operation.", action));
+ var headers = MessageToHeaderObjects (md, message);
object [] parts = MessageToParts (md, message);
if (md.MessageType != null) {
#if NET_2_1
@@ -222,7 +236,7 @@ namespace System.ServiceModel.Dispatcher
#else
parameters [0] = Activator.CreateInstance (md.MessageType, true);
#endif
- PartsToMessageObject (md, parts, parameters [0]);
+ PartsToMessageObject (md, headers, parts, parameters [0]);
}
else
{
@@ -242,6 +256,7 @@ namespace System.ServiceModel.Dispatcher
if (!mdi.IsRequest)
md = mdi;
+ var headers = MessageToHeaderObjects (md, message);
object [] parts = MessageToParts (md, message);
if (md.MessageType != null) {
#if NET_2_1
@@ -249,7 +264,7 @@ namespace System.ServiceModel.Dispatcher
#else
object msgObject = Activator.CreateInstance (md.MessageType, true);
#endif
- PartsToMessageObject (md, parts, msgObject);
+ PartsToMessageObject (md, headers, parts, msgObject);
return msgObject;
}
else {
@@ -261,8 +276,17 @@ namespace System.ServiceModel.Dispatcher
}
}
- void PartsToMessageObject (MessageDescription md, object [] parts, object msgObject)
+ void PartsToMessageObject (MessageDescription md, Dictionary<MessageHeaderDescription,object> headers, object [] parts, object msgObject)
{
+ if (headers != null)
+ foreach (var pair in headers) {
+ var mi = pair.Key.MemberInfo;
+ if (mi is FieldInfo)
+ ((FieldInfo) mi).SetValue (msgObject, pair.Value);
+ else
+ ((PropertyInfo) mi).SetValue (msgObject, pair.Value, null);
+ }
+
foreach (MessagePartDescription partDesc in md.Body.Parts)
if (partDesc.MemberInfo is FieldInfo)
((FieldInfo) partDesc.MemberInfo).SetValue (msgObject, parts [partDesc.Index]);
@@ -270,8 +294,16 @@ namespace System.ServiceModel.Dispatcher
((PropertyInfo) partDesc.MemberInfo).SetValue (msgObject, parts [partDesc.Index], null);
}
- void MessageObjectToParts (MessageDescription md, object msgObject, object [] parts)
+ void MessageObjectToParts (MessageDescription md, object msgObject, Dictionary<MessageHeaderDescription,object> headers, object [] parts)
{
+ foreach (var headDesc in md.Headers) {
+ var mi = headDesc.MemberInfo;
+ if (mi is FieldInfo)
+ headers [headDesc] = ((FieldInfo) mi).GetValue (msgObject);
+ else
+ headers [headDesc] = ((PropertyInfo) mi).GetValue (msgObject, null);
+ }
+
foreach (MessagePartDescription partDesc in md.Body.Parts)
if (partDesc.MemberInfo is FieldInfo)
parts [partDesc.Index] = ((FieldInfo) partDesc.MemberInfo).GetValue (msgObject);
@@ -340,6 +372,12 @@ namespace System.ServiceModel.Dispatcher
return (object []) GetSerializer (md.Body).Deserialize (r);
}
+ protected override Dictionary<MessageHeaderDescription,object> MessageToHeaderObjects (MessageDescription md, Message message)
+ {
+ // FIXME: do we need header serializers?
+ return null;
+ }
+
XmlSerializer GetSerializer (MessageBodyDescription desc)
{
if (bodySerializers.ContainsKey (desc))
@@ -415,6 +453,21 @@ namespace System.ServiceModel.Dispatcher
return Message.CreateMessage (version, action, new DataContractBodyWriter (md.Body, this, parts));
}
+ protected override Dictionary<MessageHeaderDescription,object> MessageToHeaderObjects (MessageDescription md, Message message)
+ {
+ if (message.IsEmpty || md.Headers.Count == 0)
+ return null;
+
+ var dic = new Dictionary<MessageHeaderDescription,object> ();
+ for (int i = 0; i < message.Headers.Count; i++) {
+ var r = message.Headers.GetReaderAtHeader (i);
+ var mh = md.Headers.FirstOrDefault (h => h.Name == r.LocalName && h.Namespace == r.NamespaceURI);
+ if (mh != null)
+ dic [mh] = GetSerializer (mh).ReadObject (r);
+ }
+ return dic;
+ }
+
protected override object [] MessageToParts (
MessageDescription md, Message message)
{
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
index 69f5ac5..b217e51 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ Do not try to serialize null header item.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ Message headers are now serialized and deserialized for
+ MessageHeaderDescription.
+
2011-02-09 Atsushi Eno <atsushi at ximian.com>
Support ServiceKnownTypes. Fixed another case on bug #652331.
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog
index 3a98126..74997fa 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ add private setter for message serialization.
+
+ Not sure if it is hack or required-to-do though.
+
2010-05-19 Atsushi Enomoto <atsushi at ximian.com>
* ServiceSettingsResponseInfo.cs
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog.old
similarity index 100%
copy from mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog
copy to mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ChangeLog.old
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshInfo.cs
index d11030c..ed3da0b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new RefreshInfoDC ();
return body;
}
+ set { body = value; }
}
RefreshInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshResponseInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshResponseInfo.cs
index 8642d2f..3eda617 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshResponseInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RefreshResponseInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new RefreshResponseInfoDC ();
return body;
}
+ set { body = value; }
}
RefreshResponseInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterInfo.cs
index 000b663..c535066 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterInfo.cs
@@ -42,6 +42,7 @@ namespace System.ServiceModel.PeerResolvers
body = new RegisterInfoDC ();
return body;
}
+ set { body = value; }
}
RegisterInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterResponseInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterResponseInfo.cs
index 46155ef..d7cb56a 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterResponseInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/RegisterResponseInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new RegisterResponseInfoDC ();
return body;
}
+ set { body = value; }
}
RegisterResponseInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveInfo.cs
index d7b3734..db8337b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new ResolveInfoDC ();
return body;
}
+ set { body = value; }
}
ResolveInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveResponseInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveResponseInfo.cs
index ea921d4..43d3cd3 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveResponseInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ResolveResponseInfo.cs
@@ -22,6 +22,7 @@ namespace System.ServiceModel.PeerResolvers
body = new ResolveResponseInfoDC ();
return body;
}
+ set { body = value; }
}
ResolveResponseInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ServiceSettingsResponseInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ServiceSettingsResponseInfo.cs
index 50be42b..3a40853 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ServiceSettingsResponseInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/ServiceSettingsResponseInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new ServiceSettingsResponseInfoDC ();
return body;
}
+ set { body = value; }
}
ServiceSettingsResponseInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UnregisterInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UnregisterInfo.cs
index ed82ee2..654f855 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UnregisterInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UnregisterInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new UnregisterInfoDC ();
return body;
}
+ set { body = value; }
}
UnregisterInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UpdateInfo.cs b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UpdateInfo.cs
index 6a2ef87..cc3a8cc 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UpdateInfo.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel.PeerResolvers/UpdateInfo.cs
@@ -21,6 +21,7 @@ namespace System.ServiceModel.PeerResolvers
body = new UpdateInfoDC ();
return body;
}
+ set { body = value; }
}
UpdateInfoDC body;
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
index 0d3628f..f2e3053 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChangeLog
@@ -1,3 +1,33 @@
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ Almost eliminate wrong use of Constants.WsaNamespace.
+
+ They should be addressing-version-aware.
+
+2011-02-18 Atsushi Eno <atsushi at ximian.com>
+
+ EndpointAddressAugust2004 was not serialized correctly.
+
+ Well, Actually unified the implementation with 10.
+
+2011-02-17 Atsushi Eno <atsushi at ximian.com>
+
+ Couple of corcompare fixes.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ implement some ServiceHostBase public methods that already existed
+ internally.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ When the callback contract type is the same as the contract, do
+ not block replies.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ EndpointAddress could be empty on opening the factory.
+
2011-02-07 Atsushi Eno <atsushi at ximian.com>
Open and close client/service runtime channels in chains. Fixed
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
index 80c04e0..f1d064d 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ChannelFactory.cs
@@ -287,8 +287,6 @@ namespace System.ServiceModel
{
if (Endpoint == null)
throw new InvalidOperationException ("A service endpoint must be configured for this channel factory");
- if (Endpoint.Address == null)
- throw new InvalidOperationException ("An EndpointAddress must be configured for this channel factory");
if (Endpoint.Contract == null)
throw new InvalidOperationException ("A service Contract must be configured for this channel factory");
if (Endpoint.Binding == null)
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/Constants.cs b/mcs/class/System.ServiceModel/System.ServiceModel/Constants.cs
index 8363da1..2ae25db 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/Constants.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/Constants.cs
@@ -61,6 +61,7 @@ namespace System.ServiceModel
public const string WssNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd";
public const string Wss11Namespace = "http://docs.oasis-open.org/wss/oasis-wss-wssecurity-secext-1.1.xsd";
public const string WspNamespace = "http://schemas.xmlsoap.org/ws/2004/09/policy";
+ // FIXME: eliminate use of this incorrectly-fixing-addressing-version constants (remains few).
public const string WsaNamespace = "http://www.w3.org/2005/08/addressing";
public const string WsuNamespace = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd";
public const string WsscNamespace = "http://schemas.xmlsoap.org/ws/2005/02/sc";
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs b/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
index b576754..66c0e79 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/DuplexClientRuntimeChannel.cs
@@ -157,7 +157,7 @@ namespace System.ServiceModel.MonoInternal
void ProcessInputCore (IInputChannel input, Message message)
{
- bool isReply = message != null && Contract.Operations.Any (od => !od.InCallbackContract && od.Messages.Any (md => md.Action == message.Headers.Action));
+ bool isReply = message != null && Contract.Operations.Any (od => (od.DeclaringContract.CallbackContractType == od.DeclaringContract.ContractType || !od.InCallbackContract) && od.Messages.Any (md => md.Action == message.Headers.Action));
if (isReply) {
if (ReplyHandlerQueue.Count > 0) {
if (isReply) {
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
index f8ca658..5acfbdf 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress.cs
@@ -37,6 +37,9 @@ using System.Xml.Schema;
using System.Xml.Serialization;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
+#if !NET_2_1
+using System.Security.Cryptography.Xml;
+#endif
namespace System.ServiceModel
{
@@ -329,18 +332,45 @@ namespace System.ServiceModel
return address.ToString ();
}
- [MonoTODO]
public void WriteContentsTo (
AddressingVersion addressingVersion,
XmlDictionaryWriter writer)
{
+ if (writer == null)
+ throw new ArgumentNullException ("writer");
#if NET_2_1
writer.WriteString (Uri.AbsoluteUri);
#else
- if (addressingVersion == AddressingVersion.WSAddressing10) {
- ((IXmlSerializable) EndpointAddress10.FromEndpointAddress (this)).WriteXml (writer);
- } else {
+ if (addressingVersion == AddressingVersion.None)
writer.WriteString (Uri.AbsoluteUri);
+ else {
+ writer.WriteStartElement ("Address", addressingVersion.Namespace);
+ writer.WriteString (Uri.AbsoluteUri);
+ writer.WriteEndElement ();
+
+ if (Identity == null)
+ return;
+
+ if (Headers != null)
+ foreach (AddressHeader ah in Headers)
+ ah.WriteAddressHeader (writer);
+
+ writer.WriteStartElement ("Identity", Constants.WsaIdentityUri);
+
+ X509CertificateEndpointIdentity x509 =
+ Identity as X509CertificateEndpointIdentity;
+ if (x509 != null) {
+ KeyInfo ki = new KeyInfo ();
+ KeyInfoX509Data x = new KeyInfoX509Data ();
+ foreach (X509Certificate2 cert in x509.Certificates)
+ x.AddCertificate (cert);
+ ki.AddClause (x);
+ ki.GetXml ().WriteTo (writer);
+ } else {
+ DataContractSerializer ds = new DataContractSerializer (Identity.IdentityClaim.GetType ());
+ ds.WriteObject (writer, Identity.IdentityClaim);
+ }
+ writer.WriteEndElement ();
}
#endif
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress10.cs b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress10.cs
index 71f317c..361a049 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress10.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddress10.cs
@@ -37,10 +37,6 @@ using System.Text;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;
-#if !NET_2_1
-using System.Security.Cryptography.X509Certificates;
-using System.Security.Cryptography.Xml;
-#endif
namespace System.ServiceModel
{
@@ -75,7 +71,7 @@ namespace System.ServiceModel
if (xmlSchemaSet == null)
throw new ArgumentNullException ("xmlSchemaSet");
xmlSchemaSet.Add (XmlSchema.Read (typeof (EndpointAddress10).Assembly.GetManifestResourceStream ("ws-addr.xsd"), null));
- return new XmlQualifiedName ("EndpointReferenceType", Constants.WsaNamespace);
+ return new XmlQualifiedName ("EndpointReferenceType", AddressingVersion.WSAddressing10.Namespace);
}
#endif
@@ -96,36 +92,7 @@ namespace System.ServiceModel
void IXmlSerializable.WriteXml (XmlWriter writer)
{
- if (writer == null)
- throw new ArgumentNullException ("writer");
- writer.WriteStartElement ("Address", Constants.WsaNamespace);
- writer.WriteString (address.Uri.AbsoluteUri);
- writer.WriteEndElement ();
-
- if (address.Identity == null)
- return;
-
- if (address.Headers != null)
- foreach (AddressHeader ah in address.Headers)
- ah.WriteAddressHeader (writer);
-
- writer.WriteStartElement ("Identity", Constants.WsaIdentityUri);
-#if !NET_2_1
- X509CertificateEndpointIdentity x509 =
- address.Identity as X509CertificateEndpointIdentity;
- if (x509 != null) {
- KeyInfo ki = new KeyInfo ();
- KeyInfoX509Data x = new KeyInfoX509Data ();
- foreach (X509Certificate2 cert in x509.Certificates)
- x.AddCertificate (cert);
- ki.AddClause (x);
- ki.GetXml ().WriteTo (writer);
- } else {
- DataContractSerializer ds = new DataContractSerializer (address.Identity.IdentityClaim.GetType ());
- ds.WriteObject (writer, address.Identity.IdentityClaim);
- }
-#endif
- writer.WriteEndElement ();
+ address.WriteContentsTo (AddressingVersion.WSAddressing10, writer);
}
}
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddressAugust2004.cs b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddressAugust2004.cs
index b28c1af..17ad33b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddressAugust2004.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/EndpointAddressAugust2004.cs
@@ -40,7 +40,6 @@ using System.Xml.Serialization;
namespace System.ServiceModel
{
- [MonoTODO]
[XmlSchemaProvider ("GetSchema")]
[XmlRoot ("EndpointReference", Namespace = "http://schemas.xmlsoap.org/ws/2004/08/addressing")]
public class EndpointAddressAugust2004 : IXmlSerializable
@@ -63,7 +62,10 @@ namespace System.ServiceModel
public static XmlQualifiedName GetSchema (XmlSchemaSet xmlSchemaSet)
{
- throw new NotImplementedException ();
+ if (xmlSchemaSet == null)
+ throw new ArgumentNullException ("xmlSchemaSet");
+ xmlSchemaSet.Add (XmlSchema.Read (typeof (EndpointAddress10).Assembly.GetManifestResourceStream ("WS-Addressing.schema"), null));
+ return new XmlQualifiedName ("EndpointReferenceType", AddressingVersion.WSAddressingAugust2004.Namespace);
}
public EndpointAddress ToEndpointAddress ()
@@ -83,11 +85,7 @@ namespace System.ServiceModel
void IXmlSerializable.WriteXml (XmlWriter writer)
{
- address.WriteTo (
- AddressingVersion.WSAddressingAugust2004,
- writer,
- "Address",
- AddressingVersion.WSAddressingAugust2004.Namespace);
+ address.WriteContentsTo (AddressingVersion.WSAddressingAugust2004, writer);
}
}
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceAuthorizationManager.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceAuthorizationManager.cs
index 21cf4b1..4a547c3 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceAuthorizationManager.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceAuthorizationManager.cs
@@ -27,24 +27,30 @@
using System;
using System.Collections.ObjectModel;
using System.IdentityModel.Policy;
+using System.ServiceModel.Channels;
namespace System.ServiceModel
{
public class ServiceAuthorizationManager
{
- public bool CheckAccess (OperationContext context)
+ public virtual bool CheckAccess (OperationContext context)
+ {
+ return CheckAccessCore (context);
+ }
+
+ public virtual bool CheckAccess (OperationContext context, ref Message message)
{
return CheckAccessCore (context);
}
[MonoTODO]
- public virtual bool CheckAccessCore (OperationContext context)
+ protected virtual bool CheckAccessCore (OperationContext context)
{
return false;
}
[MonoTODO]
- public ReadOnlyCollection<IAuthorizationPolicy> GetAuthorizationPolicies (OperationContext context)
+ protected virtual ReadOnlyCollection<IAuthorizationPolicy> GetAuthorizationPolicies (OperationContext context)
{
throw new NotImplementedException ();
}
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs
index e1230da..5df10e0 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceBehaviorAttribute.cs
@@ -46,7 +46,6 @@ namespace System.ServiceModel
ConcurrencyMode = ConcurrencyMode.Single;
InstanceContextMode = InstanceContextMode.PerSession;
MaxItemsInObjectGraph = 0x10000;
- SessionMode = SessionMode.Allowed;
ReleaseServiceInstanceOnTransactionComplete = true;
TransactionIsolationLevel = IsolationLevel.Unspecified;
UseSynchronizationContext = true;
@@ -85,9 +84,6 @@ namespace System.ServiceModel
[MonoTODO]
public bool ReleaseServiceInstanceOnTransactionComplete { get; set; }
- [MonoTODO]
- public SessionMode SessionMode { get; set; }
-
public bool UseSynchronizationContext { get; set; }
[MonoTODO]
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
index 70bb18d..9d55249 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHostBase.cs
@@ -322,7 +322,7 @@ namespace System.ServiceModel
ServiceElement service = GetServiceElement ();
if (service != null)
- ApplyServiceElement (service);
+ LoadConfigurationSection (service);
#if NET_4_0
// simplified configuration
AddServiceBehaviors (String.Empty, false);
@@ -508,15 +508,14 @@ namespace System.ServiceModel
throw new InvalidOperationException ("The ServiceHost must have at least one application endpoint (that does not include metadata exchange endpoint) defined by either configuration, behaviors or call to AddServiceEndpoint methods.");
}
- [MonoTODO]
protected void LoadConfigurationSection (ServiceElement element)
{
- ServicesSection services = ConfigUtil.ServicesSection;
+ ApplyServiceElement (element);
}
- [MonoTODO]
protected override sealed void OnAbort ()
{
+ OnCloseOrAbort (TimeSpan.Zero);
}
Action<TimeSpan> close_delegate;
@@ -540,6 +539,11 @@ namespace System.ServiceModel
protected override void OnClose (TimeSpan timeout)
{
+ OnCloseOrAbort (timeout);
+ }
+
+ void OnCloseOrAbort (TimeSpan timeout)
+ {
DateTime start = DateTime.Now;
ReleasePerformanceCounters ();
List<ChannelDispatcherBase> l = new List<ChannelDispatcherBase> (ChannelDispatchers);
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceSecurityContext.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceSecurityContext.cs
index e5c1ccb..7f84e9b 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceSecurityContext.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceSecurityContext.cs
@@ -84,6 +84,7 @@ namespace System.ServiceModel
public ReadOnlyCollection<IAuthorizationPolicy> AuthorizationPolicies {
get { return policies; }
+ set { policies = value; }
}
[MonoTODO]
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources b/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
index d1e0575..28576e8 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
+++ b/mcs/class/System.ServiceModel/System.ServiceModel_test.dll.sources
@@ -122,6 +122,7 @@ System.ServiceModel.Description/WsdlExporterTest.cs
System.ServiceModel.Description/WsdlImporterTest.cs
System.ServiceModel.Dispatcher/ActionFilterTest.cs
System.ServiceModel.Dispatcher/Bug652331Test.cs
+System.ServiceModel.Dispatcher/Bug652331_2Test.cs
System.ServiceModel.Dispatcher/ChannelDispatcherTest.cs
System.ServiceModel.Dispatcher/DispatchOperationTest.cs
System.ServiceModel.Dispatcher/DispatchRuntimeTest.cs
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
index 7b1358f..5aad653 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ChangeLog
@@ -1,3 +1,13 @@
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ Message headers are now serialized and deserialized for
+ MessageHeaderDescription.
+
+2011-02-15 Atsushi Eno <atsushi at ximian.com>
+
+ MessageHeaderDescription were not filled in message contract.
+ Reject wrong contracts.
+
2011-02-03 Atsushi Eno <atsushi at ximian.com>
Now operations are collected per corresponding
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
index 27cb06d..b0bff8b 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/ContractDescriptionTest.cs
@@ -448,6 +448,51 @@ namespace MonoTests.System.ServiceModel.Description
Assert.IsTrue (cd.Operations.Any (od => od.SyncMethod == typeof (IService2).GetMethod ("Join") && od.Messages.Any (md => md.Action == "http://tempuri.org/IService/Join")), "#3"); // callback
}
+ [Test]
+ public void MessageContractAttributes ()
+ {
+ var cd = ContractDescription.GetContract (typeof (IFoo2));
+ var od = cd.Operations.First (o => o.Name == "Nanoda");
+ var md = od.Messages.First (m => m.Direction == MessageDirection.Input);
+ Assert.AreEqual (typeof (OregoMessage), md.MessageType, "message type");
+ Assert.AreEqual ("http://tempuri.org/IFoo2/Nanoda", md.Action, "action");
+ Assert.AreEqual (1, md.Headers.Count, "headers");
+ Assert.AreEqual (3, md.Body.Parts.Count, "body parts");
+ Assert.AreEqual (0, md.Properties.Count, "properties");
+ }
+
+ // .NET complains: The operation Nanoda2 either has a parameter or a return type that is attributed with MessageContractAttribute. In order to represent the request message using a Message Contract, the operation must have a single parameter attributed with MessageContractAttribute. In order to represent the response message using a Message Contract, the operation's return value must be a type that is attributed with MessageContractAttribute and the operation may not have any out or ref parameters.
+ [Test]
+ [ExpectedException (typeof (InvalidOperationException))]
+ public void MessageContractAttributes2 ()
+ {
+ ContractDescription.GetContract (typeof (IFoo2_2));
+ }
+
+ [Test]
+ public void MessageContractAttributes3 ()
+ {
+ ContractDescription.GetContract (typeof (IFoo2_3));
+ }
+
+ [Test]
+ public void MessageContractAttributes4 ()
+ {
+ ContractDescription.GetContract (typeof (IFoo2_4));
+ }
+
+ [Test]
+ public void MessageContractAttributes5 ()
+ {
+ ContractDescription.GetContract (typeof (IFoo2_5));
+ }
+
+ [Test]
+ public void MessageContractAttributes6 ()
+ {
+ ContractDescription.GetContract (typeof (IFoo2_6));
+ }
+
// It is for testing attribute search in interfaces.
public class Foo : IFoo
{
@@ -498,11 +543,42 @@ namespace MonoTests.System.ServiceModel.Description
// FIXME: it does not pass yet
[OperationContract]
+ Mona NewMona (Mona source);
+ }
+
+ [ServiceContract]
+ public interface IFoo2_2
+ {
+ [OperationContract] // wrong operation contract, must have only one parameter with MessageContractAttribute
OregoMessage Nanoda2 (OregoMessage msg1, OregoMessage msg2);
+ }
- // FIXME: it does not pass yet
+ [ServiceContract]
+ public interface IFoo2_3
+ {
[OperationContract]
- Mona NewMona (Mona source);
+ string Nanoda2 (OregoMessage msg1);
+ }
+
+ [ServiceContract]
+ public interface IFoo2_4
+ {
+ [OperationContract]
+ OregoMessage Nanoda2 (string s, string s2);
+ }
+
+ [ServiceContract]
+ public interface IFoo2_5
+ {
+ [OperationContract]
+ Message Nanoda2 (OregoMessage msg1);
+ }
+
+ [ServiceContract]
+ public interface IFoo2_6
+ {
+ [OperationContract]
+ OregoMessage Nanoda2 (Message msg1);
}
[ServiceContract]
@@ -530,6 +606,8 @@ namespace MonoTests.System.ServiceModel.Description
[MessageContract]
public class OregoMessage
{
+ [MessageHeader]
+ public string Head;
[MessageBodyMember]
public string Neutral;
[MessageBodyMember]
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/TypedMessageConverterTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/TypedMessageConverterTest.cs
index faa52b0..eb9b672 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/TypedMessageConverterTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Description/TypedMessageConverterTest.cs
@@ -103,8 +103,7 @@ namespace MonoTests.System.ServiceModel.Description
Message msg = c.ToMessage (t1);
var t2 = (Test2) c.FromMessage (msg);
Assert.AreEqual ("test", t2.Body.msg, "#01");
- // FIXME: enable it (not working yet)
- //Assert.AreEqual (uid, t2.Id, "#02");
+ Assert.AreEqual (uid, t2.Id, "#02");
}
[Test]
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug652331_2Test.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug652331_2Test.cs
new file mode 100644
index 0000000..4a52626
--- /dev/null
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/Bug652331_2Test.cs
@@ -0,0 +1,666 @@
+//
+// Authors:
+// David Straw
+// Atsushi Enomoto <atsushi at ximian.com>
+//
+// Copyright (C) 2011 Novell, Inc. http://www.novell.com
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+using System;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+using System.Linq;
+using System.Runtime.Serialization;
+using System.ServiceModel;
+using System.ServiceModel.Description;
+using System.Threading;
+using NUnit.Framework;
+
+using WebServiceMoonlightTest.ServiceReference2;
+
+namespace MonoTests.System.ServiceModel.Dispatcher
+{
+ [TestFixture]
+ public class Bug652331_2Test
+ {
+ [Test]
+ public void Bug652331_3 ()
+ {
+ // Init service
+ ServiceHost serviceHost = new ServiceHost(typeof(Service1), new Uri("http://localhost:37564/Service1"));
+ serviceHost.AddServiceEndpoint(typeof(IService1), new BasicHttpBinding(), string.Empty);
+
+ // Enable metadata exchange (WSDL publishing)
+ ServiceMetadataBehavior mexBehavior = new ServiceMetadataBehavior();
+ mexBehavior.HttpGetEnabled = true;
+ serviceHost.Description.Behaviors.Add(mexBehavior);
+ serviceHost.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding(), "mex");
+
+ serviceHost.Open();
+
+ try {
+ RunClient ();
+ } finally {
+ serviceHost.Close ();
+ }
+ }
+
+ void RunClient ()
+ {
+ var binding = new BasicHttpBinding ();
+ var remoteAddress = new EndpointAddress ("http://localhost:37564/Service1");
+ var client = new Service1Client (binding, remoteAddress);
+
+ var waits = new ManualResetEvent [3];
+ for (int i = 0; i < waits.Length; i++)
+ waits [i] = new ManualResetEvent (false);
+
+ client.GetDataCompleted += delegate (object o, GetDataCompletedEventArgs e) {
+ if (e.Error != null)
+ throw e.Error;
+ Assert.AreEqual ("A", ((DataType1) e.Result).Id, "Normal");
+ waits [0].Set ();
+ };
+ client.GetDataAsync ();
+
+ client.GetCollectionDataCompleted += delegate (object sender, GetCollectionDataCompletedEventArgs e) {
+ if (e.Error != null)
+ throw e.Error;
+ Assert.AreEqual ("B,C", ItemsToString (e.Result.Cast<DataType1> ()), "Collection");
+ waits [1].Set ();
+ };
+ client.GetCollectionDataAsync ();
+
+ client.GetNestedDataCompleted += delegate (object sender, GetNestedDataCompletedEventArgs e) {
+ if (e.Error != null)
+ throw e.Error;
+ Assert.AreEqual ("D,E", ItemsToString (e.Result.Items.Cast<DataType1> ()), "Nested");
+ waits [2].Set ();
+ };
+ client.GetNestedDataAsync ();
+
+ WaitHandle.WaitAll (waits.Cast<WaitHandle> ().ToArray (), TimeSpan.FromMinutes (1));
+ }
+
+ string ItemsToString (IEnumerable<DataType1> items)
+ {
+ return items.Aggregate ((string) null, (result, item) => result == null ? item.Id : result + "," + item.Id);
+ }
+ }
+
+ public class Service1 : IService1
+ {
+ public object GetData()
+ {
+ return new DataType1 { Id = "A" };
+ }
+
+ Func<object> gd;
+ public IAsyncResult BeginGetData(AsyncCallback cb, object st)
+ {
+ gd = new Func<object> (GetData);
+ return gd.BeginInvoke (cb, st);
+ }
+
+ public object EndGetData (IAsyncResult result)
+ {
+ return gd.EndInvoke (result);
+ }
+
+ public ObservableCollection<object> GetCollectionData()
+ {
+ return new ObservableCollection<object> { new DataType1 { Id = "B" }, new DataType1 { Id = "C" } };
+ }
+
+ Func<ObservableCollection<object>> gcd;
+ public IAsyncResult BeginGetCollectionData(AsyncCallback cb, object st)
+ {
+ gcd = new Func<ObservableCollection<object>> (GetCollectionData);
+ return gcd.BeginInvoke (cb, st);
+ }
+
+ public ObservableCollection<object> EndGetCollectionData (IAsyncResult result)
+ {
+ return gcd.EndInvoke (result);
+ }
+
+ public DataType2 GetNestedData()
+ {
+ return new DataType2 { Items = new ObservableCollection<object> { new DataType1 { Id = "D" }, new DataType1 { Id = "E" } } };
+ }
+
+ Func<DataType2> gnd;
+ public IAsyncResult BeginGetNestedData(AsyncCallback cb, object st)
+ {
+ gnd = new Func<DataType2> (GetNestedData);
+ return gnd.BeginInvoke (cb, st);
+ }
+
+ public DataType2 EndGetNestedData (IAsyncResult result)
+ {
+ return gnd.EndInvoke (result);
+ }
+ }
+}
+
+
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.372
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+//
+// This code was auto-generated by Microsoft.Silverlight.ServiceReference, version 4.0.50826.0
+//
+namespace WebServiceMoonlightTest.ServiceReference2 {
+ using System.Runtime.Serialization;
+
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
+ [System.Runtime.Serialization.DataContractAttribute(Name="DataType1", Namespace="http://mynamespace")]
+ public partial class DataType1 : object, System.ComponentModel.INotifyPropertyChanged {
+
+ private string IdField;
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public string Id {
+ get {
+ return this.IdField;
+ }
+ set {
+ if ((object.ReferenceEquals(this.IdField, value) != true)) {
+ this.IdField = value;
+ this.RaisePropertyChanged("Id");
+ }
+ }
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+
+ protected void RaisePropertyChanged(string propertyName) {
+ System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
+ if ((propertyChanged != null)) {
+ propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
+ [System.Runtime.Serialization.DataContractAttribute(Name="DataType2", Namespace="http://mynamespace")]
+ [System.Runtime.Serialization.KnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
+ [System.Runtime.Serialization.KnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
+ public partial class DataType2 : object, System.ComponentModel.INotifyPropertyChanged {
+
+ private System.Collections.ObjectModel.ObservableCollection<object> ItemsField;
+
+ [System.Runtime.Serialization.DataMemberAttribute()]
+ public System.Collections.ObjectModel.ObservableCollection<object> Items {
+ get {
+ return this.ItemsField;
+ }
+ set {
+ if ((object.ReferenceEquals(this.ItemsField, value) != true)) {
+ this.ItemsField = value;
+ this.RaisePropertyChanged("Items");
+ }
+ }
+ }
+
+ public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
+
+ protected void RaisePropertyChanged(string propertyName) {
+ System.ComponentModel.PropertyChangedEventHandler propertyChanged = this.PropertyChanged;
+ if ((propertyChanged != null)) {
+ propertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
+ }
+ }
+ }
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ [System.ServiceModel.ServiceContractAttribute(Namespace="http://mynamespace", ConfigurationName="ServiceReference1.IService1")]
+ public interface IService1 {
+
+ [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetData", ReplyAction="http://mynamespace/IService1/GetDataResponse")]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
+ System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState);
+
+ object EndGetData(System.IAsyncResult result);
+
+ [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetCollectionData", ReplyAction="http://mynamespace/IService1/GetCollectionDataResponse")]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType1))]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(WebServiceMoonlightTest.ServiceReference2.DataType2))]
+ [System.ServiceModel.ServiceKnownTypeAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<object>))]
+ System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState);
+
+ System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result);
+
+ [System.ServiceModel.OperationContractAttribute(AsyncPattern=true, Action="http://mynamespace/IService1/GetNestedData", ReplyAction="http://mynamespace/IService1/GetNestedDataResponse")]
+ System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState);
+
+ WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result);
+ }
+
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public interface IService1Channel : WebServiceMoonlightTest.ServiceReference2.IService1, System.ServiceModel.IClientChannel {
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public partial class GetDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ public GetDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ public object Result {
+ get {
+ base.RaiseExceptionIfNecessary();
+ return ((object)(this.results[0]));
+ }
+ }
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public partial class GetCollectionDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ public GetCollectionDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ public System.Collections.ObjectModel.ObservableCollection<object> Result {
+ get {
+ base.RaiseExceptionIfNecessary();
+ return ((System.Collections.ObjectModel.ObservableCollection<object>)(this.results[0]));
+ }
+ }
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public partial class GetNestedDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs {
+
+ private object[] results;
+
+ public GetNestedDataCompletedEventArgs(object[] results, System.Exception exception, bool cancelled, object userState) :
+ base(exception, cancelled, userState) {
+ this.results = results;
+ }
+
+ public WebServiceMoonlightTest.ServiceReference2.DataType2 Result {
+ get {
+ base.RaiseExceptionIfNecessary();
+ return ((WebServiceMoonlightTest.ServiceReference2.DataType2)(this.results[0]));
+ }
+ }
+ }
+
+ [System.Diagnostics.DebuggerStepThroughAttribute()]
+ [System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
+ public partial class Service1Client : System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
+
+ private BeginOperationDelegate onBeginGetDataDelegate;
+
+ private EndOperationDelegate onEndGetDataDelegate;
+
+ private System.Threading.SendOrPostCallback onGetDataCompletedDelegate;
+
+ private BeginOperationDelegate onBeginGetCollectionDataDelegate;
+
+ private EndOperationDelegate onEndGetCollectionDataDelegate;
+
+ private System.Threading.SendOrPostCallback onGetCollectionDataCompletedDelegate;
+
+ private BeginOperationDelegate onBeginGetNestedDataDelegate;
+
+ private EndOperationDelegate onEndGetNestedDataDelegate;
+
+ private System.Threading.SendOrPostCallback onGetNestedDataCompletedDelegate;
+
+ private BeginOperationDelegate onBeginOpenDelegate;
+
+ private EndOperationDelegate onEndOpenDelegate;
+
+ private System.Threading.SendOrPostCallback onOpenCompletedDelegate;
+
+ private BeginOperationDelegate onBeginCloseDelegate;
+
+ private EndOperationDelegate onEndCloseDelegate;
+
+ private System.Threading.SendOrPostCallback onCloseCompletedDelegate;
+
+ public Service1Client() {
+ }
+
+ public Service1Client(string endpointConfigurationName) :
+ base(endpointConfigurationName) {
+ }
+
+ public Service1Client(string endpointConfigurationName, string remoteAddress) :
+ base(endpointConfigurationName, remoteAddress) {
+ }
+
+ public Service1Client(string endpointConfigurationName, System.ServiceModel.EndpointAddress remoteAddress) :
+ base(endpointConfigurationName, remoteAddress) {
+ }
+
+ public Service1Client(System.ServiceModel.Channels.Binding binding, System.ServiceModel.EndpointAddress remoteAddress) :
+ base(binding, remoteAddress) {
+ }
+
+/*
+ public System.Net.CookieContainer CookieContainer {
+ get {
+ System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
+ if ((httpCookieContainerManager != null)) {
+ return httpCookieContainerManager.CookieContainer;
+ }
+ else {
+ return null;
+ }
+ }
+ set {
+ System.ServiceModel.Channels.IHttpCookieContainerManager httpCookieContainerManager = this.InnerChannel.GetProperty<System.ServiceModel.Channels.IHttpCookieContainerManager>();
+ if ((httpCookieContainerManager != null)) {
+ httpCookieContainerManager.CookieContainer = value;
+ }
+ else {
+ throw new System.InvalidOperationException("Unable to set the CookieContainer. Please make sure the binding contains an HttpC" +
+ "ookieContainerBindingElement.");
+ }
+ }
+ }
+*/
+
+ public event System.EventHandler<GetDataCompletedEventArgs> GetDataCompleted;
+
+ public event System.EventHandler<GetCollectionDataCompletedEventArgs> GetCollectionDataCompleted;
+
+ public event System.EventHandler<GetNestedDataCompletedEventArgs> GetNestedDataCompleted;
+
+ public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> OpenCompleted;
+
+ public event System.EventHandler<System.ComponentModel.AsyncCompletedEventArgs> CloseCompleted;
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetData(System.AsyncCallback callback, object asyncState) {
+ return base.Channel.BeginGetData(callback, asyncState);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ object WebServiceMoonlightTest.ServiceReference2.IService1.EndGetData(System.IAsyncResult result) {
+ return base.Channel.EndGetData(result);
+ }
+
+ private System.IAsyncResult OnBeginGetData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+ return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetData(callback, asyncState);
+ }
+
+ private object[] OnEndGetData(System.IAsyncResult result) {
+ object retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetData(result);
+ return new object[] {
+ retVal};
+ }
+
+ private void OnGetDataCompleted(object state) {
+ if ((this.GetDataCompleted != null)) {
+ InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+ this.GetDataCompleted(this, new GetDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+ }
+ }
+
+ public void GetDataAsync() {
+ this.GetDataAsync(null);
+ }
+
+ public void GetDataAsync(object userState) {
+ if ((this.onBeginGetDataDelegate == null)) {
+ this.onBeginGetDataDelegate = new BeginOperationDelegate(this.OnBeginGetData);
+ }
+ if ((this.onEndGetDataDelegate == null)) {
+ this.onEndGetDataDelegate = new EndOperationDelegate(this.OnEndGetData);
+ }
+ if ((this.onGetDataCompletedDelegate == null)) {
+ this.onGetDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetDataCompleted);
+ }
+ base.InvokeAsync(this.onBeginGetDataDelegate, null, this.onEndGetDataDelegate, this.onGetDataCompletedDelegate, userState);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
+ return base.Channel.BeginGetCollectionData(callback, asyncState);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.Collections.ObjectModel.ObservableCollection<object> WebServiceMoonlightTest.ServiceReference2.IService1.EndGetCollectionData(System.IAsyncResult result) {
+ return base.Channel.EndGetCollectionData(result);
+ }
+
+ private System.IAsyncResult OnBeginGetCollectionData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+ return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetCollectionData(callback, asyncState);
+ }
+
+ private object[] OnEndGetCollectionData(System.IAsyncResult result) {
+ System.Collections.ObjectModel.ObservableCollection<object> retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetCollectionData(result);
+ return new object[] {
+ retVal};
+ }
+
+ private void OnGetCollectionDataCompleted(object state) {
+ if ((this.GetCollectionDataCompleted != null)) {
+ InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+ this.GetCollectionDataCompleted(this, new GetCollectionDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+ }
+ }
+
+ public void GetCollectionDataAsync() {
+ this.GetCollectionDataAsync(null);
+ }
+
+ public void GetCollectionDataAsync(object userState) {
+ if ((this.onBeginGetCollectionDataDelegate == null)) {
+ this.onBeginGetCollectionDataDelegate = new BeginOperationDelegate(this.OnBeginGetCollectionData);
+ }
+ if ((this.onEndGetCollectionDataDelegate == null)) {
+ this.onEndGetCollectionDataDelegate = new EndOperationDelegate(this.OnEndGetCollectionData);
+ }
+ if ((this.onGetCollectionDataCompletedDelegate == null)) {
+ this.onGetCollectionDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetCollectionDataCompleted);
+ }
+ base.InvokeAsync(this.onBeginGetCollectionDataDelegate, null, this.onEndGetCollectionDataDelegate, this.onGetCollectionDataCompletedDelegate, userState);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ System.IAsyncResult WebServiceMoonlightTest.ServiceReference2.IService1.BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
+ return base.Channel.BeginGetNestedData(callback, asyncState);
+ }
+
+ [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)]
+ WebServiceMoonlightTest.ServiceReference2.DataType2 WebServiceMoonlightTest.ServiceReference2.IService1.EndGetNestedData(System.IAsyncResult result) {
+ return base.Channel.EndGetNestedData(result);
+ }
+
+ private System.IAsyncResult OnBeginGetNestedData(object[] inValues, System.AsyncCallback callback, object asyncState) {
+ return ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).BeginGetNestedData(callback, asyncState);
+ }
+
+ private object[] OnEndGetNestedData(System.IAsyncResult result) {
+ WebServiceMoonlightTest.ServiceReference2.DataType2 retVal = ((WebServiceMoonlightTest.ServiceReference2.IService1)(this)).EndGetNestedData(result);
+ return new object[] {
+ retVal};
+ }
+
+ private void OnGetNestedDataCompleted(object state) {
+ if ((this.GetNestedDataCompleted != null)) {
+ InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+ this.GetNestedDataCompleted(this, new GetNestedDataCompletedEventArgs(e.Results, e.Error, e.Cancelled, e.UserState));
+ }
+ }
+
+ public void GetNestedDataAsync() {
+ this.GetNestedDataAsync(null);
+ }
+
+ public void GetNestedDataAsync(object userState) {
+ if ((this.onBeginGetNestedDataDelegate == null)) {
+ this.onBeginGetNestedDataDelegate = new BeginOperationDelegate(this.OnBeginGetNestedData);
+ }
+ if ((this.onEndGetNestedDataDelegate == null)) {
+ this.onEndGetNestedDataDelegate = new EndOperationDelegate(this.OnEndGetNestedData);
+ }
+ if ((this.onGetNestedDataCompletedDelegate == null)) {
+ this.onGetNestedDataCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnGetNestedDataCompleted);
+ }
+ base.InvokeAsync(this.onBeginGetNestedDataDelegate, null, this.onEndGetNestedDataDelegate, this.onGetNestedDataCompletedDelegate, userState);
+ }
+
+ private System.IAsyncResult OnBeginOpen(object[] inValues, System.AsyncCallback callback, object asyncState) {
+ return ((System.ServiceModel.ICommunicationObject)(this)).BeginOpen(callback, asyncState);
+ }
+
+ private object[] OnEndOpen(System.IAsyncResult result) {
+ ((System.ServiceModel.ICommunicationObject)(this)).EndOpen(result);
+ return null;
+ }
+
+ private void OnOpenCompleted(object state) {
+ if ((this.OpenCompleted != null)) {
+ InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+ this.OpenCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
+ }
+ }
+
+ public void OpenAsync() {
+ this.OpenAsync(null);
+ }
+
+ public void OpenAsync(object userState) {
+ if ((this.onBeginOpenDelegate == null)) {
+ this.onBeginOpenDelegate = new BeginOperationDelegate(this.OnBeginOpen);
+ }
+ if ((this.onEndOpenDelegate == null)) {
+ this.onEndOpenDelegate = new EndOperationDelegate(this.OnEndOpen);
+ }
+ if ((this.onOpenCompletedDelegate == null)) {
+ this.onOpenCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnOpenCompleted);
+ }
+ base.InvokeAsync(this.onBeginOpenDelegate, null, this.onEndOpenDelegate, this.onOpenCompletedDelegate, userState);
+ }
+
+ private System.IAsyncResult OnBeginClose(object[] inValues, System.AsyncCallback callback, object asyncState) {
+ return ((System.ServiceModel.ICommunicationObject)(this)).BeginClose(callback, asyncState);
+ }
+
+ private object[] OnEndClose(System.IAsyncResult result) {
+ ((System.ServiceModel.ICommunicationObject)(this)).EndClose(result);
+ return null;
+ }
+
+ private void OnCloseCompleted(object state) {
+ if ((this.CloseCompleted != null)) {
+ InvokeAsyncCompletedEventArgs e = ((InvokeAsyncCompletedEventArgs)(state));
+ this.CloseCompleted(this, new System.ComponentModel.AsyncCompletedEventArgs(e.Error, e.Cancelled, e.UserState));
+ }
+ }
+
+ public void CloseAsync() {
+ this.CloseAsync(null);
+ }
+
+ public void CloseAsync(object userState) {
+ if ((this.onBeginCloseDelegate == null)) {
+ this.onBeginCloseDelegate = new BeginOperationDelegate(this.OnBeginClose);
+ }
+ if ((this.onEndCloseDelegate == null)) {
+ this.onEndCloseDelegate = new EndOperationDelegate(this.OnEndClose);
+ }
+ if ((this.onCloseCompletedDelegate == null)) {
+ this.onCloseCompletedDelegate = new System.Threading.SendOrPostCallback(this.OnCloseCompleted);
+ }
+ base.InvokeAsync(this.onBeginCloseDelegate, null, this.onEndCloseDelegate, this.onCloseCompletedDelegate, userState);
+ }
+
+/*
+ protected override WebServiceMoonlightTest.ServiceReference2.IService1 CreateChannel() {
+ return new Service1ClientChannel(this);
+ }
+
+ private class Service1ClientChannel : ChannelBase<WebServiceMoonlightTest.ServiceReference2.IService1>, WebServiceMoonlightTest.ServiceReference2.IService1 {
+
+ public Service1ClientChannel(System.ServiceModel.ClientBase<WebServiceMoonlightTest.ServiceReference2.IService1> client) :
+ base(client) {
+ }
+
+ public System.IAsyncResult BeginGetData(System.AsyncCallback callback, object asyncState) {
+ object[] _args = new object[0];
+ System.IAsyncResult _result = base.BeginInvoke("GetData", _args, callback, asyncState);
+ return _result;
+ }
+
+ public object EndGetData(System.IAsyncResult result) {
+ object[] _args = new object[0];
+ object _result = ((object)(base.EndInvoke("GetData", _args, result)));
+ return _result;
+ }
+
+ public System.IAsyncResult BeginGetCollectionData(System.AsyncCallback callback, object asyncState) {
+ object[] _args = new object[0];
+ System.IAsyncResult _result = base.BeginInvoke("GetCollectionData", _args, callback, asyncState);
+ return _result;
+ }
+
+ public System.Collections.ObjectModel.ObservableCollection<object> EndGetCollectionData(System.IAsyncResult result) {
+ object[] _args = new object[0];
+ System.Collections.ObjectModel.ObservableCollection<object> _result = ((System.Collections.ObjectModel.ObservableCollection<object>)(base.EndInvoke("GetCollectionData", _args, result)));
+ return _result;
+ }
+
+ public System.IAsyncResult BeginGetNestedData(System.AsyncCallback callback, object asyncState) {
+ object[] _args = new object[0];
+ System.IAsyncResult _result = base.BeginInvoke("GetNestedData", _args, callback, asyncState);
+ return _result;
+ }
+
+ public WebServiceMoonlightTest.ServiceReference2.DataType2 EndGetNestedData(System.IAsyncResult result) {
+ object[] _args = new object[0];
+ WebServiceMoonlightTest.ServiceReference2.DataType2 _result = ((WebServiceMoonlightTest.ServiceReference2.DataType2)(base.EndInvoke("GetNestedData", _args, result)));
+ return _result;
+ }
+ }
+*/
+ }
+}
+
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
index 3059ef3..e2d1ebc 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel.Dispatcher/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-16 Atsushi Eno <atsushi at ximian.com>
+
+ xsi:type parsing is wrong in default namespace resolution.
+
+ Fixed case #3 in bug #652331.
+
2011-02-09 Atsushi Eno <atsushi at ximian.com>
Support ServiceKnownTypes. Fixed another case on bug #652331.
diff --git a/mcs/class/System.Transactions/System.Transactions/ChangeLog b/mcs/class/System.Transactions/System.Transactions/ChangeLog
index 0973e4b..8c85ffd 100644
--- a/mcs/class/System.Transactions/System.Transactions/ChangeLog
+++ b/mcs/class/System.Transactions/System.Transactions/ChangeLog
@@ -1,3 +1,12 @@
+2011-02-21 Marek Habersack <grendel at twistedcode.net>
+
+ [transactions] When cloning a transaction make sure to copy all
+ the stuff that matters.
+
+ The volatiles and durables lists must be copied even if they are
+ empty. The calling code might still be accessing them via the
+ original transaction (as is the case with Orchard+NHibernate)
+
2010-10-05 Martin Baulig <martin at novell.com>
Fix my previous commit.
diff --git a/mcs/class/System.Transactions/System.Transactions/Transaction.cs b/mcs/class/System.Transactions/System.Transactions/Transaction.cs
index 9e4da20..dc32c9a 100644
--- a/mcs/class/System.Transactions/System.Transactions/Transaction.cs
+++ b/mcs/class/System.Transactions/System.Transactions/Transaction.cs
@@ -30,14 +30,14 @@ namespace System.Transactions
ArrayList dependents = new ArrayList ();
/* Volatile enlistments */
- List <IEnlistmentNotification> volatiles = new List <IEnlistmentNotification> ();
+ List <IEnlistmentNotification> volatiles;
/* Durable enlistments
Durable RMs can also have 2 Phase commit but
not in LTM, and that is what we are supporting
right now
*/
- List <ISinglePhaseNotification> durables = new List <ISinglePhaseNotification> ();
+ List <ISinglePhaseNotification> durables;
delegate void AsyncCommit ();
@@ -48,7 +48,24 @@ namespace System.Transactions
TransactionScope scope = null;
Exception innerException;
+ Guid tag = Guid.NewGuid ();
+ List <IEnlistmentNotification> Volatiles {
+ get {
+ if (volatiles == null)
+ volatiles = new List <IEnlistmentNotification> ();
+ return volatiles;
+ }
+ }
+
+ List <ISinglePhaseNotification> Durables {
+ get {
+ if (durables == null)
+ durables = new List <ISinglePhaseNotification> ();
+ return durables;
+ }
+ }
+
internal Transaction ()
{
info = new TransactionInformation ();
@@ -60,6 +77,8 @@ namespace System.Transactions
level = other.level;
info = other.info;
dependents = other.dependents;
+ volatiles = other.Volatiles;
+ durables = other.Durables;
}
[MonoTODO]
@@ -137,6 +156,7 @@ namespace System.Transactions
ISinglePhaseNotification notification,
EnlistmentOptions options)
{
+ var durables = Durables;
if (durables.Count == 1)
throw new NotImplementedException ("Only LTM supported. Cannot have more than 1 durable resource per transaction.");
@@ -181,7 +201,7 @@ namespace System.Transactions
{
EnsureIncompleteCurrentScope ();
/* FIXME: Handle options.EnlistDuringPrepareRequired */
- volatiles.Add (notification);
+ Volatiles.Add (notification);
/* FIXME: Enlistment.. ? */
return new Enlistment ();
@@ -245,10 +265,11 @@ namespace System.Transactions
innerException = ex;
Enlistment e = new Enlistment ();
- foreach (IEnlistmentNotification prep in volatiles)
+ foreach (IEnlistmentNotification prep in Volatiles)
if (prep != enlisted)
prep.Rollback (e);
+ var durables = Durables;
if (durables.Count > 0 && durables [0] != enlisted)
durables [0].Rollback (e);
@@ -316,6 +337,8 @@ namespace System.Transactions
CheckAborted ();
}
+ var volatiles = Volatiles;
+ var durables = Durables;
if (volatiles.Count == 1 && durables.Count == 0)
{
/* Special case */
@@ -336,7 +359,7 @@ namespace System.Transactions
if (volatiles.Count > 0)
DoCommitPhase();
-
+
Complete();
}
@@ -372,7 +395,7 @@ namespace System.Transactions
void DoPreparePhase ()
{
// Call prepare on all volatile managers.
- foreach (IEnlistmentNotification enlist in volatiles)
+ foreach (IEnlistmentNotification enlist in Volatiles)
{
PreparingEnlistment pe = new PreparingEnlistment (this, enlist);
ThreadPool.QueueUserWorkItem (new WaitCallback(PrepareCallbackWrapper), pe);
@@ -403,7 +426,7 @@ namespace System.Transactions
void DoCommitPhase ()
{
- foreach (IEnlistmentNotification enlisted in volatiles) {
+ foreach (IEnlistmentNotification enlisted in Volatiles) {
Enlistment e = new Enlistment ();
enlisted.Commit (e);
/* Note: e.Done doesn't matter for volatile RMs */
diff --git a/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog b/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
index 6592ae9..bd36f40 100644
--- a/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
+++ b/mcs/class/System.Web/System.Web.SessionState_2.0/ChangeLog
@@ -1,3 +1,8 @@
+2011-02-21 Marek Habersack <grendel at twistedcode.net>
+
+ [asp.net] Fix for bug #669807. Cache session item locks as the
+ item might be cleared before the lock needs to be released.
+
2010-12-09 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
Get system.web/httpRuntime only once
diff --git a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionInProcHandler.cs b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionInProcHandler.cs
index 566fa35..b58992d 100644
--- a/mcs/class/System.Web/System.Web.SessionState_2.0/SessionInProcHandler.cs
+++ b/mcs/class/System.Web/System.Web.SessionState_2.0/SessionInProcHandler.cs
@@ -254,8 +254,11 @@ namespace System.Web.SessionState
return;
bool locked = false;
+ ReaderWriterLockSlim itemLock = null;
+
try {
- if (item.rwlock.TryEnterWriteLock (lockAcquireTimeout))
+ itemLock = item.rwlock;
+ if (itemLock != null && itemLock.TryEnterWriteLock (lockAcquireTimeout))
locked = true;
else
throw new ApplicationException ("Failed to acquire lock");
@@ -263,8 +266,8 @@ namespace System.Web.SessionState
} catch {
throw;
} finally {
- if (locked)
- item.rwlock.ExitWriteLock ();
+ if (locked && itemLock != null)
+ itemLock.ExitWriteLock ();
}
}
@@ -282,8 +285,11 @@ namespace System.Web.SessionState
return;
bool locked = false;
+ ReaderWriterLockSlim itemLock = null;
+
try {
- if (inProcItem.rwlock.TryEnterWriteLock (lockAcquireTimeout))
+ itemLock = inProcItem.rwlock;
+ if (itemLock != null && itemLock.TryEnterWriteLock (lockAcquireTimeout))
locked = true;
else
throw new ApplicationException ("Failed to acquire lock after");
@@ -292,7 +298,7 @@ namespace System.Web.SessionState
throw;
} finally {
if (locked)
- inProcItem.rwlock.ExitWriteLock ();
+ itemLock.ExitWriteLock ();
}
}
@@ -307,8 +313,11 @@ namespace System.Web.SessionState
return;
bool locked = false;
+ ReaderWriterLockSlim itemLock = null;
+
try {
- if (item.rwlock.TryEnterWriteLock (lockAcquireTimeout))
+ itemLock = item.rwlock;
+ if (itemLock != null && itemLock.TryEnterWriteLock (lockAcquireTimeout))
locked = true;
else
throw new ApplicationException ("Failed to acquire lock after");
@@ -318,8 +327,8 @@ namespace System.Web.SessionState
} catch {
throw;
} finally {
- if (locked)
- item.rwlock.ExitWriteLock ();
+ if (locked && itemLock != null)
+ itemLock.ExitWriteLock ();
}
}
@@ -366,8 +375,10 @@ namespace System.Web.SessionState
}
bool locked = false;
+ ReaderWriterLockSlim itemLock = null;
try {
- if (inProcItem.rwlock.TryEnterWriteLock (lockAcquireTimeout))
+ itemLock = inProcItem.rwlock;
+ if (itemLock != null && itemLock.TryEnterWriteLock (lockAcquireTimeout))
locked = true;
else
throw new ApplicationException ("Failed to acquire lock");
@@ -378,8 +389,8 @@ namespace System.Web.SessionState
} catch {
throw;
} finally {
- if (locked)
- inProcItem.rwlock.ExitWriteLock ();
+ if (locked && itemLock != null)
+ itemLock.ExitWriteLock ();
}
}
diff --git a/mcs/class/System/System.Net.NetworkInformation/ChangeLog b/mcs/class/System/System.Net.NetworkInformation/ChangeLog
index d7d34c7..13d6e53 100644
--- a/mcs/class/System/System.Net.NetworkInformation/ChangeLog
+++ b/mcs/class/System/System.Net.NetworkInformation/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-19 Miguel de Icaza <miguel at gnome.org>
+
+ [594642]
+ System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces
+ fix for MacOS X
+
2010-09-29 Atsushi Eno <atsushi at ximian.com>
Add some missing StructLayoutAttributes.
diff --git a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
index 58a6189..c52c1a7 100644
--- a/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/NetworkInterface.cs
@@ -481,7 +481,7 @@ namespace System.Net.NetworkInformation {
MacOsStructs.sockaddr_dl sockaddrdl = (MacOsStructs.sockaddr_dl) Marshal.PtrToStructure (addr.ifa_addr, typeof (MacOsStructs.sockaddr_dl));
macAddress = new byte [(int) sockaddrdl.sdl_alen];
- Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_alen, macAddress, 0, macAddress.Length);
+ Array.Copy (sockaddrdl.sdl_data, sockaddrdl.sdl_alen, macAddress, 0, Math.Min (macAddress.Length, sockaddrdl.sdl_data.Length - sockaddrdl.sdl_alen));
index = sockaddrdl.sdl_index;
int hwtype = (int) sockaddrdl.sdl_type;
diff --git a/mcs/class/System/System.Net/ChangeLog b/mcs/class/System/System.Net/ChangeLog
index 19d1f31..2397e7f 100644
--- a/mcs/class/System/System.Net/ChangeLog
+++ b/mcs/class/System/System.Net/ChangeLog
@@ -1,3 +1,17 @@
+2011-02-14 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ [HttpListener] UserHostName includes the port.
+
+2011-02-14 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ [HttpWebRequest] EndGetResponse already does this.
+
+2011-02-13 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ [HttpWebRequest] Use the timeout in GetResponse()
+
+ The timeout was not being used in GetResponse. Fixes bug #603794.
+
2011-02-13 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
[HttpWebRequest] Avoid nullref on empty cookie header.
diff --git a/mcs/class/System/System.Net/EndPointListener.cs b/mcs/class/System/System.Net/EndPointListener.cs
index 22edac0..92ed057 100644
--- a/mcs/class/System/System.Net/EndPointListener.cs
+++ b/mcs/class/System/System.Net/EndPointListener.cs
@@ -121,7 +121,7 @@ namespace System.Net {
{
HttpListenerRequest req = context.Request;
ListenerPrefix prefix;
- HttpListener listener = SearchListener (req.UserHostName, req.Url, out prefix);
+ HttpListener listener = SearchListener (req.Url, out prefix);
if (listener == null)
return false;
@@ -138,24 +138,19 @@ namespace System.Net {
HttpListenerRequest req = context.Request;
ListenerPrefix prefix;
- HttpListener listener = SearchListener (req.UserHostName, req.Url, out prefix);
+ HttpListener listener = SearchListener (req.Url, out prefix);
if (listener != null)
listener.UnregisterContext (context);
}
- HttpListener SearchListener (string host, Uri uri, out ListenerPrefix prefix)
+ HttpListener SearchListener (Uri uri, out ListenerPrefix prefix)
{
prefix = null;
if (uri == null)
return null;
- //TODO: We should use a ReaderWriterLock between this and the add/remove operations.
- if (host != null) {
- int colon = host.IndexOf (':');
- if (colon >= 0)
- host = host.Substring (0, colon);
- }
-
+ string host = uri.Host;
+ int port = uri.Port;
string path = HttpUtility.UrlDecode (uri.AbsolutePath);
string path_slash = path [path.Length - 1] == '/' ? path : path + "/";
@@ -170,7 +165,10 @@ namespace System.Net {
if (ppath.Length < best_length)
continue;
- if (p.Host == host && (path.StartsWith (ppath) || path_slash.StartsWith (ppath))) {
+ if (p.Host != host || p.Port != port)
+ continue;
+
+ if (path.StartsWith (ppath) || path_slash.StartsWith (ppath)) {
best_length = ppath.Length;
best_match = (HttpListener) prefixes [p];
prefix = p;
diff --git a/mcs/class/System/System.Net/HttpWebRequest.cs b/mcs/class/System/System.Net/HttpWebRequest.cs
index a23657c..da1c29d 100644
--- a/mcs/class/System/System.Net/HttpWebRequest.cs
+++ b/mcs/class/System/System.Net/HttpWebRequest.cs
@@ -688,7 +688,7 @@ namespace System.Net
asyncWrite = (WebAsyncResult) asyncResult;
}
- if (!asyncResult.AsyncWaitHandle.WaitOne (timeout, false)) {
+ if (!asyncResult.IsCompleted && !asyncResult.AsyncWaitHandle.WaitOne (timeout, false)) {
Abort ();
throw new WebException ("The request timed out", WebExceptionStatus.Timeout);
}
diff --git a/mcs/class/corlib/ChangeLog b/mcs/class/corlib/ChangeLog
index ee80f14..1cec6f4 100644
--- a/mcs/class/corlib/ChangeLog
+++ b/mcs/class/corlib/ChangeLog
@@ -1,3 +1,20 @@
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Kill old IScheduler interface.
+
+ We still use the ParticipateUntil facility of IScheduler
+ internally and provide a default implementation for pure
+ TaskScheduler
+
+2011-02-02 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Threadpool Task scheduler
+
+2011-02-16 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Implement properly TaskScheduler's
+ FromCurrentSynchronizationContext
+
2010-09-24 Kyle Ambroff <kyle at ambroff.com>
version tolerant serialization fails with missing primitive
diff --git a/mcs/class/corlib/System.Collections.Generic/ChangeLog b/mcs/class/corlib/System.Collections.Generic/ChangeLog
index cf616e5..5b0ef63 100644
--- a/mcs/class/corlib/System.Collections.Generic/ChangeLog
+++ b/mcs/class/corlib/System.Collections.Generic/ChangeLog
@@ -1,3 +1,10 @@
+2011-02-22 Rodrigo Kumpera <kumpera at gmail.com>
+
+ * List.cs (ICollection.CopyTo): Properly check the array argument
+ to match MS semantics.
+
+ Fixes #672907
+
2010-09-27 Marek Habersack <grendel at twistedcode.net>
[bug workaround] Fix the build of System.Web.Mvc by renaming
diff --git a/mcs/class/corlib/System.Collections.Generic/List.cs b/mcs/class/corlib/System.Collections.Generic/List.cs
index 4c56255..7646b77 100644
--- a/mcs/class/corlib/System.Collections.Generic/List.cs
+++ b/mcs/class/corlib/System.Collections.Generic/List.cs
@@ -648,6 +648,10 @@ namespace System.Collections.Generic {
void ICollection.CopyTo (Array array, int arrayIndex)
{
+ if (array == null)
+ throw new ArgumentNullException ("array");
+ if (array.Rank > 1 || array.GetLowerBound (0) != 0)
+ throw new ArgumentException ("Array must be zero based and single dimentional", "array");
Array.Copy (_items, 0, array, arrayIndex, _size);
}
diff --git a/mcs/class/corlib/System.Threading.Tasks/ChangeLog b/mcs/class/corlib/System.Threading.Tasks/ChangeLog
index 33a0016..a488ba7 100644
--- a/mcs/class/corlib/System.Threading.Tasks/ChangeLog
+++ b/mcs/class/corlib/System.Threading.Tasks/ChangeLog
@@ -1,3 +1,78 @@
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Allow people to optionally fallback to the old scheduler with an
+ environment variable
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Remove ctors in TpScheduler
+
+ This also remove the capping of the ThreadPool, problem needs to
+ be fixed in the pool itself.
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Make TryExecuteTaskInline a bit smarter
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Refactor common code block of TpScheduler and SyncContextScheduler
+ in SchedulerProxy
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Kill old IScheduler interface.
+
+ We still use the ParticipateUntil facility of IScheduler
+ internally and provide a default implementation for pure
+ TaskScheduler
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ When finding best worker number in Parallel loops use current
+ TaskScheduler instead of default TaskScheduler
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Adapt TpScheduler to the new API in TaskScheduler
+
+2011-02-17 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Cache callback delegate in TpScheduler when passing Task to
+ QueueUserWorkItem
+
+2011-02-14 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Don't create a new lambda everytime when queuing Task via
+ ThreadPool QueueUserWorkItem
+
+2011-02-14 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Try to execute task inline when they are ready to run and we wait
+ on them with no timeout
+
+2011-02-02 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Threadpool Task scheduler
+
+2011-02-16 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Implement properly TaskScheduler's
+ FromCurrentSynchronizationContext
+
+2011-01-31 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Adapt Parallel.For stealing to all processor flavors
+
+2011-01-21 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Allow multiple invocation of Task Execute method to allow
+ short-circuiting without breaking deque ordering
+
+2011-02-15 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Implement TaskFactory.FromAsync
+
2011-01-25 Geoff Norton <grompf at sublimeintervention.com>
Add pfx to the mobile profile
diff --git a/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
deleted file mode 100644
index d4c78b4..0000000
--- a/mcs/class/corlib/System.Threading.Tasks/IScheduler.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-// IScheduler.cs
-//
-// Copyright (c) 2008 Jérémie "Garuma" Laval
-//
-// 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_0 || MOBILE
-using System;
-using System.Threading;
-using System.Collections.Generic;
-
-namespace System.Threading.Tasks
-{
- internal interface IScheduler: IDisposable
- {
- void AddWork (Task t);
- void ParticipateUntil (Task task);
- bool ParticipateUntil (Task task, ManualResetEventSlim predicateEvt, int millisecondsTimeout);
- void PulseAll ();
- }
-}
-#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/Parallel.cs b/mcs/class/corlib/System.Threading.Tasks/Parallel.cs
index 7c4b2db..15f1fcc 100644
--- a/mcs/class/corlib/System.Threading.Tasks/Parallel.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Parallel.cs
@@ -27,11 +27,18 @@ using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Threading;
+using System.Runtime.InteropServices;
namespace System.Threading.Tasks
{
public static class Parallel
{
+#if MOONLIGHT || MOBILE
+ static readonly bool sixtyfour = IntPtr.Size == 8;
+#else
+ static readonly bool sixtyfour = Environment.Is64BitProcess;
+#endif
+
internal static int GetBestWorkerNumber ()
{
return GetBestWorkerNumber (TaskScheduler.Current);
@@ -44,7 +51,7 @@ namespace System.Threading.Tasks
static int GetBestWorkerNumber (int from, int to, ParallelOptions options, out int step)
{
- int num = Math.Min (GetBestWorkerNumber (),
+ int num = Math.Min (GetBestWorkerNumber (options.TaskScheduler),
options != null && options.MaxDegreeOfParallelism != -1 ? options.MaxDegreeOfParallelism : int.MaxValue);
// Integer range that each task process
if ((step = (to - from) / num) < 5) {
@@ -156,7 +163,7 @@ namespace System.Threading.Tasks
Action workerMethod = delegate {
int localWorker = Interlocked.Increment (ref currentIndex);
StealRange range = ranges[localWorker];
- int index = range.Actual;
+ int index = range.V64.Actual;
int stopIndex = localWorker + 1 == num ? toExclusive : Math.Min (toExclusive, index + step);
TLocal local = localInit ();
@@ -164,19 +171,25 @@ namespace System.Threading.Tasks
CancellationToken token = parallelOptions.CancellationToken;
try {
- for (int i = index; i < stopIndex; range.Actual = ++i) {
+ for (int i = index; i < stopIndex;) {
if (infos.IsStopped)
return;
token.ThrowIfCancellationRequested ();
+ if (i >= stopIndex - range.V64.Stolen)
+ break;
+
if (infos.LowestBreakIteration != null && infos.LowestBreakIteration > i)
return;
state.CurrentIteration = i;
local = body (i, state, local);
- if (i >= stopIndex - range.Stolen)
+
+ if (i + 1 >= stopIndex - range.V64.Stolen)
break;
+
+ range.V64.Actual = ++i;
}
// Try toExclusive steal fromInclusive our right neighbor (cyclic)
@@ -186,20 +199,33 @@ namespace System.Threading.Tasks
range = ranges[extWorker];
stopIndex = extWorker + 1 == num ? toExclusive : Math.Min (toExclusive, fromInclusive + (extWorker + 1) * step);
+ int stolen = -1;
- int stolen;
do {
- stolen = range.Stolen;
- if (stopIndex - stolen > range.Actual)
- goto next;
- } while (Interlocked.CompareExchange (ref range.Stolen, stolen + 1, stolen) != stolen);
+ do {
+ long old;
+ StealValue64 val = new StealValue64 ();
+
+ old = sixtyfour ? range.V64.Value : Interlocked.CompareExchange (ref range.V64.Value, 0, 0);
+ val.Value = old;
- stolen = stopIndex - stolen - 1;
+ if (val.Actual >= stopIndex - val.Stolen - 2)
+ goto next;
+ stolen = (val.Stolen += 1);
- if (stolen > range.Actual)
- local = body (stolen, state, local);
+ if (Interlocked.CompareExchange (ref range.V64.Value, val.Value, old) == old)
+ break;
+ } while (true);
- next:
+ stolen = stopIndex - stolen;
+
+ if (stolen > range.V64.Actual)
+ local = body (stolen, state, local);
+ else
+ break;
+ } while (true);
+
+ next:
continue;
}
} finally {
@@ -218,14 +244,23 @@ namespace System.Threading.Tasks
return new ParallelLoopResult (infos.LowestBreakIteration, !(infos.IsStopped || infos.IsExceptional));
}
+ [StructLayout(LayoutKind.Explicit)]
+ struct StealValue64 {
+ [FieldOffset(0)]
+ public long Value;
+ [FieldOffset(0)]
+ public int Actual;
+ [FieldOffset(4)]
+ public int Stolen;
+ }
+
class StealRange
{
- public int Stolen;
- public int Actual;
+ public StealValue64 V64 = new StealValue64 ();
public StealRange (int fromInclusive, int i, int step)
{
- Actual = fromInclusive + i * step;
+ V64.Actual = fromInclusive + i * step;
}
}
diff --git a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs b/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
index 1179d49..eb3f884 100644
--- a/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Scheduler.cs
@@ -28,7 +28,7 @@ using System.Collections.Concurrent;
namespace System.Threading.Tasks
{
- internal class Scheduler: TaskScheduler, IScheduler
+ internal class Scheduler: TaskScheduler
{
readonly IProducerConsumerCollection<Task> workQueue;
readonly ThreadWorker[] workers;
@@ -46,12 +46,12 @@ namespace System.Threading.Tasks
workers = new ThreadWorker [maxWorker];
for (int i = 0; i < maxWorker; i++) {
- workers [i] = new ThreadWorker (this, workers, i, workQueue, priority, pulseHandle);
+ workers [i] = new ThreadWorker (workers, i, workQueue, priority, pulseHandle);
workers [i].Pulse ();
}
}
-
- public void AddWork (Task t)
+
+ protected internal override void QueueTask (Task t)
{
// Add to the shared work pool
workQueue.TryAdd (t);
@@ -59,7 +59,7 @@ namespace System.Threading.Tasks
PulseAll ();
}
- public void ParticipateUntil (Task task)
+ internal override void ParticipateUntil (Task task)
{
if (task.IsCompleted)
return;
@@ -72,7 +72,7 @@ namespace System.Threading.Tasks
ParticipateUntilInternal (task, evt, -1);
}
- public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int millisecondsTimeout)
+ internal override bool ParticipateUntil (Task task, ManualResetEventSlim evt, int millisecondsTimeout)
{
if (task.IsCompleted)
return false;
@@ -99,7 +99,7 @@ namespace System.Threading.Tasks
return self.IsCompleted;
}
- public void PulseAll ()
+ internal override void PulseAll ()
{
pulseHandle.Set ();
}
@@ -115,11 +115,6 @@ namespace System.Threading.Tasks
throw new System.NotImplementedException();
}
- protected internal override void QueueTask (Task task)
- {
- throw new System.NotImplementedException();
- }
-
protected internal override bool TryDequeue (Task task)
{
throw new System.NotImplementedException();
diff --git a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
index 72235bc..d17bb32 100644
--- a/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/SchedulerProxy.cs
@@ -26,27 +26,61 @@
#if NET_4_0 || MOBILE
using System;
+using System.Threading;
+using System.Reflection;
namespace System.Threading.Tasks
{
-
- internal class SchedulerProxy : IScheduler
+ internal class SchedulerProxy
{
TaskScheduler scheduler;
-
+
+ Action<Task> participateUntil1;
+ Func<Task, ManualResetEventSlim, int, bool> participateUntil2;
+
public SchedulerProxy (TaskScheduler scheduler)
{
this.scheduler = scheduler;
+ FindMonoSpecificImpl ();
}
-
- #region IScheduler implementation
- public void AddWork (Task t)
+
+ void FindMonoSpecificImpl ()
{
- scheduler.QueueTask (t);
+ // participateUntil1
+ FetchMethod<Action<Task>> ("MonoParticipateUntil",
+ new[] { typeof(Task) },
+ ref participateUntil1);
+ // participateUntil2
+ FetchMethod<Func<Task, ManualResetEventSlim, int, bool>> ("MonoParticipateUntil",
+ new[] { typeof(Task), typeof(ManualResetEventSlim), typeof(int) },
+ ref participateUntil2);
}
-
+
+ void FetchMethod<TDelegate> (string name, Type[] types, ref TDelegate field) where TDelegate : class
+ {
+ var method = scheduler.GetType ().GetMethod (name,
+ BindingFlags.Instance | BindingFlags.Public,
+ null,
+ types,
+ null);
+ if (method == null)
+ return;
+ field = Delegate.CreateDelegate (typeof(TDelegate), scheduler, method) as TDelegate;
+ }
+
public void ParticipateUntil (Task task)
{
+ if (participateUntil1 != null) {
+ participateUntil1 (task);
+ return;
+ }
+
+ if (task.Status == TaskStatus.WaitingToRun)
+ task.Execute (null);
+
+ if (task.IsCompleted)
+ return;
+
ManualResetEventSlim evt = new ManualResetEventSlim (false);
task.ContinueWith (_ => evt.Set (), TaskContinuationOptions.ExecuteSynchronously);
@@ -55,6 +89,12 @@ namespace System.Threading.Tasks
public bool ParticipateUntil (Task task, ManualResetEventSlim evt, int millisecondsTimeout)
{
+ if (task.IsCompleted)
+ return false;
+
+ if (participateUntil2 != null)
+ return participateUntil2 (task, evt, millisecondsTimeout);
+
bool fromPredicate = true;
task.ContinueWith (_ => { fromPredicate = false; evt.Set (); }, TaskContinuationOptions.ExecuteSynchronously);
@@ -72,15 +112,6 @@ namespace System.Threading.Tasks
{
}
- #endregion
-
- #region IDisposable implementation
- public void Dispose ()
- {
- scheduler = null;
- }
- #endregion
-
}
}
#endif
diff --git a/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs
new file mode 100644
index 0000000..a35bb2a
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/SynchronizationContextScheduler.cs
@@ -0,0 +1,85 @@
+//
+// SynchronizationContextScheduler.cs
+//
+// Author:
+// Jérémie "Garuma" Laval <jeremie.laval at gmail.com>
+//
+// Copyright (c) 2011 Novell
+//
+// 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_0
+
+using System;
+using System.Threading;
+
+namespace System.Threading.Tasks
+{
+ public class SynchronizationContextScheduler : TaskScheduler
+ {
+ readonly SynchronizationContext ctx;
+ static readonly SendOrPostCallback callback = TaskLaunchWrapper;
+
+ public SynchronizationContextScheduler (SynchronizationContext ctx)
+ {
+ this.ctx = ctx;
+ }
+
+ protected internal override void QueueTask (Task task)
+ {
+ ctx.Post (callback, task);
+ }
+
+ static void TaskLaunchWrapper (object obj)
+ {
+ ((Task)obj).Execute (null);
+ }
+
+ protected override System.Collections.Generic.IEnumerable<Task> GetScheduledTasks ()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ protected internal override bool TryDequeue (Task task)
+ {
+ return false;
+ }
+
+ protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
+ {
+ if (task.IsCompleted)
+ return false;
+
+ if (task.Status == TaskStatus.WaitingToRun) {
+ task.Execute (null);
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int MaximumConcurrencyLevel {
+ get {
+ return base.MaximumConcurrencyLevel;
+ }
+ }
+ }
+}
+
+#endif
\ No newline at end of file
diff --git a/mcs/class/corlib/System.Threading.Tasks/Task.cs b/mcs/class/corlib/System.Threading.Tasks/Task.cs
index a40f808..4ee46e3 100644
--- a/mcs/class/corlib/System.Threading.Tasks/Task.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/Task.cs
@@ -51,8 +51,7 @@ namespace System.Threading.Tasks
int taskId;
TaskCreationOptions taskCreationOptions;
- IScheduler scheduler;
- TaskScheduler taskScheduler;
+ TaskScheduler scheduler;
ManualResetEventSlim schedWait = new ManualResetEventSlim (false);
@@ -63,6 +62,7 @@ namespace System.Threading.Tasks
Action<object> action;
object state;
+ AtomicBooleanValue executing;
ConcurrentQueue<EventHandler> completed = new ConcurrentQueue<EventHandler> ();
@@ -142,33 +142,17 @@ namespace System.Threading.Tasks
public void Start (TaskScheduler scheduler)
{
- Start (ProxifyScheduler (scheduler));
- }
-
- void Start (IScheduler scheduler)
- {
SetupScheduler (scheduler);
Schedule ();
}
- internal void SetupScheduler (TaskScheduler tscheduler)
- {
- SetupScheduler (ProxifyScheduler (tscheduler));
- }
-
- internal void SetupScheduler (IScheduler scheduler)
+ internal void SetupScheduler (TaskScheduler scheduler)
{
this.scheduler = scheduler;
status = TaskStatus.WaitingForActivation;
schedWait.Set ();
}
- IScheduler ProxifyScheduler (TaskScheduler tscheduler)
- {
- IScheduler sched = tscheduler as IScheduler;
- return sched != null ? sched : new SchedulerProxy (tscheduler);
- }
-
public void RunSynchronously ()
{
RunSynchronously (TaskScheduler.Current);
@@ -257,8 +241,7 @@ namespace System.Threading.Tasks
TaskScheduler scheduler, Func<bool> predicate)
{
// Already set the scheduler so that user can call Wait and that sort of stuff
- continuation.taskScheduler = scheduler;
- continuation.scheduler = ProxifyScheduler (scheduler);
+ continuation.scheduler = scheduler;
continuation.schedWait.Set ();
continuation.status = TaskStatus.WaitingForActivation;
@@ -356,7 +339,7 @@ namespace System.Threading.Tasks
// If worker is null it means it is a local one, revert to the old behavior
if (childWorkAdder == null || CheckTaskOptions (taskCreationOptions, TaskCreationOptions.PreferFairness)) {
- scheduler.AddWork (this);
+ scheduler.QueueTask (this);
} else {
/* Like the semantic of the ABP paper describe it, we add ourselves to the bottom
* of our Parent Task's ThreadWorker deque. It's ok to do that since we are in
@@ -368,8 +351,15 @@ namespace System.Threading.Tasks
void ThreadStart ()
{
+ /* Allow scheduler to break fairness of deque ordering without
+ * breaking its semantic (the task can be executed twice but the
+ * second time it will return immediately
+ */
+ if (!executing.TryRelaxedSet ())
+ return;
+
current = this;
- TaskScheduler.Current = taskScheduler;
+ TaskScheduler.Current = scheduler;
if (!token.IsCancellationRequested) {
@@ -473,7 +463,7 @@ namespace System.Threading.Tasks
{
exception = e;
status = TaskStatus.Faulted;
- if (taskScheduler != null && taskScheduler.FireUnobservedEvent (exception).Observed)
+ if (scheduler != null && scheduler.FireUnobservedEvent (exception).Observed)
exceptionObserved = true;
}
@@ -639,7 +629,7 @@ namespace System.Threading.Tasks
int numFinished = 0;
int indexFirstFinished = -1;
int index = 0;
- IScheduler sched = null;
+ TaskScheduler sched = null;
Task task = null;
Watch watch = Watch.StartNew ();
ManualResetEventSlim predicateEvt = new ManualResetEventSlim (false);
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs b/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
index a50f74e..253bbe2 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskFactory.cs
@@ -427,173 +427,197 @@ namespace System.Threading.Tasks
#endregion
#region FromAsync
- // For these methods to work we first have to convert the ThreadPool to use Tasks as it
- // is doing in 4.0, then all that is remaining is to identify the Task on which is
- // run the async operation (probably with some additional state in a IAsyncResult subclass)
- // and call its ContinueWith method accordingly
-
- const string errorMsg = "Mono's thread pool doesn't support this operation yet";
-
- [MonoLimitation(errorMsg)]
public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod)
{
- return FromAsync (asyncResult, endMethod, creationOptions);
+ return FromAsync (asyncResult, endMethod, creationOptions, scheduler);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod,
TaskCreationOptions creationOptions)
{
- return FromAsync (asyncResult, endMethod, creationOptions);
+ return FromAsync (asyncResult, endMethod, creationOptions, scheduler);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync (IAsyncResult asyncResult, Action<IAsyncResult> endMethod,
TaskCreationOptions creationOptions, TaskScheduler scheduler)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync<object> (asyncResult, (ar) => { endMethod (ar); return null; }, creationOptions, scheduler);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod)
{
- return FromAsync<TResult> (asyncResult, endMethod, creationOptions);
+ return FromAsync<TResult> (asyncResult, endMethod, creationOptions, scheduler);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
TaskCreationOptions creationOptions)
{
- return FromAsync<TResult> (asyncResult, endMethod, creationOptions);
+ return FromAsync<TResult> (asyncResult, endMethod, creationOptions, scheduler);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TResult> (IAsyncResult asyncResult, Func<IAsyncResult, TResult> endMethod,
TaskCreationOptions creationOptions, TaskScheduler scheduler)
{
- throw new NotSupportedException (errorMsg);
+ var completionSource = new TaskCompletionSource<TResult> ();
+
+ ThreadPool.RegisterWaitForSingleObject (asyncResult.AsyncWaitHandle,
+ (o, b) => {
+ try {
+ completionSource.SetResult (endMethod (asyncResult));
+ } catch (Exception e) {
+ completionSource.SetException (e);
+ }
+ },
+ null,
+ -1,
+ true);
+
+ return completionSource.Task;
}
-
- [MonoLimitation(errorMsg)]
- public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+ public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
+ Action<IAsyncResult> endMethod,
object state)
{
- return FromAsync<object> ((a, c, o) => beginMethod (c, o), endMethod, state, creationOptions);
+ return FromAsync (beginMethod, endMethod, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
- public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+ public Task FromAsync (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
+ Action<IAsyncResult> endMethod,
object state, TaskCreationOptions creationOptions)
{
- return FromAsync<object> ((a, c, o) => beginMethod (c, o), endMethod, state, creationOptions);
+ return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
TArg1 arg1, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync<TArg1> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
TArg1 arg1, object state, TaskCreationOptions creationOptions)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
- public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+ public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
+ Action<IAsyncResult> endMethod,
TArg1 arg1, TArg2 arg2, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, arg2, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
- public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
+ public Task FromAsync<TArg1, TArg2> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
+ Action<IAsyncResult> endMethod,
TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, arg2, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task FromAsync<TArg1, TArg2, TArg3> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod, Action<IAsyncResult> endMethod,
TArg1 arg1, TArg2 arg2, TArg3 arg3, object state, TaskCreationOptions creationOptions)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, (ar) => { endMethod (ar); return (object)null; }, arg1, arg2, arg3, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TResult> (Func<AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
- object state, TaskCreationOptions creationOptions)
- {
- throw new NotSupportedException (errorMsg);
+ object state, TaskCreationOptions creationOptions)
+ {
+ var completionSource = new TaskCompletionSource<TResult> (creationOptions);
+ beginMethod ((ar) => {
+ try {
+ completionSource.SetResult (endMethod (ar));
+ } catch (Exception e) {
+ completionSource.SetException (e);
+ }
+ }, state);
+
+ return completionSource.Task;
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
TArg1 arg1, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TArg1, TResult> (Func<TArg1, AsyncCallback, Object, IAsyncResult> beginMethod,
- Func<IAsyncResult, TResult> endMethod,
- TArg1 arg1, object state, TaskCreationOptions creationOptions)
- {
- throw new NotSupportedException (errorMsg);
+ Func<IAsyncResult, TResult> endMethod,
+ TArg1 arg1, object state, TaskCreationOptions creationOptions)
+ {
+ var completionSource = new TaskCompletionSource<TResult> (creationOptions);
+ beginMethod (arg1, (ar) => {
+ try {
+ completionSource.SetResult (endMethod (ar));
+ } catch (Exception e) {
+ completionSource.SetException (e);
+ }
+ }, state);
+
+ return completionSource.Task;
}
-
- [MonoLimitation(errorMsg)]
+
public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
TArg1 arg1, TArg2 arg2, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, arg2, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TArg1, TArg2, TResult> (Func<TArg1, TArg2, AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
TArg1 arg1, TArg2 arg2, object state, TaskCreationOptions creationOptions)
{
- throw new NotSupportedException (errorMsg);
+ var completionSource = new TaskCompletionSource<TResult> (creationOptions);
+ beginMethod (arg1, arg2, (ar) => {
+ try {
+ completionSource.SetResult (endMethod (ar));
+ } catch (Exception e) {
+ completionSource.SetException (e);
+ }
+ }, state);
+
+ return completionSource.Task;
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
TArg1 arg1, TArg2 arg2, TArg3 arg3, object state)
{
- throw new NotSupportedException (errorMsg);
+ return FromAsync (beginMethod, endMethod, arg1, arg2, arg3, state, creationOptions);
}
- [MonoLimitation(errorMsg)]
public Task<TResult> FromAsync<TArg1, TArg2, TArg3, TResult> (Func<TArg1, TArg2, TArg3, AsyncCallback, Object, IAsyncResult> beginMethod,
Func<IAsyncResult, TResult> endMethod,
TArg1 arg1, TArg2 arg2, TArg3 arg3, object state,
TaskCreationOptions creationOptions)
{
- throw new NotSupportedException (errorMsg);
+ var completionSource = new TaskCompletionSource<TResult> (creationOptions);
+ beginMethod (arg1, arg2, arg3, (ar) => {
+ try {
+ completionSource.SetResult (endMethod (ar));
+ } catch (Exception e) {
+ completionSource.SetException (e);
+ }
+ }, state);
+
+ return completionSource.Task;
}
#endregion
diff --git a/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
index 0c473f7..6196616 100644
--- a/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/TaskScheduler.cs
@@ -35,7 +35,9 @@ namespace System.Threading.Tasks
[System.Diagnostics.DebuggerTypeProxy ("System.Threading.Tasks.TaskScheduler+SystemThreadingTasks_TaskSchedulerDebugView")]
public abstract class TaskScheduler
{
- static TaskScheduler defaultScheduler = new Scheduler ();
+ static TaskScheduler defaultScheduler =
+ Environment.GetEnvironmentVariable ("USE_OLD_TASK_SCHED") != null ? (TaskScheduler)new Scheduler () : (TaskScheduler)new TpScheduler ();
+ SchedulerProxy proxy;
[ThreadStatic]
static TaskScheduler currentScheduler;
@@ -48,12 +50,13 @@ namespace System.Threading.Tasks
protected TaskScheduler ()
{
this.id = Interlocked.Increment (ref lastId);
+ this.proxy = new SchedulerProxy (this);
}
- // FIXME: Probably not correct
public static TaskScheduler FromCurrentSynchronizationContext ()
{
- return Current;
+ var syncCtx = SynchronizationContext.Current;
+ return new SynchronizationContextScheduler (syncCtx);
}
public static TaskScheduler Default {
@@ -85,7 +88,22 @@ namespace System.Threading.Tasks
return Environment.ProcessorCount;
}
}
-
+
+ internal virtual void ParticipateUntil (Task task)
+ {
+ proxy.ParticipateUntil (task);
+ }
+
+ internal virtual bool ParticipateUntil (Task task, ManualResetEventSlim predicateEvt, int millisecondsTimeout)
+ {
+ return proxy.ParticipateUntil (task, predicateEvt, millisecondsTimeout);
+ }
+
+ internal virtual void PulseAll ()
+ {
+ proxy.PulseAll ();
+ }
+
protected abstract IEnumerable<Task> GetScheduledTasks ();
protected internal abstract void QueueTask (Task task);
protected internal virtual bool TryDequeue (Task task)
diff --git a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs b/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
index c9ff883..998a058 100644
--- a/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
+++ b/mcs/class/corlib/System.Threading.Tasks/ThreadWorker.cs
@@ -44,7 +44,6 @@ namespace System.Threading.Tasks
readonly ThreadWorker[] others;
readonly ManualResetEvent waitHandle;
readonly IProducerConsumerCollection<Task> sharedWorkQueue;
- readonly IScheduler sched;
readonly ThreadPriority threadPriority;
// Flag to tell if workerThread is running
@@ -57,8 +56,7 @@ namespace System.Threading.Tasks
const int sleepThreshold = 100;
int deepSleepTime = 8;
- public ThreadWorker (IScheduler sched,
- ThreadWorker[] others,
+ public ThreadWorker (ThreadWorker[] others,
int workerPosition,
IProducerConsumerCollection<Task> sharedWorkQueue,
ThreadPriority priority,
@@ -66,7 +64,6 @@ namespace System.Threading.Tasks
{
this.others = others;
this.dDeque = new CyclicDeque<Task> ();
- this.sched = sched;
this.sharedWorkQueue = sharedWorkQueue;
this.workerLength = others.Length;
this.workerPosition = workerPosition;
@@ -299,7 +296,7 @@ namespace System.Threading.Tasks
internal void ChildWorkAdder (Task t)
{
dDeque.PushBottom (t);
- sched.PulseAll ();
+ waitHandle.Set ();
}
static bool CheckTaskFitness (Task self, Task t)
diff --git a/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs b/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs
new file mode 100644
index 0000000..06ddf94
--- /dev/null
+++ b/mcs/class/corlib/System.Threading.Tasks/TpScheduler.cs
@@ -0,0 +1,78 @@
+// TpScheduler.cs
+//
+// Copyright (c) 2011 Jérémie "Garuma" Laval
+//
+// 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_0 || MOBILE
+using System;
+using System.Collections.Concurrent;
+
+namespace System.Threading.Tasks
+{
+ internal class TpScheduler: TaskScheduler
+ {
+ static readonly WaitCallback callback = TaskExecuterCallback;
+
+ protected internal override void QueueTask (Task task)
+ {
+ ThreadPool.QueueUserWorkItem (callback, task);
+ }
+
+ static void TaskExecuterCallback (object obj)
+ {
+ Task task = obj as Task;
+ if (task == null)
+ return;
+ task.Execute (null);
+ }
+
+ protected override System.Collections.Generic.IEnumerable<Task> GetScheduledTasks ()
+ {
+ throw new System.NotImplementedException();
+ }
+
+ protected internal override bool TryDequeue (Task task)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ protected override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
+ {
+ if (task.IsCompleted)
+ return false;
+
+ if (task.Status == TaskStatus.WaitingToRun) {
+ task.Execute (null);
+ return true;
+ }
+
+ return false;
+ }
+
+ public override int MaximumConcurrencyLevel {
+ get {
+ return base.MaximumConcurrencyLevel;
+ }
+ }
+ }
+}
+#endif
diff --git a/mcs/class/corlib/System/AppDomain.cs b/mcs/class/corlib/System/AppDomain.cs
index 22ef293..a07175d 100644
--- a/mcs/class/corlib/System/AppDomain.cs
+++ b/mcs/class/corlib/System/AppDomain.cs
@@ -739,14 +739,14 @@ namespace System {
if (assemblyRef.Name != aname.Name)
throw new FileNotFoundException (null, assemblyRef.Name);
- if (assemblyRef.Version != new Version () && assemblyRef.Version != aname.Version)
+ if (assemblyRef.Version != null && assemblyRef.Version != new Version (0, 0, 0, 0) && assemblyRef.Version != aname.Version)
throw new FileNotFoundException (null, assemblyRef.Name);
if (assemblyRef.CultureInfo != null && assemblyRef.CultureInfo.Equals (aname))
throw new FileNotFoundException (null, assemblyRef.Name);
byte [] pt = assemblyRef.GetPublicKeyToken ();
- if (pt != null) {
+ if (pt != null && pt.Length != 0) {
byte [] loaded_pt = aname.GetPublicKeyToken ();
if (loaded_pt == null || (pt.Length != loaded_pt.Length))
throw new FileNotFoundException (null, assemblyRef.Name);
diff --git a/mcs/class/corlib/System/ChangeLog b/mcs/class/corlib/System/ChangeLog
index e5ea777..06f7be6 100644
--- a/mcs/class/corlib/System/ChangeLog
+++ b/mcs/class/corlib/System/ChangeLog
@@ -1,3 +1,16 @@
+2011-02-19 Gonzalo Paniagua Javier <gonzalo.mono at gmail.com>
+
+ Fix the check for version and PublicKeyToken
+
+ When loading an assembly we were comparing Version(0,0,0,0) with
+ null and a 0 length PKT with an actual one when those two cases
+ are the default. Fixes bug #661461.
+
+2011-02-18 Rodrigo Kumpera <kumpera at gmail.com>
+
+ * MonoCustomAttrs.cs (GetBase): Special case events when
+ retrieving the base event to lookup cattrs.
+
2011-02-08 Miguel de Icaza <miguel at gnome.org>
Fix Enum.HasValue, previous version crashed with negative values
diff --git a/mcs/class/corlib/System/MonoCustomAttrs.cs b/mcs/class/corlib/System/MonoCustomAttrs.cs
index 30479f2..b887c55 100644
--- a/mcs/class/corlib/System/MonoCustomAttrs.cs
+++ b/mcs/class/corlib/System/MonoCustomAttrs.cs
@@ -349,6 +349,26 @@ namespace System
}
+ static EventInfo GetBaseEventDefinition (EventInfo evt)
+ {
+ MethodInfo method = evt.GetAddMethod (true);
+ if (method == null || !method.IsVirtual)
+ method = evt.GetRaiseMethod (true);
+ if (method == null || !method.IsVirtual)
+ method = evt.GetRemoveMethod (true);
+ if (method == null || !method.IsVirtual)
+ return null;
+
+ MethodInfo baseMethod = method.GetBaseMethod ();
+ if (baseMethod != null && baseMethod != method) {
+ BindingFlags flags = method.IsPublic ? BindingFlags.Public : BindingFlags.NonPublic;
+ flags |= method.IsStatic ? BindingFlags.Static : BindingFlags.Instance;
+
+ return baseMethod.DeclaringType.GetEvent (evt.Name, flags);
+ }
+ return null;
+ }
+
// Handles Type, MonoProperty and MonoMethod.
// The runtime has also cases for MonoEvent, MonoField, Assembly and ParameterInfo,
// but for those we return null here.
@@ -363,6 +383,8 @@ namespace System
MethodInfo method = null;
if (obj is MonoProperty)
return GetBasePropertyDefinition ((MonoProperty) obj);
+ else if (obj is MonoEvent)
+ return GetBaseEventDefinition ((MonoEvent)obj);
else if (obj is MonoMethod)
method = (MethodInfo) obj;
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog b/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
index be9b884..8718607 100644
--- a/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
+++ b/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-22 Rodrigo Kumpera <kumpera at gmail.com>
+
+ Properly check arguments in List<T> ICollection.CopyTo.
+
2010-01-24 Robert Jordan <robertj at gmx.net>
* DictionaryTest.cs: Add test case for bug #474009.
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog b/mcs/class/corlib/Test/System.Collections.Generic/ChangeLog.old
similarity index 100%
copy from mcs/class/corlib/Test/System.Collections.Generic/ChangeLog
copy to mcs/class/corlib/Test/System.Collections.Generic/ChangeLog.old
diff --git a/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs b/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
index ba2273e..1a86658 100644
--- a/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
+++ b/mcs/class/corlib/Test/System.Collections.Generic/ListTest.cs
@@ -1265,6 +1265,48 @@ namespace MonoTests.System.Collections.Generic {
((IDisposable) e4).Dispose ();
Assert.IsTrue (Throws (delegate { var x = e4.Current; }));
}
+
+ [Test] //bug #672907
+ public void ICollectionCopyToExceptions ()
+ {
+ var l = new List <int> ();
+ ICollection x = l;
+ try {
+ x.CopyTo (null, 0);
+ Assert.Fail ("#1");
+ } catch (Exception e) {
+ Assert.IsTrue (e is ArgumentNullException, "#2");
+ }
+
+ try {
+ x.CopyTo (new int [10], -1);
+ Assert.Fail ("#3");
+ } catch (Exception e) {
+ Assert.IsTrue (e is ArgumentOutOfRangeException, "#4");
+ }
+
+ try {
+ x.CopyTo (new int [10, 1], 0);
+ Assert.Fail ("#5");
+ } catch (Exception e) {
+ Assert.IsTrue (e is ArgumentException, "#6");
+ }
+
+ try {
+ x.CopyTo (Array.CreateInstance (typeof (int), new int [] { 10 }, new int[] { 1 }), 0);
+ Assert.Fail ("#7");
+ } catch (Exception e) {
+ Assert.IsTrue (e is ArgumentException, "#8");
+ }
+
+ l.Add (10); l.Add (20);
+ try {
+ x.CopyTo (new int [1], 0);
+ Assert.Fail ("#9");
+ } catch (Exception e) {
+ Assert.IsTrue (e is ArgumentException, "#10");
+ }
+ }
}
}
#endif
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog b/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
index f70b65b..09f952f 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-15 Jérémie Laval <jeremie.laval at gmail.com>
+
+ Implement TaskFactory.FromAsync
+
2011-01-13 Jérémie Laval <jeremie.laval at gmail.com>
Fix continuation not being scheduled because of too early and too
diff --git a/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
index 12928aa..cb3cc10 100644
--- a/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
+++ b/mcs/class/corlib/Test/System.Threading.Tasks/TaskFactoryTest.cs
@@ -80,10 +80,10 @@ namespace MonoTests.System.Threading.Tasks
{
bool r = false, result = false, finished = false;
- Task[] tasks = new Task[3];
+ Task[] tasks = new Task[2];
tasks[0] = new Task (() => { Thread.Sleep (300); r = true; });
tasks[1] = new Task (() => { SpinWait sw; while (!finished) sw.SpinOnce (); });
- tasks[2] = new Task (() => { SpinWait sw; while (!finished) sw.SpinOnce (); });
+ //tasks[2] = new Task (() => { SpinWait sw; while (!finished) sw.SpinOnce (); });
Task cont = factory.ContinueWhenAny (tasks, (t) => { if (r) result = t == tasks[0]; finished = true; });
@@ -96,6 +96,62 @@ namespace MonoTests.System.Threading.Tasks
Assert.IsTrue (result, "#2");
Assert.IsTrue (finished, "#3");
}
+
+ [Test]
+ public void FromAsyncWithBeginTest ()
+ {
+ bool result = false;
+ bool continuationTest = false;
+
+ Func<int, int> func = (i) => { result = true; return i + 3; };
+ Task<int> task = factory.FromAsync<int, int> (func.BeginInvoke, func.EndInvoke, 1, null);
+ var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
+ task.Wait ();
+ cont.Wait ();
+
+ Assert.IsTrue (result);
+ Assert.IsTrue (continuationTest);
+ Assert.AreEqual (4, task.Result);
+ }
+
+ [Test]
+ public void FromAsyncWithDirectAsyncResultTest ()
+ {
+ bool result = false;
+ bool continuationTest = false;
+
+ Func<int, int> func = (i) => { result = true; return i + 3; };
+ Task<int> task = factory.FromAsync<int> (func.BeginInvoke (1, delegate {}, null), func.EndInvoke);
+ var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
+ task.Wait ();
+ cont.Wait ();
+
+ Assert.IsTrue (result);
+ Assert.IsTrue (continuationTest);
+ Assert.AreEqual (4, task.Result);
+ }
+
+ [Test]
+ public void FromAsyncWithBeginAndExceptionTest ()
+ {
+ bool result = false;
+ bool continuationTest = false;
+
+ Func<int, int> func = (i) => { result = true; throw new ApplicationException ("bleh"); return i + 3; };
+ Task<int> task = factory.FromAsync<int, int> (func.BeginInvoke, func.EndInvoke, 1, null);
+ var cont = task.ContinueWith (_ => continuationTest = true, TaskContinuationOptions.ExecuteSynchronously);
+ try {
+ task.Wait ();
+ } catch {}
+ cont.Wait ();
+
+ Assert.IsTrue (result);
+ Assert.IsTrue (continuationTest);
+ Assert.IsNotNull (task.Exception);
+ var agg = task.Exception;
+ Assert.AreEqual (1, agg.InnerExceptions.Count);
+ Assert.IsInstanceOfType (typeof (ApplicationException), agg.InnerExceptions[0]);
+ }
}
}
#endif
diff --git a/mcs/class/corlib/Test/System/AttributeTest.cs b/mcs/class/corlib/Test/System/AttributeTest.cs
index 96c62c8..d9f2d60 100644
--- a/mcs/class/corlib/Test/System/AttributeTest.cs
+++ b/mcs/class/corlib/Test/System/AttributeTest.cs
@@ -1120,7 +1120,7 @@ namespace MonoTests.System
Assert.AreEqual ("Derived.baz", attributes [0].Data);
}
- [AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
+ [AttributeUsage(AttributeTargets.Event | AttributeTargets.Method | AttributeTargets.Class)]
public class MyCAttr : Attribute {}
class Base {
@@ -1139,5 +1139,28 @@ namespace MonoTests.System
var attrs = Attribute.GetCustomAttributes (m, true);
Assert.AreEqual (1, attrs.Length);
}
+
+ class EvtBase
+ {
+ public virtual event EventHandler Event {add {} remove {}}
+ }
+
+ class EvtOverride : EvtBase
+ {
+ [MyCAttr]
+ public override event EventHandler Event {add {} remove {}}
+ }
+
+ class EvtChild : EvtOverride
+ {
+ public override event EventHandler Event {add {} remove {}}
+ }
+
+ [Test] //Regression test for #662867
+ public void GetCustomAttributesOnEventOverride ()
+ {
+ var attrs = Attribute.GetCustomAttributes (typeof(EvtChild).GetEvent ("Event"), true);
+ Assert.AreEqual (1, attrs.Length);
+ }
}
}
diff --git a/mcs/class/corlib/Test/System/ChangeLog b/mcs/class/corlib/Test/System/ChangeLog
index fde6cf8..f5b936e 100644
--- a/mcs/class/corlib/Test/System/ChangeLog
+++ b/mcs/class/corlib/Test/System/ChangeLog
@@ -1,3 +1,9 @@
+2011-02-18 Rodrigo Kumpera <kumpera at gmail.com>
+
+ * AttributeTest.cs: Add regression test.
+
+ Fixes #662867
+
2011-01-07 Rodrigo Kumpera <kumpera at gmail.com>
Properly search overwrites for custom attributes.
diff --git a/mcs/class/corlib/corlib.dll.sources b/mcs/class/corlib/corlib.dll.sources
index 6a0321e..2695c4b 100644
--- a/mcs/class/corlib/corlib.dll.sources
+++ b/mcs/class/corlib/corlib.dll.sources
@@ -1535,7 +1535,6 @@ System.Threading.Tasks/TaskCreationOptions.cs
System.Threading.Tasks/ThreadWorker.cs
System.Threading.Tasks/SchedulerProxy.cs
System.Threading.Tasks/Scheduler.cs
-System.Threading.Tasks/IScheduler.cs
System.Threading.Tasks/CyclicDeque.cs
System.Threading.Tasks/TaskScheduler.cs
System.Threading.Tasks/TaskContinuationOptions.cs
@@ -1573,4 +1572,6 @@ System.Threading.Tasks/ParallelLoopResult.cs
System.Threading.Tasks/ParallelLoopState.cs
System/AggregateException.cs
System.Threading.Tasks/SimpleConcurrentBag.cs
+System.Threading.Tasks/SynchronizationContextScheduler.cs
System.Threading.Tasks/UnobservedTaskExceptionEventArgs.cs
+System.Threading.Tasks/TpScheduler.cs
diff --git a/mcs/class/lib/monolite/Mono.Security.dll b/mcs/class/lib/monolite/Mono.Security.dll
index 4091588..34442fb 100755
Binary files a/mcs/class/lib/monolite/Mono.Security.dll and b/mcs/class/lib/monolite/Mono.Security.dll differ
diff --git a/mcs/class/lib/monolite/System.Core.dll b/mcs/class/lib/monolite/System.Core.dll
index 67831af..c7cf12a 100755
Binary files a/mcs/class/lib/monolite/System.Core.dll and b/mcs/class/lib/monolite/System.Core.dll differ
diff --git a/mcs/class/lib/monolite/System.Xml.dll b/mcs/class/lib/monolite/System.Xml.dll
index 29fbbf2..bf9a111 100755
Binary files a/mcs/class/lib/monolite/System.Xml.dll and b/mcs/class/lib/monolite/System.Xml.dll differ
diff --git a/mcs/class/lib/monolite/System.dll b/mcs/class/lib/monolite/System.dll
index 887c341..a6c09a5 100755
Binary files a/mcs/class/lib/monolite/System.dll and b/mcs/class/lib/monolite/System.dll differ
diff --git a/mcs/class/lib/monolite/mcs.exe b/mcs/class/lib/monolite/mcs.exe
index 3be4ac8..6eca0d6 100755
Binary files a/mcs/class/lib/monolite/mcs.exe and b/mcs/class/lib/monolite/mcs.exe differ
diff --git a/mcs/class/lib/monolite/mscorlib.dll b/mcs/class/lib/monolite/mscorlib.dll
index f9c6f2a..439df5d 100755
Binary files a/mcs/class/lib/monolite/mscorlib.dll and b/mcs/class/lib/monolite/mscorlib.dll differ
diff --git a/mono/arch/ChangeLog b/mono/arch/ChangeLog
index 180c4ed..0fe5832 100644
--- a/mono/arch/ChangeLog
+++ b/mono/arch/ChangeLog
@@ -1,3 +1,7 @@
+2011-02-20 Zoltan Varga <vargaz at gmail.com>
+
+ Implement mono_memory_barrier () and OP_MEMORY_BARRIER for ARM.
+
2011-01-10 Rodrigo Kumpera <kumpera at gmail.com>
Implement mono.simd new conversion ops on amd64
diff --git a/mono/arch/arm/arm-codegen.h b/mono/arch/arm/arm-codegen.h
index e7dc99f..2460fc4 100644
--- a/mono/arch/arm/arm-codegen.h
+++ b/mono/arch/arm/arm-codegen.h
@@ -1084,6 +1084,16 @@ typedef union {
#define ARM_MOVT_REG_IMM_COND(p, rd, imm16, cond) ARM_EMIT(p, (((cond) << 28) | (3 << 24) | (4 << 20) | ((((guint32)(imm16)) >> 12) << 16) | ((rd) << 12) | (((guint32)(imm16)) & 0xfff)))
#define ARM_MOVT_REG_IMM(p, rd, imm16) ARM_MOVT_REG_IMM_COND ((p), (rd), (imm16), ARMCOND_AL)
+/* MCR */
+#define ARM_DEF_MCR_COND(coproc, opc1, rt, crn, crm, opc2, cond) \
+ ARM_DEF_COND ((cond)) | ((0xe << 24) | (((opc1) & 0x7) << 21) | (0 << 20) | (((crn) & 0xf) << 16) | (((rt) & 0xf) << 12) | (((coproc) & 0xf) << 8) | (((opc2) & 0x7) << 5) | (1 << 4) | (((crm) & 0xf) << 0))
+
+#define ARM_MCR_COND(p, coproc, opc1, rt, crn, crm, opc2, cond) \
+ ARM_EMIT(p, ARM_DEF_MCR_COND ((coproc), (opc1), (rt), (crn), (crm), (opc2), (cond)))
+
+#define ARM_MCR(p, coproc, opc1, rt, crn, crm, opc2) \
+ ARM_MCR_COND ((p), (coproc), (opc1), (rt), (crn), (crm), (opc2), ARMCOND_AL)
+
#ifdef __cplusplus
}
#endif
diff --git a/mono/metadata/ChangeLog b/mono/metadata/ChangeLog
index d84c31a..711f040 100644
--- a/mono/metadata/ChangeLog
+++ b/mono/metadata/ChangeLog
@@ -1,3 +1,27 @@
+2011-02-22 Zoltan Varga <vargaz at gmail.com>
+
+ Avoid returning TRUE from mono_domain_finalize () if it is
+ interrupted by sdb. Fixes #673592.
+
+2011-02-20 Zoltan Varga <vargaz at gmail.com>
+
+ Make the var/mvar caches per-image, since the generic params they
+ refer to can be freed on domain unload. Fixes part of #672939.
+
+2011-02-08 Mark Probst <mark.probst at gmail.com>
+
+ [sgen] Fix some debug functions.
+
+2011-02-16 Geoff Norton <grompf at sublimeintervention.com>
+
+ Fix ARCH_STORE_REGS on arm to save r0->r12 properly
+
+2011-02-11 Hib Eris <hib at hiberis.nl>
+
+ Decorate _image_base__ with __MINGW_LSYMBOL
+
+ This fix is needed in compiling for x86_x64.
+
2011-02-13 Mark Probst <mark.probst at gmail.com>
[sgen] Register the main_thread as a GC root. Fixes shutdown
diff --git a/mono/metadata/class.c b/mono/metadata/class.c
index 7d8fb45..36f1860 100644
--- a/mono/metadata/class.c
+++ b/mono/metadata/class.c
@@ -5621,40 +5621,65 @@ make_generic_param_class (MonoGenericParam *param, MonoImage *image, gboolean is
}
#define FAST_CACHE_SIZE 16
-static MonoClass *var_cache_fast [FAST_CACHE_SIZE];
-static MonoClass *mvar_cache_fast [FAST_CACHE_SIZE];
-static GHashTable *var_cache_slow;
-static GHashTable *mvar_cache_slow;
static MonoClass *
get_anon_gparam_class (MonoGenericParam *param, gboolean is_mvar)
{
int n = mono_generic_param_num (param);
+ MonoImage *image = param->image;
GHashTable *ht;
- if (n < FAST_CACHE_SIZE)
- return (is_mvar ? mvar_cache_fast : var_cache_fast) [n];
- ht = is_mvar ? mvar_cache_slow : var_cache_slow;
- return ht ? g_hash_table_lookup (ht, GINT_TO_POINTER (n)) : NULL;
+ g_assert (image);
+
+ if (n < FAST_CACHE_SIZE) {
+ if (is_mvar)
+ return image->mvar_cache_fast ? image->mvar_cache_fast [n] : NULL;
+ else
+ return image->var_cache_fast ? image->var_cache_fast [n] : NULL;
+ } else {
+ ht = is_mvar ? image->mvar_cache_slow : image->var_cache_slow;
+ return ht ? g_hash_table_lookup (ht, GINT_TO_POINTER (n)) : NULL;
+ }
}
+/*
+ * LOCKING: Acquires the loader lock.
+ */
static void
set_anon_gparam_class (MonoGenericParam *param, gboolean is_mvar, MonoClass *klass)
{
int n = mono_generic_param_num (param);
+ MonoImage *image = param->image;
GHashTable *ht;
+ g_assert (image);
+
if (n < FAST_CACHE_SIZE) {
- (is_mvar ? mvar_cache_fast : var_cache_fast) [n] = klass;
+ if (is_mvar) {
+ /* No locking needed */
+ if (!image->mvar_cache_fast)
+ image->mvar_cache_fast = mono_image_alloc0 (image, sizeof (MonoClass*) * FAST_CACHE_SIZE);
+ image->mvar_cache_fast [n] = klass;
+ } else {
+ if (!image->var_cache_fast)
+ image->var_cache_fast = mono_image_alloc0 (image, sizeof (MonoClass*) * FAST_CACHE_SIZE);
+ image->var_cache_fast [n] = klass;
+ }
return;
}
- ht = is_mvar ? mvar_cache_slow : var_cache_slow;
+ ht = is_mvar ? image->mvar_cache_slow : image->var_cache_slow;
if (!ht) {
- ht = g_hash_table_new (NULL, NULL);
- if (is_mvar)
- mvar_cache_slow = ht;
- else
- var_cache_slow = ht;
+ mono_loader_lock ();
+ ht = is_mvar ? image->mvar_cache_slow : image->var_cache_slow;
+ if (!ht) {
+ ht = g_hash_table_new (NULL, NULL);
+ mono_memory_barrier ();
+ if (is_mvar)
+ image->mvar_cache_slow = ht;
+ else
+ image->var_cache_slow = ht;
+ }
+ mono_loader_unlock ();
}
g_hash_table_insert (ht, GINT_TO_POINTER (n), klass);
diff --git a/mono/metadata/coree.h b/mono/metadata/coree.h
index c786536..a2bec50 100644
--- a/mono/metadata/coree.h
+++ b/mono/metadata/coree.h
@@ -24,8 +24,12 @@ STDAPI MonoFixupCorEE(HMODULE ModuleHandle);
/* Defined by the linker. */
#ifndef _MSC_VER
+#ifdef __MINGW64_VERSION_MAJOR
+#define __ImageBase __MINGW_LSYMBOL(_image_base__)
+#else
#define __ImageBase _image_base__
#endif
+#endif
extern IMAGE_DOS_HEADER __ImageBase MONO_INTERNAL;
extern HMODULE coree_module_handle MONO_INTERNAL;
diff --git a/mono/metadata/gc.c b/mono/metadata/gc.c
index 7b3ecf6..04a8e46 100644
--- a/mono/metadata/gc.c
+++ b/mono/metadata/gc.c
@@ -341,6 +341,7 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
DomainFinalizationReq *req;
guint32 res;
HANDLE done_event;
+ MonoInternalThread *thread = mono_thread_internal_current ();
if (mono_thread_internal_current () == gc_thread)
/* We are called from inside a finalizer, not much we can do here */
@@ -381,12 +382,19 @@ mono_domain_finalize (MonoDomain *domain, guint32 timeout)
if (timeout == -1)
timeout = INFINITE;
- res = WaitForSingleObjectEx (done_event, timeout, TRUE);
+ while (TRUE) {
+ res = WaitForSingleObjectEx (done_event, timeout, TRUE);
+ /* printf ("WAIT RES: %d.\n", res); */
- /* printf ("WAIT RES: %d.\n", res); */
- if (res == WAIT_TIMEOUT) {
- /* We leak the handle here */
- return FALSE;
+ if (res == WAIT_IO_COMPLETION) {
+ if ((thread->state & (ThreadState_StopRequested | ThreadState_SuspendRequested)) != 0)
+ return FALSE;
+ } else if (res == WAIT_TIMEOUT) {
+ /* We leak the handle here */
+ return FALSE;
+ } else {
+ break;
+ }
}
CloseHandle (done_event);
diff --git a/mono/metadata/image.c b/mono/metadata/image.c
index b9d7d7b..5d098a0 100644
--- a/mono/metadata/image.c
+++ b/mono/metadata/image.c
@@ -1625,6 +1625,8 @@ mono_image_close_except_pools (MonoImage *image)
free_hash (image->castclass_cache);
free_hash (image->proxy_isinst_cache);
free_hash (image->thunk_invoke_cache);
+ free_hash (image->var_cache_slow);
+ free_hash (image->mvar_cache_slow);
/* The ownership of signatures is not well defined */
//g_hash_table_foreach (image->memberref_signatures, free_mr_signatures, NULL);
diff --git a/mono/metadata/metadata-internals.h b/mono/metadata/metadata-internals.h
index fd98455..464b76d 100644
--- a/mono/metadata/metadata-internals.h
+++ b/mono/metadata/metadata-internals.h
@@ -314,6 +314,12 @@ struct _MonoImage {
/* List of image sets containing this image */
GSList *image_sets;
+ /* Caches for MonoClass-es representing anon generic params */
+ MonoClass **var_cache_fast;
+ MonoClass **mvar_cache_fast;
+ GHashTable *var_cache_slow;
+ GHashTable *mvar_cache_slow;
+
/*
* No other runtime locks must be taken while holding this lock.
* It's meant to be used only to mutate and query structures part of this image.
diff --git a/mono/metadata/metadata.c b/mono/metadata/metadata.c
index 3d872b2..4075549 100644
--- a/mono/metadata/metadata.c
+++ b/mono/metadata/metadata.c
@@ -10,9 +10,6 @@
*/
#include <config.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -2795,10 +2792,8 @@ mono_metadata_get_generic_inst (int type_argc, MonoType **type_argv)
break;
is_open = (i < type_argc);
- ginst = alloca (size);
-#ifndef MONO_SMALL_CONFIG
- ginst->id = 0;
-#endif
+ ginst = g_alloca (size);
+ memset (ginst, 0, sizeof (MonoGenericInst));
ginst->is_open = is_open;
ginst->type_argc = type_argc;
memcpy (ginst->type_argv, type_argv, type_argc * sizeof (MonoType *));
diff --git a/mono/metadata/sgen-archdep.h b/mono/metadata/sgen-archdep.h
index bfb47b4..a1e3e6d 100644
--- a/mono/metadata/sgen-archdep.h
+++ b/mono/metadata/sgen-archdep.h
@@ -138,14 +138,11 @@
#define ARCH_NUM_REGS 14
#define ARCH_STORE_REGS(ptr) \
__asm__ __volatile__( \
- "ldr r12, %0\n" \
- "push {r0}\n" \
- "push {r12}\n" \
- "stmia r12!, {r0-r11}\n" \
- "pop {r0}\n" \
- "stmia r12!, {r0, lr}\n" \
+ "push {lr}\n" \
+ "ldr lr, %0\n" \
+ "stmia lr!, {r0-r12}\n" \
"mov r12, r0\n" \
- "pop {r0}\n" \
+ "pop {lr}\n" \
: \
: "m" (ptr) \
)
diff --git a/mono/metadata/sgen-marksweep.c b/mono/metadata/sgen-marksweep.c
index ecf0edd..86d1a31 100644
--- a/mono/metadata/sgen-marksweep.c
+++ b/mono/metadata/sgen-marksweep.c
@@ -587,10 +587,15 @@ ms_alloc_block (int size_index, gboolean pinned, gboolean has_references)
}
static gboolean
-obj_is_from_pinned_alloc (char *obj)
+obj_is_from_pinned_alloc (char *ptr)
{
- MSBlockInfo *block = MS_BLOCK_FOR_OBJ (obj);
- return block->pinned;
+ MSBlockInfo *block;
+
+ FOREACH_BLOCK (block) {
+ if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE)
+ return block->pinned;
+ } END_FOREACH_BLOCK;
+ return FALSE;
}
static void*
@@ -770,8 +775,8 @@ major_ptr_is_in_non_pinned_space (char *ptr)
MSBlockInfo *block;
FOREACH_BLOCK (block) {
- if (ptr >= (char*)block && ptr <= (char*)block + MS_BLOCK_SIZE)
- return TRUE;
+ if (ptr >= block->block && ptr <= block->block + MS_BLOCK_SIZE)
+ return !block->pinned;
} END_FOREACH_BLOCK;
return FALSE;
}
diff --git a/mono/mini/ChangeLog b/mono/mini/ChangeLog
index 3bb21ca..fd5cfb9 100644
--- a/mono/mini/ChangeLog
+++ b/mono/mini/ChangeLog
@@ -1,3 +1,56 @@
+2011-02-22 Zoltan Varga <vargaz at gmail.com>
+
+ Fix the passing of the mrgctx argument in case of a
+ virtual->nonvirtual optimization. Fixes #672446.
+
+2011-02-22 Zoltan Varga <vargaz at gmail.com>
+
+ Fix arm thunk creation in dynamic methods. Fixes #673828.
+
+2011-02-20 Geoff Norton <grompf at sublimeintervention.com>
+
+ OSX 10.6 properly respected signal handlers before invoking the
+ crash reporter
+
+2011-02-20 Zoltan Varga <vargaz at gmail.com>
+
+ Implement mono_memory_barrier () and OP_MEMORY_BARRIER for ARM.
+
+2011-02-19 Zoltan Varga <vargaz at gmail.com>
+
+ Reorganize the way jump_target_hash is stored in the JIT. Free
+ entries in jump_target_hash which point inside a dynamic method
+ when it is freed. Fixes #669815.
+
+2011-02-18 Zoltan Varga <vargaz at gmail.com>
+
+ Set cfg->uses_rgctx_reg in another code path too on arm, to fix
+ --regression generics.exe.
+
+2011-02-18 Zoltan Varga <vargaz at gmail.com>
+
+ Work around a gcc bug on arm.
+
+2011-02-17 Rodrigo Kumpera <kumpera at gmail.com>
+
+ * method-to-ir.c (mono_emit_method_call_full): Non virtual marshal
+ by ref methods with gsharing context must always be called using
+ indirect calls.
+
+ Fixes #665893
+
+2011-02-17 Rodrigo Kumpera <kumpera at gmail.com>
+
+ * method-to-ir.c (mono_emit_method_call_full): Make sure we keep a
+ root for delegates when calling them using the fast delegate
+ dispatch.
+
+ Fixes #667921
+
+2011-02-16 Geoff Norton <grompf at sublimeintervention.com>
+
+ Remove dead code
+
2011-02-13 Alexandre Mutel <alexandre_mutel at yahoo.fr>
Fix sizeof(T) in non-gshared code. Fixes #580189.
diff --git a/mono/mini/cpu-arm.md b/mono/mini/cpu-arm.md
index 2acc8f0..abddc16 100644
--- a/mono/mini/cpu-arm.md
+++ b/mono/mini/cpu-arm.md
@@ -46,7 +46,7 @@
#
# See the code in mini-x86.c for more details on how the specifiers are used.
#
-memory_barrier: len:4
+memory_barrier: len:8 clob:a
nop: len:4
relaxed_nop: len:4
break: len:4
diff --git a/mono/mini/exceptions-arm.c b/mono/mini/exceptions-arm.c
index b2d67c7..2d0fab1 100644
--- a/mono/mini/exceptions-arm.c
+++ b/mono/mini/exceptions-arm.c
@@ -535,6 +535,19 @@ handle_signal_exception (gpointer obj, gboolean test_only)
}
/*
+ * This works around a gcc 4.5 bug:
+ * https://bugs.launchpad.net/ubuntu/+source/gcc-4.5/+bug/721531
+ */
+#if defined(__GNUC__)
+__attribute__((noinline))
+#endif
+static gpointer
+get_handle_signal_exception_addr (void)
+{
+ return handle_signal_exception;
+}
+
+/*
* This is the function called from the signal handler
*/
gboolean
@@ -562,7 +575,7 @@ mono_arch_handle_exception (void *ctx, gpointer obj, gboolean test_only)
sp -= 16;
UCONTEXT_REG_SP (sigctx) = sp;
- UCONTEXT_REG_PC (sigctx) = (gsize)handle_signal_exception;
+ UCONTEXT_REG_PC (sigctx) = (gsize)get_handle_signal_exception_addr ();
#ifdef UCONTEXT_REG_CPSR
if ((gsize)UCONTEXT_REG_PC (sigctx) & 1)
/* Transition to thumb */
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index d075a81..4c8d4e9 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -2369,11 +2369,12 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
sig = ctor_sig;
}
+ context_used = mono_method_check_context_used (method);
+
might_be_remote = this && sig->hasthis &&
(method->klass->marshalbyref || method->klass == mono_defaults.object_class) &&
- !(method->flags & METHOD_ATTRIBUTE_VIRTUAL) && !MONO_CHECK_THIS (this);
+ !(method->flags & METHOD_ATTRIBUTE_VIRTUAL) && (!MONO_CHECK_THIS (this) || context_used);
- context_used = mono_method_check_context_used (method);
if (might_be_remote && context_used) {
MonoInst *addr;
@@ -2400,6 +2401,8 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
if ((method->klass->parent == mono_defaults.multicastdelegate_class) && (!strcmp (method->name, "Invoke"))) {
+ MonoInst *dummy_use;
+
MONO_EMIT_NULL_CHECK (cfg, this_reg);
/* Make a call to delegate->invoke_impl */
@@ -2408,6 +2411,20 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
call->inst.inst_offset = G_STRUCT_OFFSET (MonoDelegate, invoke_impl);
MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
+ /* We must emit a dummy use here because the delegate trampoline will
+ replace the 'this' argument with the delegate target making this activation
+ no longer a root for the delegate.
+ This is an issue for delegates that target collectible code such as dynamic
+ methods of GC'able assemblies.
+
+ For a test case look into #667921.
+
+ FIXME: a dummy use is not the best way to do it as the local register allocator
+ will put it on a caller save register and spil it around the call.
+ Ideally, we would either put it on a callee save register or only do the store part.
+ */
+ EMIT_NEW_DUMMY_USE (cfg, dummy_use, args [0]);
+
return (MonoInst*)call;
}
#endif
@@ -2433,13 +2450,7 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
MONO_EMIT_NEW_CHECK_THIS (cfg, this_reg);
call->inst.opcode = callvirt_to_call (call->inst.opcode);
-
- MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
-
- return (MonoInst*)call;
- }
-
- if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && MONO_METHOD_IS_FINAL (method)) {
+ } else if ((method->flags & METHOD_ATTRIBUTE_VIRTUAL) && MONO_METHOD_IS_FINAL (method)) {
/*
* the method is virtual, but we can statically dispatch since either
* it's class or the method itself are sealed.
@@ -2448,44 +2459,41 @@ mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSign
MONO_EMIT_NEW_CHECK_THIS (cfg, this_reg);
call->inst.opcode = callvirt_to_call (call->inst.opcode);
- MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
-
- return (MonoInst*)call;
- }
-
- call->inst.opcode = callvirt_to_call_membase (call->inst.opcode);
+ } else {
+ call->inst.opcode = callvirt_to_call_membase (call->inst.opcode);
- vtable_reg = alloc_preg (cfg);
- MONO_EMIT_NEW_LOAD_MEMBASE_FAULT (cfg, vtable_reg, this_reg, G_STRUCT_OFFSET (MonoObject, vtable));
- if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
- slot_reg = -1;
+ vtable_reg = alloc_preg (cfg);
+ MONO_EMIT_NEW_LOAD_MEMBASE_FAULT (cfg, vtable_reg, this_reg, G_STRUCT_OFFSET (MonoObject, vtable));
+ if (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
+ slot_reg = -1;
#ifdef MONO_ARCH_HAVE_IMT
- if (mono_use_imt) {
- guint32 imt_slot = mono_method_get_imt_slot (method);
- emit_imt_argument (cfg, call, imt_arg);
- slot_reg = vtable_reg;
- call->inst.inst_offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
- }
+ if (mono_use_imt) {
+ guint32 imt_slot = mono_method_get_imt_slot (method);
+ emit_imt_argument (cfg, call, imt_arg);
+ slot_reg = vtable_reg;
+ call->inst.inst_offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
+ }
#endif
- if (slot_reg == -1) {
- slot_reg = alloc_preg (cfg);
- mini_emit_load_intf_reg_vtable (cfg, slot_reg, vtable_reg, method->klass);
- call->inst.inst_offset = mono_method_get_vtable_index (method) * SIZEOF_VOID_P;
- }
- } else {
- slot_reg = vtable_reg;
- call->inst.inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) +
- ((mono_method_get_vtable_index (method)) * (SIZEOF_VOID_P));
+ if (slot_reg == -1) {
+ slot_reg = alloc_preg (cfg);
+ mini_emit_load_intf_reg_vtable (cfg, slot_reg, vtable_reg, method->klass);
+ call->inst.inst_offset = mono_method_get_vtable_index (method) * SIZEOF_VOID_P;
+ }
+ } else {
+ slot_reg = vtable_reg;
+ call->inst.inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) +
+ ((mono_method_get_vtable_index (method)) * (SIZEOF_VOID_P));
#ifdef MONO_ARCH_HAVE_IMT
- if (imt_arg) {
- g_assert (mono_method_signature (method)->generic_param_count);
- emit_imt_argument (cfg, call, imt_arg);
- }
+ if (imt_arg) {
+ g_assert (mono_method_signature (method)->generic_param_count);
+ emit_imt_argument (cfg, call, imt_arg);
+ }
#endif
- }
+ }
- call->inst.sreg1 = slot_reg;
- call->virtual = TRUE;
+ call->inst.sreg1 = slot_reg;
+ call->virtual = TRUE;
+ }
}
MONO_ADD_INS (cfg->cbb, (MonoInst*)call);
diff --git a/mono/mini/mini-alpha.c b/mono/mini/mini-alpha.c
index 404227a..f7f8a36 100644
--- a/mono/mini/mini-alpha.c
+++ b/mono/mini/mini-alpha.c
@@ -4035,7 +4035,7 @@ mono_arch_fregname (int reg) {
void
mono_arch_patch_code (MonoMethod *method, MonoDomain *domain,
- guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+ guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
gboolean compile_aot = !run_cctors;
diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c
index 10f9f0f..610835e 100644
--- a/mono/mini/mini-amd64.c
+++ b/mono/mini/mini-amd64.c
@@ -6208,7 +6208,7 @@ mono_arch_register_lowlevel_calls (void)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
gboolean compile_aot = !run_cctors;
diff --git a/mono/mini/mini-arm.c b/mono/mini/mini-arm.c
index 3ab3d68..0f415d0 100644
--- a/mono/mini/mini-arm.c
+++ b/mono/mini/mini-arm.c
@@ -1180,6 +1180,10 @@ mono_arch_allocate_vars (MonoCompile *cfg)
header = cfg->header;
+ /* See mono_arch_get_global_int_regs () */
+ if (cfg->flags & MONO_CFG_HAS_CALLS)
+ cfg->uses_rgctx_reg = TRUE;
+
if (cfg->frame_reg != ARMREG_SP)
cfg->used_int_regs |= 1 << cfg->frame_reg;
@@ -2797,7 +2801,7 @@ search_thunk_slot (void *data, int csize, int bsize, void *user_data) {
}
static void
-handle_thunk (MonoDomain *domain, int absolute, guchar *code, const guchar *target)
+handle_thunk (MonoDomain *domain, int absolute, guchar *code, const guchar *target, MonoCodeManager *dyn_code_mp)
{
PatchData pdata;
@@ -2809,23 +2813,53 @@ handle_thunk (MonoDomain *domain, int absolute, guchar *code, const guchar *targ
pdata.absolute = absolute;
pdata.found = 0;
- mono_domain_lock (domain);
- mono_domain_code_foreach (domain, search_thunk_slot, &pdata);
+ if (dyn_code_mp) {
+ mono_code_manager_foreach (dyn_code_mp, search_thunk_slot, &pdata);
+ }
- if (!pdata.found) {
- /* this uses the first available slot */
- pdata.found = 2;
+ if (pdata.found != 1) {
+ mono_domain_lock (domain);
mono_domain_code_foreach (domain, search_thunk_slot, &pdata);
+
+ if (!pdata.found) {
+ /* this uses the first available slot */
+ pdata.found = 2;
+ mono_domain_code_foreach (domain, search_thunk_slot, &pdata);
+ }
+ mono_domain_unlock (domain);
}
- mono_domain_unlock (domain);
+ if (pdata.found != 1) {
+ GHashTable *hash;
+ GHashTableIter iter;
+ MonoJitDynamicMethodInfo *ji;
+
+ /*
+ * This might be a dynamic method, search its code manager. We can only
+ * use the dynamic method containing CODE, since the others might be freed later.
+ */
+ pdata.found = 0;
+
+ mono_domain_lock (domain);
+ hash = domain_jit_info (domain)->dynamic_code_hash;
+ if (hash) {
+ /* FIXME: Speed this up */
+ g_hash_table_iter_init (&iter, hash);
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer*)&ji)) {
+ mono_code_manager_foreach (ji->code_mp, search_thunk_slot, &pdata);
+ if (pdata.found == 1)
+ break;
+ }
+ }
+ mono_domain_unlock (domain);
+ }
if (pdata.found != 1)
g_print ("thunk failed for %p from %p\n", target, code);
g_assert (pdata.found == 1);
}
static void
-arm_patch_general (MonoDomain *domain, guchar *code, const guchar *target)
+arm_patch_general (MonoDomain *domain, guchar *code, const guchar *target, MonoCodeManager *dyn_code_mp)
{
guint32 *code32 = (void*)code;
guint32 ins = *code32;
@@ -2871,7 +2905,7 @@ arm_patch_general (MonoDomain *domain, guchar *code, const guchar *target)
}
}
- handle_thunk (domain, TRUE, code, target);
+ handle_thunk (domain, TRUE, code, target, dyn_code_mp);
return;
}
@@ -2974,7 +3008,7 @@ arm_patch_general (MonoDomain *domain, guchar *code, const guchar *target)
void
arm_patch (guchar *code, const guchar *target)
{
- arm_patch_general (NULL, code, target);
+ arm_patch_general (NULL, code, target, NULL);
}
/*
@@ -3233,6 +3267,8 @@ mono_arch_output_basic_block (MonoCompile *cfg, MonoBasicBlock *bb)
switch (ins->opcode) {
case OP_MEMORY_BARRIER:
+ ARM_MOV_REG_IMM8 (code, ARMREG_R0, 0);
+ ARM_MCR (code, 15, 0, ARMREG_R0, 7, 10, 5);
break;
case OP_TLS_GET:
#ifdef HAVE_AEABI_READ_TP
@@ -4484,7 +4520,7 @@ mono_arch_register_lowlevel_calls (void)
} while (0)
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
gboolean compile_aot = !run_cctors;
@@ -4557,7 +4593,7 @@ mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, Mono
default:
break;
}
- arm_patch_general (domain, ip, target);
+ arm_patch_general (domain, ip, target, dyn_code_mp);
}
}
diff --git a/mono/mini/mini-darwin.c b/mono/mini/mini-darwin.c
index f61e590..7880c82 100644
--- a/mono/mini/mini-darwin.c
+++ b/mono/mini/mini-darwin.c
@@ -66,6 +66,7 @@
#include <mach/task.h>
#include <pthread.h>
#include <dlfcn.h>
+#include <AvailabilityMacros.h>
/*
* This code disables the CrashReporter of MacOS X by installing
@@ -190,7 +191,9 @@ macosx_register_exception_handler ()
void
mono_runtime_install_handlers (void)
{
+#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_5
macosx_register_exception_handler ();
+#endif
mono_runtime_posix_install_handlers ();
/* Snow Leopard has a horrible bug: http://openradar.appspot.com/7209349
diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c
index 0180540..f00e601 100644
--- a/mono/mini/mini-generic-sharing.c
+++ b/mono/mini/mini-generic-sharing.c
@@ -606,17 +606,8 @@ static gboolean
generic_inst_is_sharable (MonoGenericInst *inst, gboolean allow_type_vars,
gboolean allow_partial)
{
- gboolean has_refs;
int i;
- has_refs = FALSE;
- for (i = 0; i < inst->type_argc; ++i) {
- MonoType *type = inst->type_argv [i];
-
- if (MONO_TYPE_IS_REFERENCE (type) || (allow_type_vars && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR)))
- has_refs = TRUE;
- }
-
for (i = 0; i < inst->type_argc; ++i) {
MonoType *type = inst->type_argv [i];
diff --git a/mono/mini/mini-hppa.c b/mono/mini/mini-hppa.c
index 095ec0a..264a86c 100644
--- a/mono/mini/mini-hppa.c
+++ b/mono/mini/mini-hppa.c
@@ -2039,7 +2039,7 @@ mono_arch_register_lowlevel_calls (void)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-ia64.c b/mono/mini/mini-ia64.c
index c9395dc..e727522 100644
--- a/mono/mini/mini-ia64.c
+++ b/mono/mini/mini-ia64.c
@@ -3785,7 +3785,7 @@ ia64_patch (unsigned char* code, gpointer target)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-mips.c b/mono/mini/mini-mips.c
index a13b575..932f2ec 100644
--- a/mono/mini/mini-mips.c
+++ b/mono/mini/mini-mips.c
@@ -4385,7 +4385,7 @@ mono_arch_register_lowlevel_calls (void)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-ppc.c b/mono/mini/mini-ppc.c
index c5b8b8c..90240f6 100644
--- a/mono/mini/mini-ppc.c
+++ b/mono/mini/mini-ppc.c
@@ -4691,7 +4691,7 @@ mono_arch_register_lowlevel_calls (void)
#ifndef DISABLE_JIT
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
gboolean compile_aot = !run_cctors;
diff --git a/mono/mini/mini-s390.c b/mono/mini/mini-s390.c
index 3168f51..a001ef7 100644
--- a/mono/mini/mini-s390.c
+++ b/mono/mini/mini-s390.c
@@ -4313,7 +4313,7 @@ mono_arch_register_lowlevel_calls (void)
void
mono_arch_patch_code (MonoMethod *method, MonoDomain *domain,
- guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+ guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c
index 607ff53..8f71bdb 100644
--- a/mono/mini/mini-s390x.c
+++ b/mono/mini/mini-s390x.c
@@ -4701,7 +4701,7 @@ mono_arch_register_lowlevel_calls (void)
void
mono_arch_patch_code (MonoMethod *method, MonoDomain *domain,
- guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+ guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-sparc.c b/mono/mini/mini-sparc.c
index 531ef05..78ea5f2 100644
--- a/mono/mini/mini-sparc.c
+++ b/mono/mini/mini-sparc.c
@@ -3680,7 +3680,7 @@ mono_arch_register_lowlevel_calls (void)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c
index f0f59b0..cac724b 100644
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -4764,7 +4764,7 @@ mono_arch_register_lowlevel_calls (void)
}
void
-mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors)
+mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors)
{
MonoJumpInfo *patch_info;
gboolean compile_aot = !run_cctors;
diff --git a/mono/mini/mini.c b/mono/mini/mini.c
index fa4151b..76bebd3 100644
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -3407,7 +3407,7 @@ mono_postprocess_patches (MonoCompile *cfg)
break;
}
case MONO_PATCH_INFO_METHOD_JUMP: {
- GSList *list;
+ MonoJumpList *jlist;
MonoDomain *domain = cfg->domain;
unsigned char *ip = cfg->native_code + patch_info->ip.i;
#if defined(__native_client__) && defined(__native_client_codegen__)
@@ -3418,11 +3418,12 @@ mono_postprocess_patches (MonoCompile *cfg)
#endif
mono_domain_lock (domain);
- if (!domain_jit_info (domain)->jump_target_hash)
- domain_jit_info (domain)->jump_target_hash = g_hash_table_new (NULL, NULL);
- list = g_hash_table_lookup (domain_jit_info (domain)->jump_target_hash, patch_info->data.method);
- list = g_slist_prepend (list, ip);
- g_hash_table_insert (domain_jit_info (domain)->jump_target_hash, patch_info->data.method, list);
+ jlist = g_hash_table_lookup (domain_jit_info (domain)->jump_target_hash, patch_info->data.method);
+ if (!jlist) {
+ jlist = mono_domain_alloc0 (domain, sizeof (MonoJumpList));
+ g_hash_table_insert (domain_jit_info (domain)->jump_target_hash, patch_info->data.method, jlist);
+ }
+ jlist->list = g_slist_prepend (jlist->list, ip);
mono_domain_unlock (domain);
break;
}
@@ -3732,7 +3733,7 @@ if (valgrind_register){
mono_nacl_fix_patches (cfg->native_code, cfg->patch_info);
#endif
- mono_arch_patch_code (cfg->method, cfg->domain, cfg->native_code, cfg->patch_info, cfg->run_cctors);
+ mono_arch_patch_code (cfg->method, cfg->domain, cfg->native_code, cfg->patch_info, cfg->dynamic_info ? cfg->dynamic_info->code_mp : NULL, cfg->run_cctors);
if (cfg->method->dynamic) {
if (mono_using_xdebug)
@@ -5259,18 +5260,19 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
#ifndef DISABLE_JIT
if (domain_jit_info (target_domain)->jump_target_hash) {
MonoJumpInfo patch_info;
- GSList *list, *tmp;
- list = g_hash_table_lookup (domain_jit_info (target_domain)->jump_target_hash, method);
- if (list) {
+ MonoJumpList *jlist;
+ GSList *tmp;
+ jlist = g_hash_table_lookup (domain_jit_info (target_domain)->jump_target_hash, method);
+ if (jlist) {
patch_info.next = NULL;
patch_info.ip.i = 0;
patch_info.type = MONO_PATCH_INFO_METHOD_JUMP;
patch_info.data.method = method;
g_hash_table_remove (domain_jit_info (target_domain)->jump_target_hash, method);
+
+ for (tmp = jlist->list; tmp; tmp = tmp->next)
+ mono_arch_patch_code (NULL, target_domain, tmp->data, &patch_info, NULL, TRUE);
}
- for (tmp = list; tmp; tmp = tmp->next)
- mono_arch_patch_code (NULL, target_domain, tmp->data, &patch_info, TRUE);
- g_slist_free (list);
}
mono_emit_jit_map (jinfo);
@@ -5410,6 +5412,8 @@ mono_jit_free_method (MonoDomain *domain, MonoMethod *method)
{
MonoJitDynamicMethodInfo *ji;
gboolean destroy = TRUE;
+ GHashTableIter iter;
+ MonoJumpList *jlist;
g_assert (method->dynamic);
@@ -5419,11 +5423,31 @@ mono_jit_free_method (MonoDomain *domain, MonoMethod *method)
if (!ji)
return;
+
mono_domain_lock (domain);
g_hash_table_remove (domain_jit_info (domain)->dynamic_code_hash, method);
mono_internal_hash_table_remove (&domain->jit_code_hash, method);
g_hash_table_remove (domain_jit_info (domain)->jump_trampoline_hash, method);
g_hash_table_remove (domain_jit_info (domain)->runtime_invoke_hash, method);
+
+ /* Remove jump targets in this method */
+ g_hash_table_iter_init (&iter, domain_jit_info (domain)->jump_target_hash);
+ while (g_hash_table_iter_next (&iter, NULL, (void**)&jlist)) {
+ GSList *tmp, *remove;
+
+ remove = NULL;
+ for (tmp = jlist->list; tmp; tmp = tmp->next) {
+ guint8 *ip = tmp->data;
+
+ if (ip >= (guint8*)ji->ji->code_start && ip < (guint8*)ji->ji->code_start + ji->ji->code_size)
+ remove = g_slist_prepend (remove, tmp);
+ }
+ for (tmp = remove; tmp; tmp = tmp->next) {
+ jlist->list = g_slist_delete_link (jlist->list, tmp->data);
+ }
+ g_slist_free (remove);
+ }
+
mono_domain_unlock (domain);
#ifdef MONO_ARCH_HAVE_INVALIDATE_METHOD
@@ -6055,6 +6079,7 @@ mini_create_jit_domain_info (MonoDomain *domain)
info->runtime_invoke_hash = g_hash_table_new_full (mono_aligned_addr_hash, NULL, NULL, runtime_invoke_info_free);
info->seq_points = g_hash_table_new_full (mono_aligned_addr_hash, NULL, NULL, g_free);
info->arch_seq_points = g_hash_table_new (mono_aligned_addr_hash, NULL);
+ info->jump_target_hash = g_hash_table_new (NULL, NULL);
domain->runtime_info = info;
}
@@ -6062,7 +6087,8 @@ mini_create_jit_domain_info (MonoDomain *domain)
static void
delete_jump_list (gpointer key, gpointer value, gpointer user_data)
{
- g_slist_free (value);
+ MonoJumpList *jlist = value;
+ g_slist_free (jlist->list);
}
static void
@@ -6090,10 +6116,8 @@ mini_free_jit_domain_info (MonoDomain *domain)
{
MonoJitDomainInfo *info = domain_jit_info (domain);
- if (info->jump_target_hash) {
- g_hash_table_foreach (info->jump_target_hash, delete_jump_list, NULL);
- g_hash_table_destroy (info->jump_target_hash);
- }
+ g_hash_table_foreach (info->jump_target_hash, delete_jump_list, NULL);
+ g_hash_table_destroy (info->jump_target_hash);
if (info->jump_target_got_slot_hash) {
g_hash_table_foreach (info->jump_target_got_slot_hash, delete_jump_list, NULL);
g_hash_table_destroy (info->jump_target_got_slot_hash);
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index 7f670cb..6df0fc9 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -267,6 +267,11 @@ typedef struct {
#define domain_jit_info(domain) ((MonoJitDomainInfo*)((domain)->runtime_info))
+/* Contains a list of ips which needs to be patched when a method is compiled */
+typedef struct {
+ GSList *list;
+} MonoJumpList;
+
/* Arch-specific */
typedef struct {
int dummy;
@@ -1990,7 +1995,7 @@ GList *mono_arch_get_global_fp_regs (MonoCompile *cfg) MONO_INTERNAL
GList *mono_arch_get_iregs_clobbered_by_call (MonoCallInst *call) MONO_INTERNAL;
GList *mono_arch_get_fregs_clobbered_by_call (MonoCallInst *call) MONO_INTERNAL;
guint32 mono_arch_regalloc_cost (MonoCompile *cfg, MonoMethodVar *vmv) MONO_INTERNAL;
-void mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, gboolean run_cctors) MONO_INTERNAL;
+void mono_arch_patch_code (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *ji, MonoCodeManager *dyn_code_mp, gboolean run_cctors) MONO_INTERNAL;
void mono_arch_flush_icache (guint8 *code, gint size) MONO_INTERNAL;
int mono_arch_max_epilog_size (MonoCompile *cfg) MONO_INTERNAL;
guint8 *mono_arch_emit_prolog (MonoCompile *cfg) MONO_INTERNAL;
diff --git a/mono/utils/ChangeLog b/mono/utils/ChangeLog
index 871d301..93d4d9d 100644
--- a/mono/utils/ChangeLog
+++ b/mono/utils/ChangeLog
@@ -1,3 +1,21 @@
+2011-02-21 Geoff Norton <grompf at sublimeintervention.com>
+
+ Implement proper TSD lookup for arm-darwin
+
+2011-02-20 Zoltan Varga <vargaz at gmail.com>
+
+ Implement mono_memory_barrier () and OP_MEMORY_BARRIER for ARM.
+
+2011-02-19 Geoff Norton <grompf at sublimeintervention.com>
+
+ Avoid leaking a mach_port every time we query the counters
+
+2011-02-19 Miguel de Icaza <miguel at gnome.org>
+
+ Backport support for add support for new
+ PerformanceCounter("Process", "% Processor Time", "<process id as
+ string>" on OS X
+
2011-01-29 Marek Habersack <grendel at twistedcode.net>
[runtime] Use IOAMP-aware method of looking for domain
diff --git a/mono/utils/mach-support-arm.c b/mono/utils/mach-support-arm.c
index 4ce821d..a5d27d4 100644
--- a/mono/utils/mach-support-arm.c
+++ b/mono/utils/mach-support-arm.c
@@ -74,8 +74,8 @@ mono_mach_arch_get_tls_value_from_thread (thread_port_t thread, guint32 key)
* is baked into their pthread_getspecific implementation
*/
intptr_t *p = (intptr_t *) pthread_from_mach_thread_np (thread);
- intptr_t **tsd = (intptr_t **) (p + 0x48);
+ intptr_t **tsd = (intptr_t **) (p + 0x48 + (key << 2));
- return (void *) tsd [key];
+ return (void *) *tsd;
}
#endif
diff --git a/mono/utils/mono-membar.h b/mono/utils/mono-membar.h
index 13ed6e7..1c343b0 100644
--- a/mono/utils/mono-membar.h
+++ b/mono/utils/mono-membar.h
@@ -129,7 +129,7 @@ static inline void mono_memory_write_barrier (void)
#elif defined(__arm__)
static inline void mono_memory_barrier (void)
{
- __asm__ __volatile__ ("" : : : "memory");
+ __asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
}
static inline void mono_memory_read_barrier (void)
diff --git a/mono/utils/mono-proclib.c b/mono/utils/mono-proclib.c
index a51e75a..0b1d0c6 100644
--- a/mono/utils/mono-proclib.c
+++ b/mono/utils/mono-proclib.c
@@ -18,6 +18,9 @@
#include <sys/types.h>
#include <sys/sysctl.h>
#include <sys/proc.h>
+#if defined(__APPLE__)
+#include <mach/mach.h>
+#endif
#ifdef HAVE_SYS_USER_H
#include <sys/user.h>
#endif
@@ -262,6 +265,63 @@ mono_process_get_name (gpointer pid, char *buf, int len)
static gint64
get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
{
+#if defined(__APPLE__)
+ double process_user_time = 0, process_system_time = 0;//, process_percent = 0;
+ task_t task;
+
+ if (task_for_pid(mach_task_self(), pid, &task) != KERN_SUCCESS)
+ RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
+
+ struct task_basic_info t_info;
+ mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT, th_count;
+
+ if (task_info(task, TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count) != KERN_SUCCESS) {
+ mach_port_deallocate (mach_task_self (), task);
+ RET_ERROR (MONO_PROCESS_ERROR_OTHER);
+ }
+
+ thread_array_t th_array;
+
+ if (task_threads(task, &th_array, &th_count) != KERN_SUCCESS) {
+ mach_port_deallocate (mach_task_self (), task);
+ RET_ERROR (MONO_PROCESS_ERROR_OTHER);
+ }
+
+ size_t i;
+
+ for (i = 0; i < th_count; i++) {
+ double thread_user_time, thread_system_time;//, thread_percent;
+
+ struct thread_basic_info th_info;
+ mach_msg_type_number_t th_info_count = THREAD_BASIC_INFO_COUNT;
+ if (thread_info(th_array[i], THREAD_BASIC_INFO, (thread_info_t)&th_info, &th_info_count) == KERN_SUCCESS) {
+ thread_user_time = th_info.user_time.seconds + th_info.user_time.microseconds / 1e6;
+ thread_system_time = th_info.system_time.seconds + th_info.system_time.microseconds / 1e6;
+ //thread_percent = (double)th_info.cpu_usage / TH_USAGE_SCALE;
+
+ process_user_time += thread_user_time;
+ process_system_time += thread_system_time;
+ //process_percent += th_percent;
+ }
+ }
+
+ for (i = 0; i < th_count; i++)
+ mach_port_deallocate(task, th_array[i]);
+
+ mach_port_deallocate (mach_task_self (), task);
+
+ process_user_time += t_info.user_time.seconds + t_info.user_time.microseconds / 1e6;
+ process_system_time += t_info.system_time.seconds + t_info.system_time.microseconds / 1e6;
+
+ if (pos == 10 && sum == TRUE)
+ return (gint64)((process_user_time + process_system_time) * 10000000);
+ else if (pos == 10)
+ return (gint64)(process_user_time * 10000000);
+ else if (pos == 11)
+ return (gint64)(process_system_time * 10000000);
+
+ return 0;
+#else
char buf [512];
char *s, *end;
FILE *f;
@@ -307,6 +367,7 @@ get_process_stat_item (int pid, int pos, int sum, MonoProcessError *error)
if (error)
*error = MONO_PROCESS_ERROR_NONE;
return value;
+#endif
}
static int
@@ -327,20 +388,52 @@ static gint64
get_process_stat_time (int pid, int pos, int sum, MonoProcessError *error)
{
gint64 val = get_process_stat_item (pid, pos, sum, error);
+#if defined(__APPLE__)
+ return val;
+#else
/* return 100ns ticks */
return (val * 10000000) / get_user_hz ();
+#endif
}
static gint64
-get_pid_status_item (int pid, const char *item, MonoProcessError *error)
+get_pid_status_item (int pid, const char *item, MonoProcessError *error, int multiplier)
{
+#if defined(__APPLE__)
+ // ignore the multiplier
+
+ gint64 ret;
+ task_t task;
+ if (task_for_pid (mach_task_self (), pid, &task) != KERN_SUCCESS)
+ RET_ERROR (MONO_PROCESS_ERROR_NOT_FOUND);
+
+ struct task_basic_info t_info;
+ mach_msg_type_number_t th_count = TASK_BASIC_INFO_COUNT;
+
+ if (task_info (task, TASK_BASIC_INFO, (task_info_t)&t_info, &th_count) != KERN_SUCCESS) {
+ mach_port_deallocate (mach_task_self (), task);
+ RET_ERROR (MONO_PROCESS_ERROR_OTHER);
+ }
+
+ if (strcmp (item, "VmRSS") == 0 || strcmp (item, "VmHWM") == 0)
+ ret = t_info.resident_size;
+ else if (strcmp (item, "VmSize") == 0 || strcmp (item, "VmPeak") == 0)
+ ret = t_info.virtual_size;
+ else if (strcmp (item, "Threads") == 0)
+ ret = th_count;
+
+ mach_port_deallocate (mach_task_self (), task);
+
+ return ret;
+#else
char buf [64];
char *s;
s = get_pid_status_item_buf (pid, item, buf, sizeof (buf), error);
if (s)
- return atoi (s);
+ return atoi (s) * multiplier;
return 0;
+#endif
}
/**
@@ -362,7 +455,7 @@ mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProces
switch (data) {
case MONO_PROCESS_NUM_THREADS:
- return get_pid_status_item (rpid, "Threads", error);
+ return get_pid_status_item (rpid, "Threads", error, 1);
case MONO_PROCESS_USER_TIME:
return get_process_stat_time (rpid, 10, FALSE, error);
case MONO_PROCESS_SYSTEM_TIME:
@@ -370,20 +463,20 @@ mono_process_get_data_with_error (gpointer pid, MonoProcessData data, MonoProces
case MONO_PROCESS_TOTAL_TIME:
return get_process_stat_time (rpid, 10, TRUE, error);
case MONO_PROCESS_WORKING_SET:
- return get_pid_status_item (rpid, "VmRSS", error) * 1024;
+ return get_pid_status_item (rpid, "VmRSS", error, 1024);
case MONO_PROCESS_WORKING_SET_PEAK:
- val = get_pid_status_item (rpid, "VmHWM", error) * 1024;
+ val = get_pid_status_item (rpid, "VmHWM", error, 1024);
if (val == 0)
- val = get_pid_status_item (rpid, "VmRSS", error) * 1024;
+ val = get_pid_status_item (rpid, "VmRSS", error, 1024);
return val;
case MONO_PROCESS_PRIVATE_BYTES:
- return get_pid_status_item (rpid, "VmData", error) * 1024;
+ return get_pid_status_item (rpid, "VmData", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES:
- return get_pid_status_item (rpid, "VmSize", error) * 1024;
+ return get_pid_status_item (rpid, "VmSize", error, 1024);
case MONO_PROCESS_VIRTUAL_BYTES_PEAK:
- val = get_pid_status_item (rpid, "VmPeak", error) * 1024;
+ val = get_pid_status_item (rpid, "VmPeak", error, 1024);
if (val == 0)
- val = get_pid_status_item (rpid, "VmSize", error) * 1024;
+ val = get_pid_status_item (rpid, "VmSize", error, 1024);
return val;
case MONO_PROCESS_FAULTS:
return get_process_stat_item (rpid, 6, TRUE, error);
diff --git a/po/mcs/de.gmo b/po/mcs/de.gmo
index 3329354..5621c5c 100644
Binary files a/po/mcs/de.gmo and b/po/mcs/de.gmo differ
diff --git a/po/mcs/de.po b/po/mcs/de.po
index 18cd54e..ce7afd6 100644
--- a/po/mcs/de.po
+++ b/po/mcs/de.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2011-02-14 10:10-0700\n"
+"POT-Creation-Date: 2011-02-23 12:34-0700\n"
"PO-Revision-Date: 2008-09-26 15:14+0100\n"
"Last-Translator: Daniel Nauck <dna at mono-project.de>\n"
"Language-Team: http://www.mono-project.de\n"
diff --git a/po/mcs/es.gmo b/po/mcs/es.gmo
index 9f0f3c2..4546d14 100644
Binary files a/po/mcs/es.gmo and b/po/mcs/es.gmo differ
diff --git a/po/mcs/es.po b/po/mcs/es.po
index f805c61..d68d672 100644
--- a/po/mcs/es.po
+++ b/po/mcs/es.po
@@ -6,7 +6,7 @@ msgid ""
msgstr ""
"Project-Id-Version: mono 2.1\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2011-02-14 10:10-0700\n"
+"POT-Creation-Date: 2011-02-23 12:34-0700\n"
"PO-Revision-Date: 2008-09-19 13:28-0400\n"
"Last-Translator: Miguel de Icaza <miguel at novell.com>\n"
"Language-Team: es <mono-list at lists.ximian.com>\n"
diff --git a/po/mcs/ja.gmo b/po/mcs/ja.gmo
index a02f7ad..bc23ea6 100644
Binary files a/po/mcs/ja.gmo and b/po/mcs/ja.gmo differ
diff --git a/po/mcs/ja.po b/po/mcs/ja.po
index e07ca15..43bde87 100644
--- a/po/mcs/ja.po
+++ b/po/mcs/ja.po
@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2011-02-14 10:10-0700\n"
+"POT-Creation-Date: 2011-02-23 12:34-0700\n"
"PO-Revision-Date: \n"
"Last-Translator: Atsushi Eno <atsushi at ximian.com>\n"
"Language-Team: \n"
diff --git a/po/mcs/mcs.pot b/po/mcs/mcs.pot
index 8708165..d28b459 100644
--- a/po/mcs/mcs.pot
+++ b/po/mcs/mcs.pot
@@ -6,9 +6,9 @@
#, fuzzy
msgid ""
msgstr ""
-"Project-Id-Version: mono 2.10\n"
+"Project-Id-Version: mono 2.10.1\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2011-02-14 10:10-0700\n"
+"POT-Creation-Date: 2011-02-23 12:34-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
"Language-Team: LANGUAGE <LL at li.org>\n"
diff --git a/po/mcs/pt_BR.gmo b/po/mcs/pt_BR.gmo
index d776c87..309a244 100644
Binary files a/po/mcs/pt_BR.gmo and b/po/mcs/pt_BR.gmo differ
diff --git a/po/mcs/pt_BR.po b/po/mcs/pt_BR.po
index 5aee92e..4ad47bc 100644
--- a/po/mcs/pt_BR.po
+++ b/po/mcs/pt_BR.po
@@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: mono 2.1\n"
"Report-Msgid-Bugs-To: http://www.mono-project.com/Bugs\n"
-"POT-Creation-Date: 2011-02-14 10:10-0700\n"
+"POT-Creation-Date: 2011-02-23 12:34-0700\n"
"PO-Revision-Date: 2009-03-01 07:52-0300\n"
"Last-Translator: Rodrigo Luiz Marques Flores <mail at rodrigoflores.org>\n"
"Language-Team: pt-BR <mono-list at lists.ximian.com>\n"
--
mono
More information about the Pkg-mono-svn-commits
mailing list