[xbuild] Actually delete common files (CopyLocal) during Clean.
fi
case $host in
i?86-*-linux*|x86_64-*-linux*|powerpc-*-linux*|powerpc64-*-linux* \
-|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*)
+|amd64-*-freebsd*|i?86-*-freebsd*|ia64-*-freebsd*|arm*-*-linux*|sparc*-*-linux*|mips*-*-linux*|x86_64-apple-darwin*)
pic_options='-fPIC'
;;
?86-pc-cygwin*|i?86-pc-cygwin*)
pic_options='-DDLL_EXPORT'
;;
-i?86-apple-darwin*)
+i?86-apple-darwin*|arm-apple-darwin*)
pic_options='-fno-common'
;;
*)
# Process this file with autoconf to produce a configure script.
#AC_PREREQ([2.62])
-AC_INIT(mono, [3.0.11],
+AC_INIT(mono, [3.1.0],
[http://bugzilla.xamarin.com/enter_bug.cgi?classification=Mono])
AC_CONFIG_SRCDIR([README])
# Set to yes if Unix sockets cannot be created in an anonymous namespace
need_link_unlink=no
+#Set to extra linker flags to be passed to the runtime binaries (mono /mono-sgen)
+extra_runtime_ldflags=""
+
# Thread configuration inspired by sleepycat's db
AC_MSG_CHECKING([host platform characteristics])
libgc_threads=no
dnl Snow Leopard and newer config.guess reports as this
i*86-*-darwin*)
BROKEN_DARWIN_FLAGS="-arch i386 -D_XOPEN_SOURCE"
- CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_FLAGS"
+ BROKEN_DARWIN_CPPFLAGS="-D_XOPEN_SOURCE"
+ CPPFLAGS="$CPPFLAGS $BROKEN_DARWIN_CPPFLAGS"
CFLAGS="$CFLAGS $BROKEN_DARWIN_FLAGS"
CXXFLAGS="$CXXFLAGS $BROKEN_DARWIN_FLAGS"
CCASFLAGS="$CCASFLAGS $BROKEN_DARWIN_FLAGS"
- CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC $BROKEN_DARWIN_CPPFLAGS"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC $BROKEN_DARWIN_FLAGS"
- CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
+ CPPFLAGS_FOR_EGLIB="$CPPFLAGS_FOR_EGLIB $BROKEN_DARWIN_CPPFLAGS"
CFLAGS_FOR_EGLIB="$CFLAGS_FOR_EGLIB $BROKEN_DARWIN_FLAGS"
+ extra_runtime_ldflags="-stack_size,0x800000"
+ ;;
+ x*64-*-darwin*)
+ extra_runtime_ldflags="-stack_size,0x800000"
;;
arm*-darwin*)
has_dtrace=no
AC_DEFINE(NEED_LINK_UNLINK, 1, [Define if Unix sockets cannot be created in an anonymous namespace])
fi
+AC_SUBST(extra_runtime_ldflags)
AM_CONDITIONAL(HOST_WIN32, test x$host_win32 = xyes)
AM_CONDITIONAL(TARGET_WIN32, test x$target_win32 = xyes)
AM_CONDITIONAL(PLATFORM_LINUX, echo x$target_os | grep -q linux)
# not 64 bit clean in cross-compile
AC_CHECK_SIZEOF(void *, 4)
+AC_CACHE_CHECK([for clang],
+ mono_cv_clang,[
+ AC_TRY_COMPILE([], [
+ #ifdef __clang__
+ #else
+ #error "FAILED"
+ #endif
+ return 0;
+ ],
+ [mono_cv_clang=yes],
+ [mono_cv_clang=no],
+ [])
+])
+
WARN=''
if test x"$GCC" = xyes; then
WARN='-Wall -Wunused -Wmissing-prototypes -Wmissing-declarations -Wstrict-prototypes -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wno-cast-qual -Wwrite-strings -Wno-switch -Wno-switch-enum -Wno-unused-value'
ORIG_CFLAGS=$CFLAGS
# Check for the normal version, since gcc ignores unknown -Wno options
- CFLAGS="$CFLAGS -Wunused-but-set-variable"
+ CFLAGS="$CFLAGS -Wunused-but-set-variable -Werror"
AC_MSG_CHECKING(for -Wno-unused-but-set-variable option to gcc)
AC_TRY_COMPILE([],[
return 0;
AC_MSG_RESULT(no)
CFLAGS=$ORIG_CFLAGS
])
+
+ if test "x$mono_cv_clang" = "xyes"; then
+ # https://bugzilla.samba.org/show_bug.cgi?id=8118
+ WARN="$WARN -Qunused-arguments"
+ WARN="$WARN -Wno-unused-function -Wno-tautological-compare"
+ fi
else
# The Sun Forte compiler complains about inline functions that access static variables
# so disable all inlining.
CFLAGS="$CFLAGS -g $WARN"
CFLAGS_FOR_LIBGC="$CFLAGS_FOR_LIBGC -g"
-AC_CACHE_CHECK([for clang],
- mono_cv_clang,[
- AC_TRY_COMPILE([], [
- #ifdef __clang__
- #else
- #error "FAILED"
- #endif
- return 0;
- ],
- [mono_cv_clang=yes],
- [mono_cv_clang=no],
- [])
-])
-
# Where's the 'mcs' source tree?
if test -d $srcdir/mcs; then
mcsdir=mcs
if test "x$enable_nacl_codegen" = "xyes"; then
MONO_NACL_ALIGN_MASK_OFF=1
- CPPFLAGS="$CPPFLAGS -D__native_client_codegen__"
AC_DEFINE(TARGET_NACL, 1, [...])
+ AC_DEFINE(__native_client_codegen__, 1, [...])
else
MONO_NACL_ALIGN_MASK_OFF=0
- CPPFLAGS="$CPPFLAGS -D__default_codegen__"
+ AC_DEFINE(__default_codegen__, 1, [...])
fi
if test "x$enable_nacl_gc" = "xyes"; then
- CPPFLAGS="$CPPFLAGS -finstrument-for-thread-suspension -D__native_client_gc__"
+ if test "x$TARGET" = "xAMD64" -o "x$TARGET" = "xX86"; then
+ INSTRUMENT_CFLAG="-finstrument-for-thread-suspension"
+ else
+ # Not yet implemented
+ INSTRUMENT_CFLAG=""
+ fi
+ CPPFLAGS="$CPPFLAGS $INSTRUMENT_CFLAG -D__native_client_gc__"
fi
AC_SUBST(MONO_NACL_ALIGN_MASK_OFF)
JIT_SUPPORTED=yes
CPPFLAGS="$CPPFLAGS -D__ARM_EABI__ -DHAVE_ARMV6=1"
# libgc's gc_locks.h depends on this
- NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6"
sgen_supported=true
;;
arm*-linux*)
AC_MSG_CHECKING(if the Mono Debugger is supported on this platform)
if test "x$mono_debugger_supported" = "xyes"; then
BOEHM_DEFINES="$BOEHM_DEFINES -DMONO_DEBUGGER_SUPPORTED"
- NESTED_LIBGC_FLAGS="-DMONO_DEBUGGER_SUPPORTED"
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DMONO_DEBUGGER_SUPPORTED"
fi
AM_CONDITIONAL(MONO_DEBUGGER_SUPPORTED, test x$mono_debugger_supported = xyes)
AC_MSG_RESULT($mono_debugger_supported)
if test ${armv6} = yes; then
AC_DEFINE(HAVE_ARMV6, 1, "Host supports ARMV6 instructions")
# libgc's gc_locks.h depends on this
- NESTED_LIBGC_FLAGS="$NESTED_LIBGC_FLAGS -DHAVE_ARMV6"
+ CPPFLAGS_FOR_LIBGC="$CPPFLAGS_FOR_LIBGC -DHAVE_ARMV6"
fi
fi
fi
# The problem with this approach, is that during a reconfigure, the main
# configure scripts gets invoked with these arguments, so we use separate
# variables understood by libgc's configure to pass CPPFLAGS and CFLAGS.
- TMP_CPPFLAGS="$CPPFLAGS $NESTED_LIBGC_FLAGS"
+ TMP_CPPFLAGS="$CPPFLAGS $CPPFLAGS_FOR_LIBGC"
if test x$TARGET = xSPARC -o x$TARGET = xSPARC64; then
TMP_CPPFLAGS=`echo $TMP_CPPFLAGS | sed -e 's/-D_FILE_OFFSET_BITS=64//g'`
fi
if test "x$enable_shared" = "xno" -a "x$enable_executables" = "xyes"; then
LIBMONO_LA=libmini-static.la
else
- LIBMONO_LA=libmono-$API_VER.la
+ LIBMONO_LA=libmonosgen-$API_VER.la
fi
AC_SUBST(LIBMONO_LA)
sed -e "s,-mno-cygwin,,g" libtool > libtool.new; mv libtool.new libtool; chmod 755 libtool
fi
+if test x$platform_darwin = xyes; then
+ # This doesn't seem to be required and it slows down parallel builds
+ sed -e 's,lock_old_archive_extraction=yes,lock_old_archive_extraction=no,g' < libtool > libtool.new && mv libtool.new libtool && chmod +x libtool
+fi
+
(
case $prefix in
NONE) prefix=$ac_default_prefix ;;
?86-pc-cygwin*|i?86-pc-cygwin*)
pic_options='-DDLL_EXPORT'
;;
-i?86-apple-darwin*)
+i?86-apple-darwin*|arm-apple-darwin*)
pic_options='-fno-common'
;;
*)
AC_CHECK_SIZEOF(long long)
AC_CHECK_FUNCS(strlcpy stpcpy strtok_r rewinddir vasprintf)
+#
+# Mono currently supports 10.6, but strndup is not available prior to 10.7; avoiding
+# the detection of strndup on OS X so Mono built on 10.7+ still runs on 10.6. This can be
+# removed once support for 10.6 is dropped.
#
# iOS detection of strndup and getpwuid_r is faulty for some reason so let's simply avoid it
#
-if test x$target_ios = xno; then
+if test x$target_osx = xyes; then
+AC_CHECK_FUNCS(getpwuid_r)
+elif test x$target_ios = xno; then
AC_CHECK_FUNCS(strndup getpwuid_r)
fi
-Subproject commit fc76b93e3e0064b2d751796878f9cbe88df1d5f4
+Subproject commit 54e0a50464edbc254b39ea3c885ee91ada730705
-Subproject commit 822de0117a079369b9404429662e120bd24245d4
+Subproject commit 10b8312c8024111780ee382688cd4c8754b1f1ac
?86-pc-cygwin*|i?86-pc-cygwin*)
pic_options='-DDLL_EXPORT'
;;
-i?86-apple-darwin*)
+i?86-apple-darwin*|arm-apple-darwin*)
pic_options='-fno-common'
;;
*)
# define GC_CLEAR_DEFINED
# endif /* ALPHA */
# ifdef ARM32
-#ifdef __native_client__
-#define NACL_ALIGN() ".align 4\n"
-#define MASK_REGISTER(reg) "bic " reg ", " reg ", #0xc0000000\n"
-#else
-#define NACL_ALIGN()
-#define MASK_REGISTER(reg)
-#endif
+# ifdef __native_client__
+# define MASK_REGISTER(reg, cond) "bic" cond " " reg ", " reg ", #0xc0000000\n"
+# define NACL_ALIGN() ".align 4\n"
+# else
+# define MASK_REGISTER(reg, cond)
+# define NACL_ALIGN()
+# endif
inline static int GC_test_and_set(volatile unsigned int *addr) {
#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7__)
int ret, tmp;
__asm__ __volatile__ (
"1:\n"
NACL_ALIGN()
- MASK_REGISTER("%3")
+ MASK_REGISTER("%3", "al")
"ldrex %0, [%3]\n"
- MASK_REGISTER("%3")
+ MASK_REGISTER("%3", "al")
"strex %1, %2, [%3]\n"
"teq %1, #0\n"
"bne 1b\n"
* bus because there are no SMP ARM machines. If/when there are,
* this code will likely need to be updated. */
/* See linuxthreads/sysdeps/arm/pt-machine.h in glibc-2.1 */
- __asm__ __volatile__(MASK_REGISTER("%2")
+ __asm__ __volatile__(MASK_REGISTER("%2", "al")
"swp %0, %1, [%2]"
: "=&r"(oldval)
: "r"(1), "r"(addr)
inline static void GC_clear(volatile unsigned int *addr) {
#ifdef HAVE_ARMV6
/* Memory barrier */
+#ifdef __native_client__
+ /* NaCl requires ARMv7 CPUs. */
+ __asm__ __volatile__("dsb" : : : "memory");
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
+#endif
#endif
*(addr) = 0;
}
# define GC_CLEAR_DEFINED
+# undef NACL_ALIGN
+# undef MASK_REGISTER
# endif /* ARM32 */
# ifdef CRIS
inline static int GC_test_and_set(volatile unsigned int *addr) {
/* Determine the machine type: */
# if defined(__native_client__)
# define NACL
-# if !defined(__portable_native_client__)
+# if !defined(__portable_native_client__) && !defined(__arm__)
# define I386
# define mach_type_known
# else
/* the instrumented function uses any callee saved registers, they may */
/* be pushed to the stack much earlier. Also, on amd64 'push' puts 8 */
/* bytes on the stack even though our pointers are 4 bytes. */
+#ifdef __arm__
+/* For ARM we save r4-r8, r10-r12, r14 */
+#define NACL_GC_REG_STORAGE_SIZE 9
+#else
#define NACL_GC_REG_STORAGE_SIZE 20
+#endif
ptr_t reg_storage[NACL_GC_REG_STORAGE_SIZE];
#endif
};
#elif __arm__
#define NACL_STORE_REGS() \
- do { \
- __asm__ __volatile__ ("push {r4-r12,lr}");\
- __asm__ __volatile__ ("mov r0, %0" : : "r" (&nacl_gc_thread_self->stop_info.stack_ptr)); \
- __asm__ __volatile__ ("bic r0, r0, #0xc0000000");\
- __asm__ __volatile__ ("str sp, [r0]");\
- memcpy(nacl_gc_thread_self->stop_info.reg_storage, nacl_gc_thread_self->stop_info.stack_ptr, NACL_GC_REG_STORAGE_SIZE * sizeof(ptr_t));\
- __asm__ __volatile__ ("add sp, sp, #40");\
- __asm__ __volatile__ ("bic sp, sp, #0xc0000000");\
+ do { \
+ __asm__ __volatile__ ( \
+ ".align 4\n\t" \
+ "bic %0, %0, #0xc0000000\n\t" \
+ "str sp, [%0]\n\t" \
+ "bic %1, %1, #0xc0000000\n\t" \
+ "stm %1, {r4-r8,r10-r12,lr}\n\t" \
+ : \
+ : "r" (&nacl_gc_thread_self->stop_info.stack_ptr), \
+ "r"(nacl_gc_thread_self->stop_info.reg_storage) \
+ : "memory"); \
} while (0)
#else
.\" Copyright 2003 Ximian, Inc.
.\" Copyright 2004-2011 Novell, Inc.
.\" Copyright 2011-2012 Xamarin Inc
+.\" Copyright 2013 7digital Media Ltd.
.\" Author:
.\" Miguel de Icaza (miguel@gnu.org)
.\"
-.TH Mono "Mono 2.11"
+.TH Mono "Mono 3.0"
.SH NAME
mono \- Mono's ECMA-CLI native code generator (Just-in-Time and Ahead-of-Time)
.SH SYNOPSIS
\fB--break method\fR
Inserts a breakpoint before the method whose name is `method'
(namespace.class:methodname). Use `Main' as method name to insert a
-breakpoint on the application's main method.
+breakpoint on the application's main method. You can use it also with
+generics, for example "System.Collections.Generic.Queue`1:Peek"
.TP
\fB--breakonex\fR
Inserts a breakpoint on exceptions. This allows you to debug your
variable in your environment before starting the application and no action will
be taken.
.TP
+\fBMONO_ASPNET_WEBCONFIG_CACHESIZE\fR
+Mono has a cache of ConfigSection objects for speeding up WebConfigurationManager
+queries. Its default size is 100 items, and when more items are needed, cache
+evictions start happening. If evictions are too frequent this could impose
+unnecessary overhead, which could be avoided by using this environment variable
+to set up a higher cache size (or to lower memory requirements by decreasing it).
+.TP
+\fBMONO_CAIRO_DEBUG_DISPOSE\fR
+If set, causes Mono.Cairo to collect stack traces when objects are allocated,
+so that the finalization/Dispose warnings include information about the
+instance's origin.
+.TP
\fBMONO_CFG_DIR\fR
If set, this variable overrides the default system configuration directory
($PREFIX/etc). It's used to locate machine.config file.
lib_dir = lib
endif
+ifdef LIBRARY_SUBDIR
+the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/$(LIBRARY_SUBDIR)/
+else
the_libdir = $(topdir)/class/$(lib_dir)/$(PROFILE)/
+endif
ifdef LIBRARY_NEEDS_POSTPROCESSING
build_libdir = fixup/$(PROFILE)/
else
else \
echo "*** The compiler '$(BOOTSTRAP_MCS)' doesn't appear to be usable." 1>&2; \
echo "*** You need Mono version 2.4 or better installed to build MCS" 1>&2 ; \
- echo "*** Read INSTALL.txt for information on how to bootstrap a Mono installation." 1>&2 ; \
+ echo "*** Check mono README for information on how to bootstrap a Mono installation." 1>&2 ; \
exit 1; fi; fi
thisdir = class/Facades
-net_4_5_SUBDIRS = System.Runtime System.Linq System.Xml.Serialization System.Xml.XmlSerializer \
+net_4_5_SUBDIRS = System.Runtime System.Linq System.Xml.XmlSerializer \
System.ServiceModel.Primitives System.Xml.ReaderWriter System.Diagnostics.Debug \
System.Runtime.Extensions System.Diagnostics.Tools System.Collections \
System.ComponentModel.EventBasedAsync System.ComponentModel System.ObjectModel \
System.Text.Encoding.Extensions System.Linq.Queryable System.Linq.Expressions \
System.Net.Primitives System.Net.Requests System.Net.NetworkInformation \
System.Runtime.Serialization.Primitives System.Runtime.Serialization.Xml \
- System.Runtime.Serialization.Json System.ServiceModel.Http System.Windows \
+ System.Runtime.Serialization.Json System.ServiceModel.Http \
System.Xml.XDocument System.Threading.Tasks System.Diagnostics.Contracts \
System.Dynamic.Runtime System.ComponentModel.Annotations System.Runtime.Numerics \
System.Linq.Parallel System.Collections.Concurrent System.Threading.Tasks.Parallel \
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Collections.Concurrent.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Collections.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ComponentModel.Annotations.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ComponentModel.EventBasedAsync.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ComponentModel.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Diagnostics.Contracts.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Diagnostics.Debug.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Diagnostics.Tools.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Dynamic.Runtime.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Globalization.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.IO.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Linq.Expressions.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Linq.Parallel.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Linq.Queryable.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Linq.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Net.NetworkInformation.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Net.Primitives.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Net.Requests.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ObjectModel.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Reflection.Extensions.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Reflection.Primitives.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Reflection.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Resources.ResourceManager.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.Extensions.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.InteropServices.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.Numerics.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.Serialization.Json.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.Serialization.Primitives.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.Serialization.Xml.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Runtime.dll
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.IteratorStateMachineAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.CompilerServices.ReferenceAssemblyAttribute))]
[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Runtime.ExceptionServices.ExceptionDispatchInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(string))]
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Security.Principal.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ServiceModel.Http.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.ServiceModel.Primitives.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Text.Encoding.Extensions.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Text.Encoding.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Text.RegularExpressions.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Threading.Tasks.Parallel.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Threading.Tasks.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Threading.dll
+++ /dev/null
-//
-// TypeForwarders.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle ("System.Windows.dll")]
-[assembly: AssemblyDescription ("System.Windows.dll")]
-[assembly: AssemblyDefaultAlias ("System.Windows.dll")]
-
-[assembly: AssemblyCompany (Consts.MonoCompany)]
-[assembly: AssemblyProduct (Consts.MonoProduct)]
-[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
+++ /dev/null
-thisdir = class/Facades/System.Windows
-SUBDIRS =
-include ../../../build/rules.make
-
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Windows.dll
-LIB_MCS_FLAGS = /r:System
-
-NO_TEST = yes
-
-include ../../../build/library.make
+++ /dev/null
-AssemblyInfo.cs
-TypeForwarders.cs
-../../../build/common/Consts.cs
+++ /dev/null
-//
-// TypeForwarders.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.INotifyCollectionChanged))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<>))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedAction))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventArgs))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventHandler))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Windows.Input.ICommand))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyDataErrorInfo))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataErrorsChangedEventArgs))]
-
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Xml.ReaderWriter.dll
+++ /dev/null
-//
-// TypeForwarders.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-using System;
-using System.Reflection;
-using System.Runtime.CompilerServices;
-
-[assembly: AssemblyTitle ("System.Xml.Serialization.dll")]
-[assembly: AssemblyDescription ("System.Xml.Serialization.dll")]
-[assembly: AssemblyDefaultAlias ("System.Xml.Serialization.dll")]
-
-[assembly: AssemblyCompany (Consts.MonoCompany)]
-[assembly: AssemblyProduct (Consts.MonoProduct)]
-[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
-[assembly: AssemblyDelaySign (true)]
-[assembly: AssemblyKeyFile ("../../msfinal.pub")]
-
-[assembly: ReferenceAssembly]
+++ /dev/null
-thisdir = class/Facades/System.Xml.Serialization
-SUBDIRS =
-include ../../../build/rules.make
-
-LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
-
-LIBRARY = System.Xml.Serialization.dll
-LIB_MCS_FLAGS = /r:System.Xml /r:System.ServiceModel
-
-NO_TEST = yes
-
-include ../../../build/library.make
+++ /dev/null
-AssemblyInfo.cs
-TypeForwarders.cs
-../../../build/common/Consts.cs
+++ /dev/null
-//
-// TypeForwarders.cs
-//
-// Author:
-// Martin Baulig <martin.baulig@xamarin.com>
-//
-// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining a copy
-// of this software and associated documentation files (the "Software"), to deal
-// in the Software without restriction, including without limitation the rights
-// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-// copies of the Software, and to permit persons to whom the Software is
-// furnished to do so, subject to the following conditions:
-//
-// The above copyright notice and this permission notice shall be included in
-// all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-// THE SOFTWARE.
-
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMapping))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTypeMapping))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMappingAccess))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializer))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.XmlSerializerFormatAttribute))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttributes))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeOverrides))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributes))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttributes))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttributes))]
-[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializerNamespaces))]
-
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Xml.XDocument.dll
[assembly: AssemblyCompany (Consts.MonoCompany)]
[assembly: AssemblyProduct (Consts.MonoProduct)]
[assembly: AssemblyCopyright (Consts.MonoCopyright)]
-[assembly: AssemblyVersion (Consts.FxVersion)]
-[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
-[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyVersion ("4.0.0.0")]
+[assembly: AssemblyInformationalVersion ("4.0.0.0")]
+[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]
SUBDIRS =
include ../../../build/rules.make
+LIBRARY_SUBDIR = Facades
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)/Facades
LIBRARY = System.Xml.XmlSerializer.dll
System.IO.Compression.FileSystem \
System.ComponentModel.DataAnnotations \
System.ComponentModel.Composition.4.5 \
+ System.Net \
+ System.Windows \
+ System.Xml.Serialization \
Facades
monodroid_dirs := \
System.Threading.Tasks.Dataflow \
System.ComponentModel.Composition.4.5 \
System.Net.Http \
+ System.Net.Http.WebRequest \
System.Web.Razor \
System.Web.WebPages.Deployment \
System.Web.WebPages \
Mono.CodeContracts \
System.IO.Compression \
System.IO.Compression.FileSystem \
+ System.Windows \
+ System.Xml.Serialization \
Facades
net_2_0_SUBDIRS := $(common_dirs) $(net_2_0_dirs) $(net_2_0_only_dirs) aot-compiler
continue;
XmlElement xe = (XmlElement) xn;
- BuildItem bi = new BuildItem (xe, this);
+ BuildItem bi = CreateItem (project, xe);
buildItems.Add (bi);
project.LastItemGroupContaining [bi.Name] = this;
}
project != null ? project.FullFileName : null;
}
+ internal virtual BuildItem CreateItem (Project project, XmlElement xe)
+ {
+ return new BuildItem (xe, this);
+ }
+
public BuildItem AddNewItem (string itemName,
string itemInclude)
{
--- /dev/null
+//
+// BuildTaskItem.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.Xml;
+
+namespace Microsoft.Build.BuildEngine
+{
+ internal class BuildTaskItem : BuildItem, IBuildTask
+ {
+ BuildTaskItemGroup parent;
+ Project project;
+
+ public bool ContinueOnError {
+ get; set;
+ }
+
+ internal BuildTaskItem (Project project, XmlElement itemElement, BuildTaskItemGroup parentItemGroup)
+ : base (itemElement, parentItemGroup)
+ {
+ this.parent = parentItemGroup;
+ this.project = project;
+ }
+
+ bool CheckCondition (string condition)
+ {
+ if (string.IsNullOrEmpty (condition))
+ return true;
+ var ce = ConditionParser.ParseCondition (condition);
+ return ce.BoolEvaluate (project);
+ }
+
+ bool CheckCondition ()
+ {
+ return CheckCondition (parent.Condition) && CheckCondition (Condition);
+ }
+
+ public bool Execute ()
+ {
+ var condition = CheckCondition ();
+ Evaluate (project, condition);
+ return true;
+ }
+
+ public IEnumerable<string> GetAttributes ()
+ {
+ foreach (XmlAttribute attrib in parent.XmlElement.Attributes)
+ yield return attrib.Value;
+
+ foreach (XmlAttribute attrib in XmlElement.Attributes)
+ yield return attrib.Value;
+ }
+ }
+}
+
namespace Microsoft.Build.BuildEngine {
- internal class BuildTaskItemGroup : BuildItemGroup, IBuildTask {
+ internal class BuildTaskItemGroup : BuildItemGroup {
- public bool ContinueOnError {
- get; set;
- }
+ List<IBuildTask> items = new List<IBuildTask> ();
internal BuildTaskItemGroup (XmlElement element, Target target)
: base (element, target.Project, null, false, true)
{
}
-
- public bool Execute ()
- {
- Evaluate ();
- return true;
- }
- public IEnumerable<string> GetAttributes ()
+ internal override BuildItem CreateItem (Project project, XmlElement xe)
{
- foreach (XmlAttribute attrib in XmlElement.Attributes)
- yield return attrib.Value;
-
- foreach (BuildItem item in this) {
- foreach (XmlAttribute attrib in item.XmlElement.Attributes)
- yield return attrib.Value;
- }
+ var item = new BuildTaskItem (project, xe, this);
+ items.Add (item);
+ return item;
}
+ public List<IBuildTask> Items {
+ get { return items; }
+ }
}
}
"The element <OnError> must be last under element <Target>. Found element <Error> instead.");
#if NET_3_5
else if (xe.Name == "ItemGroup") {
- buildTasks.Add (new BuildTaskItemGroup (xe, this));
+ var group = new BuildTaskItemGroup (xe, this);
+ buildTasks.AddRange (group.Items);
continue;
} else if (xe.Name == "PropertyGroup") {
buildTasks.Add (new BuildTaskPropertyGroup (xe, this));
Microsoft.Build.BuildEngine/BuildPropertyGroup.cs
Microsoft.Build.BuildEngine/BuildSettings.cs
Microsoft.Build.BuildEngine/BuildTask.cs
+Microsoft.Build.BuildEngine/BuildTaskItem.cs
Microsoft.Build.BuildEngine/BuildTaskItemGroup.cs
Microsoft.Build.BuildEngine/BuildTaskPropertyGroup.cs
Microsoft.Build.BuildEngine/BuildWhen.cs
</Project>", "D");
}
-#endif
+ [Test]
+ public void ItemGroupInsideTarget_Batching ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project ToolsVersion=""4.0"" xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"">
+ <Target Name='Main'>
+ <ItemGroup>
+ <Foo Include='A;B' />
+ <All Include='%(Foo.Identity)' />
+ </ItemGroup>
+ <Message Text='%(All.Identity)' />
+ </Target>
+ </Project>", "A", "B");
+ }
+
+ [Test]
+ public void ItemGroupInsideTarget_Condition ()
+ {
+ ItemGroupInsideTarget (
+ @"<Project xmlns=""http://schemas.microsoft.com/developer/msbuild/2003"" ToolsVersion=""4.0"">
+ <PropertyGroup>
+ <Summer>true</Summer>
+ </PropertyGroup>
+ <ItemGroup>
+ <Weather Include='Sun;Rain' />
+ </ItemGroup>
+
+ <Target Name='Main'>
+ <ItemGroup Condition=""'$(Summer)' != 'true'"">
+ <Weather Include='Snow' />
+ </ItemGroup>
+ <Message Text='%(Weather.Identity)' />
+ </Target>
+ </Project>", "Sun", "Rain");
+ }
+ #endif
[Test]
public void TestTargetOutputsIncludingMetadata ()
Microsoft.Build.Framework/ExternalProjectStartedEventArgs.cs
Microsoft.Build.Framework/IBuildEngine.cs
Microsoft.Build.Framework/IBuildEngine2.cs
+Microsoft.Build.Framework/ICancelableTask.cs
Microsoft.Build.Framework/IEventSource.cs
Microsoft.Build.Framework/ILogger.cs
Microsoft.Build.Framework/INodeLogger.cs
--- /dev/null
+#if NET_4_0
+using System;
+
+namespace Microsoft.Build.Framework
+{
+ [MonoTODO ("This needs to be taken into consideration in the build engine")]
+ public interface ICancelableTask : ITask
+ {
+ void Cancel ();
+ }
+}
+
+#endif
moniker, base_path);
string framework_path = Path.Combine (base_path, Path.Combine (moniker.Identifier, moniker.Version));
if (!String.IsNullOrEmpty (moniker.Profile))
- framework_path = Path.Combine (framework_path, moniker.Profile);
+ framework_path = Path.Combine (framework_path, "Profile", moniker.Profile);
string redistlist_dir = Path.Combine (framework_path, "RedistList");
string framework_list = Path.Combine (redistlist_dir, "FrameworkList.xml");
continue;
ResolvedReference resolved_ref = ResolveDependencyByAssemblyName (
- aname, asm.FullName, parent_copy_local);
+ aname, asm.FullName, parent_copy_local);
- if (resolved_ref != null && !IsFromGacOrTargetFramework (resolved_ref)
- && resolved_ref.FoundInSearchPath != SearchPath.PkgConfig) {
+ if (IncludeDependencies (resolved_ref, aname.FullName)) {
tempResolvedDepFiles[resolved_ref.AssemblyName.FullName] = resolved_ref.TaskItem;
dependencies.Enqueue (resolved_ref.TaskItem.ItemSpec);
}
rr.FoundInSearchPath == SearchPath.TargetFrameworkDirectory;
}
+ bool IncludeDependencies (ResolvedReference rr, string aname)
+ {
+ if (rr == null)
+ return false;
+ if (aname.Equals ("System.Runtime, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"))
+ return true;
+ return !IsFromGacOrTargetFramework (rr) && rr.FoundInSearchPath != SearchPath.PkgConfig;
+ }
+
void LogTaskParameters ()
{
Log.LogMessage (MessageImportance.Low, "TargetFrameworkDirectories:");
using System.IO;
using System.Linq;
using System.Text;
+using System.Xml;
using Microsoft.Build.Construction;
using Microsoft.Build.Internal;
using Microsoft.Build.Execution;
+"{data.Items.Count} #Targets={data.Targets.Count}")]
public class Project
{
+ public Project (XmlReader xml)
+ : this (ProjectRootElement.Create (xml))
+ {
+ }
+ public Project (XmlReader xml, IDictionary<string, string> globalProperties,
+ string toolsVersion)
+ : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion)
+ {
+ }
+ public Project (XmlReader xml, IDictionary<string, string> globalProperties,
+ string toolsVersion, ProjectCollection projectCollection)
+ : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion, projectCollection)
+ {
+ }
+ public Project (XmlReader xml, IDictionary<string, string> globalProperties,
+ string toolsVersion, ProjectCollection projectCollection,
+ ProjectLoadSettings loadSettings)
+ : this (ProjectRootElement.Create (xml), globalProperties, toolsVersion, projectCollection, loadSettings)
+ {
+ }
+
public Project (ProjectRootElement xml) : this(xml, null, null)
{
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
+using Microsoft.Build.Construction;
using Microsoft.Build.Framework;
using Microsoft.Build.Logging;
public ToolsetDefinitionLocations ToolsetLocations {
get { throw new NotImplementedException (); }
}
+
+ public ICollection<Toolset> Toolsets {
+ get { throw new NotImplementedException (); }
+ }
+
+ public void UnloadAllProjects ()
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UnloadProject (Project project)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public void UnloadProject (ProjectRootElement projectRootElement)
+ {
+ throw new NotImplementedException ();
+ }
+
+ public static Version Version {
+ get { throw new NotImplementedException (); }
+ }
}
}
public string ItemType {
get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
}
public ICollection<ProjectMetadata> Metadata {
public string UnevaluatedInclude {
get { throw new NotImplementedException (); }
+ set { throw new NotImplementedException (); }
}
public ProjectItemElement Xml { get; private set; }
//
using System;
+using Microsoft.Build.Construction;
namespace Microsoft.Build.Evaluation
{
- public class ProjectProperty
+ // In .NET 4.0 MSDN says it is non-abstract, but some of those
+ // members are abstract and had been there since 4.0.
+ // I take this as doc bug, as non-abstract to abstract is a
+ // breaking change and I'd rather believe API designer's sanity.
+ public abstract class ProjectProperty
{
+ internal ProjectProperty () // hide default ctor
+ {
+ }
+
public string EvaluatedValue {
get {
throw new NotImplementedException ();
}
}
+
+ public abstract bool IsEnvironmentProperty { get; }
+ public abstract bool IsGlobalProperty { get; }
+ public abstract bool IsImported { get; }
+ public abstract bool IsReservedProperty { get; }
+
+ public string Name {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public abstract ProjectProperty Predecessor { get; }
+
+ public Project Project {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+
+ public abstract string UnevaluatedValue { get; set; }
+ public abstract ProjectPropertyElement Xml { get; }
}
}
../../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
../../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
../../class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs
-../../class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
+../../class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
../../build/common/Consts.cs
../../tools/monop/outline.cs
../../mcs/cs-parser.cs
../../build/common/Locale.cs
./Mono.Cairo/Antialias.cs
./Mono.Cairo/Cairo.cs
+./Mono.Cairo/CairoDebug.cs
+./Mono.Cairo/Color.cs
./Mono.Cairo/Content.cs
./Mono.Cairo/Context.cs
./Mono.Cairo/DirectFBSurface.cs
+./Mono.Cairo/Distance.cs
./Mono.Cairo/Extend.cs
./Mono.Cairo/FillRule.cs
./Mono.Cairo/Filter.cs
./Mono.Cairo/Pattern.cs
./Mono.Cairo/PatternType.cs
./Mono.Cairo/PdfSurface.cs
+./Mono.Cairo/Point.cs
+./Mono.Cairo/PointD.cs
./Mono.Cairo/PSSurface.cs
./Mono.Cairo/RadialGradient.cs
./Mono.Cairo/Rectangle.cs
+./Mono.Cairo/Region.cs
./Mono.Cairo/ScaledFont.cs
./Mono.Cairo/SolidPattern.cs
./Mono.Cairo/Status.cs
--- /dev/null
+//
+// CairoDebug.cs
+//
+// Author:
+// Michael Hutchinson (mhutch@xamarin.com)
+//
+// Copyright (C) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+using System;
+
+namespace Cairo {
+
+ static class CairoDebug
+ {
+ static System.Collections.Generic.Dictionary<IntPtr,string> traces;
+
+ public static readonly bool Enabled;
+
+ static CairoDebug ()
+ {
+ var dbg = Environment.GetEnvironmentVariable ("MONO_CAIRO_DEBUG_DISPOSE");
+ if (dbg == null)
+ return;
+ Enabled = true;
+ traces = new System.Collections.Generic.Dictionary<IntPtr,string> ();
+ }
+
+ public static void OnAllocated (IntPtr obj)
+ {
+ if (!Enabled)
+ throw new InvalidOperationException ();
+
+ traces[obj] = Environment.StackTrace;
+ }
+
+ public static void OnDisposed<T> (IntPtr obj, bool disposing)
+ {
+ if (disposing && !Enabled)
+ throw new InvalidOperationException ();
+
+ if (!disposing) {
+ Console.Error.WriteLine ("{0} is leaking, programmer is missing a call to Dispose", typeof(T).FullName);
+ if (Enabled) {
+ string val;
+ if (traces.TryGetValue (obj, out val)) {
+ Console.Error.WriteLine ("Allocated from:");
+ Console.Error.WriteLine (val);
+ }
+ } else {
+ Console.Error.WriteLine ("Set MONO_CAIRO_DEBUG_DISPOSE to track allocation traces");
+ }
+ }
+
+ if (Enabled)
+ traces.Remove (obj);
+ }
+ }
+
+}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Cairo {
+
+ public struct Color
+ {
+ public Color(double r, double g, double b) : this (r, g, b, 1.0)
+ {
+ }
+
+ public Color(double r, double g, double b, double a)
+ {
+ this.r = r;
+ this.g = g;
+ this.b = b;
+ this.a = a;
+ }
+
+ double r, g, b, a;
+
+ public double R {
+ get { return r; }
+ set { r = value; }
+ }
+
+ public double G {
+ get { return g; }
+ set { g = value; }
+ }
+
+ public double B {
+ get { return b; }
+ set { b = value; }
+ }
+
+ public double A {
+ get { return a; }
+ set { a = value; }
+ }
+ }
+}
// 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
namespace Cairo {
- public struct Point
- {
- public Point (int x, int y)
- {
- this.x = x;
- this.y = y;
- }
-
- int x, y;
- public int X {
- get { return x; }
- set { x = value; }
- }
-
- public int Y {
- get { return y; }
- set { y = value; }
- }
- }
-
- public struct PointD
- {
- public PointD (double x, double y)
- {
- this.x = x;
- this.y = y;
- }
-
- double x, y;
- public double X {
- get { return x; }
- set { x = value; }
- }
-
- public double Y {
- get { return y; }
- set { y = value; }
- }
- }
-
-
- public struct Distance
- {
- public Distance (double dx, double dy)
- {
- this.dx = dx;
- this.dy = dy;
- }
-
- double dx, dy;
- public double Dx {
- get { return dx; }
- set { dx = value; }
- }
-
- public double Dy {
- get { return dy; }
- set { dy = value; }
- }
- }
-
- public struct Color
- {
- public Color(double r, double g, double b) : this (r, g, b, 1.0)
- {
- }
-
- public Color(double r, double g, double b, double a)
- {
- this.r = r;
- this.g = g;
- this.b = b;
- this.a = a;
- }
-
- double r, g, b, a;
-
- public double R {
- get { return r; }
- set { r = value; }
- }
-
- public double G {
- get { return g; }
- set { g = value; }
- }
-
- public double B {
- get { return b; }
- set { b = value; }
- }
-
- public double A {
- get { return a; }
- set { a = value; }
- }
-
- }
-
[Obsolete ("Renamed Cairo.Context per suggestion from cairo binding guidelines.")]
public class Graphics : Context {
public Graphics (IntPtr state) : base (state) {}
public Graphics (Surface surface) : base (surface) {}
}
- public class Context : IDisposable
- {
- internal IntPtr state = IntPtr.Zero;
+ public class Context : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
static int native_glyph_size, c_compiler_long_size;
-
+
static Context ()
{
//
// is 32 bits
//
int ptr_size = Marshal.SizeOf (typeof (IntPtr));
-
+
PlatformID platform = Environment.OSVersion.Platform;
if (platform == PlatformID.Win32NT ||
platform == PlatformID.Win32S ||
native_glyph_size = Marshal.SizeOf (typeof (Glyph));
}
}
-
- public Context (Surface surface)
- {
- state = NativeMethods.cairo_create (surface.Handle);
- }
-
- public Context (IntPtr state)
+
+ public Context (Surface surface) : this (NativeMethods.cairo_create (surface.Handle), true)
{
- this.state = state;
}
-
+
+
+ public Context (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ [Obsolete]
+ public Context (IntPtr state) : this (state, true)
+ {
+ }
+
~Context ()
{
Dispose (false);
}
- void IDisposable.Dispose ()
+ public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing){
- Console.Error.WriteLine ("Cairo.Context: called from finalization thread, programmer is missing a call to Dispose");
- return;
- }
-
- if (state == IntPtr.Zero)
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Context> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
return;
- //Console.WriteLine ("Destroying");
- NativeMethods.cairo_destroy (state);
- state = IntPtr.Zero;
- }
+ NativeMethods.cairo_destroy (handle);
+ handle = IntPtr.Zero;
- public void Save ()
- {
- NativeMethods.cairo_save (state);
- }
+ }
- public void Restore ()
- {
- NativeMethods.cairo_restore (state);
- }
+ public void Save ()
+ {
+ NativeMethods.cairo_save (handle);
+ }
+
+ public void Restore ()
+ {
+ NativeMethods.cairo_restore (handle);
+ }
public Antialias Antialias {
- get { return NativeMethods.cairo_get_antialias (state); }
- set { NativeMethods.cairo_set_antialias (state, value); }
- }
-
- public Cairo.Status Status {
- get {
- return NativeMethods.cairo_status (state);
- }
- }
-
- public IntPtr Handle {
- get {
- return state;
- }
- }
-
- public Cairo.Operator Operator {
- set {
- NativeMethods.cairo_set_operator (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_operator (state);
- }
- }
-
- //FIXME: obsolete this property
- public Cairo.Color Color {
- set {
- NativeMethods.cairo_set_source_rgba (state, value.R, value.G, value.B, value.A);
- }
- }
-
- [Obsolete ("Use Color property")]
- public Cairo.Color ColorRgb {
- set {
+ get { return NativeMethods.cairo_get_antialias (handle); }
+ set { NativeMethods.cairo_set_antialias (handle, value); }
+ }
+
+ public Cairo.Status Status {
+ get {
+ return NativeMethods.cairo_status (handle);
+ }
+ }
+
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
+
+ public Operator Operator {
+ set {
+ NativeMethods.cairo_set_operator (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_operator (handle);
+ }
+ }
+
+ [Obsolete ("Use SetSourceRGBA method")]
+ public Color Color {
+ set {
+ NativeMethods.cairo_set_source_rgba (handle, value.R, value.G, value.B, value.A);
+ }
+ }
+
+ [Obsolete ("Use SetSourceRGBA method")]
+ public Cairo.Color ColorRgb {
+ set {
Color = new Color (value.R, value.G, value.B);
}
- }
+ }
- public double Tolerance {
+ public double Tolerance {
get {
- return NativeMethods.cairo_get_tolerance (state);
- }
-
- set {
- NativeMethods.cairo_set_tolerance (state, value);
- }
- }
-
- public Cairo.FillRule FillRule {
- set {
- NativeMethods.cairo_set_fill_rule (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_fill_rule (state);
- }
- }
-
- public double LineWidth {
- set {
- NativeMethods.cairo_set_line_width (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_width (state);
- }
- }
-
- public Cairo.LineCap LineCap {
- set {
- NativeMethods.cairo_set_line_cap (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_cap (state);
- }
- }
-
- public Cairo.LineJoin LineJoin {
- set {
- NativeMethods.cairo_set_line_join (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_line_join (state);
- }
- }
-
- public void SetDash (double [] dashes, double offset)
- {
- NativeMethods.cairo_set_dash (state, dashes, dashes.Length, offset);
- }
-
- public Pattern Pattern {
- set {
- NativeMethods.cairo_set_source (state, value.Pointer);
- }
-
+ return NativeMethods.cairo_get_tolerance (handle);
+ }
+
+ set {
+ NativeMethods.cairo_set_tolerance (handle, value);
+ }
+ }
+
+ public Cairo.FillRule FillRule {
+ set {
+ NativeMethods.cairo_set_fill_rule (handle, value);
+ }
+
get {
- return new Pattern (NativeMethods.cairo_get_source (state));
- }
- }
-
- public Pattern Source {
- set {
- NativeMethods.cairo_set_source (state, value.Pointer);
- }
-
+ return NativeMethods.cairo_get_fill_rule (handle);
+ }
+ }
+
+ public double LineWidth {
+ set {
+ NativeMethods.cairo_set_line_width (handle, value);
+ }
+
get {
- return Pattern.Lookup (NativeMethods.cairo_get_source (state));
- }
- }
-
- public double MiterLimit {
- set {
- NativeMethods.cairo_set_miter_limit (state, value);
- }
-
- get {
- return NativeMethods.cairo_get_miter_limit (state);
- }
- }
-
- public PointD CurrentPoint {
- get {
- double x, y;
- NativeMethods.cairo_get_current_point (state, out x, out y);
- return new PointD (x, y);
- }
- }
-
- public Cairo.Surface Target {
- set {
- if (state != IntPtr.Zero)
- NativeMethods.cairo_destroy (state);
-
- state = NativeMethods.cairo_create (value.Handle);
- }
-
- get {
- return Cairo.Surface.LookupExternalSurface (
- NativeMethods.cairo_get_target (state));
- }
- }
-
- public Cairo.ScaledFont ScaledFont {
- set {
- NativeMethods.cairo_set_scaled_font (state, value.Handle);
- }
-
- get {
- return new ScaledFont (NativeMethods.cairo_get_scaled_font (state));
- }
- }
+ return NativeMethods.cairo_get_line_width (handle);
+ }
+ }
+
+ public Cairo.LineCap LineCap {
+ set {
+ NativeMethods.cairo_set_line_cap (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_line_cap (handle);
+ }
+ }
+
+ public Cairo.LineJoin LineJoin {
+ set {
+ NativeMethods.cairo_set_line_join (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_line_join (handle);
+ }
+ }
+
+ public void SetDash (double [] dashes, double offset)
+ {
+ NativeMethods.cairo_set_dash (handle, dashes, dashes.Length, offset);
+ }
+
+ [Obsolete("Use GetSource/GetSource")]
+ public Pattern Pattern {
+ set {
+ SetSource (value);
+ }
+ get {
+ return GetSource ();
+ }
+ }
+
+ //This is obsolete because it wasn't obvious it needed to be disposed
+ [Obsolete("Use GetSource/GetSource")]
+ public Pattern Source {
+ set {
+ SetSource (value);
+ }
+ get {
+ return GetSource ();
+ }
+ }
+
+ public void SetSource (Pattern source)
+ {
+ NativeMethods.cairo_set_source (handle, source.Handle);
+ }
+
+ public Pattern GetSource ()
+ {
+ var ptr = NativeMethods.cairo_get_source (handle);
+ return Cairo.Pattern.Lookup (ptr, false);
+ }
+
+ public double MiterLimit {
+ set {
+ NativeMethods.cairo_set_miter_limit (handle, value);
+ }
+
+ get {
+ return NativeMethods.cairo_get_miter_limit (handle);
+ }
+ }
+
+ public PointD CurrentPoint {
+ get {
+ double x, y;
+ NativeMethods.cairo_get_current_point (handle, out x, out y);
+ return new PointD (x, y);
+ }
+ }
+
+ [Obsolete ("Use GetTarget/SetTarget")]
+ public Cairo.Surface Target {
+ set {
+ if (handle != IntPtr.Zero)
+ NativeMethods.cairo_destroy (handle);
+
+ handle = NativeMethods.cairo_create (value.Handle);
+ }
+
+ get {
+ return GetTarget ();
+ }
+ }
+
+ public Surface GetTarget ()
+ {
+ return Surface.Lookup (NativeMethods.cairo_get_target (handle), false);
+ }
+
+ public void SetTarget (Surface target)
+ {
+ if (handle != IntPtr.Zero)
+ NativeMethods.cairo_destroy (handle);
+ handle = NativeMethods.cairo_create (target.Handle);
+ }
+
+ [Obsolete("Use GetScaledFont/SetScaledFont")]
+ public ScaledFont ScaledFont {
+ set {
+ SetScaledFont (value);
+ }
+
+ get {
+ return GetScaledFont ();
+ }
+ }
+
+ public ScaledFont GetScaledFont ()
+ {
+ return new ScaledFont (NativeMethods.cairo_get_scaled_font (handle), false);
+ }
+
+ public void SetScaledFont (ScaledFont font)
+ {
+ NativeMethods.cairo_set_scaled_font (handle, font.Handle);
+ }
public uint ReferenceCount {
- get { return NativeMethods.cairo_get_reference_count (state); }
+ get { return NativeMethods.cairo_get_reference_count (handle); }
}
public void SetSourceRGB (double r, double g, double b)
{
- NativeMethods.cairo_set_source_rgb (state, r, g, b);
+ NativeMethods.cairo_set_source_rgb (handle, r, g, b);
}
public void SetSourceRGBA (double r, double g, double b, double a)
{
- NativeMethods.cairo_set_source_rgba (state, r, g, b, a);
+ NativeMethods.cairo_set_source_rgba (handle, r, g, b, a);
}
//[Obsolete ("Use SetSource method (with double parameters)")]
public void SetSourceSurface (Surface source, int x, int y)
{
- NativeMethods.cairo_set_source_surface (state, source.Handle, x, y);
+ NativeMethods.cairo_set_source_surface (handle, source.Handle, x, y);
}
public void SetSource (Surface source, double x, double y)
{
- NativeMethods.cairo_set_source_surface (state, source.Handle, x, y);
+ NativeMethods.cairo_set_source_surface (handle, source.Handle, x, y);
}
public void SetSource (Surface source)
{
- NativeMethods.cairo_set_source_surface (state, source.Handle, 0, 0);
+ NativeMethods.cairo_set_source_surface (handle, source.Handle, 0, 0);
}
-
+
#region Path methods
-
- public void NewPath ()
- {
- NativeMethods.cairo_new_path (state);
- }
+
+ public void NewPath ()
+ {
+ NativeMethods.cairo_new_path (handle);
+ }
public void NewSubPath ()
{
- NativeMethods.cairo_new_sub_path (state);
+ NativeMethods.cairo_new_sub_path (handle);
}
-
- public void MoveTo (PointD p)
- {
+
+ public void MoveTo (PointD p)
+ {
MoveTo (p.X, p.Y);
- }
+ }
public void MoveTo (double x, double y)
{
- NativeMethods.cairo_move_to (state, x, y);
+ NativeMethods.cairo_move_to (handle, x, y);
}
-
- public void LineTo (PointD p)
+
+ public void LineTo (PointD p)
{
LineTo (p.X, p.Y);
}
-
+
public void LineTo (double x, double y)
- {
- NativeMethods.cairo_line_to (state, x, y);
- }
+ {
+ NativeMethods.cairo_line_to (handle, x, y);
+ }
- public void CurveTo (PointD p1, PointD p2, PointD p3)
+ public void CurveTo (PointD p1, PointD p2, PointD p3)
{
CurveTo (p1.X, p1.Y, p2.X, p2.Y, p3.X, p3.Y);
}
-
- public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
- {
- NativeMethods.cairo_curve_to (state, x1, y1, x2, y2, x3, y3);
- }
- public void RelMoveTo (Distance d)
+ public void CurveTo (double x1, double y1, double x2, double y2, double x3, double y3)
+ {
+ NativeMethods.cairo_curve_to (handle, x1, y1, x2, y2, x3, y3);
+ }
+
+ public void RelMoveTo (Distance d)
{
RelMoveTo (d.Dx, d.Dy);
}
-
- public void RelMoveTo (double dx, double dy)
- {
- NativeMethods.cairo_rel_move_to (state, dx, dy);
- }
-
- public void RelLineTo (Distance d)
- {
+
+ public void RelMoveTo (double dx, double dy)
+ {
+ NativeMethods.cairo_rel_move_to (handle, dx, dy);
+ }
+
+ public void RelLineTo (Distance d)
+ {
RelLineTo (d.Dx, d.Dy);
- }
-
- public void RelLineTo (double dx, double dy)
+ }
+
+ public void RelLineTo (double dx, double dy)
{
- NativeMethods.cairo_rel_line_to (state, dx, dy);
+ NativeMethods.cairo_rel_line_to (handle, dx, dy);
}
-
- public void RelCurveTo (Distance d1, Distance d2, Distance d3)
+
+ public void RelCurveTo (Distance d1, Distance d2, Distance d3)
{
RelCurveTo (d1.Dx, d1.Dy, d2.Dx, d2.Dy, d3.Dx, d3.Dy);
}
- public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
- {
- NativeMethods.cairo_rel_curve_to (state, dx1, dy1, dx2, dy2, dx3, dy3);
- }
+ public void RelCurveTo (double dx1, double dy1, double dx2, double dy2, double dx3, double dy3)
+ {
+ NativeMethods.cairo_rel_curve_to (handle, dx1, dy1, dx2, dy2, dx3, dy3);
+ }
+
+ public void Arc (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc (handle, xc, yc, radius, angle1, angle2);
+ }
- public void Arc (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc (state, xc, yc, radius, angle1, angle2);
- }
+ public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
+ {
+ NativeMethods.cairo_arc_negative (handle, xc, yc, radius, angle1, angle2);
+ }
- public void ArcNegative (double xc, double yc, double radius, double angle1, double angle2)
- {
- NativeMethods.cairo_arc_negative (state, xc, yc, radius, angle1, angle2);
- }
-
- public void Rectangle (Rectangle rectangle)
+ public void Rectangle (Rectangle rectangle)
{
Rectangle (rectangle.X, rectangle.Y, rectangle.Width, rectangle.Height);
}
- public void Rectangle (PointD p, double width, double height)
+ public void Rectangle (PointD p, double width, double height)
{
Rectangle (p.X, p.Y, width, height);
}
- public void Rectangle (double x, double y, double width, double height)
- {
- NativeMethods.cairo_rectangle (state, x, y, width, height);
- }
-
- public void ClosePath ()
- {
- NativeMethods.cairo_close_path (state);
- }
+ public void Rectangle (double x, double y, double width, double height)
+ {
+ NativeMethods.cairo_rectangle (handle, x, y, width, height);
+ }
+
+ public void ClosePath ()
+ {
+ NativeMethods.cairo_close_path (handle);
+ }
- public Path CopyPath ()
+ public Path CopyPath ()
{
- return new Path (NativeMethods.cairo_copy_path (state));
+ return new Path (NativeMethods.cairo_copy_path (handle));
}
public Path CopyPathFlat ()
{
- return new Path (NativeMethods.cairo_copy_path_flat (state));
+ return new Path (NativeMethods.cairo_copy_path_flat (handle));
}
public void AppendPath (Path path)
{
- NativeMethods.cairo_append_path (state, path.handle);
+ NativeMethods.cairo_append_path (handle, path.Handle);
}
-
+
#endregion
#region Painting Methods
public void Paint ()
{
- NativeMethods.cairo_paint (state);
+ NativeMethods.cairo_paint (handle);
}
-
+
public void PaintWithAlpha (double alpha)
{
- NativeMethods.cairo_paint_with_alpha (state, alpha);
+ NativeMethods.cairo_paint_with_alpha (handle, alpha);
}
-
+
public void Mask (Pattern pattern)
{
- NativeMethods.cairo_mask (state, pattern.Pointer);
+ NativeMethods.cairo_mask (handle, pattern.Handle);
}
-
+
public void MaskSurface (Surface surface, double surface_x, double surface_y)
{
- NativeMethods.cairo_mask_surface (state, surface.Handle, surface_x, surface_y);
+ NativeMethods.cairo_mask_surface (handle, surface.Handle, surface_x, surface_y);
+ }
+
+ public void Stroke ()
+ {
+ NativeMethods.cairo_stroke (handle);
+ }
+
+ public void StrokePreserve ()
+ {
+ NativeMethods.cairo_stroke_preserve (handle);
}
-
- public void Stroke ()
- {
- NativeMethods.cairo_stroke (state);
- }
-
- public void StrokePreserve ()
- {
- NativeMethods.cairo_stroke_preserve (state);
- }
public Rectangle StrokeExtents ()
{
double x1, y1, x2, y2;
- NativeMethods.cairo_stroke_extents (state, out x1, out y1, out x2, out y2);
- return new Rectangle (x1, y1, x2, y2);
+ NativeMethods.cairo_stroke_extents (handle, out x1, out y1, out x2, out y2);
+ return new Rectangle (x1, y1, x2 - x1, y2 - y1);
}
- public void Fill ()
- {
- NativeMethods.cairo_fill (state);
- }
+ public void Fill ()
+ {
+ NativeMethods.cairo_fill (handle);
+ }
- public Rectangle FillExtents ()
+ public Rectangle FillExtents ()
{
double x1, y1, x2, y2;
- NativeMethods.cairo_fill_extents (state, out x1, out y1, out x2, out y2);
- return new Rectangle (x1, y1, x2, y2);
+ NativeMethods.cairo_fill_extents (handle, out x1, out y1, out x2, out y2);
+ return new Rectangle (x1, y1, x2 - x1, y2 - y1);
}
public void FillPreserve ()
{
- NativeMethods.cairo_fill_preserve (state);
+ NativeMethods.cairo_fill_preserve (handle);
}
#endregion
- public void Clip ()
- {
- NativeMethods.cairo_clip (state);
- }
+ public void Clip ()
+ {
+ NativeMethods.cairo_clip (handle);
+ }
public void ClipPreserve ()
{
- NativeMethods.cairo_clip_preserve (state);
+ NativeMethods.cairo_clip_preserve (handle);
}
-
+
public void ResetClip ()
{
- NativeMethods.cairo_reset_clip (state);
+ NativeMethods.cairo_reset_clip (handle);
}
-
+
public bool InStroke (double x, double y)
{
- return NativeMethods.cairo_in_stroke (state, x, y);
+ return NativeMethods.cairo_in_stroke (handle, x, y);
}
public bool InFill (double x, double y)
{
- return NativeMethods.cairo_in_fill (state, x, y);
+ return NativeMethods.cairo_in_fill (handle, x, y);
}
public Pattern PopGroup ()
{
- return Pattern.Lookup (NativeMethods.cairo_pop_group (state));
+ return Pattern.Lookup (NativeMethods.cairo_pop_group (handle), true);
}
public void PopGroupToSource ()
{
- NativeMethods.cairo_pop_group_to_source (state);
+ NativeMethods.cairo_pop_group_to_source (handle);
}
public void PushGroup ()
{
- NativeMethods.cairo_push_group (state);
+ NativeMethods.cairo_push_group (handle);
}
public void PushGroup (Content content)
{
- NativeMethods.cairo_push_group_with_content (state, content);
+ NativeMethods.cairo_push_group_with_content (handle, content);
}
+ [Obsolete ("Use GetGroupTarget()")]
public Surface GroupTarget {
get {
- IntPtr surface = NativeMethods.cairo_get_group_target (state);
- return Surface.LookupSurface (surface);
+ return GetGroupTarget ();
}
}
- public void Rotate (double angle)
- {
- NativeMethods.cairo_rotate (state, angle);
- }
+ public Surface GetGroupTarget ()
+ {
+ IntPtr surface = NativeMethods.cairo_get_group_target (handle);
+ return Surface.Lookup (surface, false);
+ }
- public void Scale (double sx, double sy)
- {
- NativeMethods.cairo_scale (state, sx, sy);
- }
+ public void Rotate (double angle)
+ {
+ NativeMethods.cairo_rotate (handle, angle);
+ }
+
+ public void Scale (double sx, double sy)
+ {
+ NativeMethods.cairo_scale (handle, sx, sy);
+ }
+
+ public void Translate (double tx, double ty)
+ {
+ NativeMethods.cairo_translate (handle, tx, ty);
+ }
- public void Translate (double tx, double ty)
- {
- NativeMethods.cairo_translate (state, tx, ty);
- }
-
public void Transform (Matrix m)
{
- NativeMethods.cairo_transform (state, m);
+ NativeMethods.cairo_transform (handle, m);
}
-
-#region Methods that will become obsolete in the long term, after 1.2.5 becomes wildly available
-
- //[Obsolete("Use UserToDevice instead")]
+
+ [Obsolete("Use UserToDevice instead")]
public void TransformPoint (ref double x, ref double y)
{
- NativeMethods.cairo_user_to_device (state, ref x, ref y);
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
}
-
- //[Obsolete("Use UserToDeviceDistance instead")]
- public void TransformDistance (ref double dx, ref double dy)
+
+ [Obsolete("Use UserToDeviceDistance instead")]
+ public void TransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_user_to_device_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
}
-
- //[Obsolete("Use InverseTransformPoint instead")]
+
+ [Obsolete("Use InverseTransformPoint instead")]
public void InverseTransformPoint (ref double x, ref double y)
{
- NativeMethods.cairo_device_to_user (state, ref x, ref y);
+ NativeMethods.cairo_device_to_user (handle, ref x, ref y);
}
- //[Obsolete("Use DeviceToUserDistance instead")]
+ [Obsolete("Use DeviceToUserDistance instead")]
public void InverseTransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_device_to_user_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
}
-#endregion
-
+
public void UserToDevice (ref double x, ref double y)
{
- NativeMethods.cairo_user_to_device (state, ref x, ref y);
+ NativeMethods.cairo_user_to_device (handle, ref x, ref y);
}
-
- public void UserToDeviceDistance (ref double dx, ref double dy)
+
+ public void UserToDeviceDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_user_to_device_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_user_to_device_distance (handle, ref dx, ref dy);
}
-
+
public void DeviceToUser (ref double x, ref double y)
{
- NativeMethods.cairo_device_to_user (state, ref x, ref y);
+ NativeMethods.cairo_device_to_user (handle, ref x, ref y);
}
public void DeviceToUserDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_device_to_user_distance (state, ref dx, ref dy);
+ NativeMethods.cairo_device_to_user_distance (handle, ref dx, ref dy);
}
-
- public Cairo.Matrix Matrix {
- set {
- NativeMethods.cairo_set_matrix (state, value);
- }
- get {
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_set_matrix (handle, value);
+ }
+
+ get {
Matrix m = new Matrix();
- NativeMethods.cairo_get_matrix (state, m);
- return m;
- }
- }
+ NativeMethods.cairo_get_matrix (handle, m);
+ return m;
+ }
+ }
public void SetFontSize (double scale)
{
- NativeMethods.cairo_set_font_size (state, scale);
+ NativeMethods.cairo_set_font_size (handle, scale);
}
public void IdentityMatrix ()
{
- NativeMethods.cairo_identity_matrix (state);
+ NativeMethods.cairo_identity_matrix (handle);
}
-
+
[Obsolete ("Use SetFontSize() instead.")]
public void FontSetSize (double scale)
{
public double FontSize {
set { SetFontSize (value); }
}
-
+
public Matrix FontMatrix {
get {
Matrix m;
- NativeMethods.cairo_get_font_matrix (state, out m);
+ NativeMethods.cairo_get_font_matrix (handle, out m);
return m;
}
- set { NativeMethods.cairo_set_font_matrix (state, value); }
+ set { NativeMethods.cairo_set_font_matrix (handle, value); }
}
public FontOptions FontOptions {
get {
FontOptions options = new FontOptions ();
- NativeMethods.cairo_get_font_options (state, options.Handle);
+ NativeMethods.cairo_get_font_options (handle, options.Handle);
return options;
}
- set { NativeMethods.cairo_set_font_options (state, value.Handle); }
+ set { NativeMethods.cairo_set_font_options (handle, value.Handle); }
}
[StructLayout(LayoutKind.Sequential)]
} else {
foreach (Glyph g in glyphs){
NativeGlyph_4byte_longs n = new NativeGlyph_4byte_longs (g);
-
+
Marshal.StructureToPtr (n, (IntPtr)pos, false);
pos += native_glyph_size;
}
return dest;
}
- public void ShowGlyphs (Glyph[] glyphs)
+ public void ShowGlyphs (Glyph[] glyphs)
{
- IntPtr ptr;
+ IntPtr ptr;
- ptr = FromGlyphToUnManagedMemory (glyphs);
-
- NativeMethods.cairo_show_glyphs (state, ptr, glyphs.Length);
+ ptr = FromGlyphToUnManagedMemory (glyphs);
- Marshal.FreeHGlobal (ptr);
+ NativeMethods.cairo_show_glyphs (handle, ptr, glyphs.Length);
+
+ Marshal.FreeHGlobal (ptr);
}
[Obsolete("The matrix argument was never used, use ShowGlyphs(Glyphs []) instead")]
- public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
- {
+ public void ShowGlyphs (Matrix matrix, Glyph[] glyphs)
+ {
ShowGlyphs (glyphs);
- }
+ }
[Obsolete("The matrix argument was never used, use GlyphPath(Glyphs []) instead")]
- public void GlyphPath (Matrix matrix, Glyph[] glyphs)
- {
+ public void GlyphPath (Matrix matrix, Glyph[] glyphs)
+ {
GlyphPath (glyphs);
}
public void GlyphPath (Glyph[] glyphs)
{
- IntPtr ptr;
+ IntPtr ptr;
+
+ ptr = FromGlyphToUnManagedMemory (glyphs);
- ptr = FromGlyphToUnManagedMemory (glyphs);
+ NativeMethods.cairo_glyph_path (handle, ptr, glyphs.Length);
- NativeMethods.cairo_glyph_path (state, ptr, glyphs.Length);
+ Marshal.FreeHGlobal (ptr);
- Marshal.FreeHGlobal (ptr);
+ }
- }
+ public FontExtents FontExtents {
+ get {
+ FontExtents f_extents;
+ NativeMethods.cairo_font_extents (handle, out f_extents);
+ return f_extents;
+ }
+ }
- public FontExtents FontExtents {
- get {
- FontExtents f_extents;
- NativeMethods.cairo_font_extents (state, out f_extents);
- return f_extents;
- }
- }
-
public void CopyPage ()
{
- NativeMethods.cairo_copy_page (state);
+ NativeMethods.cairo_copy_page (handle);
}
[Obsolete ("Use SelectFontFace() instead.")]
SelectFontFace (family, slant, weight);
}
+ [Obsolete("Use GetFontFace/SetFontFace")]
public FontFace ContextFontFace {
get {
- return Cairo.FontFace.Lookup (NativeMethods.cairo_get_font_face (state));
+ return GetContextFontFace ();
}
-
set {
- NativeMethods.cairo_set_font_face (state, value == null ? IntPtr.Zero : value.Handle);
+ SetContextFontFace (value);
}
}
-
+
+ public FontFace GetContextFontFace ()
+ {
+ return Cairo.FontFace.Lookup (NativeMethods.cairo_get_font_face (handle), false);
+ }
+
+ public void SetContextFontFace (FontFace value)
+ {
+ NativeMethods.cairo_set_font_face (handle, value == null ? IntPtr.Zero : value.Handle);
+ }
+
public void SelectFontFace (string family, FontSlant slant, FontWeight weight)
{
- NativeMethods.cairo_select_font_face (state, family, slant, weight);
+ NativeMethods.cairo_select_font_face (handle, family, slant, weight);
}
public void ShowPage ()
{
- NativeMethods.cairo_show_page (state);
+ NativeMethods.cairo_show_page (handle);
}
private static byte[] TerminateUtf8(byte[] utf8)
public void ShowText(string str)
{
- NativeMethods.cairo_show_text(state, TerminateUtf8(str));
+ NativeMethods.cairo_show_text (handle, TerminateUtf8(str));
}
public void ShowText(byte[] utf8)
{
- NativeMethods.cairo_show_text(state, TerminateUtf8(utf8));
+ NativeMethods.cairo_show_text (handle, TerminateUtf8(utf8));
}
public void TextPath(string str)
{
- NativeMethods.cairo_text_path(state, TerminateUtf8(str));
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(str));
}
public void TextPath(byte[] utf8)
{
- NativeMethods.cairo_text_path(state, TerminateUtf8(utf8));
+ NativeMethods.cairo_text_path (handle, TerminateUtf8(utf8));
}
public TextExtents TextExtents(string s)
{
TextExtents extents;
- NativeMethods.cairo_text_extents(state, TerminateUtf8(s), out extents);
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(s), out extents);
return extents;
}
public TextExtents TextExtents(byte[] utf8)
{
TextExtents extents;
- NativeMethods.cairo_text_extents(state, TerminateUtf8(utf8), out extents);
+ NativeMethods.cairo_text_extents (handle, TerminateUtf8(utf8), out extents);
return extents;
}
TextExtents extents;
- NativeMethods.cairo_glyph_extents (state, ptr, glyphs.Length, out extents);
+ NativeMethods.cairo_glyph_extents (handle, ptr, glyphs.Length, out extents);
Marshal.FreeHGlobal (ptr);
return extents;
}
- }
+ }
}
}
public DirectFBSurface (IntPtr dfb, IntPtr dfb_surface)
+ : base (NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface), true)
{
- surface = NativeMethods.cairo_directfb_surface_create (dfb, dfb_surface);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Cairo {
+
+ public struct Distance
+ {
+ public Distance (double dx, double dy)
+ {
+ this.dx = dx;
+ this.dy = dy;
+ }
+
+ double dx, dy;
+ public double Dx {
+ get { return dx; }
+ set { dx = value; }
+ }
+
+ public double Dy {
+ get { return dy; }
+ set { dy = value; }
+ }
+ }
+}
{
IntPtr handle;
- internal static FontFace Lookup (IntPtr handle)
+ internal static FontFace Lookup (IntPtr handle, bool owner)
{
if (handle == IntPtr.Zero)
return null;
-
- NativeMethods.cairo_font_face_reference (handle);
-
- return new FontFace (handle);
+ return new FontFace (handle, owner);
}
~FontFace ()
{
- // Since Cairo is not thread safe, we can not unref the
- // font_face here, the programmer must do this with Dispose
-
- Console.Error.WriteLine ("Programmer forgot to call Dispose on the FontFace");
Dispose (false);
}
public void Dispose ()
{
Dispose (true);
+ GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
- if (disposing)
- NativeMethods.cairo_font_face_destroy (handle);
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<FontFace> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_font_face_destroy (handle);
handle = IntPtr.Zero;
- GC.SuppressFinalize (this);
}
-
- // TODO: make non-public when all entry points are complete in binding
- public FontFace (IntPtr handle)
+
+ [Obsolete]
+ public FontFace (IntPtr handle) : this (handle, true)
+ {
+ }
+
+ public FontFace (IntPtr handle, bool owned)
{
this.handle = handle;
+ if (!owned)
+ NativeMethods.cairo_font_face_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
public IntPtr Handle {
public class FontOptions : IDisposable
{
IntPtr handle;
- bool disposed;
- public FontOptions ()
+ public FontOptions () : this (NativeMethods.cairo_font_options_create ())
{
- handle = NativeMethods.cairo_font_options_create ();
}
~FontOptions ()
internal FontOptions (IntPtr handle)
{
this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
public FontOptions Copy ()
return new FontOptions (NativeMethods.cairo_font_options_copy (handle));
}
+ [Obsolete ("Use Dispose()")]
public void Destroy ()
{
- NativeMethods.cairo_font_options_destroy (handle);
+ Dispose ();
}
public void Dispose ()
GC.SuppressFinalize (this);
}
- private void Dispose (bool disposing)
+ protected virtual void Dispose (bool disposing)
{
- if (!disposed) {
- Destroy ();
- handle = IntPtr.Zero;
- }
- disposed = true;
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<FontOptions> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_font_options_destroy (handle);
+ handle = IntPtr.Zero;
}
public static bool operator == (FontOptions options, FontOptions other)
}
public GlitzSurface (IntPtr glitz_surface)
+ : base (NativeMethods.cairo_glitz_surface_create (glitz_surface), true)
{
- surface = NativeMethods.cairo_glitz_surface_create (glitz_surface);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
}
-//
+//
// Mono.Cairo.Gradient.cs
//
// Author: Jordi Mas (jordi@ximian.com)
// 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
using System;
namespace Cairo {
-
+
public class Gradient : Pattern
{
- protected Gradient (IntPtr handle) : base (handle)
+ protected Gradient (IntPtr handle, bool owned) : base (handle, owned)
{
}
+ [Obsolete]
protected Gradient ()
{
}
public int ColorStopCount {
get {
int cnt;
- NativeMethods.cairo_pattern_get_color_stop_count (pattern, out cnt);
+ NativeMethods.cairo_pattern_get_color_stop_count (Handle, out cnt);
return cnt;
}
}
- public Status AddColorStop (double offset, Cairo.Color c)
+ public Status AddColorStop (double offset, Color c)
{
- NativeMethods.cairo_pattern_add_color_stop_rgba (pattern, offset, c.R, c.G, c.B, c.A);
+ NativeMethods.cairo_pattern_add_color_stop_rgba (Handle, offset, c.R, c.G, c.B, c.A);
return Status;
}
- public Status AddColorStopRgb (double offset, Cairo.Color c)
+ public Status AddColorStopRgb (double offset, Color c)
{
- NativeMethods.cairo_pattern_add_color_stop_rgb (pattern, offset, c.R, c.G, c.B);
+ NativeMethods.cairo_pattern_add_color_stop_rgb (Handle, offset, c.R, c.G, c.B);
return Status;
}
}
// 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
namespace Cairo {
- public class ImageSurface : Surface
- {
+ public class ImageSurface : Surface
+ {
internal ImageSurface (IntPtr handle, bool owns) : base (handle, owns)
{
}
public ImageSurface (Format format, int width, int height)
+ : base (NativeMethods.cairo_image_surface_create (format, width, height), true)
{
- surface = NativeMethods.cairo_image_surface_create (format, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
[Obsolete ("Use ImageSurface (byte[] data, Cairo.Format format, int width, int height, int stride)")]
- public ImageSurface (ref byte[] data, Cairo.Format format, int width, int height, int stride) :this (data, format, width, height, stride)
+ public ImageSurface (ref byte[] data, Cairo.Format format, int width, int height, int stride)
+ : this (data, format, width, height, stride)
{
}
- public ImageSurface (byte[] data, Cairo.Format format, int width, int height, int stride)
+ public ImageSurface (byte[] data, Format format, int width, int height, int stride)
+ : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
{
- surface = NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
- public ImageSurface (IntPtr data, Cairo.Format format, int width, int height, int stride)
+ public ImageSurface (IntPtr data, Format format, int width, int height, int stride)
+ : base (NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride), true)
{
- surface = NativeMethods.cairo_image_surface_create_for_data (data, format, width, height, stride);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
public ImageSurface (string filename)
+ : base (NativeMethods.cairo_image_surface_create_from_png (filename), true)
{
- surface = NativeMethods.cairo_image_surface_create_from_png (filename);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
-
+
public int Width {
- get { return NativeMethods.cairo_image_surface_get_width (surface); }
+ get { return NativeMethods.cairo_image_surface_get_width (Handle); }
}
-
+
public int Height {
- get { return NativeMethods.cairo_image_surface_get_height (surface); }
+ get { return NativeMethods.cairo_image_surface_get_height (Handle); }
}
-
+
public byte[] Data {
get {
- IntPtr ptr = NativeMethods.cairo_image_surface_get_data (surface);
+ IntPtr ptr = NativeMethods.cairo_image_surface_get_data (Handle);
int length = Height * Stride;
byte[] data = new byte[length];
Marshal.Copy (ptr, data, 0, length);
public IntPtr DataPtr {
get {
- return NativeMethods.cairo_image_surface_get_data (surface);
+ return NativeMethods.cairo_image_surface_get_data (Handle);
}
}
public Format Format {
- get { return NativeMethods.cairo_image_surface_get_format (surface); }
+ get { return NativeMethods.cairo_image_surface_get_format (Handle); }
}
public int Stride {
- get { return NativeMethods.cairo_image_surface_get_stride (surface); }
+ get { return NativeMethods.cairo_image_surface_get_stride (Handle); }
}
}
}
-//
+//
// Mono.Cairo.LinearGradient.cs
//
// Author: Jordi Mas (jordi@ximian.com)
// 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
using System;
namespace Cairo {
-
+
public class LinearGradient : Gradient
{
- internal LinearGradient (IntPtr handle) : base (handle)
+ internal LinearGradient (IntPtr handle, bool owned) : base (handle, owned)
{
}
public LinearGradient (double x0, double y0, double x1, double y1)
+ : base (NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1), true)
{
- pattern = NativeMethods.cairo_pattern_create_linear (x0, y0, x1, y1);
}
public PointD[] LinearPoints {
- get {
+ get {
double x0, y0, x1, y1;
PointD[] points = new PointD [2];
- NativeMethods.cairo_pattern_get_linear_points (pattern, out x0, out y0, out x1, out y1);
+ NativeMethods.cairo_pattern_get_linear_points (Handle, out x0, out y0, out x1, out y1);
points[0] = new PointD (x0, y0);
points[1] = new PointD (x1, y1);
return points;
- }
- }
-
+ }
+ }
}
}
// 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
namespace Cairo {
- [StructLayout(LayoutKind.Sequential)]
- public class Matrix : ICloneable
- {
+ [StructLayout(LayoutKind.Sequential)]
+ public class Matrix : ICloneable
+ {
public double Xx;
public double Yx;
- public double Xy;
+ public double Xy;
public double Yy;
- public double X0;
+ public double X0;
public double Y0;
public Matrix (double xx, double yx, double xy, double yy,
double x0, double y0)
- {
+ {
this.Xx = xx; this.Yx = yx; this.Xy = xy;
this.Yy = yy; this.X0 = x0; this.Y0 = y0;
}
-
- public Matrix ()
+
+ public Matrix ()
{
this.InitIdentity ();
}
-
+
public bool IsIdentity ()
{
return (this == new Matrix ());
}
-
- public void InitIdentity ()
- {
- // this.Init(1,0,0,1,0,0);
- NativeMethods.cairo_matrix_init_identity (this);
- }
-
+
+ public void InitIdentity ()
+ {
+ // this.Init(1,0,0,1,0,0);
+ NativeMethods.cairo_matrix_init_identity (this);
+ }
+
public void Init (double xx, double yx, double xy, double yy,
double x0, double y0)
{
this.Xx = xx; this.Yx = yx; this.Xy = xy;
this.Yy = yy; this.X0 = x0; this.Y0 = y0;
}
-
+
public void InitTranslate (double tx, double ty)
- {
+ {
//this.Init (1, 0, 0, 1, tx, ty);
NativeMethods.cairo_matrix_init_translate (this, tx, ty);
- }
-
+ }
+
public void Translate (double tx, double ty)
{
NativeMethods.cairo_matrix_translate (this, tx, ty);
}
-
- public void InitScale (double sx, double sy)
- {
+
+ public void InitScale (double sx, double sy)
+ {
//this.Init (sx, 0, 0, sy, 0, 0);
- NativeMethods.cairo_matrix_init_scale (this, sx, sy);
- }
-
- public void Scale (double sx, double sy)
- {
+ NativeMethods.cairo_matrix_init_scale (this, sx, sy);
+ }
+
+ public void Scale (double sx, double sy)
+ {
NativeMethods.cairo_matrix_scale (this, sx, sy);
- }
-
- public void InitRotate (double radians)
- {
- /*
- double s, c;
- s = Math.Sin (radians);
- c = Math.Cos (radians);
- this.Init (c, s, -s, c, 0, 0);
- */
- NativeMethods.cairo_matrix_init_rotate (this, radians);
- }
-
- public void Rotate (double radians)
- {
+ }
+
+ public void InitRotate (double radians)
+ {
+ /*
+ double s, c;
+ s = Math.Sin (radians);
+ c = Math.Cos (radians);
+ this.Init (c, s, -s, c, 0, 0);
+ */
+ NativeMethods.cairo_matrix_init_rotate (this, radians);
+ }
+
+ public void Rotate (double radians)
+ {
NativeMethods.cairo_matrix_rotate (this, radians);
- }
+ }
- public Cairo.Status Invert ()
- {
+ public Cairo.Status Invert ()
+ {
return NativeMethods.cairo_matrix_invert (this);
- }
+ }
public void Multiply (Matrix b)
{
Matrix a = (Matrix) this.Clone ();
NativeMethods.cairo_matrix_multiply (this, a, b);
}
-
+
public static Matrix Multiply (Matrix a, Matrix b) {
Matrix result = new Matrix ();
NativeMethods.cairo_matrix_multiply (result, a, b);
return result;
}
-
-
- public void TransformDistance (ref double dx, ref double dy)
+
+
+ public void TransformDistance (ref double dx, ref double dy)
{
- NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
- }
+ NativeMethods.cairo_matrix_transform_distance (this, ref dx, ref dy);
+ }
- public void TransformPoint (ref double x, ref double y)
- {
- NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
+ public void TransformPoint (ref double x, ref double y)
+ {
+ NativeMethods.cairo_matrix_transform_point (this, ref x, ref y);
}
public override String ToString ()
this.Xx, this.Yx, this.Xy, this.Yy, this.X0, this.Y0);
return s;
}
-
+
public static bool operator == (Matrix lhs, Matrix rhs)
{
return (lhs.Xx == rhs.Xx &&
lhs.X0 == rhs.X0 &&
lhs.Y0 == rhs.Y0 );
}
-
+
public static bool operator != (Matrix lhs, Matrix rhs)
{
- return !(lhs==rhs);
+ return !(lhs==rhs);
}
-
-
-
+
+
+
public override bool Equals(object o)
{
if (! (o is Matrix))
else
return (this == (Matrix) o);
}
-
+
public override int GetHashCode()
{
return (int)this.Xx ^ (int)this.Xx>>32 ^
(int)this.X0 ^ (int)this.X0>>32 ^
(int)this.Y0 ^ (int)this.Y0>>32;
}
-
+
public object Clone()
{
return this.MemberwiseClone ();
}
-
- }
+
+ }
}
namespace Cairo
{
- // sort these so it is easier to find what is missing
- // http://www.cairographics.org/manual/ix01.html
+ // sort the functions like in the following page so it is easier to find what is missing
+ // http://cairographics.org/manual/index-all.html
internal static class NativeMethods
{
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern IntPtr cairo_create (IntPtr target);
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_get_reference_count (IntPtr surface);
-
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_curve_to (IntPtr cr, double x1, double y1, double x2, double y2, double x3, double y3);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern Operator cairo_get_operator (IntPtr cr);
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern uint cairo_get_reference_count (IntPtr surface);
+
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern IntPtr cairo_get_source (IntPtr cr);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern int cairo_image_surface_get_width (IntPtr surface);
- [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
-
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
[return: MarshalAs (UnmanagedType.U1)]
internal static extern bool cairo_in_fill (IntPtr cr, double x, double y);
//[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
//internal static extern IntPtr cairo_ps_surface_create_for_stream (string filename, double width, double height);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_begin_page_setup (IntPtr surface);
+ internal static extern void cairo_ps_surface_dsc_begin_page_setup (IntPtr surface);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
- internal static extern void cairo_ps_surface_begin_setup (IntPtr surface);
+ internal static extern void cairo_ps_surface_dsc_begin_setup (IntPtr surface);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_ps_surface_dsc_comment (IntPtr surface, string comment);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_reference (IntPtr cr);
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_contains_point (IntPtr region, int x, int y);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern RegionOverlap cairo_region_contains_rectangle (IntPtr region, ref RectangleInt rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_copy (IntPtr original);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create ();
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create_rectangle (ref RectangleInt rect);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_create_rectangles (RectangleInt[] rects, int count);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_destroy (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_equal (IntPtr a, IntPtr b);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_extents (IntPtr region, out RectangleInt extents);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_get_rectangle (IntPtr region, int nth, out RectangleInt rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_intersect_rectangle (IntPtr dst, ref RectangleInt rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern bool cairo_region_is_empty (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern int cairo_region_num_rectangles (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern IntPtr cairo_region_reference (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_status (IntPtr region);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_subtract (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_subtract_rectangle (IntPtr dst, ref RectangleInt rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern void cairo_region_translate (IntPtr region, int dx, int dy);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_union (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_union_rectangle (IntPtr dst, ref RectangleInt rectangle);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor (IntPtr dst, IntPtr other);
+
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern Status cairo_region_xor_rectangle (IntPtr dst, ref RectangleInt rectangle);
+
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_rel_curve_to (IntPtr cr, double dx1, double dy1, double dx2, double dy2, double dx3, double dy3);
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern void cairo_surface_get_font_options (IntPtr surface, IntPtr FontOptions);
+ [DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
+ internal static extern uint cairo_surface_get_reference_count (IntPtr surface);
+
[DllImport (cairo, CallingConvention=CallingConvention.Cdecl)]
internal static extern SurfaceType cairo_surface_get_type (IntPtr surface);
}
public PSSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_ps_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_ps_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void BeginPageSetup ()
{
- NativeMethods.cairo_ps_surface_begin_page_setup (surface);
+ NativeMethods.cairo_ps_surface_dsc_begin_page_setup (Handle);
}
public void BeginSetup ()
{
- NativeMethods.cairo_ps_surface_begin_setup (surface);
+ NativeMethods.cairo_ps_surface_dsc_begin_setup (Handle);
}
public void DscComment (string comment)
{
- NativeMethods.cairo_ps_surface_dsc_comment (surface, comment);
+ NativeMethods.cairo_ps_surface_dsc_comment (Handle, comment);
}
public void SetSize (double width, double height)
{
- NativeMethods.cairo_ps_surface_set_size (surface, width, height);
+ NativeMethods.cairo_ps_surface_set_size (Handle, width, height);
}
}
}
// 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
namespace Cairo {
- public class Path : IDisposable
- {
- internal IntPtr handle = IntPtr.Zero;
-
+ public class Path : IDisposable
+ {
+ IntPtr handle = IntPtr.Zero;
+
internal Path (IntPtr handle)
{
this.handle = handle;
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
~Path ()
Dispose (false);
}
-
+ public IntPtr Handle { get { return handle; } }
+
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
-
- protected virtual void Dispose (bool disposing)
- {
- if (!disposing){
- Console.Error.WriteLine ("Cairo.Context: called from finalization thread, programmer is missing a call to Dispose");
- return;
- }
-
- if (handle == IntPtr.Zero)
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Path> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
return;
- NativeMethods.cairo_path_destroy (handle);
+ NativeMethods.cairo_path_destroy (handle);
handle = IntPtr.Zero;
- }
- }
+ }
+ }
}
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
namespace Cairo {
- public class Pattern : IDisposable
- {
- protected IntPtr pattern = IntPtr.Zero;
+ public class Pattern : IDisposable
+ {
+ [Obsolete]
+ protected IntPtr pattern = IntPtr.Zero;
- internal static Pattern Lookup (IntPtr pattern)
+ public static Pattern Lookup (IntPtr pattern, bool owner)
{
if (pattern == IntPtr.Zero)
return null;
-
- object x = patterns [pattern];
- if (x != null)
- return (Pattern) x;
PatternType pt = NativeMethods.cairo_pattern_get_type (pattern);
switch (pt) {
case PatternType.Solid:
- return new SolidPattern (pattern);
+ return new SolidPattern (pattern, owner);
case PatternType.Surface:
- return new SurfacePattern (pattern);
+ return new SurfacePattern (pattern, owner);
case PatternType.Linear:
- return new LinearGradient (pattern);
+ return new LinearGradient (pattern, owner);
case PatternType.Radial:
- return new RadialGradient (pattern);
+ return new RadialGradient (pattern, owner);
default:
- return new Pattern (pattern);
+ return new Pattern (pattern, owner);
}
}
-
- protected Pattern ()
- {
- }
- static Hashtable patterns = new Hashtable ();
+ [Obsolete]
+ protected Pattern ()
+ {
+ }
- internal Pattern (IntPtr ptr)
+ internal Pattern (IntPtr handle, bool owned)
{
- lock (patterns){
- patterns [ptr] = this;
- }
- pattern = ptr;
+ Handle = handle;
+ if (!owned)
+ NativeMethods.cairo_pattern_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
~Pattern ()
{
+ Dispose (false);
}
- [Obsolete ("Use the SurfacePattern constructor")]
- public Pattern (Surface surface)
- {
- pattern = NativeMethods.cairo_pattern_create_for_surface (surface.Handle);
- }
+ [Obsolete ("Use the SurfacePattern constructor")]
+ public Pattern (Surface surface)
+ : this ( NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
+ {
+ }
- protected void Reference ()
- {
- NativeMethods.cairo_pattern_reference (pattern);
- }
+ [Obsolete]
+ protected void Reference ()
+ {
+ NativeMethods.cairo_pattern_reference (pattern);
+ }
public void Dispose ()
{
Dispose (true);
+ GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
- if (disposing)
- Destroy ();
- GC.SuppressFinalize (this);
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Pattern> (Handle, disposing);
+
+ if (!disposing|| Handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_pattern_destroy (Handle);
+ Handle = IntPtr.Zero;
}
-
- public void Destroy ()
- {
- if (pattern != IntPtr.Zero){
- NativeMethods.cairo_pattern_destroy (pattern);
- pattern = IntPtr.Zero;
- }
- lock (patterns){
- patterns.Remove (this);
- }
- }
-
+
+ [Obsolete ("Use Dispose()")]
+ public void Destroy ()
+ {
+ Dispose ();
+ }
+
public Status Status
{
- get { return NativeMethods.cairo_pattern_status (pattern); }
+ get { return NativeMethods.cairo_pattern_status (Handle); }
}
public Extend Extend
{
- get { return NativeMethods.cairo_pattern_get_extend (pattern); }
- set { NativeMethods.cairo_pattern_set_extend (pattern, value); }
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
}
-
- public Matrix Matrix {
- set {
- NativeMethods.cairo_pattern_set_matrix (pattern, value);
+
+ public Matrix Matrix {
+ set {
+ NativeMethods.cairo_pattern_set_matrix (Handle, value);
}
- get {
+ get {
Matrix m = new Matrix ();
- NativeMethods.cairo_pattern_get_matrix (pattern, m);
+ NativeMethods.cairo_pattern_get_matrix (Handle, m);
return m;
- }
- }
+ }
+ }
- public IntPtr Pointer {
- get { return pattern; }
- }
+#pragma warning disable 612
+ public IntPtr Handle {
+ get { return pattern; }
+ private set { pattern = value; }
+ }
+#pragma warning restore 612
+
+ [Obsolete]
+ public IntPtr Pointer {
+ get { return pattern; }
+ }
public PatternType PatternType {
- get { return NativeMethods.cairo_pattern_get_type (pattern); }
+ get { return NativeMethods.cairo_pattern_get_type (Handle); }
}
- }
+ }
}
}
public PdfSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_pdf_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_pdf_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void SetSize (double width, double height)
{
- NativeMethods.cairo_pdf_surface_set_size (surface, width, height);
+ NativeMethods.cairo_pdf_surface_set_size (Handle, width, height);
}
}
}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Cairo {
+ public struct Point
+ {
+ public Point (int x, int y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ int x, y;
+ public int X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public int Y {
+ get { return y; }
+ set { y = value; }
+ }
+ }
+}
--- /dev/null
+//
+// Mono.Cairo.Context.cs
+//
+// Author:
+// Duncan Mak (duncan@ximian.com)
+// Miguel de Icaza (miguel@novell.com)
+// Hisham Mardam Bey (hisham.mardambey@gmail.com)
+// Alp Toker (alp@atoker.com)
+//
+// (C) Ximian Inc, 2003.
+// (C) Novell Inc, 2003.
+//
+// This is an OO wrapper API for the Cairo API.
+//
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+
+namespace Cairo {
+
+ public struct PointD
+ {
+ public PointD (double x, double y)
+ {
+ this.x = x;
+ this.y = y;
+ }
+
+ double x, y;
+ public double X {
+ get { return x; }
+ set { x = value; }
+ }
+
+ public double Y {
+ get { return y; }
+ set { y = value; }
+ }
+ }
+}
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
// 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
using System;
namespace Cairo {
-
+
public class RadialGradient : Gradient
{
- internal RadialGradient (IntPtr handle) : base (handle)
+ internal RadialGradient (IntPtr handle, bool owned) : base (handle, owned)
{
}
public RadialGradient (double cx0, double cy0, double radius0, double cx1, double cy1, double radius1)
+ : base (NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1), true)
{
- pattern = NativeMethods.cairo_pattern_create_radial (cx0, cy0, radius0, cx1, cy1, radius1);
}
}
}
--- /dev/null
+// 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.Runtime.InteropServices;
+
+namespace Cairo
+{
+
+ [StructLayout(LayoutKind.Sequential)]
+ public struct RectangleInt {
+ public int X;
+ public int Y;
+ public int Width;
+ public int Height;
+ }
+
+ public enum RegionOverlap {
+ In,
+ Out,
+ Part,
+ }
+
+ public class Region : IDisposable {
+
+ IntPtr handle;
+ public IntPtr Handle {
+ get { return handle; }
+ }
+
+ [Obsolete]
+ public Region (IntPtr handle) : this (handle, false) {}
+
+ public Region (IntPtr handle, bool owned)
+ {
+ this.handle = handle;
+ if (!owned)
+ NativeMethods.cairo_region_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public Region () : this (NativeMethods.cairo_region_create () , true)
+ {
+ }
+
+ public Region (RectangleInt rect)
+ {
+ handle = NativeMethods.cairo_region_create_rectangle (ref rect);
+ }
+
+ public Region (RectangleInt[] rects)
+ {
+ handle = NativeMethods.cairo_region_create_rectangles (rects, rects.Length);
+ }
+
+ public Region Copy ()
+ {
+ return new Region (NativeMethods.cairo_region_copy (Handle), true);
+ }
+
+ ~Region ()
+ {
+ Dispose (false);
+ }
+
+ public void Dispose ()
+ {
+ Dispose (true);
+ GC.SuppressFinalize (this);
+ }
+
+ protected virtual void Dispose (bool disposing)
+ {
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Region> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_region_destroy (Handle);
+ handle = IntPtr.Zero;
+ }
+
+ public override bool Equals (object obj)
+ {
+ return (obj is Region) && NativeMethods.cairo_region_equal (Handle, (obj as Region).Handle);
+ }
+
+ public override int GetHashCode ()
+ {
+ return Handle.GetHashCode ();
+ }
+
+ public Status Status {
+ get { return NativeMethods.cairo_region_status (Handle); }
+ }
+
+ public RectangleInt Extents {
+ get {
+ RectangleInt result;
+ NativeMethods.cairo_region_get_extents (Handle, out result);
+ return result;
+ }
+ }
+
+ public int NumRectangles {
+ get { return NativeMethods.cairo_region_num_rectangles (Handle); }
+ }
+
+ public RectangleInt GetRectangle (int nth)
+ {
+ RectangleInt val;
+ NativeMethods.cairo_region_get_rectangle (Handle, nth, out val);
+ return val;
+ }
+
+ public bool IsEmpty {
+ get { return NativeMethods.cairo_region_is_empty (Handle); }
+ }
+
+ public RegionOverlap ContainsPoint (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_contains_rectangle (Handle, ref rectangle);
+ }
+
+ public bool ContainsPoint (int x, int y)
+ {
+ return NativeMethods.cairo_region_contains_point (Handle, x, y);
+ }
+
+ public void Translate (int dx, int dy)
+ {
+ NativeMethods.cairo_region_translate (Handle, dx, dy);
+ }
+
+ public Status Subtract (Region other)
+ {
+ return NativeMethods.cairo_region_subtract (Handle, other.Handle);
+ }
+
+ public Status SubtractRectangle (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_subtract_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Intersect (Region other)
+ {
+ return NativeMethods.cairo_region_intersect (Handle, other.Handle);
+ }
+
+ public Status IntersectRectangle (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_intersect_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Union (Region other)
+ {
+ return NativeMethods.cairo_region_union (Handle, other.Handle);
+ }
+
+ public Status UnionRectangle (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_union_rectangle (Handle, ref rectangle);
+ }
+
+ public Status Xor (Region other)
+ {
+ return NativeMethods.cairo_region_xor (Handle, other.Handle);
+ }
+
+ public Status XorRectangle (RectangleInt rectangle)
+ {
+ return NativeMethods.cairo_region_xor_rectangle (Handle, ref rectangle);
+ }
+ }
+}
{
protected IntPtr handle = IntPtr.Zero;
- internal ScaledFont (IntPtr handle)
+ internal ScaledFont (IntPtr handle, bool owner)
{
this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_scaled_font_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
}
public ScaledFont (FontFace fontFace, Matrix matrix, Matrix ctm, FontOptions options)
+ : this (NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle), true)
{
- handle = NativeMethods.cairo_scaled_font_create (fontFace.Handle, matrix, ctm, options.Handle);
}
~ScaledFont ()
Dispose (false);
}
- public IntPtr Handle {
- get {
- return handle;
- }
- }
+ public IntPtr Handle {
+ get {
+ return handle;
+ }
+ }
public FontExtents FontExtents {
- get {
- FontExtents extents;
- NativeMethods.cairo_scaled_font_extents (handle, out extents);
- return extents;
- }
- }
+ get {
+ FontExtents extents;
+ NativeMethods.cairo_scaled_font_extents (handle, out extents);
+ return extents;
+ }
+ }
public Matrix FontMatrix {
get {
protected virtual void Dispose (bool disposing)
{
- if (disposing) {
- NativeMethods.cairo_scaled_font_destroy (handle);
- handle = IntPtr.Zero;
- }
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<ScaledFont> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
+ return;
+
+ NativeMethods.cairo_scaled_font_destroy (handle);
+ handle = IntPtr.Zero;
+ }
+
+ [Obsolete]
+ protected void Reference ()
+ {
+ NativeMethods.cairo_scaled_font_reference (handle);
}
-
- protected void Reference ()
- {
- NativeMethods.cairo_scaled_font_reference (handle);
- }
}
}
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
// 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
using System;
namespace Cairo {
-
+
public class SolidPattern : Pattern
{
- internal SolidPattern (IntPtr handle) : base (handle)
+ internal SolidPattern (IntPtr handle, bool owned) : base (handle, owned)
{
}
public SolidPattern (Color color)
+ : base (NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A), true)
{
- pattern = NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A);
}
public SolidPattern (double r, double g, double b)
+ : base (NativeMethods.cairo_pattern_create_rgb (r, g, b), true)
{
- pattern = NativeMethods.cairo_pattern_create_rgb (r, g, b);
}
public SolidPattern (double r, double g, double b, double a)
+ : base (NativeMethods.cairo_pattern_create_rgba (r, g, b, a), true)
{
- NativeMethods.cairo_pattern_create_rgba (r, g, b, a);
}
public SolidPattern (Color color, bool solid)
+ : base (solid
+ ? NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B)
+ : NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A),
+ true)
{
- if (solid)
- pattern = NativeMethods.cairo_pattern_create_rgb (color.R, color.G, color.B);
- else
- pattern = NativeMethods.cairo_pattern_create_rgba (color.R, color.G, color.B, color.A);
}
public Color Color {
- get {
+ get {
double red, green, blue, alpha;
-
- NativeMethods.cairo_pattern_get_rgba (pattern, out red, out green, out blue, out alpha);
+ NativeMethods.cairo_pattern_get_rgba (Handle, out red, out green, out blue, out alpha);
return new Color (red, green, blue, alpha);
- }
- }
+ }
+ }
}
}
// 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
namespace Cairo {
- public class Surface : IDisposable
- {
+ public class Surface : IDisposable
+ {
+ [Obsolete]
protected static Hashtable surfaces = new Hashtable ();
- internal IntPtr surface = IntPtr.Zero;
+ IntPtr handle = IntPtr.Zero;
+
+ [Obsolete]
protected Surface()
{
}
-
- protected Surface (IntPtr ptr, bool owns)
- {
- surface = ptr;
- lock (surfaces.SyncRoot){
- surfaces [ptr] = this;
- }
- if (!owns)
- NativeMethods.cairo_surface_reference (ptr);
- }
-
- static internal Surface LookupExternalSurface (IntPtr p)
- {
- lock (surfaces.SyncRoot){
- object o = surfaces [p];
- if (o == null){
- return new Surface (p, false);
- }
- return (Surface) o;
- }
- }
- static internal Surface LookupSurface (IntPtr surface)
+ [Obsolete]
+ protected Surface (IntPtr ptr) : this (ptr, true)
+ {
+ }
+
+ protected Surface (IntPtr handle, bool owner)
+ {
+ this.handle = handle;
+ if (!owner)
+ NativeMethods.cairo_surface_reference (handle);
+ if (CairoDebug.Enabled)
+ CairoDebug.OnAllocated (handle);
+ }
+
+ public static Surface Lookup (IntPtr surface, bool owned)
{
SurfaceType st = NativeMethods.cairo_surface_get_type (surface);
switch (st) {
case SurfaceType.Image:
- return new ImageSurface (surface, true);
+ return new ImageSurface (surface, owned);
case SurfaceType.Xlib:
- return new XlibSurface (surface, true);
+ return new XlibSurface (surface, owned);
case SurfaceType.Xcb:
- return new XcbSurface (surface, true);
+ return new XcbSurface (surface, owned);
case SurfaceType.Glitz:
- return new GlitzSurface (surface, true);
+ return new GlitzSurface (surface, owned);
case SurfaceType.Win32:
- return new Win32Surface (surface, true);
-
+ return new Win32Surface (surface, owned);
case SurfaceType.Pdf:
- return new PdfSurface (surface, true);
+ return new PdfSurface (surface, owned);
case SurfaceType.PS:
- return new PSSurface (surface, true);
+ return new PSSurface (surface, owned);
case SurfaceType.DirectFB:
- return new DirectFBSurface (surface, true);
+ return new DirectFBSurface (surface, owned);
case SurfaceType.Svg:
- return new SvgSurface (surface, true);
-
+ return new SvgSurface (surface, owned);
default:
- return Surface.LookupExternalSurface (surface);
+ return new Surface (surface, owned);
}
}
-
+
[Obsolete ("Use an ImageSurface constructor instead.")]
- public static Cairo.Surface CreateForImage (
- ref byte[] data, Cairo.Format format, int width, int height, int stride)
- {
- IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
- data, format, width, height, stride);
-
- return new Cairo.Surface (p, true);
- }
+ public static Cairo.Surface CreateForImage (
+ ref byte[] data, Cairo.Format format, int width, int height, int stride)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create_for_data (
+ data, format, width, height, stride);
+
+ return new Cairo.Surface (p, true);
+ }
[Obsolete ("Use an ImageSurface constructor instead.")]
- public static Cairo.Surface CreateForImage (
- Cairo.Format format, int width, int height)
- {
- IntPtr p = NativeMethods.cairo_image_surface_create (
- format, width, height);
+ public static Cairo.Surface CreateForImage (
+ Cairo.Format format, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_image_surface_create (
+ format, width, height);
- return new Cairo.Surface (p, true);
- }
+ return new Cairo.Surface (p, true);
+ }
- public Cairo.Surface CreateSimilar (
- Cairo.Content content, int width, int height)
- {
- IntPtr p = NativeMethods.cairo_surface_create_similar (
- this.Handle, content, width, height);
+ public Cairo.Surface CreateSimilar (
+ Cairo.Content content, int width, int height)
+ {
+ IntPtr p = NativeMethods.cairo_surface_create_similar (
+ this.Handle, content, width, height);
- return new Cairo.Surface (p, true);
- }
+ return new Cairo.Surface (p, true);
+ }
~Surface ()
{
}
//[Obsolete ("Use Context.SetSource() followed by Context.Paint()")]
- public void Show (Context gr, double x, double y)
+ public void Show (Context gr, double x, double y)
{
- NativeMethods.cairo_set_source_surface (gr.Handle, surface, x, y);
+ NativeMethods.cairo_set_source_surface (gr.Handle, handle, x, y);
NativeMethods.cairo_paint (gr.Handle);
}
protected virtual void Dispose (bool disposing)
{
- if (surface == IntPtr.Zero)
+ if (!disposing || CairoDebug.Enabled)
+ CairoDebug.OnDisposed<Surface> (handle, disposing);
+
+ if (!disposing|| handle == IntPtr.Zero)
return;
-
- lock (surfaces.SyncRoot)
- surfaces.Remove (surface);
- NativeMethods.cairo_surface_destroy (surface);
- surface = IntPtr.Zero;
+ NativeMethods.cairo_surface_destroy (handle);
+ handle = IntPtr.Zero;
}
-
+
public Status Finish ()
{
- NativeMethods.cairo_surface_finish (surface);
+ NativeMethods.cairo_surface_finish (handle);
return Status;
}
-
+
public void Flush ()
{
- NativeMethods.cairo_surface_flush (surface);
+ NativeMethods.cairo_surface_flush (handle);
}
-
+
public void MarkDirty ()
{
NativeMethods.cairo_surface_mark_dirty (Handle);
}
-
+
public void MarkDirty (Rectangle rectangle)
{
NativeMethods.cairo_surface_mark_dirty_rectangle (Handle, (int)rectangle.X, (int)rectangle.Y, (int)rectangle.Width, (int)rectangle.Height);
}
-
- public IntPtr Handle {
- get {
- return surface;
+
+ public IntPtr Handle {
+ get {
+ return handle;
}
- }
+ }
public PointD DeviceOffset {
get {
double x, y;
- NativeMethods.cairo_surface_get_device_offset (surface, out x, out y);
+ NativeMethods.cairo_surface_get_device_offset (handle, out x, out y);
return new PointD (x, y);
}
set {
- NativeMethods.cairo_surface_set_device_offset (surface, value.X, value.Y);
+ NativeMethods.cairo_surface_set_device_offset (handle, value.X, value.Y);
}
}
-
+
+ [Obsolete ("Use Dispose()")]
public void Destroy()
{
- Dispose (true);
+ Dispose ();
}
public void SetFallbackResolution (double x, double y)
{
- NativeMethods.cairo_surface_set_fallback_resolution (surface, x, y);
+ NativeMethods.cairo_surface_set_fallback_resolution (handle, x, y);
}
public void WriteToPng (string filename)
{
- NativeMethods.cairo_surface_write_to_png (surface, filename);
+ NativeMethods.cairo_surface_write_to_png (handle, filename);
}
-
+
[Obsolete ("Use Handle instead.")]
- public IntPtr Pointer {
- get {
- return surface;
+ public IntPtr Pointer {
+ get {
+ return handle;
}
- }
-
+ }
+
public Status Status {
- get { return NativeMethods.cairo_surface_status (surface); }
+ get { return NativeMethods.cairo_surface_status (handle); }
}
public Content Content {
- get { return NativeMethods.cairo_surface_get_content (surface); }
+ get { return NativeMethods.cairo_surface_get_content (handle); }
}
public SurfaceType SurfaceType {
- get { return NativeMethods.cairo_surface_get_type (surface); }
+ get { return NativeMethods.cairo_surface_get_type (handle); }
}
public uint ReferenceCount {
- get { return NativeMethods.cairo_surface_get_reference_count (surface); }
+ get { return NativeMethods.cairo_surface_get_reference_count (handle); }
}
- }
+ }
}
-//
+//
// Mono.Cairo.Pattern.cs
//
// Author: Jordi Mas (jordi@ximian.com)
// 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
using System;
namespace Cairo {
-
+
public class SurfacePattern : Pattern
{
- internal SurfacePattern (IntPtr handle) : base (handle)
+ internal SurfacePattern (IntPtr handle, bool owned) : base (handle, owned)
{
}
public SurfacePattern (Surface surface)
+ : base (NativeMethods.cairo_pattern_create_for_surface (surface.Handle), true)
{
- pattern = NativeMethods.cairo_pattern_create_for_surface (surface.Handle);
}
- public Extend Extend {
- set { NativeMethods.cairo_pattern_set_extend (pattern, value); }
- get { return NativeMethods.cairo_pattern_get_extend (pattern); }
+ //no idea why this is here, the base one is identical, but we can't remove it now
+ public new Extend Extend {
+ set { NativeMethods.cairo_pattern_set_extend (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_extend (Handle); }
}
public Filter Filter {
- set { NativeMethods.cairo_pattern_set_filter (pattern, value); }
- get { return NativeMethods.cairo_pattern_get_filter (pattern); }
+ set { NativeMethods.cairo_pattern_set_filter (Handle, value); }
+ get { return NativeMethods.cairo_pattern_get_filter (Handle); }
}
}
}
}
public SvgSurface (string filename, double width, double height)
+ : base (NativeMethods.cairo_svg_surface_create (filename, width, height), true)
{
- surface = NativeMethods.cairo_svg_surface_create (filename, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public void RestrictToVersion (SvgVersion version)
{
- NativeMethods.cairo_svg_surface_restrict_to_version (surface, version);
+ NativeMethods.cairo_svg_surface_restrict_to_version (Handle, version);
}
}
}
}
public Win32Surface (IntPtr hdc)
+ : base (NativeMethods.cairo_win32_surface_create (hdc), true)
{
- surface = NativeMethods.cairo_win32_surface_create (hdc);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
}
-
}
}
public XcbSurface (IntPtr connection, uint drawable, IntPtr visual, int width, int height)
+ : base (NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height), true)
{
- surface = NativeMethods.cairo_xcb_surface_create (connection, drawable, visual, width, height);
- lock (surfaces.SyncRoot) {
- surfaces [surface] = this;
- }
}
public static XcbSurface FromBitmap (IntPtr connection, uint bitmap, IntPtr screen, int width, int height)
{
- IntPtr ptr;
-
- ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
+ IntPtr ptr = NativeMethods.cairo_xcb_surface_create_for_bitmap (connection, bitmap, screen, width, height);
return new XcbSurface (ptr, true);
}
public void SetSize (int width, int height)
{
- NativeMethods.cairo_xcb_surface_set_size (surface, width, height);
+ NativeMethods.cairo_xcb_surface_set_size (Handle, width, height);
}
}
}
public class XlibSurface : Surface
{
public XlibSurface (IntPtr display, IntPtr drawable, IntPtr visual, int width, int height)
+ : base (NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height), true)
{
- surface = NativeMethods.cairo_xlib_surface_create (display, drawable, visual, width, height);
- lock (surfaces.SyncRoot){
- surfaces [surface] = this;
- }
}
public XlibSurface (IntPtr ptr, bool own) : base (ptr, own)
public static XlibSurface FromBitmap (IntPtr display, IntPtr bitmap, IntPtr screen, int width, int height)
{
- IntPtr ptr;
-
- ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
+ IntPtr ptr = NativeMethods.cairo_xlib_surface_create_for_bitmap (display, bitmap, screen, width, height);
return new XlibSurface(ptr, true);
}
public void SetDrawable (IntPtr drawable, int width, int height)
{
- NativeMethods.cairo_xlib_surface_set_drawable (surface, drawable, width, height);
+ NativeMethods.cairo_xlib_surface_set_drawable (Handle, drawable, width, height);
}
public void SetSize (int width, int height)
{
- NativeMethods.cairo_xlib_surface_set_size (surface, width, height);
+ NativeMethods.cairo_xlib_surface_set_size (Handle, width, height);
}
public int Depth {
- get { return NativeMethods.cairo_xlib_surface_get_depth (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_depth (Handle); }
}
public IntPtr Display {
- get { return NativeMethods.cairo_xlib_surface_get_display (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_display (Handle); }
}
public IntPtr Drawable {
- get { return NativeMethods.cairo_xlib_surface_get_drawable (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_drawable (Handle); }
}
public int Height {
- get { return NativeMethods.cairo_xlib_surface_get_height (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_height (Handle); }
}
public IntPtr Screen {
- get { return NativeMethods.cairo_xlib_surface_get_screen (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_screen (Handle); }
}
public IntPtr Visual {
- get { return NativeMethods.cairo_xlib_surface_get_visual (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_visual (Handle); }
}
public int Width {
- get { return NativeMethods.cairo_xlib_surface_get_width (surface); }
+ get { return NativeMethods.cairo_xlib_surface_get_width (Handle); }
}
}
* with newer runtimes, and vice versa.
*/
internal const int MAJOR_VERSION = 2;
- internal const int MINOR_VERSION = 23;
+ internal const int MINOR_VERSION = 24;
enum WPSuspendPolicy {
NONE = 0,
GET_INFO = 6,
GET_BODY = 7,
RESOLVE_TOKEN = 8,
- GET_CATTRS = 9
+ GET_CATTRS = 9,
+ MAKE_GENERIC_METHOD = 10
}
enum CmdType {
return ReadCattrs (r);
}
+ internal long Method_MakeGenericMethod (long id, long[] args) {
+ PacketReader r = SendReceive (CommandSet.METHOD, (int)CmdMethod.MAKE_GENERIC_METHOD, new PacketWriter ().WriteId (id).WriteInt (args.Length).WriteIds (args));
+ return r.ReadId ();
+ }
+
/*
* THREAD
*/
public void ForceDisconnect ()
{
+ closed = true;
+ disconnected = true;
TransportClose ();
}
}
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Text;
using System.Reflection;
using C = Mono.Cecil;
return type_args;
}
+ // Since protocol version 2.24
+ public MethodMirror MakeGenericMethod (TypeMirror[] args) {
+ if (args == null)
+ throw new ArgumentNullException ("args");
+ foreach (var a in args)
+ if (a == null)
+ throw new ArgumentNullException ("args");
+
+ if (!IsGenericMethodDefinition)
+ throw new InvalidOperationException ("not a generic method definition");
+
+ if (GetGenericArguments ().Length != args.Length)
+ throw new ArgumentException ("Incorrect length");
+
+ vm.CheckProtocolVersion (2, 24);
+ long id = -1;
+ try {
+ id = vm.conn.Method_MakeGenericMethod (Id, args.Select (t => t.Id).ToArray ());
+ } catch (CommandException) {
+ throw new InvalidOperationException ();
+ }
+ return vm.GetMethod (id);
+ }
+
public IList<int> ILOffsets {
get {
if (debug_info == null)
conn.VM_Resume ();
} catch (CommandException ex) {
if (ex.ErrorCode == ErrorCode.NOT_SUSPENDED)
- throw new InvalidOperationException ("The vm is not suspended.");
+ throw new VMNotSuspendedException ();
else
throw;
}
case ErrorCode.INVALID_FRAMEID:
throw new InvalidStackFrameException ();
case ErrorCode.NOT_SUSPENDED:
- throw new InvalidOperationException ("The vm is not suspended.");
+ throw new VMNotSuspendedException ();
case ErrorCode.NOT_IMPLEMENTED:
throw new NotSupportedException ("This request is not supported by the protocol version implemented by the debuggee.");
case ErrorCode.ABSENT_INFORMATION:
get; set;
}
}
+
+ public class VMNotSuspendedException : InvalidOperationException
+ {
+ public VMNotSuspendedException () : base ("The vm is not suspended.")
+ {
+ }
+ }
}
}
}
+ public static void wait_one ()
+ {
+ ManualResetEvent evt = new ManualResetEvent (false);
+ evt.WaitOne ();
+ }
+
public static int Main (String[] args) {
tls_i = 42;
unhandled_exception_user ();
return 0;
}
+ if (args.Length >0 && args [0] == "wait-one") {
+ wait_one ();
+ return 0;
+ }
breakpoints ();
single_stepping ();
arguments ();
locals2<string> (null, 5, "ABC", ref s);
locals3 ();
locals6 ();
+ locals7<int> (22);
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void locals6_6 (int arg) {
}
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void locals7<T> (T arg) {
+ T t = arg;
+ T t2 = t;
+ }
+
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void line_numbers () {
LineNumbers.ln1 ();
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void frames_in_native () {
Thread.Sleep (500);
+ var evt = new ManualResetEvent (false);
+
object mon = new object ();
ThreadPool.QueueUserWorkItem (delegate {
frames_in_native_2 ();
- lock (mon) {
- Monitor.Pulse (mon);
- }
+ evt.Set ();
});
- lock (mon) {
- Monitor.Wait (mon);
- }
+ evt.WaitOne ();
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
set_gc_suspend_field ();
gc_suspend_1 ();
}
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ public static void generic_method<T> () where T : class {
+ }
}
class TypeLoadClass {
VirtualMachine vm;
MethodMirror entry_point;
StepEventRequest step_req;
+ bool forceExit;
void AssertThrows<ExType> (Action del) where ExType : Exception {
bool thrown = false;
return es [0];
}
- void Start (string[] args) {
+ void Start (params string[] args) {
+ Start (false, args);
+ }
+
+ void Start (bool forceExit, params string[] args) {
+ this.forceExit = forceExit;
+
if (!listening) {
var pi = new Diag.ProcessStartInfo ();
[SetUp]
public void SetUp () {
+ ThreadMirror.NativeTransitions = false;
Start (new string [] { "dtest-app.exe" });
}
step_req.Disable ();
vm.Resume ();
+ if (forceExit)
+ vm.Exit (0);
+
while (true) {
Event e = GetNextEvent ();
vm.Resume ();
}
+ vm = null;
}
[Test]
});
req.Disable ();
+
+ // gsharedvt
+ be = run_until ("locals7");
+
+ req = vm.CreateStepRequest (be.Thread);
+ req.Enable ();
+ step_req = req;
+
+ // Skip nop
+ e = step_once ();
+
+ // Test that locals are initialized
+ frame = e.Thread.GetFrames () [0];
+ val = frame.GetValue (frame.Method.GetLocal ("t"));
+ AssertValue (0, val);
+
+ // Execute t = arg
+ e = step_once ();
+ Assert.AreEqual ("locals7", (e as StepEvent).Method.Name);
+
+ // Execute t2 = t
+ e = step_once ();
+ Assert.AreEqual ("locals7", (e as StepEvent).Method.Name);
+
+ frame = e.Thread.GetFrames () [0];
+ val = frame.GetValue (frame.Method.GetParameters ()[0]);
+ AssertValue (22, val);
+ val = frame.GetValue (frame.Method.GetLocal ("t"));
+ AssertValue (22, val);
+ val = frame.GetValue (frame.Method.GetLocal ("t2"));
+ AssertValue (22, val);
}
[Test]
var o2 = entry_point.DeclaringType.GetValue (entry_point.DeclaringType.GetField ("gc_suspend_field")) as ObjectMirror;
Assert.IsNull (o2);
}
+
+ [Test]
+ public void MakeGenericMethod () {
+ Event e = run_until ("bp1");
+
+ var intm = vm.RootDomain.GetCorrespondingType (typeof (int));
+ var stringm = vm.RootDomain.GetCorrespondingType (typeof (string));
+ var gm = entry_point.DeclaringType.GetMethod ("generic_method");
+ var res = gm.MakeGenericMethod (new TypeMirror [] { stringm });
+ var args = res.GetGenericArguments ();
+ Assert.AreEqual (1, args.Length);
+ Assert.AreEqual (stringm, args [0]);
+
+ // Error checking
+ AssertThrows<ArgumentNullException> (delegate {
+ gm.MakeGenericMethod (null);
+ });
+ AssertThrows<ArgumentNullException> (delegate {
+ gm.MakeGenericMethod (new TypeMirror [] { null });
+ });
+ AssertThrows<ArgumentException> (delegate {
+ gm.MakeGenericMethod (new TypeMirror [] { stringm, stringm });
+ });
+ AssertThrows<InvalidOperationException> (delegate {
+ gm.MakeGenericMethod (new TypeMirror [] { intm });
+ });
+ AssertThrows<InvalidOperationException> (delegate {
+ entry_point.DeclaringType.GetMethod ("Main").MakeGenericMethod (new TypeMirror [] { intm });
+ });
+ }
+
+ [Test]
+ public void InspectThreadSuspenedOnWaitOne () {
+ TearDown ();
+ Start (true, "dtest-app.exe", "wait-one" );
+
+ ThreadMirror.NativeTransitions = true;
+
+ var evt = run_until ("wait_one");
+ Assert.IsNotNull (evt, "#1");
+
+ var thread = evt.Thread;
+ Assert.AreEqual (ThreadState.Running, thread.ThreadState, "#1.1");
+
+ var frames = thread.GetFrames ();
+ Assert.IsNotNull (frames, "#2");
+ Assert.AreEqual (2, frames.Length, "#3");
+ Assert.AreEqual ("wait_one", frames [0].Method.Name, "#4");
+ Assert.AreEqual ("Main", frames [1].Method.Name, "#5");
+
+ vm.Resume ();
+
+ Thread.Sleep (500); //FIXME this is racy, maybe single step? or something?
+
+ vm.Suspend ();
+ Assert.AreEqual (ThreadState.WaitSleepJoin, thread.ThreadState, "#6");
+
+ frames = thread.GetFrames ();
+ Assert.AreEqual (4, frames.Length, "#7");
+ Assert.AreEqual ("WaitOne_internal", frames [0].Method.Name, "#8");
+ Assert.AreEqual ("WaitOne", frames [1].Method.Name, "#8.1");
+ Assert.AreEqual ("wait_one", frames [2].Method.Name, "#9");
+ Assert.AreEqual ("Main", frames [3].Method.Name, "#10");
+
+
+ var frame = frames [0];
+ Assert.IsTrue (frame.IsNativeTransition, "#11.1");
+ try {
+ frame.GetThis ();
+ Assert.Fail ("Known limitation - can't get info from m2n frames");
+ } catch (AbsentInformationException) {}
+
+ frame = frames [1];
+ Assert.IsFalse (frame.IsNativeTransition, "#12.1");
+ var wait_one_this = frame.GetThis ();
+ Assert.IsNotNull (wait_one_this, "#12.2");
+
+ frame = frames [2];
+ var locals = frame.GetVisibleVariables ();
+ Assert.AreEqual (1, locals.Count, "#13.1");
+
+ var local_0 = frame.GetValue (locals [0]);
+ Assert.IsNotNull (local_0, "#13.2");
+
+ Assert.AreEqual (wait_one_this, local_0, "#14.2");
+ }
}
}
return '-';
}
+ public static readonly DateTime UnixEpoch =
+ new DateTime (year:1970, month:1, day:1, hour:0, minute:0, second:0, kind:DateTimeKind.Utc);
public static readonly DateTime LocalUnixEpoch =
new DateTime (1970, 1, 1);
public static readonly TimeSpan LocalUtcOffset =
public static DateTime FromTimeT (long time)
{
- DateTime r = LocalUnixEpoch.AddSeconds ((double) time +
- LocalUtcOffset.TotalSeconds);
- return r;
+ return UnixEpoch.AddSeconds (time).ToLocalTime ();
}
public static long ToTimeT (DateTime time)
{
- TimeSpan unixTime = time.Subtract (LocalUnixEpoch) - LocalUtcOffset;
- return (long) unixTime.TotalSeconds;
+ if (time.Kind == DateTimeKind.Unspecified)
+ throw new ArgumentException ("DateTimeKind.Unspecified is not supported. Use Local or Utc times.", "time");
+
+ if (time.Kind == DateTimeKind.Local)
+ time = time.ToUniversalTime ();
+
+ return (long) (time - UnixEpoch).TotalSeconds;
}
public static OpenFlags ToOpenFlags (FileMode mode, FileAccess access)
public class Catalog {
private Catalog () {}
- [DllImport("intl")]
+ [DllImport("intl", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr bindtextdomain (IntPtr domainname, IntPtr dirname);
- [DllImport("intl")]
+ [DllImport("intl", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr bind_textdomain_codeset (IntPtr domainname,
IntPtr codeset);
- [DllImport("intl")]
+ [DllImport("intl", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr textdomain (IntPtr domainname);
public static void Init (String package, String localedir)
}
}
- [DllImport("intl")]
+ [DllImport("intl", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr gettext (IntPtr instring);
public static String GetString (String s)
}
}
- [DllImport("intl")]
+ [DllImport("intl", CallingConvention=CallingConvention.Cdecl)]
static extern IntPtr ngettext (IntPtr singular, IntPtr plural, Int32 n);
public static String GetPluralString (String s, String p, Int32 n)
HashAlgorithm ha = null;
switch (signedHash.Length) {
case 16:
- ha = HashAlgorithm.Create ("MD5");
+ ha = MD5.Create ();
hash = GetHash (ha);
break;
case 20:
- ha = HashAlgorithm.Create ("SHA1");
+ ha = SHA1.Create ();
hash = GetHash (ha);
break;
default:
// a. Usenet 1994 - RC4 Algorithm revealed
// http://www.qrst.de/html/dsds/rc4.htm
-#if INSIDE_SYSTEM
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
class ARC4Managed : RC4, ICryptoTransform {
namespace Mono.Security.Cryptography {
- public abstract class MD2 : HashAlgorithm {
+#if !INSIDE_CORLIB
+ public
+#endif
+ abstract class MD2 : HashAlgorithm {
protected MD2 ()
{
public static new MD2 Create ()
{
+#if FULL_AOT_RUNTIME
+ return new MD2Managed ();
+#else
// for this to work we must register ourself with CryptoConfig
return Create ("MD2");
+#endif
}
public static new MD2 Create (string hashName)
// a. RFC1319: The MD2 Message-Digest Algorithm
// http://www.ietf.org/rfc/rfc1319.txt
- public class MD2Managed : MD2 {
+#if !INSIDE_CORLIB
+ public
+#endif
+ class MD2Managed : MD2 {
private byte[] state;
private byte[] checksum;
namespace Mono.Security.Cryptography {
-#if INSIDE_SYSTEM
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
abstract class MD4 : HashAlgorithm {
// a. RFC1320: The MD4 Message-Digest Algorithm
// http://www.ietf.org/rfc/rfc1320.txt
-#if INSIDE_SYSTEM
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
class MD4Managed : MD4 {
// PKCS1.cs - Implements PKCS#1 primitives.
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@xamarin.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
+// Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
byte[] S = I2OSP (s, size);
return S;
}
-
+
+ internal static byte[] Sign_v15 (RSA rsa, string hashName, byte[] hashValue)
+ {
+ using (var hash = CreateFromName (hashName))
+ return Sign_v15 (rsa, hash, hashValue);
+ }
+
// PKCS #1 v.2.1, Section 8.2.2
// RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
public static bool Verify_v15 (RSA rsa, HashAlgorithm hash, byte[] hashValue, byte[] signature)
return Verify_v15 (rsa, hash, hashValue, signature, false);
}
+ internal static bool Verify_v15 (RSA rsa, string hashName, byte[] hashValue, byte[] signature)
+ {
+ using (var hash = CreateFromName (hashName))
+ return Verify_v15 (rsa, hash, hashValue, signature, false);
+ }
+
// DO NOT USE WITHOUT A VERY GOOD REASON
public static bool Verify_v15 (RSA rsa, HashAlgorithm hash, byte [] hashValue, byte [] signature, bool tryNonStandardEncoding)
{
Buffer.BlockCopy (T, 0, mask, 0, maskLen);
return mask;
}
+
+ static internal string HashNameFromOid (string oid, bool throwOnError = true)
+ {
+ switch (oid) {
+ case "1.2.840.113549.1.1.2": // MD2 with RSA encryption
+ return "MD2";
+ case "1.2.840.113549.1.1.3": // MD4 with RSA encryption
+ return "MD4";
+ case "1.2.840.113549.1.1.4": // MD5 with RSA encryption
+ return "MD5";
+ case "1.2.840.113549.1.1.5": // SHA-1 with RSA Encryption
+ case "1.3.14.3.2.29": // SHA1 with RSA signature
+ case "1.2.840.10040.4.3": // SHA1-1 with DSA
+ return "SHA1";
+ case "1.2.840.113549.1.1.11": // SHA-256 with RSA Encryption
+ return "SHA256";
+ case "1.2.840.113549.1.1.12": // SHA-384 with RSA Encryption
+ return "SHA384";
+ case "1.2.840.113549.1.1.13": // SHA-512 with RSA Encryption
+ return "SHA512";
+ case "1.3.36.3.3.1.2":
+ return "RIPEMD160";
+ default:
+ if (throwOnError)
+ throw new CryptographicException ("Unsupported hash algorithm: " + oid);
+ return null;
+ }
+ }
+
+ static internal HashAlgorithm CreateFromOid (string oid)
+ {
+ return CreateFromName (HashNameFromOid (oid));
+ }
+
+ static internal HashAlgorithm CreateFromName (string name)
+ {
+#if FULL_AOT_RUNTIME
+ switch (name) {
+ case "MD2":
+ return MD2.Create ();
+ case "MD4":
+ return MD4.Create ();
+ case "MD5":
+ return MD5.Create ();
+ case "SHA1":
+ return SHA1.Create ();
+ case "SHA256":
+ return SHA256.Create ();
+ case "SHA384":
+ return SHA384.Create ();
+ case "SHA512":
+ return SHA512.Create ();
+ case "RIPEMD160":
+ return RIPEMD160.Create ();
+ default:
+ try {
+ return (HashAlgorithm) Activator.CreateInstance (Type.GetType (name));
+ }
+ catch {
+ throw new CryptographicException ("Unsupported hash algorithm: " + name);
+ }
+ }
+#else
+ return HashAlgorithm.Create (name);
+#endif
+ }
}
}
// ftp://ftp.rsasecurity.com/pub/pkcs/doc/pkcs-8.doc
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@xamarin.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com)
+// Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System;
using System.Collections;
using System.Security.Cryptography;
-using System.Text;
using Mono.Security.X509;
namespace Mono.Security.Cryptography {
-#if INSIDE_CORLIB
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
sealed class PKCS8 {
rsa.ImportParameters (param);
}
catch (CryptographicException) {
+#if MONOTOUCH
+ // there's no machine-wide store available for iOS so we can drop the dependency on
+ // CspParameters (which drops other things, like XML key persistance, unless used elsewhere)
+ throw;
+#else
// this may cause problem when this code is run under
// the SYSTEM identity on Windows (e.g. ASP.NET). See
// http://bugzilla.ximian.com/show_bug.cgi?id=77559
csp.Flags = CspProviderFlags.UseMachineKeyStore;
rsa = new RSACryptoServiceProvider (csp);
rsa.ImportParameters (param);
+#endif
}
return rsa;
}
namespace Mono.Security.Cryptography {
-#if INSIDE_SYSTEM
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
abstract class RC4 : SymmetricAlgorithm {
this.Initialize();
}
- public HMAC(string hashName, byte[] rgbKey)
+ public HMAC (HashAlgorithm ha, byte[] rgbKey)
{
- // Create the hash
- if (hashName == null || hashName.Length == 0)
- {
- hashName = "MD5";
- }
- hash = HashAlgorithm.Create(hashName);
+ hash = ha;
// Set HashSizeValue
HashSizeValue = hash.HashSize;
}
}
+ internal HashAlgorithm CreateHashAlgorithm ()
+ {
+ switch (hashAlgorithmType) {
+ case HashAlgorithmType.Md5:
+ return MD5.Create ();
+ case HashAlgorithmType.Sha1:
+ return SHA1.Create ();
+ default:
+ return null;
+ }
+ }
+
public HashAlgorithmType HashAlgorithmType
{
get { return this.hashAlgorithmType; }
Buffer.BlockCopy(secret, (secret.Length - secretLen), secret2, 0, secretLen);
// Secret 1 processing
- byte[] p_md5 = Expand("MD5", secret1, seed, length);
+ byte[] p_md5 = Expand (MD5.Create (), secret1, seed, length);
// Secret 2 processing
- byte[] p_sha = Expand("SHA1", secret2, seed, length);
+ byte[] p_sha = Expand (SHA1.Create (), secret2, seed, length);
// Perfor XOR of both results
byte[] masterSecret = new byte[length];
return masterSecret;
}
- public byte[] Expand(string hashName, byte[] secret, byte[] seed, int length)
+ public byte[] Expand (HashAlgorithm hash, byte[] secret, byte[] seed, int length)
{
- int hashLength = hashName == "MD5" ? 16 : 20;
+ int hashLength = hash.HashSize / 8;
int iterations = (int)(length / hashLength);
if ((length % hashLength) > 0)
{
iterations++;
}
- M.HMAC hmac = new M.HMAC(hashName, secret);
+ M.HMAC hmac = new M.HMAC (hash, secret);
TlsStream resMacs = new TlsStream();
byte[][] hmacs = new byte[iterations + 1][];
if (this.context is ClientContext)
{
this.clientHMAC = new M.HMAC(
- this.HashAlgorithmName,
+ CreateHashAlgorithm (),
this.context.Negotiating.ClientWriteMAC);
}
else
{
this.serverHMAC = new M.HMAC(
- this.HashAlgorithmName,
+ CreateHashAlgorithm (),
this.context.Negotiating.ServerWriteMAC);
}
}
if (this.context is ClientContext)
{
this.serverHMAC = new M.HMAC(
- this.HashAlgorithmName,
+ CreateHashAlgorithm (),
this.context.Negotiating.ServerWriteMAC);
}
else
{
this.clientHMAC = new M.HMAC(
- this.HashAlgorithmName,
+ CreateHashAlgorithm (),
this.context.Negotiating.ClientWriteMAC);
}
}
public override byte[] ComputeServerRecordMAC(ContentType contentType, byte[] fragment)
{
- HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName);
+ HashAlgorithm hash = CreateHashAlgorithm ();
byte[] smac = this.Context.Read.ServerWriteMAC;
hash.TransformBlock (smac, 0, smac.Length, smac, 0);
public override byte[] ComputeClientRecordMAC(ContentType contentType, byte[] fragment)
{
- HashAlgorithm hash = HashAlgorithm.Create(this.HashAlgorithmName);
+ HashAlgorithm hash = CreateHashAlgorithm ();
byte[] cmac = this.Context.Current.ClientWriteMAC;
hash.TransformBlock (cmac, 0, cmac.Length, cmac, 0);
public SslHandshakeHash(byte[] secret)
{
// Create md5 and sha1 hashes
- this.md5 = HashAlgorithm.Create("MD5");
- this.sha = HashAlgorithm.Create("SHA1");
+ this.md5 = MD5.Create ();
+ this.sha = SHA1.Create ();
// Set HashSizeValue
this.HashSizeValue = md5.HashSize + sha.HashSize;
// PKCS12.cs: PKCS 12 - Personal Information Exchange Syntax
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@xamarin.com>
//
// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004,2005,2006 Novell Inc. (http://www.novell.com)
+// Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
//
// Key derivation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
// See bouncycastle.txt for license.
private byte[] Derive (byte[] diversifier, int n)
{
- HashAlgorithm digest = HashAlgorithm.Create (_hashName);
+ HashAlgorithm digest = PKCS1.CreateFromName (_hashName);
int u = (digest.HashSize >> 3); // div 8
int v = 64;
byte[] dKey = new byte [n];
throw new NotSupportedException ("unknown oid " + algorithm);
}
- SymmetricAlgorithm sa = SymmetricAlgorithm.Create (algorithm);
+ SymmetricAlgorithm sa = null;
+#if INSIDE_CORLIB && FULL_AOT_RUNTIME
+ // we do not want CryptoConfig to bring the whole crypto stack
+ // in particular Rijndael which is not supported by CommonCrypto
+ switch (algorithm) {
+ case "DES":
+ sa = DES.Create ();
+ break;
+ case "RC2":
+ sa = RC2.Create ();
+ break;
+ case "TripleDES":
+ sa = TripleDES.Create ();
+ break;
+ case "RC4":
+ sa = RC4.Create ();
+ break;
+ default:
+ throw new NotSupportedException (algorithm);
+ }
+#else
+ sa = SymmetricAlgorithm.Create (algorithm);
+#endif
sa.Key = pd.DeriveKey (keyLength);
// IV required only for block ciphers (not stream ciphers)
if (ivLength > 0) {
// X509CRL.cs: Handles X.509 certificates revocation lists.
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@xamarin.com>
//
// Copyright (C) 2004,2006 Novell Inc. (http://www.novell.com)
+// Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using System.IO;
using System.Security.Cryptography;
+using Mono.Security.Cryptography;
using Mono.Security.X509.Extensions;
namespace Mono.Security.X509 {
* crlExtensions [0] Extensions OPTIONAL }
* -- if present, MUST be v2
*/
-#if INSIDE_CORLIB
- internal
-#else
+#if !INSIDE_CORLIB
public
#endif
class X509Crl {
if (hash_value == null) {
ASN1 encodedCRL = new ASN1 (encoded);
byte[] toBeSigned = encodedCRL [0].GetBytes ();
- HashAlgorithm ha = HashAlgorithm.Create (GetHashName ());
- hash_value = ha.ComputeHash (toBeSigned);
+ using (var ha = PKCS1.CreateFromOid (signatureOID))
+ hash_value = ha.ComputeHash (toBeSigned);
}
return hash_value;
}
}
}
- private string GetHashName ()
- {
- switch (signatureOID) {
- // MD2 with RSA encryption
- case "1.2.840.113549.1.1.2":
- // maybe someone installed MD2 ?
- return "MD2";
- // MD5 with RSA encryption
- case "1.2.840.113549.1.1.4":
- return "MD5";
- // SHA-1 with DSA
- case "1.2.840.10040.4.3":
- // SHA-1 with RSA Encryption
- case "1.2.840.113549.1.1.5":
- return "SHA1";
- default:
- throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID);
- }
- }
-
internal bool VerifySignature (DSA dsa)
{
if (signatureOID != "1.2.840.10040.4.3")
internal bool VerifySignature (RSA rsa)
{
RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa);
- v.SetHashAlgorithm (GetHashName ());
+ v.SetHashAlgorithm (PKCS1.HashNameFromOid (signatureOID));
return v.VerifySignature (Hash, signature);
}
// X509Certificates.cs: Handles X.509 certificates.
//
// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
+// Sebastien Pouliot <sebastien@xamarin.com>
//
// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
+// Copyright 2013 Xamarin Inc. (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
using SSCX = System.Security.Cryptography.X509Certificates;
using System.Security.Permissions;
using System.Text;
+using Mono.Security.Cryptography;
namespace Mono.Security.X509 {
public byte[] Hash {
get {
if (certhash == null) {
- HashAlgorithm hash = null;
- switch (m_signaturealgo) {
- case "1.2.840.113549.1.1.2": // MD2 with RSA encryption
- // maybe someone installed MD2 ?
-#if INSIDE_CORLIB
- hash = HashAlgorithm.Create ("MD2");
-#else
- hash = Mono.Security.Cryptography.MD2.Create ();
-#endif
- break;
- case "1.2.840.113549.1.1.3": // MD4 with RSA encryption
- // maybe someone installed MD4 ?
-#if INSIDE_CORLIB
- hash = HashAlgorithm.Create ("MD4");
-#else
- hash = Mono.Security.Cryptography.MD4.Create ();
-#endif
- break;
- case "1.2.840.113549.1.1.4": // MD5 with RSA encryption
- hash = MD5.Create ();
- break;
- case "1.2.840.113549.1.1.5": // SHA-1 with RSA Encryption
- case "1.3.14.3.2.29": // SHA1 with RSA signature
- case "1.2.840.10040.4.3": // SHA1-1 with DSA
- hash = SHA1.Create ();
- break;
- case "1.2.840.113549.1.1.11": // SHA-256 with RSA Encryption
- hash = SHA256.Create ();
- break;
- case "1.2.840.113549.1.1.12": // SHA-384 with RSA Encryption
- hash = SHA384.Create ();
- break;
- case "1.2.840.113549.1.1.13": // SHA-512 with RSA Encryption
- hash = SHA512.Create ();
- break;
- default:
- return null;
- }
if ((decoder == null) || (decoder.Count < 1))
return null;
+ string algo = PKCS1.HashNameFromOid (m_signaturealgo, false);
+ if (algo == null)
+ return null;
byte[] toBeSigned = decoder [0].GetBytes ();
- certhash = hash.ComputeHash (toBeSigned, 0, toBeSigned.Length);
+ using (var hash = PKCS1.CreateFromName (algo))
+ certhash = hash.ComputeHash (toBeSigned, 0, toBeSigned.Length);
}
return (byte[]) certhash.Clone ();
}
case "1.2.840.113549.1.1.11": // SHA-256 with RSA Encryption
case "1.2.840.113549.1.1.12": // SHA-384 with RSA Encryption
case "1.2.840.113549.1.1.13": // SHA-512 with RSA Encryption
+ case "1.3.36.3.3.1.2": // RIPEMD160 with RSA Encryption
return (byte[]) signature.Clone ();
case "1.2.840.10040.4.3": // SHA-1 with DSA
internal bool VerifySignature (RSA rsa)
{
+ // SHA1-1 with DSA
+ if (m_signaturealgo == "1.2.840.10040.4.3")
+ return false;
RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa);
- switch (m_signaturealgo) {
- // MD2 with RSA encryption
- case "1.2.840.113549.1.1.2":
- // maybe someone installed MD2 ?
- v.SetHashAlgorithm ("MD2");
- break;
- // MD4 with RSA encryption
- case "1.2.840.113549.1.1.3":
- // maybe someone installed MD4 ?
- v.SetHashAlgorithm ("MD4");
- break;
- // MD5 with RSA encryption
- case "1.2.840.113549.1.1.4":
- v.SetHashAlgorithm ("MD5");
- break;
- // SHA-1 with RSA Encryption
- case "1.2.840.113549.1.1.5":
- case "1.3.14.3.2.29":
- v.SetHashAlgorithm ("SHA1");
- break;
- // SHA-256 with RSA Encryption
- case "1.2.840.113549.1.1.11":
- v.SetHashAlgorithm ("SHA256");
- break;
- // SHA-384 with RSA Encryption
- case "1.2.840.113549.1.1.12":
- v.SetHashAlgorithm ("SHA384");
- break;
- // SHA-512 with RSA Encryption
- case "1.2.840.113549.1.1.13":
- v.SetHashAlgorithm ("SHA512");
- break;
- // SHA1-1 with DSA
- case "1.2.840.10040.4.3":
- // invalid but this can occurs when building a bad chain - e.g. missing certificate(s)
- // we return false so we can report the "chain" error to the user (not an exception)
- return false;
- default:
- throw new CryptographicException ("Unsupported hash algorithm: " + m_signaturealgo);
- }
+ v.SetHashAlgorithm (PKCS1.HashNameFromOid (m_signaturealgo));
return v.VerifySignature (this.Hash, this.Signature);
}
return Convert.FromBase64String (base64);
}
}
-}
+}
\ No newline at end of file
// http://wp.netscape.com/eng/ssl3/traces/trc-clnt-ex.html
[TestFixture]
- public class ARC4ManagedTest : Assertion {
+ public class ARC4ManagedTest {
// because most crypto stuff works with byte[] buffers
static public void AssertEquals (string msg, byte[] array1, byte[] array2)
if ((array1 == null) && (array2 == null))
return;
if (array1 == null)
- Fail (msg + " -> First array is NULL");
+ Assert.Fail (msg + " -> First array is NULL");
if (array2 == null)
- Fail (msg + " -> Second array is NULL");
+ Assert.Fail (msg + " -> Second array is NULL");
bool a = (array1.Length == array2.Length);
if (a) {
}
msg += " -> Expected " + BitConverter.ToString (array1, 0);
msg += " is different than " + BitConverter.ToString (array2, 0);
- Assert (msg, a);
+ Assert.IsTrue (a, msg);
}
// from ref. a
public void DefaultProperties ()
{
ARC4Managed rc4 = new ARC4Managed ();
- Assert ("CanReuseTransform", !rc4.CanReuseTransform);
- Assert ("CanTransformMultipleBlocks", rc4.CanTransformMultipleBlocks);
- AssertEquals ("InputBlockSize", 1, rc4.InputBlockSize);
- AssertEquals ("OutputBlockSize", 1, rc4.OutputBlockSize);
+ Assert.IsFalse (rc4.CanReuseTransform, "CanReuseTransform");
+ Assert.IsTrue (rc4.CanTransformMultipleBlocks, "CanTransformMultipleBlocks");
+ Assert.AreEqual (1, rc4.InputBlockSize, "InputBlockSize");
+ Assert.AreEqual (1, rc4.OutputBlockSize, "OutputBlockSize");
}
[Test]
ARC4Managed rc4 = new ARC4Managed ();
rc4.GenerateKey ();
rc4.GenerateIV ();
- AssertEquals ("Key.Length", 16, rc4.Key.Length);
- AssertEquals ("KeySize", 128, rc4.KeySize);
- AssertEquals ("IV.Length", 0, rc4.IV.Length);
+ Assert.AreEqual (16, rc4.Key.Length, "Key.Length");
+ Assert.AreEqual (128, rc4.KeySize, "KeySize");
+ Assert.AreEqual (0, rc4.IV.Length, "IV.Length");
}
[Test]
{
// try creating ourselve using Create
HashAlgorithm h = MD2.Create ("MD2Managed");
- Assert ("MD2Managed", (h is MD2Managed));
+ Assert.IsTrue ((h is MD2Managed), "MD2Managed");
}
}
-}
\ No newline at end of file
+}
// MD2 is a abstract class - so ALL of the test included here wont be tested
// on the abstract class but should be tested in ALL its descendants.
- public abstract class MD2Test : Assertion {
+ public abstract class MD2Test {
protected MD2 hash;
+ static void Fail (string msg)
+ {
+ Assert.Fail (msg);
+ }
+
+ static void AssertEquals (string msg, int expected, int actual)
+ {
+ Assert.AreEqual (expected, actual, msg);
+ }
+
// because most crypto stuff works with byte[] buffers
static public void AssertEquals (string msg, byte[] array1, byte[] array2)
{
msg += " -> Expected " + BitConverter.ToString (array1, 0);
msg += " is different than " + BitConverter.ToString (array2, 0);
}
- Assert (msg, a);
+ Assert.IsTrue (a, msg);
}
// MD2 ("") = 8350e5a3e24c153df2275c9f80692773
{
// create the default implementation
HashAlgorithm h = MD2.Create ();
- Assert ("MD2Managed", (h is MD2Managed));
+ Assert.IsTrue ((h is MD2Managed), "MD2Managed");
// Note: will fail is default is changed in machine.config
}
}
{
// try creating ourselve using Create
HashAlgorithm h = MD4.Create ("MD4Managed");
- Assert ("MD4Managed", (h is MD4Managed));
+ Assert.IsTrue ((h is MD4Managed), "MD4Managed");
}
}
-}
\ No newline at end of file
+}
// MD4 is a abstract class - so ALL of the test included here wont be tested
// on the abstract class but should be tested in ALL its descendants.
- public abstract class MD4Test : Assertion {
+ public abstract class MD4Test {
protected MD4 hash;
+ static void AssertEquals (string msg, int expected, int actual)
+ {
+ Assert.AreEqual (expected, actual, msg);
+ }
+
// because most crypto stuff works with byte[] buffers
static public void AssertEquals (string msg, byte[] array1, byte[] array2)
{
if ((array1 == null) && (array2 == null))
return;
if (array1 == null)
- Assertion.Fail (msg + " -> First array is NULL");
+ Assert.Fail (msg + " -> First array is NULL");
if (array2 == null)
- Assertion.Fail (msg + " -> Second array is NULL");
+ Assert.Fail (msg + " -> Second array is NULL");
bool a = (array1.Length == array2.Length);
if (a) {
msg += " -> Expected " + BitConverter.ToString (array1, 0);
msg += " is different than " + BitConverter.ToString (array2, 0);
}
- Assertion.Assert (msg, a);
+ Assert.IsTrue (a, msg);
}
// MD4 ("") = 31d6cfe0d16ae931b73c59d7e0c089c0
{
// create the default implementation
HashAlgorithm h = MD4.Create ();
- Assert ("MD4Managed", (h is MD4Managed));
+ Assert.IsTrue ((h is MD4Managed), "MD4Managed");
// Note: will fail is default is changed in machine.config
}
}
Assert.AreEqual (630663336000000000, cert.ValidFrom.Ticks, "ValidFrom");
Assert.AreEqual (633912839400000000, cert.ValidUntil.Ticks, "ValidUntil");
}
+
+ byte[] sha256_data = {
+ 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x42, 0x45, 0x47, 0x49, 0x4E, 0x20, 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41,
+ 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0D, 0x0A, 0x4D, 0x49, 0x49, 0x43, 0x78, 0x44, 0x43, 0x43, 0x41, 0x61, 0x79,
+ 0x67, 0x41, 0x77, 0x49, 0x42, 0x41, 0x67, 0x49, 0x44, 0x41, 0x4B, 0x37, 0x6C, 0x4D, 0x41, 0x30, 0x47, 0x43, 0x53, 0x71,
+ 0x47, 0x53, 0x49, 0x62, 0x33, 0x44, 0x51, 0x45, 0x42, 0x43, 0x77, 0x55, 0x41, 0x4D, 0x43, 0x34, 0x78, 0x43, 0x7A, 0x41,
+ 0x4A, 0x42, 0x67, 0x4E, 0x56, 0x42, 0x41, 0x59, 0x54, 0x41, 0x6B, 0x4E, 0x61, 0x0D, 0x0A, 0x4D, 0x51, 0x34, 0x77, 0x44,
+ 0x41, 0x59, 0x44, 0x56, 0x51, 0x51, 0x4B, 0x45, 0x77, 0x56, 0x53, 0x5A, 0x57, 0x4A, 0x6C, 0x65, 0x44, 0x45, 0x50, 0x4D,
+ 0x41, 0x30, 0x47, 0x41, 0x31, 0x55, 0x45, 0x41, 0x78, 0x4D, 0x47, 0x56, 0x47, 0x56, 0x7A, 0x64, 0x45, 0x4E, 0x42, 0x4D,
+ 0x42, 0x34, 0x58, 0x44, 0x54, 0x45, 0x7A, 0x4D, 0x44, 0x55, 0x78, 0x4F, 0x54, 0x45, 0x79, 0x4E, 0x44, 0x63, 0x31, 0x0D,
+ 0x0A, 0x4E, 0x31, 0x6F, 0x58, 0x44, 0x54, 0x51, 0x35, 0x4D, 0x54, 0x49, 0x7A, 0x4D, 0x54, 0x41, 0x77, 0x4D, 0x44, 0x41,
+ 0x77, 0x4D, 0x46, 0x6F, 0x77, 0x4F, 0x6A, 0x45, 0x57, 0x4D, 0x42, 0x51, 0x47, 0x41, 0x31, 0x55, 0x45, 0x41, 0x78, 0x4D,
+ 0x4E, 0x55, 0x6D, 0x56, 0x69, 0x5A, 0x58, 0x67, 0x67, 0x55, 0x33, 0x56, 0x77, 0x63, 0x47, 0x39, 0x79, 0x64, 0x44, 0x45,
+ 0x67, 0x4D, 0x42, 0x34, 0x47, 0x0D, 0x0A, 0x43, 0x53, 0x71, 0x47, 0x53, 0x49, 0x62, 0x33, 0x44, 0x51, 0x45, 0x4A, 0x41,
+ 0x52, 0x59, 0x52, 0x63, 0x33, 0x56, 0x77, 0x63, 0x47, 0x39, 0x79, 0x64, 0x45, 0x42, 0x79, 0x5A, 0x57, 0x4A, 0x6C, 0x65,
+ 0x43, 0x35, 0x75, 0x5A, 0x58, 0x51, 0x77, 0x67, 0x5A, 0x38, 0x77, 0x44, 0x51, 0x59, 0x4A, 0x4B, 0x6F, 0x5A, 0x49, 0x68,
+ 0x76, 0x63, 0x4E, 0x41, 0x51, 0x45, 0x42, 0x42, 0x51, 0x41, 0x44, 0x0D, 0x0A, 0x67, 0x59, 0x30, 0x41, 0x4D, 0x49, 0x47,
+ 0x4A, 0x41, 0x6F, 0x47, 0x42, 0x41, 0x4B, 0x7A, 0x36, 0x49, 0x37, 0x49, 0x59, 0x4E, 0x4A, 0x4C, 0x44, 0x43, 0x36, 0x42,
+ 0x79, 0x44, 0x32, 0x75, 0x59, 0x36, 0x69, 0x55, 0x61, 0x34, 0x30, 0x54, 0x34, 0x37, 0x34, 0x44, 0x41, 0x65, 0x59, 0x55,
+ 0x49, 0x31, 0x37, 0x43, 0x79, 0x39, 0x55, 0x6B, 0x77, 0x62, 0x4E, 0x4D, 0x2B, 0x6B, 0x39, 0x62, 0x57, 0x0D, 0x0A, 0x68,
+ 0x75, 0x46, 0x62, 0x65, 0x63, 0x56, 0x42, 0x6D, 0x43, 0x37, 0x42, 0x79, 0x31, 0x6C, 0x48, 0x65, 0x2B, 0x79, 0x41, 0x59,
+ 0x59, 0x78, 0x78, 0x74, 0x47, 0x50, 0x7A, 0x41, 0x48, 0x58, 0x50, 0x76, 0x68, 0x4A, 0x4D, 0x56, 0x50, 0x41, 0x2F, 0x37,
+ 0x4C, 0x36, 0x41, 0x4B, 0x58, 0x6D, 0x6A, 0x71, 0x69, 0x77, 0x78, 0x7A, 0x47, 0x51, 0x79, 0x30, 0x73, 0x59, 0x67, 0x2F,
+ 0x6A, 0x36, 0x79, 0x0D, 0x0A, 0x6F, 0x58, 0x39, 0x36, 0x39, 0x52, 0x53, 0x30, 0x49, 0x58, 0x33, 0x75, 0x33, 0x64, 0x31,
+ 0x72, 0x35, 0x61, 0x6F, 0x44, 0x76, 0x36, 0x4A, 0x58, 0x53, 0x69, 0x53, 0x73, 0x75, 0x67, 0x78, 0x56, 0x47, 0x69, 0x65,
+ 0x54, 0x53, 0x2F, 0x50, 0x71, 0x55, 0x6E, 0x6E, 0x76, 0x72, 0x49, 0x74, 0x59, 0x78, 0x6F, 0x64, 0x4F, 0x31, 0x58, 0x79,
+ 0x76, 0x41, 0x67, 0x4D, 0x42, 0x41, 0x41, 0x47, 0x6A, 0x0D, 0x0A, 0x59, 0x7A, 0x42, 0x68, 0x4D, 0x41, 0x34, 0x47, 0x41,
+ 0x31, 0x55, 0x64, 0x44, 0x77, 0x45, 0x42, 0x2F, 0x77, 0x51, 0x45, 0x41, 0x77, 0x49, 0x45, 0x38, 0x44, 0x41, 0x64, 0x42,
+ 0x67, 0x4E, 0x56, 0x48, 0x51, 0x34, 0x45, 0x46, 0x67, 0x51, 0x55, 0x66, 0x75, 0x52, 0x51, 0x78, 0x4E, 0x75, 0x59, 0x71,
+ 0x77, 0x73, 0x38, 0x56, 0x48, 0x7A, 0x4A, 0x6D, 0x4A, 0x50, 0x6F, 0x39, 0x41, 0x45, 0x6F, 0x0D, 0x0A, 0x6F, 0x50, 0x77,
+ 0x77, 0x44, 0x77, 0x59, 0x44, 0x56, 0x52, 0x30, 0x6C, 0x42, 0x41, 0x67, 0x77, 0x42, 0x67, 0x59, 0x45, 0x56, 0x52, 0x30,
+ 0x6C, 0x41, 0x44, 0x41, 0x66, 0x42, 0x67, 0x4E, 0x56, 0x48, 0x53, 0x4D, 0x45, 0x47, 0x44, 0x41, 0x57, 0x67, 0x42, 0x51,
+ 0x39, 0x62, 0x39, 0x74, 0x4C, 0x54, 0x34, 0x4C, 0x78, 0x30, 0x78, 0x43, 0x76, 0x39, 0x48, 0x69, 0x7A, 0x74, 0x50, 0x59,
+ 0x39, 0x0D, 0x0A, 0x4B, 0x79, 0x39, 0x71, 0x6C, 0x7A, 0x41, 0x4E, 0x42, 0x67, 0x6B, 0x71, 0x68, 0x6B, 0x69, 0x47, 0x39,
+ 0x77, 0x30, 0x42, 0x41, 0x51, 0x73, 0x46, 0x41, 0x41, 0x4F, 0x43, 0x41, 0x51, 0x45, 0x41, 0x41, 0x59, 0x62, 0x69, 0x46,
+ 0x41, 0x6D, 0x33, 0x6E, 0x71, 0x61, 0x6F, 0x4A, 0x51, 0x45, 0x41, 0x6D, 0x37, 0x7A, 0x34, 0x33, 0x71, 0x6E, 0x71, 0x41,
+ 0x6B, 0x41, 0x6E, 0x35, 0x30, 0x76, 0x6F, 0x0D, 0x0A, 0x75, 0x4F, 0x39, 0x4E, 0x57, 0x61, 0x33, 0x53, 0x43, 0x45, 0x38,
+ 0x78, 0x6B, 0x4C, 0x55, 0x2B, 0x31, 0x50, 0x62, 0x67, 0x76, 0x6F, 0x48, 0x4E, 0x50, 0x54, 0x6A, 0x36, 0x4D, 0x51, 0x30,
+ 0x59, 0x37, 0x6F, 0x63, 0x2B, 0x6D, 0x42, 0x75, 0x55, 0x6B, 0x5A, 0x52, 0x63, 0x4B, 0x33, 0x51, 0x4C, 0x69, 0x58, 0x6C,
+ 0x62, 0x34, 0x66, 0x6E, 0x7A, 0x39, 0x59, 0x55, 0x36, 0x66, 0x69, 0x7A, 0x4A, 0x0D, 0x0A, 0x79, 0x6A, 0x33, 0x76, 0x33,
+ 0x42, 0x34, 0x6B, 0x4A, 0x33, 0x5A, 0x62, 0x42, 0x6D, 0x38, 0x48, 0x4E, 0x34, 0x78, 0x79, 0x44, 0x62, 0x66, 0x6E, 0x77,
+ 0x6C, 0x67, 0x42, 0x55, 0x65, 0x6F, 0x68, 0x78, 0x61, 0x36, 0x2B, 0x50, 0x78, 0x67, 0x2F, 0x37, 0x72, 0x39, 0x34, 0x78,
+ 0x54, 0x4A, 0x72, 0x35, 0x46, 0x30, 0x43, 0x68, 0x2F, 0x41, 0x68, 0x2F, 0x6D, 0x59, 0x37, 0x66, 0x4B, 0x6C, 0x50, 0x0D,
+ 0x0A, 0x46, 0x46, 0x35, 0x47, 0x68, 0x4A, 0x2B, 0x62, 0x34, 0x76, 0x55, 0x6F, 0x36, 0x47, 0x74, 0x6E, 0x79, 0x6F, 0x4F,
+ 0x33, 0x58, 0x57, 0x4C, 0x45, 0x34, 0x4D, 0x38, 0x4B, 0x67, 0x68, 0x6C, 0x39, 0x78, 0x48, 0x4E, 0x32, 0x52, 0x76, 0x57,
+ 0x47, 0x45, 0x39, 0x4B, 0x6F, 0x31, 0x4B, 0x31, 0x55, 0x62, 0x42, 0x62, 0x53, 0x4A, 0x51, 0x4D, 0x76, 0x66, 0x65, 0x49,
+ 0x65, 0x52, 0x38, 0x32, 0x71, 0x0D, 0x0A, 0x69, 0x66, 0x37, 0x49, 0x30, 0x56, 0x2B, 0x77, 0x59, 0x70, 0x57, 0x61, 0x4B,
+ 0x79, 0x5A, 0x68, 0x33, 0x6C, 0x50, 0x4C, 0x34, 0x33, 0x67, 0x35, 0x4C, 0x4F, 0x42, 0x34, 0x75, 0x51, 0x6C, 0x68, 0x76,
+ 0x76, 0x50, 0x4D, 0x5A, 0x63, 0x43, 0x48, 0x36, 0x4F, 0x37, 0x37, 0x37, 0x6E, 0x2F, 0x33, 0x4C, 0x2B, 0x54, 0x6C, 0x32,
+ 0x2F, 0x41, 0x56, 0x31, 0x73, 0x7A, 0x73, 0x67, 0x53, 0x6B, 0x54, 0x0D, 0x0A, 0x47, 0x79, 0x74, 0x54, 0x75, 0x4B, 0x6A,
+ 0x51, 0x35, 0x6E, 0x50, 0x53, 0x58, 0x76, 0x65, 0x44, 0x39, 0x76, 0x4B, 0x42, 0x50, 0x2F, 0x58, 0x4C, 0x73, 0x54, 0x4D,
+ 0x75, 0x69, 0x6A, 0x48, 0x4C, 0x43, 0x68, 0x57, 0x55, 0x69, 0x33, 0x74, 0x4B, 0x7A, 0x49, 0x48, 0x6F, 0x66, 0x4B, 0x6F,
+ 0x58, 0x62, 0x42, 0x43, 0x35, 0x37, 0x77, 0x3D, 0x3D, 0x0D, 0x0A, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x45, 0x4E, 0x44, 0x20,
+ 0x43, 0x45, 0x52, 0x54, 0x49, 0x46, 0x49, 0x43, 0x41, 0x54, 0x45, 0x2D, 0x2D, 0x2D, 0x2D, 0x2D, 0x0D, 0x0A, };
+
+ [Test]
+ public void Sha256 ()
+ {
+ X509Certificate c = new X509Certificate (sha256_data);
+ Assert.AreEqual ("1.2.840.113549.1.1.11", c.SignatureAlgorithm, "SignatureAlgorithm");
+ Assert.IsFalse (c.VerifySignature (c.RSA), "hash mapping");
+ }
+
+ byte[] sha512_data = {
+ 0x30, 0x82, 0x02, 0x13, 0x30, 0x82, 0x01, 0x9D, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xF8, 0x92, 0xDA, 0x88,
+ 0xAF, 0x25, 0x83, 0xA3, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0D, 0x05, 0x00, 0x30,
+ 0x45, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
+ 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x53, 0x6F, 0x6D, 0x65, 0x2D, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1F, 0x06,
+ 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x18, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69,
+ 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4C, 0x74, 0x64, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x33, 0x30, 0x35, 0x31, 0x37,
+ 0x30, 0x37, 0x35, 0x30, 0x33, 0x34, 0x5A, 0x17, 0x0D, 0x34, 0x30, 0x31, 0x30, 0x30, 0x32, 0x30, 0x37, 0x35, 0x30, 0x33,
+ 0x34, 0x5A, 0x30, 0x45, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30,
+ 0x11, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x53, 0x6F, 0x6D, 0x65, 0x2D, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21,
+ 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x18, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x57, 0x69,
+ 0x64, 0x67, 0x69, 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4C, 0x74, 0x64, 0x30, 0x7C, 0x30, 0x0D, 0x06, 0x09, 0x2A,
+ 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x6B, 0x00, 0x30, 0x68, 0x02, 0x61, 0x00, 0xE2, 0xE0,
+ 0x43, 0xDF, 0x6A, 0x4F, 0xB5, 0x30, 0xED, 0xE3, 0x70, 0xC4, 0xC3, 0xEE, 0x97, 0x3B, 0x6A, 0xF2, 0x37, 0xEF, 0xF8, 0x52,
+ 0x7D, 0x38, 0xED, 0x08, 0x38, 0xA0, 0x35, 0x1B, 0x24, 0x45, 0xC4, 0x05, 0x37, 0x6B, 0xDD, 0xFA, 0x7F, 0x82, 0x73, 0x45,
+ 0xB2, 0x2F, 0x0E, 0x13, 0x56, 0x37, 0xEC, 0x4F, 0x2A, 0x71, 0x1F, 0xA5, 0x3A, 0xD9, 0xEF, 0xB2, 0x1E, 0xD1, 0x65, 0xFB,
+ 0xAF, 0xBE, 0x7F, 0xEE, 0xE5, 0x9F, 0x4D, 0x7F, 0x24, 0xE8, 0x09, 0xE8, 0x35, 0x44, 0x13, 0xEA, 0x91, 0xFB, 0x6D, 0x2E,
+ 0xBE, 0x11, 0x77, 0xB0, 0x7D, 0xC3, 0x31, 0xC5, 0xE1, 0xF2, 0x03, 0xE9, 0x66, 0x65, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3,
+ 0x50, 0x30, 0x4E, 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x92, 0xEB, 0xAA, 0x6A, 0x08, 0xEC,
+ 0x6A, 0x5B, 0xAF, 0x4F, 0xBF, 0x92, 0x27, 0x52, 0x52, 0x76, 0xF6, 0x60, 0x1F, 0x30, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D,
+ 0x23, 0x04, 0x18, 0x30, 0x16, 0x80, 0x14, 0x92, 0xEB, 0xAA, 0x6A, 0x08, 0xEC, 0x6A, 0x5B, 0xAF, 0x4F, 0xBF, 0x92, 0x27,
+ 0x52, 0x52, 0x76, 0xF6, 0x60, 0x1F, 0x30, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01,
+ 0xFF, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x0D, 0x05, 0x00, 0x03, 0x61, 0x00, 0x3A,
+ 0x76, 0x0E, 0xF1, 0x00, 0x80, 0x72, 0x7E, 0x81, 0x32, 0xE5, 0xE2, 0xF9, 0xB8, 0xE1, 0xA5, 0xB4, 0x63, 0x11, 0x21, 0x24,
+ 0x3B, 0xE7, 0xFF, 0x64, 0x41, 0x6E, 0xD3, 0xA3, 0x4B, 0xE2, 0xF8, 0xDB, 0xDA, 0xB8, 0x21, 0xB3, 0x28, 0xA0, 0xA9, 0xE2,
+ 0xF8, 0x73, 0x51, 0x0D, 0xF7, 0x3A, 0xDF, 0x41, 0x2E, 0x27, 0x4A, 0xE5, 0x5F, 0xE3, 0xB8, 0x1E, 0x75, 0x57, 0xF1, 0x73,
+ 0xE2, 0xF8, 0xE1, 0xAE, 0xD8, 0x33, 0x99, 0x71, 0x9E, 0xF0, 0x2C, 0xBF, 0x55, 0x90, 0x4E, 0xA1, 0x3F, 0x68, 0xAD, 0x75,
+ 0x94, 0xCC, 0x45, 0x08, 0xB3, 0xDC, 0x96, 0x9D, 0x20, 0x97, 0x72, 0xB8, 0x7A, 0x9C, 0x5E, };
+
+ [Test]
+ public void Sha512 ()
+ {
+ X509Certificate c = new X509Certificate (sha512_data);
+ Assert.AreEqual ("1.2.840.113549.1.1.13", c.SignatureAlgorithm, "SignatureAlgorithm");
+ Assert.IsTrue (c.VerifySignature (c.RSA), "hash mapping");
+ Assert.IsTrue (c.IsSelfSigned, "IsSelfSigned");
+ }
+
+ byte[] ripemd160_data = {
+ 0x30, 0x82, 0x02, 0x0D, 0x30, 0x82, 0x01, 0x9A, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 0x09, 0x00, 0xA6, 0x2A, 0xB2, 0x97,
+ 0x8A, 0xC3, 0x34, 0x87, 0x30, 0x0A, 0x06, 0x06, 0x2B, 0x24, 0x03, 0x03, 0x01, 0x02, 0x05, 0x00, 0x30, 0x45, 0x31, 0x0B,
+ 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03, 0x55, 0x04, 0x08,
+ 0x0C, 0x0A, 0x53, 0x6F, 0x6D, 0x65, 0x2D, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04,
+ 0x0A, 0x0C, 0x18, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69, 0x74, 0x73, 0x20,
+ 0x50, 0x74, 0x79, 0x20, 0x4C, 0x74, 0x64, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x33, 0x30, 0x35, 0x31, 0x37, 0x30, 0x37, 0x35,
+ 0x31, 0x31, 0x38, 0x5A, 0x17, 0x0D, 0x34, 0x30, 0x31, 0x30, 0x30, 0x32, 0x30, 0x37, 0x35, 0x31, 0x31, 0x38, 0x5A, 0x30,
+ 0x45, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x41, 0x55, 0x31, 0x13, 0x30, 0x11, 0x06, 0x03,
+ 0x55, 0x04, 0x08, 0x0C, 0x0A, 0x53, 0x6F, 0x6D, 0x65, 0x2D, 0x53, 0x74, 0x61, 0x74, 0x65, 0x31, 0x21, 0x30, 0x1F, 0x06,
+ 0x03, 0x55, 0x04, 0x0A, 0x0C, 0x18, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65, 0x74, 0x20, 0x57, 0x69, 0x64, 0x67, 0x69,
+ 0x74, 0x73, 0x20, 0x50, 0x74, 0x79, 0x20, 0x4C, 0x74, 0x64, 0x30, 0x7C, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
+ 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x6B, 0x00, 0x30, 0x68, 0x02, 0x61, 0x00, 0x94, 0x15, 0x1A, 0xE1, 0x30,
+ 0xE7, 0x9E, 0x1E, 0x4B, 0x13, 0x82, 0x67, 0x67, 0xD5, 0x09, 0x64, 0xFC, 0x36, 0x07, 0xCE, 0x38, 0xAE, 0x02, 0xFA, 0xBC,
+ 0x98, 0xEE, 0xCF, 0x08, 0xD5, 0x61, 0x33, 0x6A, 0xFF, 0x4E, 0x0E, 0x8A, 0xB9, 0xE6, 0x9B, 0x6F, 0xB8, 0xB0, 0x6B, 0xF0,
+ 0x4D, 0x2F, 0xE7, 0x2A, 0x45, 0xA3, 0x47, 0xA1, 0xD5, 0x03, 0x2C, 0x6C, 0x00, 0x56, 0xD3, 0x1C, 0xEC, 0xD9, 0x99, 0xD8,
+ 0x1B, 0xFF, 0x03, 0xF1, 0x74, 0xAC, 0xDA, 0x20, 0xD0, 0x71, 0x58, 0xD7, 0x27, 0xC0, 0x17, 0x99, 0x43, 0x09, 0xFD, 0x54,
+ 0x03, 0x44, 0x4D, 0x51, 0x99, 0x09, 0x9A, 0xBB, 0x22, 0x53, 0x87, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3, 0x50, 0x30, 0x4E,
+ 0x30, 0x1D, 0x06, 0x03, 0x55, 0x1D, 0x0E, 0x04, 0x16, 0x04, 0x14, 0x21, 0x56, 0x19, 0x05, 0x70, 0xE8, 0x5A, 0xFC, 0xE3,
+ 0xA1, 0xDD, 0x0D, 0x1C, 0x8B, 0x9C, 0xDF, 0x39, 0x33, 0xA2, 0x76, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x1D, 0x23, 0x04, 0x18,
+ 0x30, 0x16, 0x80, 0x14, 0x21, 0x56, 0x19, 0x05, 0x70, 0xE8, 0x5A, 0xFC, 0xE3, 0xA1, 0xDD, 0x0D, 0x1C, 0x8B, 0x9C, 0xDF,
+ 0x39, 0x33, 0xA2, 0x76, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0A,
+ 0x06, 0x06, 0x2B, 0x24, 0x03, 0x03, 0x01, 0x02, 0x05, 0x00, 0x03, 0x61, 0x00, 0x93, 0x45, 0x7E, 0xA6, 0xEB, 0x8D, 0xE0,
+ 0x36, 0xF1, 0x0D, 0xC5, 0xC0, 0x61, 0xA3, 0xF6, 0x36, 0xDB, 0x71, 0xA8, 0x05, 0x8A, 0x8B, 0x12, 0xAD, 0xAC, 0xA5, 0x36,
+ 0xE8, 0xBE, 0x18, 0xF1, 0x8D, 0x8E, 0x4C, 0x8C, 0x10, 0x47, 0xE8, 0xD2, 0x89, 0x2E, 0x8B, 0x43, 0xC2, 0xB3, 0x70, 0x5F,
+ 0xBF, 0x0E, 0x69, 0x71, 0x5A, 0x86, 0x83, 0xC6, 0x34, 0x48, 0x1E, 0x10, 0x9B, 0xBD, 0xE8, 0x47, 0x66, 0xF6, 0x97, 0x4C,
+ 0x07, 0x5D, 0x64, 0x1D, 0xE6, 0x8E, 0xA9, 0xB7, 0x10, 0xF4, 0xC1, 0xC9, 0xD4, 0x5C, 0x3B, 0xB6, 0x82, 0x92, 0x2D, 0xEF,
+ 0xE7, 0x42, 0x3B, 0x09, 0xBF, 0x53, 0x89, 0xBD, 0x0B, };
+
+ [Test]
+ public void RipeMd160 ()
+ {
+ X509Certificate c = new X509Certificate (ripemd160_data);
+ Assert.AreEqual ("1.3.36.3.3.1.2", c.SignatureAlgorithm, "SignatureAlgorithm");
+ Assert.IsTrue (c.VerifySignature (c.RSA), "hash mapping");
+ Assert.IsTrue (c.IsSelfSigned, "IsSelfSigned");
+ }
}
}
+#if !MONOTOUCH
// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------------
}
}
}
+#endif
-// -----------------------------------------------------------------------
+#if !MONOTOUCH
+// -----------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
// -----------------------------------------------------------------------
using System;
}
}
+#endif
{
if(!metadataViewType.IsAttributeDefined<MetadataViewImplementationAttribute>())
{
+#if !MONOTOUCH
try
{
proxyType = MetadataViewGenerator.GenerateView(metadataViewType);
{
throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.NotSupportedInterfaceMetadataView, metadataViewType.FullName), ex);
}
+#else
+ throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, Strings.NotSupportedInterfaceMetadataView, metadataViewType.FullName));
+#endif
}
else
{
}
catch (TargetInvocationException ex)
{
+#if !MONOTOUCH
//Unwrap known failures that we want to present as CompositionContractMismatchException
if(metadataViewType.IsInterface)
{
ex.InnerException.Data[MetadataViewGenerator.MetadataItemTargetType]), ex);
}
}
+#endif
throw;
}
}
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.ComponentModel;
using System.Collections.Specialized;
}
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.Reflection;
using System.Configuration.Internal;
}
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections.Specialized;
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
using System.Collections;
using System.Collections.Specialized;
internal abstract void ResetModified (Configuration config);
}
}
-
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Configuration.Internal;
using System.IO;
}
}
-#endif
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Configuration
{
public enum ConfigurationAllowDefinition
Everywhere = 300
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Configuration
{
public enum ConfigurationAllowExeDefinition
MachineToRoamingUser = 200
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
namespace System.Configuration
}
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
namespace System.Configuration
}
}
}
-#endif
// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
using System.Reflection;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.Collections;
using System.Diagnostics;
using System.Xml;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
namespace System.Configuration
{
public enum ConfigurationElementCollectionType
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
public sealed class ConfigurationElementProperty
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Configuration.Internal;
using System.Globalization;
#pragma warning restore
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
namespace System.Configuration
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.Xml;
using System.IO;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.Collections;
namespace System.Configuration {
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.Collections;
}
}
-#endif
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
using System.Collections;
using System.Runtime.CompilerServices;
}
}
- [MonoTODO]
public static ConnectionStringSettingsCollection ConnectionStrings {
get {
ConnectionStringsSection connectionStrings = (ConnectionStringsSection) GetSection ("connectionStrings");
}
}
}
-
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.Security;
using System.Security.Permissions;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Security;
using System.Security.Permissions;
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.ComponentModel;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
[AttributeUsage (AttributeTargets.Property)]
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Collections.Generic;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Configuration
{
[Flags]
IsKey = 4
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.ComponentModel;
using System.Configuration;
}
}
}
-
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
-#if NET_2_0
+
using System;
namespace System.Configuration
}
}
}
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//
-#if NET_2_0
+
using System;
namespace System.Configuration
{
internal delegate void ConfigurationSaveEventHandler (Configuration sender, ConfigurationSaveEventArgs args);
}
-#endif
-
\ No newline at end of file
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
namespace System.Configuration
{
public enum ConfigurationSaveMode
Modified = 0
}
}
-#endif
// Copyright (c) 2012 Xamarin Inc. (http://www.xamarin.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
using System.IO;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
}
-#endif
+
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
namespace System.Configuration {
PerUserRoamingAndLocal = 20
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration
public abstract void Validate (object value);
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.ComponentModel;
}
}
}
-#endif // NET_2_0
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
namespace System.Configuration
}
}
-#endif // NET_2_0
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Xml;
}
}
-#endif // NET_2_0
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Xml;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Xml;
using System.Collections.Specialized;
}
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
namespace System.Configuration
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
public sealed class ExeConfigurationFileMap: ConfigurationFileMap
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections.Specialized;
using System.Xml;
}
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.IO;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Configuration.Internal;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.IO;
using System.Security;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.Collections;
using System.Configuration.Internal;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections.Specialized;
using System.Xml;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.IO;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.ComponentModel;
namespace System.Configuration
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
public enum PropertyValueOrigin
SetHere = 2
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Xml;
using System.Collections.Specialized;
using System.Security.Cryptography;
}
}
-
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Xml;
using System.Configuration.Provider;
public abstract XmlNode Encrypt (XmlNode node);
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System.Configuration.Provider;
namespace System.Configuration
}
-#endif
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.IO;
using System.Xml;
}
}
}
-#endif
+
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
namespace System.Configuration
{
public class ProtectedProviderSettings : ConfigurationElement
}
-#endif
// Copyright (C) 2004,2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.Xml;
using System.Collections.Specialized;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
-
using System;
using System.Configuration;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System;
using System.Text.RegularExpressions;
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
[AttributeUsage (AttributeTargets.Property)]
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_2_0
using System.Xml;
using System.IO;
using System.Collections.Specialized;
}
}
}
-#endif
+
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
-#endif
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
+
using System;
using System.Collections;
using System.Collections.Specialized;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System.Collections;
using System.Xml;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
public class StringValidator: ConfigurationValidatorBase
}
}
}
-
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
[AttributeUsage (AttributeTargets.Property)]
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
}
-
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration {
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
+
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
namespace System.Configuration
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
namespace System.Configuration
{
[AttributeUsage (AttributeTargets.Property)]
}
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
-#endif
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
using System;
using System.IO;
public delegate void ValidatorCallback (object o);
}
-#endif
// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
//
-#if NET_2_0
-
using System.ComponentModel;
using System.Globalization;
}
}
-#endif
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+Test/App.config
\ No newline at end of file
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+ <connectionStrings>
+ <add name="test-connstring"
+ connectionString="Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;" />
+ </connectionStrings>
+</configuration>
Assert.That (EvaluationContext != null, label);
}
}
+
+
+ [Test]
+ public void TestConnectionStringRetrieval ()
+ {
+ var connStringObj = ConfigurationManager.ConnectionStrings ["test-connstring"];
+ Assert.IsNotNull (connStringObj);
+ var connString = connStringObj.ConnectionString;
+ Assert.IsFalse (String.IsNullOrEmpty (connString));
+ Assert.AreEqual ("Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;",
+ connString);
+ }
}
}
start = length = 0;
- int i = Array.BinarySearch (names, name);
+ int i = Array.BinarySearch (names, name, StringComparer.Ordinal);
if (i < 0)
return null;
return buf.ToString ();
return null;
}
+
+#if SELF_TEST
+ /*
+ * Compile:
+ * mcs /out:tzi.exe "/d:INSIDE_CORLIB;MONODROID;NET_4_0;LIBC;SELF_TEST" System/TimeZone*.cs ../../build/common/Consts.cs
+ * Prep:
+ * mkdir -p usr/share/zoneinfo
+ * android_root=`adb shell echo '$ANDROID_ROOT' | tr -d "\r"`
+ * adb pull $android_root/usr/share/zoneinfo usr/share/zoneinfo
+ * Run:
+ * ANDROID_ROOT=`pwd` mono tzi.exe
+ */
+ static void Main (string[] args)
+ {
+ Console.WriteLine ("Version: {0}", version);
+ for (int i = 0; i < names.Length; ++i) {
+ Console.Write ("{0,3}\tname={1,-40} start={2,-10} length={3,-4} offset=0x{4,8}",
+ i, names [i], starts [i], lengths [i], offsets [i].ToString ("x8"));
+ try {
+ TimeZoneInfo zone = _GetTimeZone (names [i]);
+ if (zone != null)
+ Console.Write (" {0}", zone);
+ else {
+ Console.Write (" ERROR:null Index? {0}",
+ Array.BinarySearch (names, names [i], StringComparer.Ordinal));
+ }
+ } catch (Exception e) {
+ Console.WriteLine ();
+ Console.Write ("ERROR: {0}", e);
+ }
+ Console.WriteLine ();
+ }
+ }
+#endif
}
}
}
}
[Test]
-#if MOBILE
- [Category ("NotWorking")] // String:Intern () is linked away
-#endif
[ExpectedException (typeof (ArgumentException))]
public void InstanceTypeDoesntMatchMethodDeclaringType ()
{
+#if MOBILE
+ // ensure that String.Intern won't be removed by the linker
+ string s = String.Intern (String.Empty);
+#endif
Expression.Call (Expression.Constant (1), typeof (string).GetMethod ("Intern"));
}
AssertException<ArgumentNullException> (delegate () { ((IEnumerable<string>) null).Contains ("2", (IEqualityComparer<string>) EqualityComparer<string>.Default); });
}
+ static void IsFalse(bool b, int[] data) {
+ if (b) {
+ Console.WriteLine (data.Contains (0));
+ object o = null;
+ o.ToString ();
+ Assert.IsFalse (true);
+ }
+ //Console.WriteLine ("HIT!");
+ }
+
[Test]
public void ContainsTest ()
{
int [] data = { 5, 2, 3, 1, 6 };
-
+ ICollection<int> icoll = data;
// Contains<TSource> (TSource)
Assert.IsTrue (data.Contains (2));
- Assert.IsFalse (data.Contains (0));
+ for (int i = 0; i < 50; ++i)
+ Console.WriteLine (icoll.Contains (0));//Console.WriteLine (data.Contains (0));
+ IsFalse (data.Contains (0), data);
// Contains<TSource> (TSource, IEqualityComparer<TSource>)
Assert.IsTrue (data.Contains (2, EqualityComparer<int>.Default));
../../build/common/Consts.cs
../../build/common/Locale.cs
../../build/common/MonoTODOAttribute.cs
-../corlib/Mono.Security.Cryptography/CryptoTools.cs
-../corlib/Mono.Security.Cryptography/SymmetricTransform.cs
+../Mono.Security/Mono.Security.Cryptography/CryptoTools.cs
+../Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
../corlib/System.Threading/AtomicBoolean.cs
../corlib/System.Collections.Generic/CollectionDebuggerView.cs
../corlib/System.Collections/HashPrimeNumbers.cs
#include dynamic_System.Core.dll.sources
System/TimeZoneInfo.Android.cs
+System.Security.Cryptography/AesCryptoServiceProvider.cs
System.Security.Cryptography/AesManaged.cs
System.Security.Cryptography/AesTransform.cs
--- /dev/null
+//
+// AssemblyInfo.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.Resources;
+using System.Security;
+using System.Security.Permissions;
+using System.Diagnostics;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+
+[assembly: AssemblyTitle ("System.Net.Http.WebRequest.dll")]
+[assembly: AssemblyDescription ("System.Net.Http.WebRequest.dll")]
+[assembly: AssemblyDefaultAlias ("System.Net.Http.WebRequest.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: SatelliteContractVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+
+[assembly: NeutralResourcesLanguage ("en-US")]
+[assembly: CLSCompliant (true)]
+[assembly: AssemblyDelaySign (true)]
+
+[assembly: AssemblyKeyFile ("../../msfinal.pub")]
+
+[assembly: ComVisible (false)]
+
--- /dev/null
+thisdir = class/System.Net.Http.WebRequest
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Net.Http.WebRequest.dll
+
+LIB_MCS_FLAGS = -r:System.Net.Http.dll -r:System.dll
+
+TEST_MCS_FLAGS = -r:System.Net.Http.dll
+
+include ../../build/library.make
--- /dev/null
+../../build/common/Consts.cs
+../../build/common/MonoTODOAttribute.cs
+Assembly/AssemblyInfo.cs
+System.Net.Http.WebRequest/WebRequestHandler.cs
--- /dev/null
+//
+// WebRequestHandler.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Net.Cache;
+using System.Net.Security;
+using System.Security.Principal;
+using System.Security.Cryptography.X509Certificates;
+
+namespace System.Net.Http
+{
+ public class WebRequestHandler : HttpClientHandler
+ {
+ bool allowPipelining;
+ RequestCachePolicy cachePolicy;
+ AuthenticationLevel authenticationLevel;
+ TimeSpan continueTimeout;
+ TokenImpersonationLevel impersonationLevel;
+ int maxResponseHeadersLength;
+ int readWriteTimeout;
+ RemoteCertificateValidationCallback serverCertificateValidationCallback;
+ bool unsafeAuthenticatedConnectionSharing;
+
+ public WebRequestHandler ()
+ {
+ allowPipelining = true;
+ authenticationLevel = AuthenticationLevel.MutualAuthRequested;
+ cachePolicy = System.Net.WebRequest.DefaultCachePolicy;
+ continueTimeout = TimeSpan.FromMilliseconds (350);
+ impersonationLevel = TokenImpersonationLevel.Delegation;
+ maxResponseHeadersLength = HttpWebRequest.DefaultMaximumResponseHeadersLength;
+ readWriteTimeout = 300000;
+ serverCertificateValidationCallback = null;
+ unsafeAuthenticatedConnectionSharing = false;
+ }
+
+ public bool AllowPipelining {
+ get { return allowPipelining; }
+ set {
+ EnsureModifiability ();
+ allowPipelining = value;
+ }
+ }
+
+ public RequestCachePolicy CachePolicy {
+ get { return cachePolicy; }
+ set {
+ EnsureModifiability ();
+ cachePolicy = value;
+ }
+ }
+
+ public AuthenticationLevel AuthenticationLevel {
+ get { return authenticationLevel; }
+ set {
+ EnsureModifiability ();
+ authenticationLevel = value;
+ }
+ }
+
+ [MonoTODO]
+ public X509CertificateCollection ClientCertificates {
+ get { throw new NotImplementedException (); }
+ }
+
+ [MonoTODO]
+ public TimeSpan ContinueTimeout {
+ get { return continueTimeout; }
+ set {
+ EnsureModifiability ();
+ continueTimeout = value;
+ }
+ }
+
+ public TokenImpersonationLevel ImpersonationLevel {
+ get { return impersonationLevel; }
+ set {
+ EnsureModifiability ();
+ impersonationLevel = value;
+ }
+ }
+
+ public int MaxResponseHeadersLength {
+ get { return maxResponseHeadersLength; }
+ set {
+ EnsureModifiability ();
+ maxResponseHeadersLength = value;
+ }
+ }
+
+ public int ReadWriteTimeout {
+ get { return readWriteTimeout; }
+ set {
+ EnsureModifiability ();
+ readWriteTimeout = value;
+ }
+ }
+
+ [MonoTODO]
+ public RemoteCertificateValidationCallback ServerCertificateValidationCallback {
+ get { return serverCertificateValidationCallback; }
+ set {
+ EnsureModifiability ();
+ serverCertificateValidationCallback = value;
+ }
+ }
+
+ public bool UnsafeAuthenticatedConnectionSharing {
+ get { return unsafeAuthenticatedConnectionSharing; }
+ set {
+ EnsureModifiability ();
+ unsafeAuthenticatedConnectionSharing = value;
+ }
+ }
+
+ internal override HttpWebRequest CreateWebRequest (HttpRequestMessage request)
+ {
+ HttpWebRequest wr = base.CreateWebRequest (request);
+
+ wr.Pipelined = allowPipelining;
+ wr.AuthenticationLevel = authenticationLevel;
+ wr.CachePolicy = cachePolicy;
+ wr.ImpersonationLevel = impersonationLevel;
+ wr.MaximumResponseHeadersLength = maxResponseHeadersLength;
+ wr.ReadWriteTimeout = readWriteTimeout;
+ wr.UnsafeAuthenticatedConnectionSharing = unsafeAuthenticatedConnectionSharing;
+
+ return wr;
+ }
+ }
+}
+
[assembly: ComVisible (false)]
+[assembly: InternalsVisibleTo ("System.Net.Http.WebRequest, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
+
throw new ArgumentNullException ("MediaType");
string temp;
- if (TryParseMediaType (new Lexer (value), out temp) != Token.Type.End)
+ var token = TryParseMediaType (new Lexer (value), out temp);
+ if (token == null || token.Value.Kind != Token.Type.End)
throw new FormatException ();
media_type = temp;
static readonly TimeSpan TimeoutDefault = TimeSpan.FromSeconds (100);
Uri base_address;
- CancellationTokenSource cancellation_token;
+ CancellationTokenSource cts;
bool disposed;
HttpRequestHeaders headers;
long buffer_size;
{
buffer_size = int.MaxValue;
timeout = TimeoutDefault;
+ cts = new CancellationTokenSource ();
}
public Uri BaseAddress {
public void CancelPendingRequests ()
{
- if (cancellation_token != null)
- cancellation_token.Cancel ();
-
- cancellation_token = new CancellationTokenSource ();
+ // Cancel only any already running requests not any new request after this cancellation
+ using (var c = Interlocked.Exchange (ref cts, new CancellationTokenSource ()))
+ c.Cancel ();
}
protected override void Dispose (bool disposing)
if (disposing && !disposed) {
disposed = true;
- if (cancellation_token != null)
- cancellation_token.Dispose ();
+ cts.Dispose ();
}
base.Dispose (disposing);
async Task<HttpResponseMessage> SendAsyncWorker (HttpRequestMessage request, HttpCompletionOption completionOption, CancellationToken cancellationToken)
{
- try {
- if (cancellation_token == null)
- cancellation_token = new CancellationTokenSource ();
-
- using (var cts = CancellationTokenSource.CreateLinkedTokenSource (cancellation_token.Token, cancellationToken)) {
- cts.CancelAfter (timeout);
+ using (var lcts = CancellationTokenSource.CreateLinkedTokenSource (cts.Token, cancellationToken)) {
+ lcts.CancelAfter (timeout);
- var task = base.SendAsync (request, cts.Token);
- if (task == null)
- throw new InvalidOperationException ("Handler failed to return a value");
+ var task = base.SendAsync (request, lcts.Token);
+ if (task == null)
+ throw new InvalidOperationException ("Handler failed to return a value");
- var response = await task.ConfigureAwait (false);
- if (response == null)
- throw new InvalidOperationException ("Handler failed to return a response");
-
- //
- // Read the content when default HttpCompletionOption.ResponseContentRead is set
- //
- if (response.Content != null && (completionOption & HttpCompletionOption.ResponseHeadersRead) == 0) {
- await response.Content.LoadIntoBufferAsync (MaxResponseContentBufferSize).ConfigureAwait (false);
- }
-
- return response;
+ var response = await task.ConfigureAwait (false);
+ if (response == null)
+ throw new InvalidOperationException ("Handler failed to return a response");
+
+ //
+ // Read the content when default HttpCompletionOption.ResponseContentRead is set
+ //
+ if (response.Content != null && (completionOption & HttpCompletionOption.ResponseHeadersRead) == 0) {
+ await response.Content.LoadIntoBufferAsync (MaxResponseContentBufferSize).ConfigureAwait (false);
}
- } finally {
- cancellation_token.Dispose ();
- cancellation_token = null;
+
+ return response;
}
}
useProxy = true;
}
- void EnsureModifiability ()
+ internal void EnsureModifiability ()
{
if (sentRequest)
throw new InvalidOperationException (
base.Dispose (disposing);
}
- HttpWebRequest CreateWebRequest (HttpRequestMessage request)
+ internal virtual HttpWebRequest CreateWebRequest (HttpRequestMessage request)
{
var wr = new HttpWebRequest (request.RequestUri);
wr.ThrowOnError = false;
Assert.That (client.GetStringAsync ("Computer").Result != null);
}
+ [Test]
+ [Category ("MobileNotWorking")] // Missing encoding
+ public void GetString_Many ()
+ {
+ var client = new HttpClient ();
+ var t1 = client.GetStringAsync ("http://www.google.com");
+ var t2 = client.GetStringAsync ("http://www.google.com");
+ Assert.IsTrue (Task.WaitAll (new [] { t1, t2 }, WaitTimeout));
+ }
+
[Test]
public void GetByteArray_ServerError ()
{
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
- <Compile Include="Test\System.Numerics\BigIntegerTest.cs" />\r </ItemGroup>\r
+ <Compile Include="Test\System.Numerics\BigIntegerTest.cs" />\r
+ <Compile Include="Test\System.Numerics\ComplexTest.cs" />\r </ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
Other similar extension points exist, see Microsoft.Common.targets.\r
<Target Name="BeforeBuild">\r
</PropertyGroup>\r
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />\r
<ItemGroup>\r
- <Compile Include="Test\System.Numerics\BigIntegerTest.cs" />\r </ItemGroup>\r
+ <Compile Include="Test\System.Numerics\BigIntegerTest.cs" />\r
+ <Compile Include="Test\System.Numerics\ComplexTest.cs" />\r </ItemGroup>\r
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. \r
Other similar extension points exist, see Microsoft.Common.targets.\r
<Target Name="BeforeBuild">\r
}
public bool IsEven {
- get { return (data [0] & 0x1) == 0; }
+ get { return sign == 0 || (data [0] & 0x1) == 0; }
}
public bool IsOne {
public static explicit operator int (BigInteger value)
{
+ if (value.sign == 0)
+ return 0;
if (value.data.Length > 1)
throw new OverflowException ();
uint data = value.data [0];
[CLSCompliantAttribute (false)]
public static explicit operator uint (BigInteger value)
{
+ if (value.sign == 0)
+ return 0;
if (value.data.Length > 1 || value.sign == -1)
throw new OverflowException ();
return value.data [0];
[CLSCompliantAttribute (false)]
public static explicit operator ulong (BigInteger value)
{
+ if (value.sign == 0)
+ return 0;
if (value.data.Length > 2 || value.sign == -1)
throw new OverflowException ();
public static BigInteger operator++ (BigInteger value)
{
+ if (value.sign == 0)
+ return One;
+
short sign = value.sign;
uint[] data = value.data;
if (data.Length == 1) {
public static BigInteger operator-- (BigInteger value)
{
+ if (value.sign == 0)
+ return MinusOne;
+
short sign = value.sign;
uint[] data = value.data;
if (data.Length == 1) {
int bit_shift = shift & 0x1F;
int carry_shift = 32 - bit_shift;
- for (int i = 0; i < data.Length; ++i) {
- uint word = data [i];
- res [i + idx_shift] |= word << bit_shift;
- if (i + idx_shift + 1 < res.Length)
- res [i + idx_shift + 1] = word >> carry_shift;
+ if (carry_shift == 32) {
+ for (int i = 0; i < data.Length; ++i) {
+ uint word = data [i];
+ res [i + idx_shift] |= word << bit_shift;
+ }
+ } else {
+ for (int i = 0; i < data.Length; ++i) {
+ uint word = data [i];
+ res [i + idx_shift] |= word << bit_shift;
+ if (i + idx_shift + 1 < res.Length)
+ res [i + idx_shift + 1] = word >> carry_shift;
+ }
}
return new BigInteger ((short)sign, res);
uint[] res = new uint [size];
int carry_shift = 32 - bit_shift;
- for (int i = data.Length - 1; i >= idx_shift; --i) {
- uint word = data [i];
+ if (carry_shift == 32) {
+ for (int i = data.Length - 1; i >= idx_shift; --i) {
+ uint word = data [i];
+
+ if (i - idx_shift < res.Length)
+ res [i - idx_shift] |= word >> bit_shift;
+ }
+ } else {
+ for (int i = data.Length - 1; i >= idx_shift; --i) {
+ uint word = data [i];
+
+ if (i - idx_shift < res.Length)
+ res [i - idx_shift] |= word >> bit_shift;
+ if (i - idx_shift - 1 >= 0)
+ res [i - idx_shift - 1] = word << carry_shift;
+ }
- if (i - idx_shift < res.Length)
- res [i - idx_shift] |= word >> bit_shift;
- if (i - idx_shift - 1 >= 0)
- res [i - idx_shift - 1] = word << carry_shift;
}
//Round down instead of toward zero
{
if (sign != other.sign)
return false;
- if (data.Length != other.data.Length)
+
+ int alen = data != null ? data.Length : 0;
+ int blen = other.data != null ? other.data.Length : 0;
+
+ if (alen != blen)
return false;
- for (int i = 0; i < data.Length; ++i) {
+ for (int i = 0; i < alen; ++i) {
if (data [i] != other.data [i])
return false;
}
public static BigInteger GreatestCommonDivisor (BigInteger left, BigInteger right)
{
- if (left.data.Length == 1 && left.data [0] == 1)
+ if (left.sign != 0 && left.data.Length == 1 && left.data [0] == 1)
return new BigInteger (1, ONE);
- if (right.data.Length == 1 && right.data [0] == 1)
+ if (right.sign != 0 && right.data.Length == 1 && right.data [0] == 1)
return new BigInteger (1, ONE);
if (left.IsZero)
- return right;
+ return Abs(right);
if (right.IsZero)
- return left;
+ return Abs(left);
BigInteger x = new BigInteger (1, left.data);
BigInteger y = new BigInteger (1, right.data);
public override int GetHashCode ()
{
uint hash = (uint)(sign * 0x01010101u);
+ int len = data != null ? data.Length : 0;
- for (int i = 0; i < data.Length; ++i)
+ for (int i = 0; i < len; ++i)
hash ^= data [i];
return (int)hash;
}
static int CoreCompare (uint[] a, uint[] b)
{
- int al = a.Length;
- int bl = b.Length;
+ int al = a != null ? a.Length : 0;
+ int bl = b != null ? b.Length : 0;
if (al > bl)
return 1;
+2013-06-12 Christoph Ruegg <git@cdrnet.ch>
+
+ * BigInteger.cs: Fix GreatestCommonDivisor to
+ return absolute value if one of the args is zero.
+
+2013-06-09 Christoph Ruegg <git@cdrnet.ch>
+
+ * Complex.cs: Fix IFormattable.ToString to pass custom
+ format strings to double.ToString instead of string.Format.
+
2010-07-12 Jb Evain <jbevain@novell.com>
* Complex.cs: implement IFormattable.
public string ToString (string format)
{
- return string.Format ("({0}, {1})", string.Format (format, real), string.Format (format, imaginary));
+ return string.Format ("({0}, {1})", real.ToString (format), imaginary.ToString (format));
}
public string ToString (string format, IFormatProvider provider)
{
- return string.Format ("({0}, {1})", string.Format (provider, format, real), string.Format (provider, format, imaginary));
+ return string.Format ("({0}, {1})", real.ToString (format, provider), imaginary.ToString (format, provider));
}
}
}
System.Numerics/BigIntegerTest.cs
+System.Numerics/ComplexTest.cs
Assert.AreEqual (2, (int)BigInteger.GreatestCommonDivisor (-12345678, -8765432), "#14");
Assert.AreEqual (40, (int)BigInteger.GreatestCommonDivisor (5581 * 40, 6671 * 40), "#15");
+
+ Assert.AreEqual (5, (int)BigInteger.GreatestCommonDivisor (-5, 0), "#16");
+ Assert.AreEqual (5, (int)BigInteger.GreatestCommonDivisor (0, -5), "#17");
}
[Test]
Assert.AreEqual (-1, b.CompareTo (2000));
Assert.AreEqual (-1, b.CompareTo (-2000));
}
+
+ [Test]
+ public void LeftShitByInt ()
+ {
+ var v = BigInteger.Parse("230794411440927908251127453634");
+
+ Assert.AreEqual ("230794411440927908251127453634", (v << 0).ToString (), "#0");
+ Assert.AreEqual ("461588822881855816502254907268", (v << 1).ToString (), "#1");
+ Assert.AreEqual ("923177645763711633004509814536", (v << 2).ToString (), "#2");
+ Assert.AreEqual ("1846355291527423266009019629072", (v << 3).ToString (), "#3");
+ Assert.AreEqual ("3692710583054846532018039258144", (v << 4).ToString (), "#4");
+ Assert.AreEqual ("7385421166109693064036078516288", (v << 5).ToString (), "#5");
+ Assert.AreEqual ("14770842332219386128072157032576", (v << 6).ToString (), "#6");
+ Assert.AreEqual ("29541684664438772256144314065152", (v << 7).ToString (), "#7");
+ Assert.AreEqual ("59083369328877544512288628130304", (v << 8).ToString (), "#8");
+ Assert.AreEqual ("118166738657755089024577256260608", (v << 9).ToString (), "#9");
+ Assert.AreEqual ("236333477315510178049154512521216", (v << 10).ToString (), "#10");
+ Assert.AreEqual ("472666954631020356098309025042432", (v << 11).ToString (), "#11");
+ Assert.AreEqual ("945333909262040712196618050084864", (v << 12).ToString (), "#12");
+ Assert.AreEqual ("1890667818524081424393236100169728", (v << 13).ToString (), "#13");
+ Assert.AreEqual ("3781335637048162848786472200339456", (v << 14).ToString (), "#14");
+ Assert.AreEqual ("7562671274096325697572944400678912", (v << 15).ToString (), "#15");
+ Assert.AreEqual ("15125342548192651395145888801357824", (v << 16).ToString (), "#16");
+ Assert.AreEqual ("30250685096385302790291777602715648", (v << 17).ToString (), "#17");
+ Assert.AreEqual ("60501370192770605580583555205431296", (v << 18).ToString (), "#18");
+ Assert.AreEqual ("121002740385541211161167110410862592", (v << 19).ToString (), "#19");
+ Assert.AreEqual ("242005480771082422322334220821725184", (v << 20).ToString (), "#20");
+ Assert.AreEqual ("484010961542164844644668441643450368", (v << 21).ToString (), "#21");
+ Assert.AreEqual ("968021923084329689289336883286900736", (v << 22).ToString (), "#22");
+ Assert.AreEqual ("1936043846168659378578673766573801472", (v << 23).ToString (), "#23");
+ Assert.AreEqual ("3872087692337318757157347533147602944", (v << 24).ToString (), "#24");
+ Assert.AreEqual ("7744175384674637514314695066295205888", (v << 25).ToString (), "#25");
+ Assert.AreEqual ("15488350769349275028629390132590411776", (v << 26).ToString (), "#26");
+ Assert.AreEqual ("30976701538698550057258780265180823552", (v << 27).ToString (), "#27");
+ Assert.AreEqual ("61953403077397100114517560530361647104", (v << 28).ToString (), "#28");
+ Assert.AreEqual ("123906806154794200229035121060723294208", (v << 29).ToString (), "#29");
+ Assert.AreEqual ("247813612309588400458070242121446588416", (v << 30).ToString (), "#30");
+ Assert.AreEqual ("495627224619176800916140484242893176832", (v << 31).ToString (), "#31");
+ Assert.AreEqual ("991254449238353601832280968485786353664", (v << 32).ToString (), "#32");
+ Assert.AreEqual ("1982508898476707203664561936971572707328", (v << 33).ToString (), "#33");
+ Assert.AreEqual ("3965017796953414407329123873943145414656", (v << 34).ToString (), "#34");
+ Assert.AreEqual ("7930035593906828814658247747886290829312", (v << 35).ToString (), "#35");
+ Assert.AreEqual ("15860071187813657629316495495772581658624", (v << 36).ToString (), "#36");
+ Assert.AreEqual ("31720142375627315258632990991545163317248", (v << 37).ToString (), "#37");
+ Assert.AreEqual ("63440284751254630517265981983090326634496", (v << 38).ToString (), "#38");
+ Assert.AreEqual ("126880569502509261034531963966180653268992", (v << 39).ToString (), "#39");
+ Assert.AreEqual ("253761139005018522069063927932361306537984", (v << 40).ToString (), "#40");
+ Assert.AreEqual ("507522278010037044138127855864722613075968", (v << 41).ToString (), "#41");
+ Assert.AreEqual ("1015044556020074088276255711729445226151936", (v << 42).ToString (), "#42");
+ Assert.AreEqual ("2030089112040148176552511423458890452303872", (v << 43).ToString (), "#43");
+ Assert.AreEqual ("4060178224080296353105022846917780904607744", (v << 44).ToString (), "#44");
+ Assert.AreEqual ("8120356448160592706210045693835561809215488", (v << 45).ToString (), "#45");
+ Assert.AreEqual ("16240712896321185412420091387671123618430976", (v << 46).ToString (), "#46");
+ Assert.AreEqual ("32481425792642370824840182775342247236861952", (v << 47).ToString (), "#47");
+ Assert.AreEqual ("64962851585284741649680365550684494473723904", (v << 48).ToString (), "#48");
+ Assert.AreEqual ("129925703170569483299360731101368988947447808", (v << 49).ToString (), "#49");
+ Assert.AreEqual ("259851406341138966598721462202737977894895616", (v << 50).ToString (), "#50");
+ Assert.AreEqual ("519702812682277933197442924405475955789791232", (v << 51).ToString (), "#51");
+ Assert.AreEqual ("1039405625364555866394885848810951911579582464", (v << 52).ToString (), "#52");
+ Assert.AreEqual ("2078811250729111732789771697621903823159164928", (v << 53).ToString (), "#53");
+ Assert.AreEqual ("4157622501458223465579543395243807646318329856", (v << 54).ToString (), "#54");
+ Assert.AreEqual ("8315245002916446931159086790487615292636659712", (v << 55).ToString (), "#55");
+ Assert.AreEqual ("16630490005832893862318173580975230585273319424", (v << 56).ToString (), "#56");
+ Assert.AreEqual ("33260980011665787724636347161950461170546638848", (v << 57).ToString (), "#57");
+ Assert.AreEqual ("66521960023331575449272694323900922341093277696", (v << 58).ToString (), "#58");
+ Assert.AreEqual ("133043920046663150898545388647801844682186555392", (v << 59).ToString (), "#59");
+ Assert.AreEqual ("266087840093326301797090777295603689364373110784", (v << 60).ToString (), "#60");
+ Assert.AreEqual ("532175680186652603594181554591207378728746221568", (v << 61).ToString (), "#61");
+ Assert.AreEqual ("1064351360373305207188363109182414757457492443136", (v << 62).ToString (), "#62");
+ Assert.AreEqual ("2128702720746610414376726218364829514914984886272", (v << 63).ToString (), "#63");
+ Assert.AreEqual ("4257405441493220828753452436729659029829969772544", (v << 64).ToString (), "#64");
+ Assert.AreEqual ("8514810882986441657506904873459318059659939545088", (v << 65).ToString (), "#65");
+ Assert.AreEqual ("17029621765972883315013809746918636119319879090176", (v << 66).ToString (), "#66");
+ Assert.AreEqual ("34059243531945766630027619493837272238639758180352", (v << 67).ToString (), "#67");
+ Assert.AreEqual ("68118487063891533260055238987674544477279516360704", (v << 68).ToString (), "#68");
+ Assert.AreEqual ("136236974127783066520110477975349088954559032721408", (v << 69).ToString (), "#69");
+ }
+
+
+ [Test]
+ public void RightShitByInt ()
+ {
+ var v = BigInteger.Parse("230794411440927908251127453634");
+ v = v * BigInteger.Pow (2, 70);
+
+ Assert.AreEqual ("272473948255566133040220955950698177909118065442816", (v >> 0).ToString (), "#0");
+ Assert.AreEqual ("136236974127783066520110477975349088954559032721408", (v >> 1).ToString (), "#1");
+ Assert.AreEqual ("68118487063891533260055238987674544477279516360704", (v >> 2).ToString (), "#2");
+ Assert.AreEqual ("34059243531945766630027619493837272238639758180352", (v >> 3).ToString (), "#3");
+ Assert.AreEqual ("17029621765972883315013809746918636119319879090176", (v >> 4).ToString (), "#4");
+ Assert.AreEqual ("8514810882986441657506904873459318059659939545088", (v >> 5).ToString (), "#5");
+ Assert.AreEqual ("4257405441493220828753452436729659029829969772544", (v >> 6).ToString (), "#6");
+ Assert.AreEqual ("2128702720746610414376726218364829514914984886272", (v >> 7).ToString (), "#7");
+ Assert.AreEqual ("1064351360373305207188363109182414757457492443136", (v >> 8).ToString (), "#8");
+ Assert.AreEqual ("532175680186652603594181554591207378728746221568", (v >> 9).ToString (), "#9");
+ Assert.AreEqual ("266087840093326301797090777295603689364373110784", (v >> 10).ToString (), "#10");
+ Assert.AreEqual ("133043920046663150898545388647801844682186555392", (v >> 11).ToString (), "#11");
+ Assert.AreEqual ("66521960023331575449272694323900922341093277696", (v >> 12).ToString (), "#12");
+ Assert.AreEqual ("33260980011665787724636347161950461170546638848", (v >> 13).ToString (), "#13");
+ Assert.AreEqual ("16630490005832893862318173580975230585273319424", (v >> 14).ToString (), "#14");
+ Assert.AreEqual ("8315245002916446931159086790487615292636659712", (v >> 15).ToString (), "#15");
+ Assert.AreEqual ("4157622501458223465579543395243807646318329856", (v >> 16).ToString (), "#16");
+ Assert.AreEqual ("2078811250729111732789771697621903823159164928", (v >> 17).ToString (), "#17");
+ Assert.AreEqual ("1039405625364555866394885848810951911579582464", (v >> 18).ToString (), "#18");
+ Assert.AreEqual ("519702812682277933197442924405475955789791232", (v >> 19).ToString (), "#19");
+ Assert.AreEqual ("259851406341138966598721462202737977894895616", (v >> 20).ToString (), "#20");
+ Assert.AreEqual ("129925703170569483299360731101368988947447808", (v >> 21).ToString (), "#21");
+ Assert.AreEqual ("64962851585284741649680365550684494473723904", (v >> 22).ToString (), "#22");
+ Assert.AreEqual ("32481425792642370824840182775342247236861952", (v >> 23).ToString (), "#23");
+ Assert.AreEqual ("16240712896321185412420091387671123618430976", (v >> 24).ToString (), "#24");
+ Assert.AreEqual ("8120356448160592706210045693835561809215488", (v >> 25).ToString (), "#25");
+ Assert.AreEqual ("4060178224080296353105022846917780904607744", (v >> 26).ToString (), "#26");
+ Assert.AreEqual ("2030089112040148176552511423458890452303872", (v >> 27).ToString (), "#27");
+ Assert.AreEqual ("1015044556020074088276255711729445226151936", (v >> 28).ToString (), "#28");
+ Assert.AreEqual ("507522278010037044138127855864722613075968", (v >> 29).ToString (), "#29");
+ Assert.AreEqual ("253761139005018522069063927932361306537984", (v >> 30).ToString (), "#30");
+ Assert.AreEqual ("126880569502509261034531963966180653268992", (v >> 31).ToString (), "#31");
+ Assert.AreEqual ("63440284751254630517265981983090326634496", (v >> 32).ToString (), "#32");
+ Assert.AreEqual ("31720142375627315258632990991545163317248", (v >> 33).ToString (), "#33");
+ Assert.AreEqual ("15860071187813657629316495495772581658624", (v >> 34).ToString (), "#34");
+ Assert.AreEqual ("7930035593906828814658247747886290829312", (v >> 35).ToString (), "#35");
+ Assert.AreEqual ("3965017796953414407329123873943145414656", (v >> 36).ToString (), "#36");
+ Assert.AreEqual ("1982508898476707203664561936971572707328", (v >> 37).ToString (), "#37");
+ Assert.AreEqual ("991254449238353601832280968485786353664", (v >> 38).ToString (), "#38");
+ Assert.AreEqual ("495627224619176800916140484242893176832", (v >> 39).ToString (), "#39");
+ Assert.AreEqual ("247813612309588400458070242121446588416", (v >> 40).ToString (), "#40");
+ Assert.AreEqual ("123906806154794200229035121060723294208", (v >> 41).ToString (), "#41");
+ Assert.AreEqual ("61953403077397100114517560530361647104", (v >> 42).ToString (), "#42");
+ Assert.AreEqual ("30976701538698550057258780265180823552", (v >> 43).ToString (), "#43");
+ Assert.AreEqual ("15488350769349275028629390132590411776", (v >> 44).ToString (), "#44");
+ Assert.AreEqual ("7744175384674637514314695066295205888", (v >> 45).ToString (), "#45");
+ Assert.AreEqual ("3872087692337318757157347533147602944", (v >> 46).ToString (), "#46");
+ Assert.AreEqual ("1936043846168659378578673766573801472", (v >> 47).ToString (), "#47");
+ Assert.AreEqual ("968021923084329689289336883286900736", (v >> 48).ToString (), "#48");
+ Assert.AreEqual ("484010961542164844644668441643450368", (v >> 49).ToString (), "#49");
+ Assert.AreEqual ("242005480771082422322334220821725184", (v >> 50).ToString (), "#50");
+ Assert.AreEqual ("121002740385541211161167110410862592", (v >> 51).ToString (), "#51");
+ Assert.AreEqual ("60501370192770605580583555205431296", (v >> 52).ToString (), "#52");
+ Assert.AreEqual ("30250685096385302790291777602715648", (v >> 53).ToString (), "#53");
+ Assert.AreEqual ("15125342548192651395145888801357824", (v >> 54).ToString (), "#54");
+ Assert.AreEqual ("7562671274096325697572944400678912", (v >> 55).ToString (), "#55");
+ Assert.AreEqual ("3781335637048162848786472200339456", (v >> 56).ToString (), "#56");
+ Assert.AreEqual ("1890667818524081424393236100169728", (v >> 57).ToString (), "#57");
+ Assert.AreEqual ("945333909262040712196618050084864", (v >> 58).ToString (), "#58");
+ Assert.AreEqual ("472666954631020356098309025042432", (v >> 59).ToString (), "#59");
+ Assert.AreEqual ("236333477315510178049154512521216", (v >> 60).ToString (), "#60");
+ Assert.AreEqual ("118166738657755089024577256260608", (v >> 61).ToString (), "#61");
+ Assert.AreEqual ("59083369328877544512288628130304", (v >> 62).ToString (), "#62");
+ Assert.AreEqual ("29541684664438772256144314065152", (v >> 63).ToString (), "#63");
+ Assert.AreEqual ("14770842332219386128072157032576", (v >> 64).ToString (), "#64");
+ Assert.AreEqual ("7385421166109693064036078516288", (v >> 65).ToString (), "#65");
+ Assert.AreEqual ("3692710583054846532018039258144", (v >> 66).ToString (), "#66");
+ Assert.AreEqual ("1846355291527423266009019629072", (v >> 67).ToString (), "#67");
+ Assert.AreEqual ("923177645763711633004509814536", (v >> 68).ToString (), "#68");
+ Assert.AreEqual ("461588822881855816502254907268", (v >> 69).ToString (), "#69");
+ }
+
+ [Test]
+ public void Bug10887 ()
+ {
+ BigInteger b = 0;
+ for(int i = 1; i <= 16; i++)
+ b = b * 256 + i;
+ BigInteger p = BigInteger.Pow (2, 32);
+ Assert.AreEqual ("1339673755198158349044581307228491536", b.ToString (), "#1");
+ Assert.AreEqual ("1339673755198158349044581307228491536", ((b << 32) / p).ToString (), "#2");
+ Assert.AreEqual ("1339673755198158349044581307228491536", (b * p >> 32).ToString (), "#3");
+ }
+
+ [Test]
+ public void DefaultCtorWorks ()
+ {
+ var a = new BigInteger ();
+ Assert.AreEqual (BigInteger.One, ++a, "#1");
+
+ a = new BigInteger ();
+ Assert.AreEqual (BigInteger.MinusOne, --a, "#2");
+
+ a = new BigInteger ();
+ Assert.AreEqual (BigInteger.MinusOne, ~a, "#3");
+
+ a = new BigInteger ();
+ Assert.AreEqual ("0", a.ToString (), "#4");
+
+ a = new BigInteger ();
+ Assert.AreEqual (true, a == a, "#5");
+
+ a = new BigInteger ();
+ Assert.AreEqual (false, a < a, "#6");
+
+ a = new BigInteger ();
+ Assert.AreEqual (true, a < 10l, "#7");
+
+ a = new BigInteger ();
+ Assert.AreEqual (true, a.IsEven, "#8");
+
+ a = new BigInteger ();
+ Assert.AreEqual (0, (int)a, "#9");
+
+ a = new BigInteger ();
+ Assert.AreEqual (0, (uint)a, "#10");
+
+ a = new BigInteger ();
+ Assert.AreEqual (0, (ulong)a, "#11");
+
+ a = new BigInteger ();
+ Assert.AreEqual (true, a.Equals (a), "#12");
+
+ a = new BigInteger ();
+ Assert.AreEqual (a, BigInteger.Min (a, a), "#13");
+
+ a = new BigInteger ();
+ Assert.AreEqual (a, BigInteger.GreatestCommonDivisor (a, a), "#14");
+
+ a = new BigInteger ();
+ Assert.AreEqual (BigInteger.Zero.GetHashCode (), a.GetHashCode (), "#15");
+ }
}
}
+2013-06-13 Christoph Ruegg <git@cdrnet.ch>
+
+ * BigIntegerTest.cs: Extended tests for
+ GreatestCommonDivisor to cover zero-args.
+
+2013-06-09 Christoph Ruegg <git@cdrnet.ch>
+
+ * ComplexTest.cs: Created; Tests ToString
+ with special format strings.
+
2010-03-06 Rodrigo Kumpera <rkumpera@novell.com>
* BigIntegerTest.cs: Tests for decimal stuff.
--- /dev/null
+// ComplexTest.cs
+//
+// Authors:
+// Christoph Ruegg <git@cdrnet.ch>
+//
+// Copyright (C) 2013 Novell, Inc (http://www.novell.com)
+//
+
+using System;
+using System.Numerics;
+using System.Globalization;
+using NUnit.Framework;
+
+namespace MonoTests.System.Numerics
+{
+ [TestFixture]
+ public class ComplexTest
+ {
+ [Test]
+ public void TestToStringFormats ()
+ {
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString (), "#1");
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString ("G"), "#2");
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString ((string)null), "#3");
+
+ IFormatProvider provider = CultureInfo.InvariantCulture;
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString (provider), "#4");
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString ("G", provider), "#5");
+ Assert.AreEqual ("(1, 2)", new Complex (1, 2).ToString ((string)null, provider), "#6");
+ }
+ }
+}
}
if (heapCount >= heapSize) {
- heapSize <<= 1;
- Array.Resize <MemoryCacheEntry> (ref heap, heapSize);
+ checked {
+ heapSize <<= 1;
+ }
+
+ if (heapSize <= Int32.MaxValue)
+ Array.Resize <MemoryCacheEntry> (ref heap, heapSize);
}
return heap;
return null;
if (heapSize > HEAP_RESIZE_THRESHOLD) {
- int halfTheSize = heapSize >> 1;
-
- if (heapCount < halfTheSize)
- Array.Resize <MemoryCacheEntry> (ref heap, halfTheSize + (heapCount / 3));
+ int halfTheSize, newSize;
+ checked {
+ halfTheSize = heapSize >> 1;
+ newSize = halfTheSize + (heapCount / 3);
+ }
+
+ if ((heapCount < halfTheSize) && newSize > -1)
+ Array.Resize <MemoryCacheEntry> (ref heap, newSize);
}
return heap;
queueLock.EnterWriteLock ();
locked = true;
heap = GetHeapWithGrow ();
- heap [heapCount++] = item;
+ heap [checked(heapCount++)] = item;
BubbleUp (heap);
} finally {
if (locked)
return null;
ret = heap [0];
- index = --heapCount;
+ index = checked(--heapCount);
heap [0] = heap [index];
heap [index] = null;
while (selected < heapCount && heap [selected].ExpiresAt < item.ExpiresAt) {
heap [index] = heap [selected];
index = selected;
- left = (index << 1) + 1;
+ left = checked((index << 1) + 1);
right = left + 1;
selected = right < heapCount && heap [right].ExpiresAt < heap [left].ExpiresAt ? right : left;
}
if (heapCount <= 1)
return;
- index = heapCount - 1;
- parentIndex = (index - 1) >> 1;
+ index = checked(heapCount - 1);
+ parentIndex = checked((index - 1) >> 1);
item = heap [index];
while (index > 0) {
scheduler.ExecuteAll ();
Assert.IsTrue (target.HasPostponed);
- ((IDataflowBlock)source).Fault (new Exception ());
+ var exception = new Exception ();
+ ((IDataflowBlock)source).Fault (exception);
scheduler.ExecuteAll ();
- Thread.Sleep (100);
+
+ try {
+ source.Completion.Wait (1000);
+ Assert.Fail ("Task must be faulted");
+ } catch (AggregateException ex) {
+ Assert.AreEqual (exception, ex.InnerException, "#9");
+ }
Assert.IsTrue (source.Completion.IsFaulted);
int value;
var target = new TestTargetBlock<int> { Postpone = true };
Assert.IsNotNull (source.LinkTo (target));
- Assert.IsTrue (source.Post (1));
- Assert.IsTrue (source.Post (2));
- Assert.IsTrue (source.Post (3));
- Thread.Sleep (500);
- Assert.IsTrue (target.HasPostponed);
+ Assert.IsTrue (source.Post (1), "#1");
+ Assert.IsTrue (source.Post (2), "#2");
+ Assert.IsTrue (source.Post (3), "#3");
+ target.PostponedEvent.Wait (1000);
+ Assert.IsTrue (target.HasPostponed, "#4");
- ((IDataflowBlock)source).Fault (new Exception ());
+ var exception = new Exception ();
+ ((IDataflowBlock)source).Fault (exception);
- Thread.Sleep (100);
+ source.Completion.Wait (1000);
- Assert.IsFalse (source.Completion.IsFaulted);
+ Assert.IsFalse (source.Completion.IsFaulted, "#5");
int value;
- Assert.IsTrue (target.RetryPostponed (out value));
- Assert.AreEqual (1, value);
+ Assert.IsTrue (target.RetryPostponed (out value), "#6");
+ Assert.AreEqual (1, value, "#7");
evt.Set ();
- Thread.Sleep (100);
+ try {
+ source.Completion.Wait (1000);
+ Assert.Fail ("Task must be faulted");
+ } catch (AggregateException ex) {
+ Assert.AreEqual (exception, ex.InnerException, "#9");
+ }
- Assert.IsTrue (source.Completion.IsFaulted);
- Assert.IsFalse (target.RetryPostponed (out value));
+ Assert.IsTrue (source.Completion.IsFaulted, "#10");
+ Assert.IsFalse (target.RetryPostponed (out value), "#11");
}
[Test]
public T DirectlyAccepted { get; private set; }
+ public ManualResetEventSlim PostponedEvent = new ManualResetEventSlim ();
+
public DataflowMessageStatus OfferMessage (
DataflowMessageHeader messageHeader, T messageValue, ISourceBlock<T> source,
bool consumeToAccept)
if (Postpone) {
postponed = Tuple.Create (source, messageHeader);
+ PostponedEvent.Set ();
return DataflowMessageStatus.Postponed;
}
var action = new ActionBlock<int> (i => received = true);
transformMany.LinkTo (action);
- Assert.IsTrue (transformMany.Post (1));
+ Assert.IsTrue (transformMany.Post (1), "#1");
transformMany.Complete ();
- Assert.IsTrue (transformMany.Completion.Wait (100));
- Assert.IsFalse (received);
+ Assert.IsTrue (transformMany.Completion.Wait (100), "#2");
+ Assert.IsFalse (received, "#3");
}
[Test]
block.LinkTo (action1);
block.LinkTo (action2);
- Assert.IsTrue (block.Post (42));
- Assert.IsFalse (block.Post (43));
+ Assert.IsTrue (block.Post (42), "#1");
+ Assert.IsFalse (block.Post (43), "#2");
- Assert.IsTrue (evt.Wait (100));
+ Assert.IsTrue (evt.Wait (100), "#3");
- Assert.IsTrue (act1);
- Assert.IsTrue (act2);
+ Assert.IsTrue (act1, "#4");
+ Assert.IsTrue (act2, "#5");
}
[Test]
using System.Collections.Generic;
using System.Security.Permissions;
using System.Text;
+using System.Text.RegularExpressions;
using System.Web;
using System.Web.Util;
+using System.Diagnostics;
+using System.Globalization;
namespace System.Web.Routing
{
return dict;
}
+ static bool ParametersAreEqual (object a, object b)
+ {
+ if (a is string && b is string) {
+ return String.Equals (a as string, b as string, StringComparison.OrdinalIgnoreCase);
+ } else {
+ // Parameter may be a boxed value type, need to use .Equals() for comparison
+ return object.Equals (a, b);
+ }
+ }
+
+ static bool ParameterIsNonEmpty (object param)
+ {
+ if (param is string)
+ return !string.IsNullOrEmpty (param as string);
+
+ return param != null;
+ }
+
+ bool IsParameterRequired (string parameterName, RouteValueDictionary defaultValues, out object defaultValue)
+ {
+ foreach (var token in tokens) {
+ if (token == null)
+ continue;
+
+ if (string.Equals (token.Name, parameterName, StringComparison.OrdinalIgnoreCase)) {
+ if (token.Type == PatternTokenType.CatchAll) {
+ defaultValue = null;
+ return false;
+ }
+ }
+ }
+
+ if (defaultValues == null)
+ throw new ArgumentNullException ("defaultValues is null?!");
+
+ return !defaultValues.TryGetValue (parameterName, out defaultValue);
+ }
+
+ static string EscapeReservedCharacters (Match m)
+ {
+ if (m == null)
+ throw new ArgumentNullException("m");
+
+ return Uri.HexEscape (m.Value[0]);
+ }
+
+ static string UriEncode (string str)
+ {
+ if (string.IsNullOrEmpty (str))
+ return str;
+
+ string escape = Uri.EscapeUriString (str);
+ return Regex.Replace (escape, "([#?])", new MatchEvaluator (EscapeReservedCharacters));
+ }
+
bool MatchSegment (int segIndex, int argsCount, string[] argSegs, List <PatternToken> tokens, RouteValueDictionary ret)
{
string pathSegment = argSegs [segIndex];
return null;
RouteData routeData = requestContext.RouteData;
- RouteValueDictionary defaultValues = route != null ? route.Defaults : null;
- RouteValueDictionary ambientValues = routeData.Values;
-
- if (defaultValues != null && defaultValues.Count == 0)
- defaultValues = null;
- if (ambientValues != null && ambientValues.Count == 0)
- ambientValues = null;
- if (userValues != null && userValues.Count == 0)
- userValues = null;
-
- // Check URL parameters
- // It is allowed to take ambient values for required parameters if:
- //
- // - there are no default values provided
- // - the default values dictionary contains at least one required
- // parameter value
- //
- bool canTakeFromAmbient;
- if (defaultValues == null)
- canTakeFromAmbient = true;
- else {
- canTakeFromAmbient = false;
- foreach (KeyValuePair <string, bool> de in parameterNames) {
- if (defaultValues.ContainsKey (de.Key)) {
- canTakeFromAmbient = true;
+ var currentValues = routeData.Values ?? new RouteValueDictionary ();
+ var values = userValues ?? new RouteValueDictionary ();
+ var defaultValues = (route != null ? route.Defaults : null) ?? new RouteValueDictionary ();
+
+ // The set of values we should be using when generating the URL in this route
+ var acceptedValues = new RouteValueDictionary ();
+
+ // Keep track of which new values have been used
+ HashSet<string> unusedNewValues = new HashSet<string> (values.Keys, StringComparer.OrdinalIgnoreCase);
+
+ // This route building logic is based on System.Web.Http's Routing code (which is Apache Licensed by MS)
+ // and which can be found at mono's external/aspnetwebstack/src/System.Web.Http/Routing/HttpParsedRoute.cs
+ // Hopefully this will ensure a much higher compatiblity with MS.NET's System.Web.Routing logic. (pruiz)
+
+ #region Step 1: Get the list of values we're going to use to match and generate this URL
+ // Find out which entries in the URL are valid for the URL we want to generate.
+ // If the URL had ordered parameters a="1", b="2", c="3" and the new values
+ // specified that b="9", then we need to invalidate everything after it. The new
+ // values should then be a="1", b="9", c=<no value>.
+ foreach (var item in parameterNames) {
+ var parameterName = item.Key;
+
+ object newParameterValue;
+ bool hasNewParameterValue = values.TryGetValue (parameterName, out newParameterValue);
+ if (hasNewParameterValue) {
+ unusedNewValues.Remove(parameterName);
+ }
+
+ object currentParameterValue;
+ bool hasCurrentParameterValue = currentValues.TryGetValue (parameterName, out currentParameterValue);
+
+ if (hasNewParameterValue && hasCurrentParameterValue) {
+ if (!ParametersAreEqual (currentParameterValue, newParameterValue)) {
+ // Stop copying current values when we find one that doesn't match
break;
}
}
- }
-
- bool allMustBeInUserValues = false;
- foreach (KeyValuePair <string, bool> de in parameterNames) {
- string parameterName = de.Key;
- // Is the parameter required?
- if (defaultValues == null || !defaultValues.ContainsKey (parameterName)) {
- // Yes, it is required (no value in defaults)
- // Has the user provided value for it?
- if (userValues == null || !userValues.ContainsKey (parameterName)) {
- if (allMustBeInUserValues)
- return null; // partial override => no match
-
- if (!canTakeFromAmbient || ambientValues == null || !ambientValues.ContainsKey (parameterName))
- return null; // no value provided => no match
- } else if (canTakeFromAmbient)
- allMustBeInUserValues = true;
+
+ // If the parameter is a match, add it to the list of values we will use for URL generation
+ if (hasNewParameterValue) {
+ if (ParameterIsNonEmpty (newParameterValue)) {
+ acceptedValues.Add (parameterName, newParameterValue);
+ }
+ }
+ else {
+ if (hasCurrentParameterValue) {
+ acceptedValues.Add (parameterName, currentParameterValue);
+ }
}
}
- // Check for non-url parameters
- if (defaultValues != null) {
- foreach (var de in defaultValues) {
- string parameterName = de.Key;
-
- if (parameterNames.ContainsKey (parameterName))
- continue;
-
- object parameterValue = null;
- // Has the user specified value for this parameter and, if
- // yes, is it the same as the one in defaults?
- if (userValues != null && userValues.TryGetValue (parameterName, out parameterValue)) {
- object defaultValue = de.Value;
- if (defaultValue is string && parameterValue is string) {
- if (String.Compare ((string)defaultValue, (string)parameterValue, StringComparison.OrdinalIgnoreCase) != 0)
- return null; // different value => no match
- // Parameter may be a boxed value type, need to use .Equals() for comparison
- } else if (!object.Equals (parameterValue, defaultValue))
- return null; // different value => no match
- }
+ // Add all remaining new values to the list of values we will use for URL generation
+ foreach (var newValue in values) {
+ if (ParameterIsNonEmpty (newValue.Value) && !acceptedValues.ContainsKey (newValue.Key)) {
+ acceptedValues.Add (newValue.Key, newValue.Value);
}
}
- // We're a match, generate the URL
- var ret = new StringBuilder ();
- usedValues = new RouteValueDictionary ();
- bool canTrim = true;
-
- // Going in reverse order, so that we can trim without much ado
- int tokensCount = tokens.Length - 1;
- for (int i = tokensCount; i >= 0; i--) {
- PatternToken token = tokens [i];
- if (token == null) {
- if (i < tokensCount && ret.Length > 0 && ret [0] != '/')
- ret.Insert (0, '/');
- continue;
+ // Add all current values that aren't in the URL at all
+ foreach (var currentValue in currentValues) {
+ if (!acceptedValues.ContainsKey (currentValue.Key) && !parameterNames.ContainsKey (currentValue.Key)) {
+ acceptedValues.Add (currentValue.Key, currentValue.Value);
}
-
- if (token.Type == PatternTokenType.Literal) {
- ret.Insert (0, token.Name);
- continue;
+ }
+
+ // Add all remaining default values from the route to the list of values we will use for URL generation
+ foreach (var item in parameterNames) {
+ object defaultValue;
+ if (!acceptedValues.ContainsKey (item.Key) && !IsParameterRequired (item.Key, defaultValues, out defaultValue)) {
+ // Add the default value only if there isn't already a new value for it and
+ // only if it actually has a default value, which we determine based on whether
+ // the parameter value is required.
+ acceptedValues.Add (item.Key, defaultValue);
}
+ }
- string parameterName = token.Name;
- object tokenValue;
+ // All required parameters in this URL must have values from somewhere (i.e. the accepted values)
+ foreach (var item in parameterNames) {
+ object defaultValue;
+ if (IsParameterRequired (item.Key, defaultValues, out defaultValue) && !acceptedValues.ContainsKey (item.Key)) {
+ // If the route parameter value is required that means there's
+ // no default value, so if there wasn't a new value for it
+ // either, this route won't match.
+ return null;
+ }
+ }
-#if SYSTEMCORE_DEP
- if (userValues.GetValue (parameterName, out tokenValue)) {
- if (tokenValue != null)
- usedValues.Add (parameterName, tokenValue.ToString ());
+ // All other default values must match if they are explicitly defined in the new values
+ var otherDefaultValues = new RouteValueDictionary (defaultValues);
+ foreach (var item in parameterNames) {
+ otherDefaultValues.Remove (item.Key);
+ }
- if (!defaultValues.Has (parameterName, tokenValue)) {
- canTrim = false;
- if (tokenValue != null)
- ret.Insert (0, tokenValue.ToString ());
- continue;
+ foreach (var defaultValue in otherDefaultValues) {
+ object value;
+ if (values.TryGetValue (defaultValue.Key, out value)) {
+ unusedNewValues.Remove (defaultValue.Key);
+ if (!ParametersAreEqual (value, defaultValue.Value)) {
+ // If there is a non-parameterized value in the route and there is a
+ // new value for it and it doesn't match, this route won't match.
+ return null;
}
-
- if (!canTrim && tokenValue != null)
- ret.Insert (0, tokenValue.ToString ());
-
- continue;
}
+ }
+ #endregion
- if (defaultValues.GetValue (parameterName, out tokenValue)) {
- object ambientTokenValue;
- if (ambientValues.GetValue (parameterName, out ambientTokenValue))
- tokenValue = ambientTokenValue;
+ #region Step 2: If the route is a match generate the appropriate URL
- if (!canTrim && tokenValue != null)
- ret.Insert (0, tokenValue.ToString ());
+ var uri = new StringBuilder ();
+ var pendingParts = new StringBuilder ();
+ var pendingPartsAreAllSafe = false;
+ bool blockAllUriAppends = false;
+ var allSegments = new List<PatternSegment?> ();
- usedValues.Add (parameterName, tokenValue.ToString ());
- continue;
- }
+ // Build a list of segments plus separators we can use as template.
+ foreach (var segment in segments) {
+ if (allSegments.Count > 0)
+ allSegments.Add (null); // separator exposed as null.
+ allSegments.Add (segment);
+ }
- canTrim = false;
- if (ambientValues.GetValue (parameterName, out tokenValue)) {
- if (tokenValue != null)
- {
- ret.Insert (0, tokenValue.ToString ());
- usedValues.Add (parameterName, tokenValue.ToString ());
+ // Finally loop thru al segment-templates building the actual uri.
+ foreach (var item in allSegments) {
+ var segment = item.GetValueOrDefault ();
+
+ // If segment is a separator..
+ if (item == null) {
+ if (pendingPartsAreAllSafe) {
+ // Accept
+ if (pendingParts.Length > 0) {
+ if (blockAllUriAppends)
+ return null;
+
+ // Append any pending literals to the URL
+ uri.Append (pendingParts.ToString ());
+ pendingParts.Length = 0;
+ }
}
- continue;
- }
+ pendingPartsAreAllSafe = false;
+
+ // Guard against appending multiple separators for empty segments
+ if (pendingParts.Length > 0 && pendingParts[pendingParts.Length - 1] == '/') {
+ // Dev10 676725: Route should not be matched if that causes mismatched tokens
+ // Dev11 86819: We will allow empty matches if all subsequent segments are null
+ if (blockAllUriAppends)
+ return null;
+
+ // Append any pending literals to the URI (without the trailing slash) and prevent any future appends
+ uri.Append(pendingParts.ToString (0, pendingParts.Length - 1));
+ pendingParts.Length = 0;
+ } else {
+ pendingParts.Append ("/");
+ }
+#if false
+ } else if (segment.AllLiteral) {
+ // Spezial (optimized) case: all elements of segment are literals.
+ pendingPartsAreAllSafe = true;
+ foreach (var tk in segment.Tokens)
+ pendingParts.Append (tk.Name);
#endif
- }
+ } else {
+ // Segments are treated as all-or-none. We should never output a partial segment.
+ // If we add any subsegment of this segment to the generated URL, we have to add
+ // the complete match. For example, if the subsegment is "{p1}-{p2}.xml" and we
+ // used a value for {p1}, we have to output the entire segment up to the next "/".
+ // Otherwise we could end up with the partial segment "v1" instead of the entire
+ // segment "v1-v2.xml".
+ bool addedAnySubsegments = false;
+
+ foreach (var token in segment.Tokens) {
+ if (token.Type == PatternTokenType.Literal) {
+ // If it's a literal we hold on to it until we are sure we need to add it
+ pendingPartsAreAllSafe = true;
+ pendingParts.Append (token.Name);
+ } else {
+ if (token.Type == PatternTokenType.Standard) {
+ if (pendingPartsAreAllSafe) {
+ // Accept
+ if (pendingParts.Length > 0) {
+ if (blockAllUriAppends)
+ return null;
+
+ // Append any pending literals to the URL
+ uri.Append (pendingParts.ToString ());
+ pendingParts.Length = 0;
+
+ addedAnySubsegments = true;
+ }
+ }
+ pendingPartsAreAllSafe = false;
+
+ // If it's a parameter, get its value
+ object acceptedParameterValue;
+ bool hasAcceptedParameterValue = acceptedValues.TryGetValue (token.Name, out acceptedParameterValue);
+ if (hasAcceptedParameterValue)
+ unusedNewValues.Remove (token.Name);
+
+ object defaultParameterValue;
+ defaultValues.TryGetValue (token.Name, out defaultParameterValue);
+
+ if (ParametersAreEqual (acceptedParameterValue, defaultParameterValue)) {
+ // If the accepted value is the same as the default value, mark it as pending since
+ // we won't necessarily add it to the URL we generate.
+ pendingParts.Append (Convert.ToString (acceptedParameterValue, CultureInfo.InvariantCulture));
+ } else {
+ if (blockAllUriAppends)
+ return null;
+
+ // Add the new part to the URL as well as any pending parts
+ if (pendingParts.Length > 0) {
+ // Append any pending literals to the URL
+ uri.Append (pendingParts.ToString ());
+ pendingParts.Length = 0;
+ }
+ uri.Append (Convert.ToString (acceptedParameterValue, CultureInfo.InvariantCulture));
+
+ addedAnySubsegments = true;
+ }
+ } else {
+ Debug.Fail ("Invalid path subsegment type");
+ }
+ }
+ }
- // All the values specified in userValues that aren't part of the original
- // URL, the constraints or defaults collections are treated as overflow
- // values - they are appended as query parameters to the URL
- if (userValues != null) {
- bool first = true;
- foreach (var de in userValues) {
- string parameterName = de.Key;
+ if (addedAnySubsegments) {
+ // See comment above about why we add the pending parts
+ if (pendingParts.Length > 0) {
+ if (blockAllUriAppends)
+ return null;
-#if SYSTEMCORE_DEP
- if (parameterNames.ContainsKey (parameterName) || defaultValues.Has (parameterName) || constraints.Has (parameterName))
- continue;
-#endif
+ // Append any pending literals to the URL
+ uri.Append (pendingParts.ToString ());
+ pendingParts.Length = 0;
+ }
+ }
+ }
+ }
- object parameterValue = de.Value;
- if (parameterValue == null)
- continue;
+ if (pendingPartsAreAllSafe) {
+ // Accept
+ if (pendingParts.Length > 0) {
+ if (blockAllUriAppends)
+ return null;
- var parameterValueAsString = parameterValue as string;
- if (parameterValueAsString != null && parameterValueAsString.Length == 0)
- continue;
-
- if (first) {
- ret.Append ('?');
- first = false;
- } else
- ret.Append ('&');
+ // Append any pending literals to the URI
+ uri.Append (pendingParts.ToString ());
+ }
+ }
-
- ret.Append (Uri.EscapeDataString (parameterName));
- ret.Append ('=');
- if (parameterValue != null)
- ret.Append (Uri.EscapeDataString (de.Value.ToString ()));
+ // Process constraints keys
+ if (constraints != null) {
+ // If there are any constraints, mark all the keys as being used so that we don't
+ // generate query string items for custom constraints that don't appear as parameters
+ // in the URI format.
+ foreach (var constraintsItem in constraints) {
+ unusedNewValues.Remove (constraintsItem.Key);
+ }
+ }
- usedValues.Add (parameterName, de.Value.ToString ());
+ // Encode the URI before we append the query string, otherwise we would double encode the query string
+ var encodedUri = new StringBuilder ();
+ encodedUri.Append (UriEncode (uri.ToString ()));
+ uri = encodedUri;
+
+ // Add remaining new values as query string parameters to the URI
+ if (unusedNewValues.Count > 0) {
+ // Generate the query string
+ bool firstParam = true;
+ foreach (string unusedNewValue in unusedNewValues) {
+ object value;
+ if (acceptedValues.TryGetValue (unusedNewValue, out value)) {
+ uri.Append (firstParam ? '?' : '&');
+ firstParam = false;
+ uri.Append (Uri.EscapeDataString (unusedNewValue));
+ uri.Append ('=');
+ uri.Append (Uri.EscapeDataString (Convert.ToString (value, CultureInfo.InvariantCulture)));
+ }
}
}
-
- return ret.ToString ();
+
+ #endregion
+
+ usedValues = acceptedValues;
+ return uri.ToString();
}
}
}
Assert.IsNull (vp);
}
+ [Test]
+ public void GetVirtualPath4_2 ()
+ {
+ var r = new MyRoute("{foo}/{bar}", new MyRouteHandler());
+ var hc = new HttpContextStub2("~/x/y", String.Empty);
+ var rd = r.GetRouteData(hc);
+
+ // override a value incompletely
+ var values = new RouteValueDictionary();
+ values["bar"] = "A";
+
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+ Assert.IsNotNull(vp);
+ Assert.AreEqual("x/A", vp.VirtualPath);
+ }
+
+ [Test]
+ public void GetVirtualPath4Bis ()
+ {
+ var r = new MyRoute("part/{foo}/{bar}", new MyRouteHandler());
+ var hc = new HttpContextStub2("~/part/x/y", String.Empty);
+ var rd = r.GetRouteData(hc);
+
+ // override a value incompletely
+ var values = new RouteValueDictionary();
+ values["foo"] = "A";
+
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+ Assert.IsNull(vp);
+ }
+
+ [Test]
+ public void GetVirtualPath4_2Bis ()
+ {
+ var r = new MyRoute("part/{foo}/{bar}", new MyRouteHandler());
+ var hc = new HttpContextStub2("~/part/x/y", String.Empty);
+ var rd = r.GetRouteData(hc);
+
+ // override a value incompletely
+ var values = new RouteValueDictionary();
+ values["bar"] = "A";
+
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+ Assert.IsNotNull(vp);
+ Assert.AreEqual("part/x/A", vp.VirtualPath);
+ }
+
[Test]
public void GetVirtualPath5 ()
{
Assert.AreEqual ("HelloWorld", uppercase.VirtualPath, "#A6");
}
+ [Test]
+ public void GetVirtualPath20 ()
+ {
+ var r = new MyRoute("summary/{controller}/{id}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary(new { action = "Index" })
+ };
+ var hc = new HttpContextStub2("~/summary/kind/1/test", String.Empty);
+ var rd = r.GetRouteData(hc);
+ Assert.IsNotNull(rd, "#1");
+
+ var values = new RouteValueDictionary(new { id = "2", action = "save" });
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#2");
+ Assert.AreEqual("summary/kind/2/save", vp.VirtualPath, "#2-1");
+ Assert.AreEqual(r, vp.Route, "#2-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#2-3");
+
+ values = new RouteValueDictionary(new { id = "3", action = "save", extra = "stuff" });
+ vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#3");
+ Assert.AreEqual("summary/kind/3/save?extra=stuff", vp.VirtualPath, "#3-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#3-3");
+ }
+
+ [Test]
+ public void GetVirtualPath21 ()
+ {
+ var r = new MyRoute("summary/{controller}/{id}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary(new { action = "Index" })
+ };
+ var hc = new HttpContextStub2("~/summary/kind/1/test", String.Empty);
+ var rd = r.GetRouteData(hc);
+ Assert.IsNotNull(rd, "#1");
+ Assert.AreEqual("1", rd.Values["id"]);
+
+ var values = new RouteValueDictionary(new { action = "save" });
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#2");
+ Assert.AreEqual("summary/kind/1/save", vp.VirtualPath, "#2-1");
+ Assert.AreEqual(r, vp.Route, "#2-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#2-3");
+
+ values = new RouteValueDictionary(new { action = "save", extra = "stuff" });
+ vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#3");
+ Assert.AreEqual("summary/kind/1/save?extra=stuff", vp.VirtualPath, "#3-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#3-3");
+ }
+
+ [Test]
+ public void GetVirtualPath22 ()
+ {
+ var r = new MyRoute("summary/{controller}/{id}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary(new { action = "Index" })
+ };
+ var hc = new HttpContextStub2("~/summary/kind/90941a4f-daf3-4c89-a6dc-83e8de4e3db5/test", String.Empty);
+ var rd = r.GetRouteData(hc);
+ Assert.IsNotNull(rd, "#0");
+ Assert.AreEqual("90941a4f-daf3-4c89-a6dc-83e8de4e3db5", rd.Values["id"]);
+
+ var values = new RouteValueDictionary(new { action = "Index" });
+ var vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#1");
+ Assert.AreEqual("summary/kind/90941a4f-daf3-4c89-a6dc-83e8de4e3db5", vp.VirtualPath, "#1-1");
+ Assert.AreEqual(r, vp.Route, "#1-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#1-3");
+
+ values = new RouteValueDictionary(new { action = "save" });
+ vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#2");
+ Assert.AreEqual("summary/kind/90941a4f-daf3-4c89-a6dc-83e8de4e3db5/save", vp.VirtualPath, "#2-1");
+ Assert.AreEqual(r, vp.Route, "#2-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#2-3");
+
+ values = new RouteValueDictionary(new { action = "save", extra = "stuff" });
+ vp = r.GetVirtualPath(new RequestContext(hc, rd), values);
+
+ Assert.IsNotNull(vp, "#3");
+ Assert.AreEqual("summary/kind/90941a4f-daf3-4c89-a6dc-83e8de4e3db5/save?extra=stuff", vp.VirtualPath, "#3-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#3-3");
+ }
+
+ [Test]
+ public void GetVirtualPath23 ()
+ {
+ var r0 = new MyRoute ("summary/{id}", new MyRouteHandler());
+ var r1 = new MyRoute ("summary/{controller}/{id}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary (new { action = "Index" })
+ };
+ var hc = new HttpContextStub2 ("~/summary/90941a4f-daf3-4c89-a6dc-83e8de4e3db5", String.Empty);
+ var rd = r0.GetRouteData (hc);
+ Assert.IsNotNull (rd, "#0");
+ Assert.AreEqual ("90941a4f-daf3-4c89-a6dc-83e8de4e3db5", rd.Values["id"]);
+
+ var values = new RouteValueDictionary ()
+ {
+ { "controller", "SomeThing" },
+ { "action", "Index" }
+ };
+ var vp = r1.GetVirtualPath (new RequestContext (hc, rd), values);
+
+ Assert.IsNotNull (vp, "#1");
+ Assert.AreEqual ("summary/SomeThing/90941a4f-daf3-4c89-a6dc-83e8de4e3db5", vp.VirtualPath, "#1-1");
+ Assert.AreEqual (r1, vp.Route, "#1-2");
+ Assert.AreEqual (0, vp.DataTokens.Count, "#1-3");
+ }
+
+ [Test]
+ public void GetVirtualPath24 ()
+ {
+ var r = new MyRoute ("{controller}/{country}-{locale}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary (new { action = "Index", country = "us", locale = "en" })
+ };
+ var hc = new HttpContextStub2 ("~/login", String.Empty);
+ var rd = r.GetRouteData (hc);
+ Assert.IsNull (rd, "#0");
+
+ var values = new RouteValueDictionary ()
+ {
+ { "controller", "SomeThing" },
+ { "action", "Index" },
+ { "country", "es" }
+ };
+ var vp = r.GetVirtualPath (new RequestContext (hc, new RouteData()), values);
+
+ Assert.IsNotNull (vp, "#1");
+ Assert.AreEqual ("SomeThing/es-en", vp.VirtualPath, "#1-1");
+ Assert.AreEqual (r, vp.Route, "#1-2");
+ Assert.AreEqual (0, vp.DataTokens.Count, "#1-3");
+
+ // Case #2: pass no country, but locale as user value.
+ values.Remove("country");
+ values.Add("locale", "xx");
+ vp = r.GetVirtualPath(new RequestContext(hc, new RouteData()), values);
+
+ Assert.IsNotNull(vp, "#2");
+ Assert.AreEqual("SomeThing/us-xx", vp.VirtualPath, "#2-1");
+ Assert.AreEqual(r, vp.Route, "#2-2");
+ Assert.AreEqual(0, vp.DataTokens.Count, "#2-3");
+
+ // Case #3: make contry required.
+ r = new MyRoute("{controller}/{country}-{locale}/{action}", new MyRouteHandler())
+ {
+ Defaults = new RouteValueDictionary(new { action = "Index", locale = "en" })
+ };
+ vp = r.GetVirtualPath(new RequestContext(hc, new RouteData()), values);
+
+ Assert.IsNull(vp, "#3");
+ }
+
// Bug #500739
[Test]
public void RouteGetRequiredStringWithDefaults ()
<Compile Include="System.Web.Configuration_2.0\IConfigMapPathFactory.cs" />\r
<Compile Include="System.Web.Configuration_2.0\IdentitySection.cs" />\r
<Compile Include="System.Web.Configuration_2.0\IRemoteWebConfigurationHostServer.cs" />\r
+ <Compile Include="System.Web.Configuration_2.0\LruCache.cs" />\r
<Compile Include="System.Web.Configuration_2.0\LowerCaseStringConverter.cs" />\r
<Compile Include="System.Web.Configuration_2.0\MachineKeyCompatibilityMode.cs" />\r
<Compile Include="System.Web.Configuration_2.0\MachineKeyRegistryStorage.cs" />\r
--- /dev/null
+//
+// A simple LRU cache
+//
+// Authors:
+// Miguel de Icaza (miguel@gnome.org)
+// Andres G. Aragoneses (andres@7digital.com)
+//
+// Copyright 2010 Miguel de Icaza
+// Copyright 2013 7digital Media Ltd.
+//
+// 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;
+
+namespace System.Web.Configuration {
+
+ class LruCache<TKey, TValue> {
+ Dictionary<TKey, LinkedListNode <TValue>> dict;
+ Dictionary<LinkedListNode<TValue>, TKey> revdict;
+ LinkedList<TValue> list;
+ int entry_limit;
+
+ bool eviction_warning_shown;
+ int evictions;
+ bool size_overriden;
+
+ internal string EvictionWarning { set; private get; }
+
+ public LruCache (int entryLimit)
+ {
+ entry_limit = entryLimit;
+ dict = new Dictionary<TKey, LinkedListNode<TValue>> ();
+ revdict = new Dictionary<LinkedListNode<TValue>, TKey> ();
+ list = new LinkedList<TValue> ();
+ }
+
+ //for debugging: public int Count { get { return dict.Count; } }
+
+ void Evict ()
+ {
+ var last = list.Last;
+ if (last == null)
+ return;
+
+ var key = revdict [last];
+
+ dict.Remove (key);
+ revdict.Remove (last);
+ list.RemoveLast ();
+ DisposeValue (last.Value);
+ evictions++;
+
+ if (!String.IsNullOrEmpty (EvictionWarning) && !eviction_warning_shown && (evictions >= entry_limit)) {
+ Console.Error.WriteLine ("WARNING: " + EvictionWarning);
+ eviction_warning_shown = true;
+ }
+ }
+
+ public void Clear ()
+ {
+ foreach (var element in list) {
+ DisposeValue (element);
+ }
+
+ dict.Clear ();
+ revdict.Clear ();
+ list.Clear ();
+ eviction_warning_shown = false;
+ evictions = 0;
+ }
+
+ void DisposeValue (TValue value)
+ {
+ if (value is IDisposable) {
+ ((IDisposable)value).Dispose ();
+ }
+ }
+
+ public bool TryGetValue (TKey key, out TValue value)
+ {
+ LinkedListNode<TValue> node;
+
+ if (dict.TryGetValue (key, out node)){
+ list.Remove (node);
+ list.AddFirst (node);
+
+ value = node.Value;
+ return true;
+ }
+ value = default (TValue);
+ return false;
+ }
+
+ public void Add (TKey key, TValue value)
+ {
+ LinkedListNode<TValue> node;
+
+ if (dict.TryGetValue (key, out node)){
+
+ // If we already have a key, move it to the front
+ list.Remove (node);
+ list.AddFirst (node);
+
+ // Remove the old value
+ DisposeValue (node.Value);
+
+ node.Value = value;
+ return;
+ }
+
+ if (dict.Count >= entry_limit)
+ Evict ();
+
+ // Adding new node
+ node = new LinkedListNode<TValue> (value);
+ list.AddFirst (node);
+ dict [key] = node;
+ revdict [node] = key;
+ }
+
+ public override string ToString ()
+ {
+ return "LRUCache dict={0} revdict={1} list={2}";
+ }
+ }
+}
// See comment for the cacheLock field at top of System.Web.Caching/Cache.cs
static readonly ReaderWriterLockSlim sectionCacheLock;
-
+
#if !TARGET_J2EE
static IInternalConfigConfigurationFactory configFactory;
static Hashtable configurations = Hashtable.Synchronized (new Hashtable ());
- static Dictionary <int, object> sectionCache = new Dictionary <int, object> ();
static Hashtable configPaths = Hashtable.Synchronized (new Hashtable ());
static bool suppressAppReload;
#else
}
}
}
+
+ const int DEFAULT_SECTION_CACHE_SIZE = 100;
+ const string CACHE_SIZE_OVERRIDING_KEY = "MONO_ASPNET_WEBCONFIG_CACHESIZE";
+ static LruCache<int, object> sectionCache;
static WebConfigurationManager ()
{
+ var section_cache_size = DEFAULT_SECTION_CACHE_SIZE;
+ int section_cache_size_override;
+ bool size_overriden = false;
+ if (int.TryParse (Environment.GetEnvironmentVariable (CACHE_SIZE_OVERRIDING_KEY), out section_cache_size_override)) {
+ section_cache_size = section_cache_size_override;
+ size_overriden = true;
+ Console.WriteLine ("WebConfigurationManager's LRUcache Size overriden to: {0} (via {1})", section_cache_size_override, CACHE_SIZE_OVERRIDING_KEY);
+ }
+ sectionCache = new LruCache<int, object> (section_cache_size);
+ string eviction_warning = "WebConfigurationManager's LRUcache evictions count reached its max size";
+ if (!size_overriden)
+ eviction_warning += String.Format ("{0}Cache Size: {1} (overridable via {2})",
+ Environment.NewLine, section_cache_size, CACHE_SIZE_OVERRIDING_KEY);
+ sectionCache.EvictionWarning = eviction_warning;
+
configFactory = ConfigurationManager.ConfigurationFactory;
_Configuration.SaveStart += ConfigurationSaveHandler;
_Configuration.SaveEnd += ConfigurationSaveHandler;
baseCacheKey ^= configPath.GetHashCode ();
try {
- sectionCacheLock.EnterReadLock ();
+ sectionCacheLock.EnterWriteLock ();
object o;
if (pathPresent) {
if (sectionCache.TryGetValue (baseCacheKey, out o))
return o;
} finally {
- sectionCacheLock.ExitReadLock ();
+ sectionCacheLock.ExitWriteLock ();
}
string cachePath = null;
{
object cachedSection;
+ bool locked = false;
try {
- if (!sectionCacheLock.TryEnterUpgradeableReadLock (SECTION_CACHE_LOCK_TIMEOUT))
+ if (!sectionCacheLock.TryEnterWriteLock (SECTION_CACHE_LOCK_TIMEOUT))
return;
-
+ locked = true;
+
if (sectionCache.TryGetValue (key, out cachedSection) && cachedSection != null)
return;
- try {
- if (!sectionCacheLock.TryEnterWriteLock (SECTION_CACHE_LOCK_TIMEOUT))
- return;
- sectionCache.Add (key, section);
- } finally {
- try {
- sectionCacheLock.ExitWriteLock ();
- } catch (SynchronizationLockException) {
- // we can ignore it here
- }
- }
+ sectionCache.Add (key, section);
} finally {
- try {
- sectionCacheLock.ExitUpgradeableReadLock ();
- } catch (SynchronizationLockException) {
- // we can ignore it here
+ if (locked) {
+ sectionCacheLock.ExitWriteLock ();
}
}
}
System.Web.Configuration_2.0/IConfigMapPathFactory.cs
System.Web.Configuration_2.0/IRemoteWebConfigurationHostServer.cs
System.Web.Configuration_2.0/LowerCaseStringConverter.cs
+System.Web.Configuration_2.0/LruCache.cs
System.Web.Configuration_2.0/MachineKeyRegistryStorage.cs
System.Web.Configuration_2.0/MachineKeySection.cs
System.Web.Configuration_2.0/MachineKeyValidation.cs
// changing last byte (padding)
byte be = encdata [encdata.Length - 1];
encdata [encdata.Length - 1] = ChangeByte (be);
- Assert.IsNull (MachineKeySectionUtils.Decrypt (section, encdata), "bad padding");
+ byte[] result = MachineKeySectionUtils.Decrypt (section, encdata);
+ // this will return null if a bad padding is detected - OTOH since we're using a random key and we
+ // encrypt a random IV it's possible the decrypted stuff will randomly have a "valid" padding (there's
+ // only so much possible values and the bots runs those tests pretty often and give false positive)
+ // To avoid this we fallback to ensure the data is invalid (if should be empty)
+ int total = 0;
+ if (result != null) {
+ for (int i=0; i < result.Length; i++)
+ total += result [i];
+ }
+ Assert.IsTrue (result == null || total != 0, "bad padding");
}
[Test]
--- /dev/null
+//
+// TypeForwarders.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Windows.dll")]
+[assembly: AssemblyDescription ("System.Windows.dll")]
+[assembly: AssemblyDefaultAlias ("System.Windows.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../msfinal.pub")]
+
+[assembly: ReferenceAssembly]
--- /dev/null
+thisdir = class/System.Windows
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Windows.dll
+LIB_MCS_FLAGS = /r:System
+
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+AssemblyInfo.cs
+TypeForwarders.cs
+../../build/common/Consts.cs
--- /dev/null
+//
+// TypeForwarders.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.INotifyCollectionChanged))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ObservableCollection<>))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.ObjectModel.ReadOnlyObservableCollection<>))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedAction))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventArgs))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Collections.Specialized.NotifyCollectionChangedEventHandler))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Windows.Input.ICommand))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.INotifyDataErrorInfo))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ComponentModel.DataErrorsChangedEventArgs))]
+
--- /dev/null
+//
+// TypeForwarders.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+using System;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+[assembly: AssemblyTitle ("System.Xml.Serialization.dll")]
+[assembly: AssemblyDescription ("System.Xml.Serialization.dll")]
+[assembly: AssemblyDefaultAlias ("System.Xml.Serialization.dll")]
+
+[assembly: AssemblyCompany (Consts.MonoCompany)]
+[assembly: AssemblyProduct (Consts.MonoProduct)]
+[assembly: AssemblyCopyright (Consts.MonoCopyright)]
+[assembly: AssemblyVersion (Consts.FxVersion)]
+[assembly: AssemblyInformationalVersion (Consts.FxFileVersion)]
+[assembly: AssemblyFileVersion (Consts.FxFileVersion)]
+[assembly: AssemblyDelaySign (true)]
+[assembly: AssemblyKeyFile ("../msfinal.pub")]
+
+[assembly: ReferenceAssembly]
--- /dev/null
+thisdir = class/System.Xml.Serialization
+SUBDIRS =
+include ../../build/rules.make
+
+LIBRARY = System.Xml.Serialization.dll
+LIB_MCS_FLAGS = /r:System.Xml /r:System.ServiceModel
+
+NO_TEST = yes
+
+include ../../build/library.make
--- /dev/null
+AssemblyInfo.cs
+TypeForwarders.cs
+../../build/common/Consts.cs
--- /dev/null
+//
+// TypeForwarders.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMapping))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlTypeMapping))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlMappingAccess))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializer))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.ServiceModel.XmlSerializerFormatAttribute))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlArrayItemAttributes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributeOverrides))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAttributes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlElementAttributes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlAnyElementAttributes))]
+[assembly: System.Runtime.CompilerServices.TypeForwardedToAttribute(typeof(System.Xml.Serialization.XmlSerializerNamespaces))]
+
static void FillKeywordTable ()
{
- keywordsTable = new Hashtable ();
- foreach (string keyword in keywords) {
- keywordsTable.Add (keyword, keyword);
+ lock (keywords) {
+ if (keywordsTable == null) {
+ keywordsTable = new Hashtable ();
+ foreach (string keyword in keywords) {
+ keywordsTable.Add (keyword, keyword);
+ }
+ }
}
}
+//
+// ClientWebSocket.cs
+//
+// Author:
+// Martin Baulig <martin.baulig@xamarin.com>
+//
+// Copyright (c) 2013 Xamarin Inc. (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+
+#if NET_4_5
+
+using System;
+using System.Threading;
+using System.Threading.Tasks;
+
+namespace System.Net.WebSockets
+{
+ [MonoTODO]
+ public class ClientWebSocket : WebSocket
+ {
+ public ClientWebSocketOptions Options {
+ get { throw new NotImplementedException (); }
+ }
+
+ public Task ConnectAsync (Uri uri, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException ();
+ }
+
+ #region implemented abstract members of WebSocket
+ public override void Abort ()
+ {
+ throw new NotImplementedException ();
+ }
+ public override Task CloseAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException ();
+ }
+ public override Task CloseOutputAsync (WebSocketCloseStatus closeStatus, string statusDescription, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException ();
+ }
+ public override Task<WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException ();
+ }
+ public override Task SendAsync (ArraySegment<byte> buffer, WebSocketMessageType messageType, bool endOfMessage, CancellationToken cancellationToken)
+ {
+ throw new NotImplementedException ();
+ }
+ public override void Dispose ()
+ {
+ throw new NotImplementedException ();
+ }
+ public override WebSocketCloseStatus? CloseStatus {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ public override string CloseStatusDescription {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ public override WebSocketState State {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ public override string SubProtocol {
+ get {
+ throw new NotImplementedException ();
+ }
+ }
+ #endregion
+ }
+}
+
+#endif
+
// build the hash object (only MD5 is defined in RFC2617)
if ((parser.Algorithm == null) || (parser.Algorithm.ToUpper ().StartsWith ("MD5")))
- hash = HashAlgorithm.Create ("MD5");
+ hash = MD5.Create ();
return true;
}
throw ares.Exception;
IPHostEntry entry = ares.HostEntry;
if (entry == null || entry.AddressList == null || entry.AddressList.Length == 0)
- throw new SocketException(11001);
+ Error_11001 (entry.HostName);
return entry;
}
#endif
private extern static bool GetHostName_internal(out string h_name);
#endif
- private static IPHostEntry hostent_to_IPHostEntry(string h_name, string[] h_aliases, string[] h_addrlist)
+ static void Error_11001 (string hostName)
+ {
+ throw new SocketException(11001, string.Format ("Could not resolve host '{0}'", hostName));
+
+ }
+
+ private static IPHostEntry hostent_to_IPHostEntry(string originalHostName, string h_name, string[] h_aliases, string[] h_addrlist)
{
IPHostEntry he = new IPHostEntry();
ArrayList addrlist = new ArrayList();
}
if(addrlist.Count == 0)
- throw new SocketException(11001);
+ Error_11001 (originalHostName);
he.AddressList = addrlist.ToArray(typeof(IPAddress)) as IPAddress[];
return he;
#else
bool ret = GetHostByAddr_internal(address, out h_name, out h_aliases, out h_addrlist);
if (!ret)
- throw new SocketException(11001);
+ Error_11001 (address);
#endif
- return (hostent_to_IPHostEntry (h_name, h_aliases, h_addrlist));
+ return (hostent_to_IPHostEntry (address, h_name, h_aliases, h_addrlist));
}
bool ret = GetHostByName_internal(hostName, out h_name, out h_aliases, out h_addrlist);
if (ret == false)
- throw new SocketException(11001);
+ Error_11001 (hostName);
- return(hostent_to_IPHostEntry(h_name, h_aliases, h_addrlist));
+ return(hostent_to_IPHostEntry(hostName, h_name, h_aliases, h_addrlist));
#endif
}
bool ret = GetHostName_internal(out hostName);
if (ret == false)
- throw new SocketException(11001);
+ Error_11001 (hostName);
return hostName;
#endif
if (idx >= 0)
return false;
+ IPAddress ipaddr;
+ if (IPAddress.TryParse (val, out ipaddr))
+ return true;
+
string u = scheme + "://" + val + "/";
return Uri.IsWellFormedUriString (u, UriKind.Absolute);
}
public class ServicePointManager {
class SPKey {
Uri uri; // schema/host/port
+ Uri proxy;
bool use_connect;
- public SPKey (Uri uri, bool use_connect) {
+ public SPKey (Uri uri, Uri proxy, bool use_connect) {
this.uri = uri;
+ this.proxy = proxy;
this.use_connect = use_connect;
}
get { return use_connect; }
}
+ public bool UsesProxy {
+ get { return proxy != null; }
+ }
+
public override int GetHashCode () {
- return uri.GetHashCode () + ((use_connect) ? 1 : 0);
+ int hash = 23;
+ hash = hash * 31 + ((use_connect) ? 1 : 0);
+ hash = hash * 31 + uri.GetHashCode ();
+ hash = hash * 31 + (proxy != null ? proxy.GetHashCode () : 0);
+ return hash;
}
public override bool Equals (object obj) {
return false;
}
- return (uri.Equals (other.uri) && other.use_connect == use_connect);
+ if (!uri.Equals (other.uri))
+ return false;
+ if (use_connect != other.use_connect || UsesProxy != other.UsesProxy)
+ return false;
+ if (UsesProxy && !proxy.Equals (other.proxy))
+ return false;
+ return true;
}
}
ServicePoint sp = null;
lock (servicePoints) {
- SPKey key = new SPKey (origAddress, useConnect);
+ SPKey key = new SPKey (origAddress, usesProxy ? address : null, useConnect);
sp = servicePoints [key] as ServicePoint;
if (sp != null)
return sp;
int nread = 0;
long notify_total = 0;
- while ((nread = st.Read (buffer, 0, length)) != 0){
- if (async){
- notify_total += nread;
+ while ((nread = st.Read (buffer, 0, length)) != 0) {
+ notify_total += nread;
+ if (async)
OnDownloadProgressChanged (
new DownloadProgressChangedEventArgs (notify_total, response.ContentLength, userToken));
-
- }
f.Write (buffer, 0, nread);
}
+
+ if (cLength > 0 && notify_total < cLength)
+ throw new WebException ("Download aborted prematurely.", WebExceptionStatus.ReceiveFailure);
} catch (ThreadInterruptedException){
if (request != null)
request.Abort ();
static PropertyInfo piTrustFailure;
#if MONOTOUCH
- static MethodInfo start_wwan;
-
- static WebConnection ()
- {
- Type type = Type.GetType ("MonoTouch.ObjCRuntime.Runtime, monotouch");
- if (type != null)
- start_wwan = type.GetMethod ("StartWWAN", new Type [] { typeof (System.Uri) });
- }
+ [System.Runtime.InteropServices.DllImport ("__Internal")]
+ static extern void monotouch_start_wwan (string uri);
#endif
public WebConnection (WebConnectionGroup group, ServicePoint sPoint)
if (hostEntry == null) {
#if MONOTOUCH
- if (start_wwan != null) {
- start_wwan.Invoke (null, new object [1] { sPoint.Address });
- hostEntry = sPoint.HostEntry;
- }
+ monotouch_start_wwan (sPoint.Address.ToString ());
+ hostEntry = sPoint.HostEntry;
if (hostEntry == null) {
#endif
status = sPoint.UsesProxy ? WebExceptionStatus.ProxyNameResolutionFailure :
cnc.position = 0;
- WebConnectionStream stream = new WebConnectionStream (cnc);
+ WebConnectionStream stream = new WebConnectionStream (cnc, data);
bool expect_content = ExpectContent (data.StatusCode, data.request.Method);
string tencoding = null;
if (expect_content)
}
int nbytes = 0;
+ bool done = false;
WebAsyncResult wr = null;
IAsyncResult nsAsync = ((WebAsyncResult) result).InnerAsyncResult;
if (chunkedRead && (nsAsync is WebAsyncResult)) {
wr = (WebAsyncResult) nsAsync;
IAsyncResult inner = wr.InnerAsyncResult;
- if (inner != null && !(inner is WebAsyncResult))
+ if (inner != null && !(inner is WebAsyncResult)) {
nbytes = s.EndRead (inner);
+ done = nbytes == 0;
+ }
} else if (!(nsAsync is WebAsyncResult)) {
nbytes = s.EndRead (nsAsync);
wr = (WebAsyncResult) result;
+ done = nbytes == 0;
}
if (chunkedRead) {
- bool done = (nbytes == 0);
try {
chunkStream.WriteAndReadBack (wr.Buffer, wr.Offset, wr.Size, ref nbytes);
if (!done && nbytes == 0 && chunkStream.WantMore)
AsyncCallback cb_wrapper; // Calls to ReadCallbackWrapper or WriteCallbacWrapper
internal bool IgnoreIOErrors;
- public WebConnectionStream (WebConnection cnc)
- {
- if (cnc.Data == null)
- throw new InvalidOperationException ("cnc.Data was not initialized");
- if (cnc.Data.Headers == null)
- throw new InvalidOperationException ("cnc.Data.Headers was not initialized");
- if (cnc.Data.request == null)
- throw new InvalidOperationException ("cnc.Data.request was not initialized");
+ public WebConnectionStream (WebConnection cnc, WebConnectionData data)
+ {
+ if (data == null)
+ throw new InvalidOperationException ("data was not initialized");
+ if (data.Headers == null)
+ throw new InvalidOperationException ("data.Headers was not initialized");
+ if (data.request == null)
+ throw new InvalidOperationException ("data.request was not initialized");
isRead = true;
cb_wrapper = new AsyncCallback (ReadCallbackWrapper);
pending = new ManualResetEvent (true);
- this.request = cnc.Data.request;
+ this.request = data.request;
read_timeout = request.ReadWriteTimeout;
write_timeout = read_timeout;
this.cnc = cnc;
- string contentType = cnc.Data.Headers ["Transfer-Encoding"];
+ string contentType = data.Headers ["Transfer-Encoding"];
bool chunkedRead = (contentType != null && contentType.IndexOf ("chunked", StringComparison.OrdinalIgnoreCase) != -1);
- string clength = cnc.Data.Headers ["Content-Length"];
+ string clength = data.Headers ["Content-Length"];
if (!chunkedRead && clength != null && clength != "") {
try {
contentLength = Int32.Parse (clength);
namespace System.Security.Cryptography.X509Certificates {
+#if NET_4_0
+ [Serializable]
+#endif
public class X509Certificate2 : X509Certificate {
#if !SECURITY_DEP
// Used in Mono.Security HttpsClientStream
if (_cert == null)
throw new CryptographicException (empty_error);
- X509Chain chain = (X509Chain) CryptoConfig.CreateFromName ("X509Chain");
+ X509Chain chain = X509Chain.Create ();
if (!chain.Build (this))
return false;
// TODO - check chain and other stuff ???
public static X509Chain Create ()
{
+#if FULL_AOT_RUNTIME
+ return new X509Chain ();
+#else
return (X509Chain) CryptoConfig.CreateFromName ("X509Chain");
+#endif
}
// private stuff
using System.Text;
using System.Collections;
using System.Reflection;
+#if !FULL_AOT_RUNTIME
using System.Reflection.Emit;
+#endif
using System.Runtime.Serialization;
using RegularExpression = System.Text.RegularExpressions.Syntax.RegularExpression;
success = false;
break;
}
+
+ if (success && isAbsoluteUri && (path.Length > 0))
+ path = EscapeString (path);
}
}
client.BeginReceive (BRCallback, client);
- IPEndPoint ep = new IPEndPoint (Dns.GetHostEntry (string.Empty).AddressList[0], 1237);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1237);
byte[] send_bytes = new byte[] {10, 11, 12, 13};
client.Send (send_bytes, send_bytes.Length, ep);
public void Available ()
{
UdpClient client = new UdpClient (1238);
- IPEndPoint ep = new IPEndPoint (Dns.GetHostEntry (string.Empty).AddressList[0], 1238);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1238);
byte[] bytes = new byte[] {10, 11, 12, 13};
client.Send (bytes, bytes.Length, ep);
if (timeoutWorker.End == null) {
thread.Abort ();
- Assert.Fail ("Thread did not finish after double the timout specified passed");
+ Assert.Fail ("Thread finished after triple the timeout specified has passed");
}
if (!String.IsNullOrEmpty (timeoutWorker.Body)) {
Assert.AreEqual (webEx.Status, WebExceptionStatus.Timeout,
"WebException was thrown, but with a wrong status (should be timeout): " + webEx.Status);
- Assert.IsFalse (timeoutWorker.End > (timeoutWorker.Start + TimeSpan.FromMilliseconds (three_seconds_in_milliseconds + 500)));
+ Assert.IsFalse (timeoutWorker.End > (timeoutWorker.Start + TimeSpan.FromMilliseconds (three_seconds_in_milliseconds + 500)),
+ "Timeout exception should have been thrown shortly after timeout is reached, however it was at least half-second late");
}
[Test] // 1st possible case of https://bugzilla.novell.com/show_bug.cgi?id=MONO74177
Assert.AreEqual (null, req.Headers.Get ("Date"));
}
+
+ [Test]
+ // Bug #12393
+ public void TestIPv6Host ()
+ {
+ var address = "2001:0000:0000:0001:0001:0001:0157:0000";
+ var address2 = '[' + address + ']';
+ var uri = new Uri (string.Format ("http://{0}/test.css", address2));
+ var hwr = (HttpWebRequest)WebRequest.Create (uri);
+
+ hwr.Host = address2;
+ Assert.AreEqual (address2, hwr.Host, "#1");
+ }
+
+ [Test]
+ // Bug #12393
+ [Category ("NotWorking")]
+ public void TestIPv6Host2 ()
+ {
+ var address = "2001:0000:0000:0001:0001:0001:0157:0000";
+ var address2 = '[' + address + ']';
+ var uri = new Uri (string.Format ("http://{0}/test.css", address2));
+ var hwr = (HttpWebRequest)WebRequest.Create (uri);
+
+ try {
+ hwr.Host = address;
+ Assert.Fail ("#1");
+ } catch (ArgumentException) {
+ ;
+ }
+ }
#endif
+
+
class ListenerScope : IDisposable {
EventWaitHandle completed;
public HttpListener listener;
public void StaticCreation ()
{
X509Chain c = X509Chain.Create ();
-#if MOBILE
- Assert.IsNull (c);
-#else
CheckDefaultChain (c);
-#endif
}
-#if !MOBILE
[Test]
public void CreateViaCryptoConfig ()
{
Assert.AreEqual (typeof (X509Chain), CryptoConfig.CreateFromName ("X509Chain").GetType (), "X509Chain");
Assert.IsNull (CryptoConfig.CreateFromName ("System.Security.Cryptography.X509Certificates.X509Chain"), "System.Security.Cryptography.X509Certificates.X509Chain");
}
-#endif
}
}
string escaped = uri.GetComponents (UriComponents.Fragment, UriFormat.UriEscaped);
Assert.AreEqual ("id=1%262&sort=asc", escaped, "UriEscaped");
}
+
+ [Test]
+ // Bug #12631
+ public void LocalPathWithBaseUrl ()
+ {
+ var mainUri = new Uri ("http://www.imdb.com");
+ var uriPath = "/title/tt0106521";
+
+ Uri result;
+ Assert.IsTrue (Uri.TryCreate (mainUri, uriPath, out result), "#1");
+ Assert.AreEqual ("http://www.imdb.com/title/tt0106521", result.ToString (), "#2");
+ }
}
}
uri = new Uri ("http://dummy.com");
Assert.IsTrue (Uri.TryCreate (relative, UriKind.Relative, out uri), "relative-Relative");
Assert.AreEqual (relative, uri.OriginalString, "relative-RelativeOrAbsolute-OriginalString");
+
+ Assert.IsTrue (Uri.TryCreate ("http://mono-project.com/☕", UriKind.Absolute, out uri), "highunicode-Absolute");
+ Assert.AreEqual("http://mono-project.com/%E2%98%95", uri.AbsoluteUri, "highunicode-Absolute-AbsoluteUri");
}
[Test] // TryCreate (String, UriKind, Uri)
public object GetValue(DependencyProperty dp)
{
- object val = properties[dp];
+ object val = properties.ContainsKey (dp) ? properties [dp] : null;
return val == null ? dp.DefaultMetadata.DefaultValue : val;
}
public object ReadLocalValue(DependencyProperty dp)
{
- object val = properties[dp];
+ object val = properties.ContainsKey (dp) ? properties [dp] : null;
return val == null ? DependencyProperty.UnsetValue : val;
}
class Y : DependencyObject {
}
+ class DefaultValueTest : DependencyObject {
+ public static readonly DependencyProperty AProperty = DependencyProperty.Register("A", typeof(string), typeof(DefaultValueTest), new PropertyMetadata("defaultValueTest"));
+ }
+
[TestFixture]
public class DependencyObjectTest {
[Test]
Assert.AreEqual(2, count);
}
+ [Test]
+ public void TestDefaultValue()
+ {
+ DefaultValueTest obj = new DefaultValueTest ();
+ Assert.AreEqual (obj.GetValue(DefaultValueTest.AProperty), "defaultValueTest");
+ }
+
}
}
+++ /dev/null
-2007-09-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * NextPrimeFinder.cs, PrimeGeneratorBase.cs: Updated to match
- Mono.Security sources.
-
-2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
-
- * SequentialSearchPrimeGeneratorBase.cs: Fixed warning (l4) for unused
- variables.
-
-2004-05-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * SequentialSearchPrimeGeneratorBase.cs: In sync with
- Mono.Security.dll version.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * NextPrimeFinder.cs: In sync with Mono.Security.dll version.
- * PrimeGeneratorBase.cs: In sync with Mono.Security.dll version.
- * SequentialSearchPrimeGeneratorBase.cs: In sync with
- Mono.Security.dll version.
-
-2004-02-13 Sebastien Pouliot <sebastien@ximian.com>
-
- * PrimeGeneratorBase.cs: Changed primality test to Rabin Miller to
- fix issues #51229 (bug), #54262 (very long in same cases).
-
-2003-04-22 Sebastien Pouliot <spouliot@videotron.ca>
-
- * NextPrimeFinder.cs: New. Prime Generator.
- Support class for BigInteger (commited for Ben Maurer).
- * PrimeGeneratorBase.cs: New. Abstract Prime Generator.
- Support class for BigInteger (commited for Ben Maurer).
- * SequentialSearchPrimeGeneratorBase.cs: New. Prime Generator.
- Support class for BigInteger (commited for Ben Maurer).
+++ /dev/null
-//
-// Mono.Math.Prime.Generator.NextPrimeFinder.cs - Prime Generator
-//
-// Authors:
-// Ben Maurer
-//
-// Copyright (c) 2003 Ben Maurer. All rights reserved
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Math.Prime.Generator {
-
- /// <summary>
- /// Finds the next prime after a given number.
- /// </summary>
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class NextPrimeFinder : SequentialSearchPrimeGeneratorBase {
-
- protected override BigInteger GenerateSearchBase (int bits, object Context)
- {
- if (Context == null)
- throw new ArgumentNullException ("Context");
-
- BigInteger ret = new BigInteger ((BigInteger)Context);
- ret.SetBit (0);
- return ret;
- }
- }
-}
+++ /dev/null
-//
-// Mono.Math.Prime.Generator.PrimeGeneratorBase.cs - Abstract Prime Generator
-//
-// Authors:
-// Ben Maurer
-//
-// Copyright (c) 2003 Ben Maurer. All rights reserved
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Math.Prime.Generator {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- abstract class PrimeGeneratorBase {
-
- public virtual ConfidenceFactor Confidence {
- get {
-#if DEBUG
- return ConfidenceFactor.ExtraLow;
-#else
- return ConfidenceFactor.Medium;
-#endif
- }
- }
-
- public virtual Prime.PrimalityTest PrimalityTest {
- get {
- return new Prime.PrimalityTest (PrimalityTests.RabinMillerTest);
- }
- }
-
- public virtual int TrialDivisionBounds {
- get { return 4000; }
- }
-
- /// <summary>
- /// Performs primality tests on bi, assumes trial division has been done.
- /// </summary>
- /// <param name="bi">A BigInteger that has been subjected to and passed trial division</param>
- /// <returns>False if bi is composite, true if it may be prime.</returns>
- /// <remarks>The speed of this method is dependent on Confidence</remarks>
- protected bool PostTrialDivisionTests (BigInteger bi)
- {
- return PrimalityTest (bi, this.Confidence);
- }
-
- public abstract BigInteger GenerateNewPrime (int bits);
- }
-}
+++ /dev/null
-//
-// Mono.Math.Prime.Generator.SequentialSearchPrimeGeneratorBase.cs - Prime Generator
-//
-// Authors:
-// Ben Maurer
-//
-// Copyright (c) 2003 Ben Maurer. All rights reserved
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-namespace Mono.Math.Prime.Generator {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class SequentialSearchPrimeGeneratorBase : PrimeGeneratorBase {
-
- protected virtual BigInteger GenerateSearchBase (int bits, object context)
- {
- BigInteger ret = BigInteger.GenerateRandom (bits);
- ret.SetBit (0);
- return ret;
- }
-
-
- public override BigInteger GenerateNewPrime (int bits)
- {
- return GenerateNewPrime (bits, null);
- }
-
-
- public virtual BigInteger GenerateNewPrime (int bits, object context)
- {
- //
- // STEP 1. Find a place to do a sequential search
- //
- BigInteger curVal = GenerateSearchBase (bits, context);
-
- const uint primeProd1 = 3u* 5u * 7u * 11u * 13u * 17u * 19u * 23u * 29u;
-
- uint pMod1 = curVal % primeProd1;
-
- int DivisionBound = TrialDivisionBounds;
- uint[] SmallPrimes = BigInteger.smallPrimes;
- //
- // STEP 2. Search for primes
- //
- while (true) {
-
- //
- // STEP 2.1 Sieve out numbers divisible by the first 9 primes
- //
- if (pMod1 % 3 == 0) goto biNotPrime;
- if (pMod1 % 5 == 0) goto biNotPrime;
- if (pMod1 % 7 == 0) goto biNotPrime;
- if (pMod1 % 11 == 0) goto biNotPrime;
- if (pMod1 % 13 == 0) goto biNotPrime;
- if (pMod1 % 17 == 0) goto biNotPrime;
- if (pMod1 % 19 == 0) goto biNotPrime;
- if (pMod1 % 23 == 0) goto biNotPrime;
- if (pMod1 % 29 == 0) goto biNotPrime;
-
- //
- // STEP 2.2 Sieve out all numbers divisible by the primes <= DivisionBound
- //
- for (int p = 10; p < SmallPrimes.Length && SmallPrimes [p] <= DivisionBound; p++) {
- if (curVal % SmallPrimes [p] == 0)
- goto biNotPrime;
- }
-
- //
- // STEP 2.3 Is the potential prime acceptable?
- //
- if (!IsPrimeAcceptable (curVal, context))
- goto biNotPrime;
-
- //
- // STEP 2.4 Filter out all primes that pass this step with a primality test
- //
- if (PrimalityTest (curVal, Confidence))
- return curVal;
-
- //
- // STEP 2.4
- //
- biNotPrime:
- pMod1 += 2;
- if (pMod1 >= primeProd1)
- pMod1 -= primeProd1;
- curVal.Incr2 ();
- }
- }
-
- protected virtual bool IsPrimeAcceptable (BigInteger bi, object context)
- {
- return true;
- }
- }
-}
+++ /dev/null
-2007-09-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * ConfidenceFactor.cs, PrimalityTests.cs: Updated to match
- Mono.Security sources.
-
-2004-05-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * PrimalityTests.cs: In sync with Mono.Security.dll version.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * PrimalityTests.cs: In sync with Mono.Security.dll version.
-
-2003-04-23 Alp Toker <alp@atoker.com>
-
- * PrimalityTests.cs: Mark PrimalityTest as non-CLS-compliant (build fix)
-
-2003-04-22 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ConfidenceFactor.cs: New. Enum for prime quality.
- Support for BigInteger (commited for Ben Maurer).
- * PrimalityTests.cs: New. Tests for primality.
- Support for BigInteger (commited for Ben Maurer).
-
+++ /dev/null
-//
-// Mono.Math.Prime.ConfidenceFactor.cs - Confidence factor for prime generation
-//
-// Authors:
-// Ben Maurer
-//
-// Copyright (c) 2003 Ben Maurer. All rights reserved
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Math.Prime {
- /// <summary>
- /// A factor of confidence.
- /// </summary>
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- enum ConfidenceFactor {
- /// <summary>
- /// Only suitable for development use, probability of failure may be greater than 1/2^20.
- /// </summary>
- ExtraLow,
- /// <summary>
- /// Suitable only for transactions which do not require forward secrecy. Probability of failure about 1/2^40
- /// </summary>
- Low,
- /// <summary>
- /// Designed for production use. Probability of failure about 1/2^80.
- /// </summary>
- Medium,
- /// <summary>
- /// Suitable for sensitive data. Probability of failure about 1/2^160.
- /// </summary>
- High,
- /// <summary>
- /// Use only if you have lots of time! Probability of failure about 1/2^320.
- /// </summary>
- ExtraHigh,
- /// <summary>
- /// Only use methods which generate provable primes. Not yet implemented.
- /// </summary>
- Provable
- }
-}
+++ /dev/null
-//
-// Mono.Math.Prime.PrimalityTests.cs - Test for primality
-//
-// Authors:
-// Ben Maurer
-//
-// Copyright (c) 2003 Ben Maurer. All rights reserved
-//
-
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-
-namespace Mono.Math.Prime {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- delegate bool PrimalityTest (BigInteger bi, ConfidenceFactor confidence);
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class PrimalityTests {
-
- private PrimalityTests ()
- {
- }
-
- #region SPP Test
-
- private static int GetSPPRounds (BigInteger bi, ConfidenceFactor confidence)
- {
- int bc = bi.BitCount();
-
- int Rounds;
-
- // Data from HAC, 4.49
- if (bc <= 100 ) Rounds = 27;
- else if (bc <= 150 ) Rounds = 18;
- else if (bc <= 200 ) Rounds = 15;
- else if (bc <= 250 ) Rounds = 12;
- else if (bc <= 300 ) Rounds = 9;
- else if (bc <= 350 ) Rounds = 8;
- else if (bc <= 400 ) Rounds = 7;
- else if (bc <= 500 ) Rounds = 6;
- else if (bc <= 600 ) Rounds = 5;
- else if (bc <= 800 ) Rounds = 4;
- else if (bc <= 1250) Rounds = 3;
- else Rounds = 2;
-
- switch (confidence) {
- case ConfidenceFactor.ExtraLow:
- Rounds >>= 2;
- return Rounds != 0 ? Rounds : 1;
- case ConfidenceFactor.Low:
- Rounds >>= 1;
- return Rounds != 0 ? Rounds : 1;
- case ConfidenceFactor.Medium:
- return Rounds;
- case ConfidenceFactor.High:
- return Rounds << 1;
- case ConfidenceFactor.ExtraHigh:
- return Rounds << 2;
- case ConfidenceFactor.Provable:
- throw new Exception ("The Rabin-Miller test can not be executed in a way such that its results are provable");
- default:
- throw new ArgumentOutOfRangeException ("confidence");
- }
- }
-
- public static bool Test (BigInteger n, ConfidenceFactor confidence)
- {
- // Rabin-Miller fails with smaller primes (at least with our BigInteger code)
- if (n.BitCount () < 33)
- return SmallPrimeSppTest (n, confidence);
- else
- return RabinMillerTest (n, confidence);
- }
-
- /// <summary>
- /// Probabilistic prime test based on Rabin-Miller's test
- /// </summary>
- /// <param name="n" type="BigInteger.BigInteger">
- /// <para>
- /// The number to test.
- /// </para>
- /// </param>
- /// <param name="confidence" type="int">
- /// <para>
- /// The number of chosen bases. The test has at least a
- /// 1/4^confidence chance of falsely returning True.
- /// </para>
- /// </param>
- /// <returns>
- /// <para>
- /// True if "this" is a strong pseudoprime to randomly chosen bases.
- /// </para>
- /// <para>
- /// False if "this" is definitely NOT prime.
- /// </para>
- /// </returns>
- public static bool RabinMillerTest (BigInteger n, ConfidenceFactor confidence)
- {
- int bits = n.BitCount ();
- int t = GetSPPRounds (bits, confidence);
-
- // n - 1 == 2^s * r, r is odd
- BigInteger n_minus_1 = n - 1;
- int s = n_minus_1.LowestSetBit ();
- BigInteger r = n_minus_1 >> s;
-
- BigInteger.ModulusRing mr = new BigInteger.ModulusRing (n);
-
- // Applying optimization from HAC section 4.50 (base == 2)
- // not a really random base but an interesting (and speedy) one
- BigInteger y = null;
- // FIXME - optimization disable for small primes due to bug #81857
- if (n.BitCount () > 100)
- y = mr.Pow (2, r);
-
- // still here ? start at round 1 (round 0 was a == 2)
- for (int round = 0; round < t; round++) {
-
- if ((round > 0) || (y == null)) {
- BigInteger a = null;
-
- // check for 2 <= a <= n - 2
- // ...but we already did a == 2 previously as an optimization
- do {
- a = BigInteger.GenerateRandom (bits);
- } while ((a <= 2) && (a >= n_minus_1));
-
- y = mr.Pow (a, r);
- }
-
- if (y == 1)
- continue;
-
- for (int j = 0; ((j < s) && (y != n_minus_1)); j++) {
-
- y = mr.Pow (y, 2);
- if (y == 1)
- return false;
- }
-
- if (y != n_minus_1)
- return false;
- }
- return true;
- }
-
- public static bool SmallPrimeSppTest (BigInteger bi, ConfidenceFactor confidence)
- {
- int Rounds = GetSPPRounds (bi, confidence);
-
- // calculate values of s and t
- BigInteger p_sub1 = bi - 1;
- int s = p_sub1.LowestSetBit ();
-
- BigInteger t = p_sub1 >> s;
-
-
- BigInteger.ModulusRing mr = new BigInteger.ModulusRing (bi);
-
- for (int round = 0; round < Rounds; round++) {
-
- BigInteger b = mr.Pow (BigInteger.smallPrimes [round], t);
-
- if (b == 1) continue; // a^t mod p = 1
-
- bool result = false;
- for (int j = 0; j < s; j++) {
-
- if (b == p_sub1) { // a^((2^j)*t) mod p = p-1 for some 0 <= j <= s-1
- result = true;
- break;
- }
-
- b = (b * b) % bi;
- }
-
- if (result == false)
- return false;
- }
- return true;
- }
-
- #endregion
-
- // TODO: Implement the Lucus test
- // TODO: Implement other new primality tests
- // TODO: Implement primality proving
- }
-}
+++ /dev/null
-//
-// BigInteger.cs - Big Integer implementation
-//
-// Authors:
-// Ben Maurer
-// Chew Keong TAN
-// Sebastien Pouliot <sebastien@ximian.com>
-// Pieter Philippaerts <Pieter@mentalis.org>
-//
-// Copyright (c) 2003 Ben Maurer
-// All rights reserved
-//
-// Copyright (c) 2002 Chew Keong TAN
-// All rights reserved.
-//
-// Copyright (C) 2004, 2007 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.Security.Cryptography;
-using Mono.Math.Prime.Generator;
-using Mono.Math.Prime;
-
-namespace Mono.Math {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class BigInteger {
-
- #region Data Storage
-
- /// <summary>
- /// The Length of this BigInteger
- /// </summary>
- uint length = 1;
-
- /// <summary>
- /// The data for this BigInteger
- /// </summary>
- uint [] data;
-
- #endregion
-
- #region Constants
-
- /// <summary>
- /// Default length of a BigInteger in bytes
- /// </summary>
- const uint DEFAULT_LEN = 20;
-
- /// <summary>
- /// Table of primes below 2000.
- /// </summary>
- /// <remarks>
- /// <para>
- /// This table was generated using Mathematica 4.1 using the following function:
- /// </para>
- /// <para>
- /// <code>
- /// PrimeTable [x_] := Prime [Range [1, PrimePi [x]]]
- /// PrimeTable [6000]
- /// </code>
- /// </para>
- /// </remarks>
- internal static readonly uint [] smallPrimes = {
- 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71,
- 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151,
- 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
- 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317,
- 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419,
- 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503,
- 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607,
- 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701,
- 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811,
- 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911,
- 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997,
-
- 1009, 1013, 1019, 1021, 1031, 1033, 1039, 1049, 1051, 1061, 1063, 1069, 1087,
- 1091, 1093, 1097, 1103, 1109, 1117, 1123, 1129, 1151, 1153, 1163, 1171, 1181,
- 1187, 1193, 1201, 1213, 1217, 1223, 1229, 1231, 1237, 1249, 1259, 1277, 1279,
- 1283, 1289, 1291, 1297, 1301, 1303, 1307, 1319, 1321, 1327, 1361, 1367, 1373,
- 1381, 1399, 1409, 1423, 1427, 1429, 1433, 1439, 1447, 1451, 1453, 1459, 1471,
- 1481, 1483, 1487, 1489, 1493, 1499, 1511, 1523, 1531, 1543, 1549, 1553, 1559,
- 1567, 1571, 1579, 1583, 1597, 1601, 1607, 1609, 1613, 1619, 1621, 1627, 1637,
- 1657, 1663, 1667, 1669, 1693, 1697, 1699, 1709, 1721, 1723, 1733, 1741, 1747,
- 1753, 1759, 1777, 1783, 1787, 1789, 1801, 1811, 1823, 1831, 1847, 1861, 1867,
- 1871, 1873, 1877, 1879, 1889, 1901, 1907, 1913, 1931, 1933, 1949, 1951, 1973,
- 1979, 1987, 1993, 1997, 1999,
-
- 2003, 2011, 2017, 2027, 2029, 2039, 2053, 2063, 2069, 2081, 2083, 2087, 2089,
- 2099, 2111, 2113, 2129, 2131, 2137, 2141, 2143, 2153, 2161, 2179, 2203, 2207,
- 2213, 2221, 2237, 2239, 2243, 2251, 2267, 2269, 2273, 2281, 2287, 2293, 2297,
- 2309, 2311, 2333, 2339, 2341, 2347, 2351, 2357, 2371, 2377, 2381, 2383, 2389,
- 2393, 2399, 2411, 2417, 2423, 2437, 2441, 2447, 2459, 2467, 2473, 2477, 2503,
- 2521, 2531, 2539, 2543, 2549, 2551, 2557, 2579, 2591, 2593, 2609, 2617, 2621,
- 2633, 2647, 2657, 2659, 2663, 2671, 2677, 2683, 2687, 2689, 2693, 2699, 2707,
- 2711, 2713, 2719, 2729, 2731, 2741, 2749, 2753, 2767, 2777, 2789, 2791, 2797,
- 2801, 2803, 2819, 2833, 2837, 2843, 2851, 2857, 2861, 2879, 2887, 2897, 2903,
- 2909, 2917, 2927, 2939, 2953, 2957, 2963, 2969, 2971, 2999,
-
- 3001, 3011, 3019, 3023, 3037, 3041, 3049, 3061, 3067, 3079, 3083, 3089, 3109,
- 3119, 3121, 3137, 3163, 3167, 3169, 3181, 3187, 3191, 3203, 3209, 3217, 3221,
- 3229, 3251, 3253, 3257, 3259, 3271, 3299, 3301, 3307, 3313, 3319, 3323, 3329,
- 3331, 3343, 3347, 3359, 3361, 3371, 3373, 3389, 3391, 3407, 3413, 3433, 3449,
- 3457, 3461, 3463, 3467, 3469, 3491, 3499, 3511, 3517, 3527, 3529, 3533, 3539,
- 3541, 3547, 3557, 3559, 3571, 3581, 3583, 3593, 3607, 3613, 3617, 3623, 3631,
- 3637, 3643, 3659, 3671, 3673, 3677, 3691, 3697, 3701, 3709, 3719, 3727, 3733,
- 3739, 3761, 3767, 3769, 3779, 3793, 3797, 3803, 3821, 3823, 3833, 3847, 3851,
- 3853, 3863, 3877, 3881, 3889, 3907, 3911, 3917, 3919, 3923, 3929, 3931, 3943,
- 3947, 3967, 3989,
-
- 4001, 4003, 4007, 4013, 4019, 4021, 4027, 4049, 4051, 4057, 4073, 4079, 4091,
- 4093, 4099, 4111, 4127, 4129, 4133, 4139, 4153, 4157, 4159, 4177, 4201, 4211,
- 4217, 4219, 4229, 4231, 4241, 4243, 4253, 4259, 4261, 4271, 4273, 4283, 4289,
- 4297, 4327, 4337, 4339, 4349, 4357, 4363, 4373, 4391, 4397, 4409, 4421, 4423,
- 4441, 4447, 4451, 4457, 4463, 4481, 4483, 4493, 4507, 4513, 4517, 4519, 4523,
- 4547, 4549, 4561, 4567, 4583, 4591, 4597, 4603, 4621, 4637, 4639, 4643, 4649,
- 4651, 4657, 4663, 4673, 4679, 4691, 4703, 4721, 4723, 4729, 4733, 4751, 4759,
- 4783, 4787, 4789, 4793, 4799, 4801, 4813, 4817, 4831, 4861, 4871, 4877, 4889,
- 4903, 4909, 4919, 4931, 4933, 4937, 4943, 4951, 4957, 4967, 4969, 4973, 4987,
- 4993, 4999,
-
- 5003, 5009, 5011, 5021, 5023, 5039, 5051, 5059, 5077, 5081, 5087, 5099, 5101,
- 5107, 5113, 5119, 5147, 5153, 5167, 5171, 5179, 5189, 5197, 5209, 5227, 5231,
- 5233, 5237, 5261, 5273, 5279, 5281, 5297, 5303, 5309, 5323, 5333, 5347, 5351,
- 5381, 5387, 5393, 5399, 5407, 5413, 5417, 5419, 5431, 5437, 5441, 5443, 5449,
- 5471, 5477, 5479, 5483, 5501, 5503, 5507, 5519, 5521, 5527, 5531, 5557, 5563,
- 5569, 5573, 5581, 5591, 5623, 5639, 5641, 5647, 5651, 5653, 5657, 5659, 5669,
- 5683, 5689, 5693, 5701, 5711, 5717, 5737, 5741, 5743, 5749, 5779, 5783, 5791,
- 5801, 5807, 5813, 5821, 5827, 5839, 5843, 5849, 5851, 5857, 5861, 5867, 5869,
- 5879, 5881, 5897, 5903, 5923, 5927, 5939, 5953, 5981, 5987
- };
-
- public enum Sign : int {
- Negative = -1,
- Zero = 0,
- Positive = 1
- };
-
- #region Exception Messages
- const string WouldReturnNegVal = "Operation would return a negative value";
- #endregion
-
- #endregion
-
- #region Constructors
-
- public BigInteger ()
- {
- data = new uint [DEFAULT_LEN];
- this.length = DEFAULT_LEN;
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public BigInteger (Sign sign, uint len)
- {
- this.data = new uint [len];
- this.length = len;
- }
-
- public BigInteger (BigInteger bi)
- {
- this.data = (uint [])bi.data.Clone ();
- this.length = bi.length;
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public BigInteger (BigInteger bi, uint len)
- {
-
- this.data = new uint [len];
-
- for (uint i = 0; i < bi.length; i++)
- this.data [i] = bi.data [i];
-
- this.length = bi.length;
- }
-
- #endregion
-
- #region Conversions
-
- public BigInteger (byte [] inData)
- {
- if (inData.Length == 0)
- inData = new byte [1];
- length = (uint)inData.Length >> 2;
- int leftOver = inData.Length & 0x3;
-
- // length not multiples of 4
- if (leftOver != 0) length++;
-
- data = new uint [length];
-
- for (int i = inData.Length - 1, j = 0; i >= 3; i -= 4, j++) {
- data [j] = (uint)(
- (inData [i-3] << (3*8)) |
- (inData [i-2] << (2*8)) |
- (inData [i-1] << (1*8)) |
- (inData [i])
- );
- }
-
- switch (leftOver) {
- case 1: data [length-1] = (uint)inData [0]; break;
- case 2: data [length-1] = (uint)((inData [0] << 8) | inData [1]); break;
- case 3: data [length-1] = (uint)((inData [0] << 16) | (inData [1] << 8) | inData [2]); break;
- }
-
- this.Normalize ();
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public BigInteger (uint [] inData)
- {
- if (inData.Length == 0)
- inData = new uint [1];
- length = (uint)inData.Length;
-
- data = new uint [length];
-
- for (int i = (int)length - 1, j = 0; i >= 0; i--, j++)
- data [j] = inData [i];
-
- this.Normalize ();
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public BigInteger (uint ui)
- {
- data = new uint [] {ui};
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public BigInteger (ulong ul)
- {
- data = new uint [2] { (uint)ul, (uint)(ul >> 32)};
- length = 2;
-
- this.Normalize ();
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static implicit operator BigInteger (uint value)
- {
- return (new BigInteger (value));
- }
-
- public static implicit operator BigInteger (int value)
- {
- if (value < 0) throw new ArgumentOutOfRangeException ("value");
- return (new BigInteger ((uint)value));
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static implicit operator BigInteger (ulong value)
- {
- return (new BigInteger (value));
- }
-
- /* This is the BigInteger.Parse method I use. This method works
- because BigInteger.ToString returns the input I gave to Parse. */
- public static BigInteger Parse (string number)
- {
- if (number == null)
- throw new ArgumentNullException ("number");
-
- int i = 0, len = number.Length;
- char c;
- bool digits_seen = false;
- BigInteger val = new BigInteger (0);
- if (number [i] == '+') {
- i++;
- }
- else if (number [i] == '-') {
- throw new FormatException (WouldReturnNegVal);
- }
-
- for (; i < len; i++) {
- c = number [i];
- if (c == '\0') {
- i = len;
- continue;
- }
- if (c >= '0' && c <= '9') {
- val = val * 10 + (c - '0');
- digits_seen = true;
- }
- else {
- if (Char.IsWhiteSpace (c)) {
- for (i++; i < len; i++) {
- if (!Char.IsWhiteSpace (number [i]))
- throw new FormatException ();
- }
- break;
- }
- else
- throw new FormatException ();
- }
- }
- if (!digits_seen)
- throw new FormatException ();
- return val;
- }
-
- #endregion
-
- #region Operators
-
- public static BigInteger operator + (BigInteger bi1, BigInteger bi2)
- {
- if (bi1 == 0)
- return new BigInteger (bi2);
- else if (bi2 == 0)
- return new BigInteger (bi1);
- else
- return Kernel.AddSameSign (bi1, bi2);
- }
-
- public static BigInteger operator - (BigInteger bi1, BigInteger bi2)
- {
- if (bi2 == 0)
- return new BigInteger (bi1);
-
- if (bi1 == 0)
- throw new ArithmeticException (WouldReturnNegVal);
-
- switch (Kernel.Compare (bi1, bi2)) {
-
- case Sign.Zero:
- return 0;
-
- case Sign.Positive:
- return Kernel.Subtract (bi1, bi2);
-
- case Sign.Negative:
- throw new ArithmeticException (WouldReturnNegVal);
- default:
- throw new Exception ();
- }
- }
-
- public static int operator % (BigInteger bi, int i)
- {
- if (i > 0)
- return (int)Kernel.DwordMod (bi, (uint)i);
- else
- return -(int)Kernel.DwordMod (bi, (uint)-i);
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static uint operator % (BigInteger bi, uint ui)
- {
- return Kernel.DwordMod (bi, (uint)ui);
- }
-
- public static BigInteger operator % (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.multiByteDivide (bi1, bi2)[1];
- }
-
- public static BigInteger operator / (BigInteger bi, int i)
- {
- if (i > 0)
- return Kernel.DwordDiv (bi, (uint)i);
-
- throw new ArithmeticException (WouldReturnNegVal);
- }
-
- public static BigInteger operator / (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.multiByteDivide (bi1, bi2)[0];
- }
-
- public static BigInteger operator * (BigInteger bi1, BigInteger bi2)
- {
- if (bi1 == 0 || bi2 == 0) return 0;
-
- //
- // Validate pointers
- //
- if (bi1.data.Length < bi1.length) throw new IndexOutOfRangeException ("bi1 out of range");
- if (bi2.data.Length < bi2.length) throw new IndexOutOfRangeException ("bi2 out of range");
-
- BigInteger ret = new BigInteger (Sign.Positive, bi1.length + bi2.length);
-
- Kernel.Multiply (bi1.data, 0, bi1.length, bi2.data, 0, bi2.length, ret.data, 0);
-
- ret.Normalize ();
- return ret;
- }
-
- public static BigInteger operator * (BigInteger bi, int i)
- {
- if (i < 0) throw new ArithmeticException (WouldReturnNegVal);
- if (i == 0) return 0;
- if (i == 1) return new BigInteger (bi);
-
- return Kernel.MultiplyByDword (bi, (uint)i);
- }
-
- public static BigInteger operator << (BigInteger bi1, int shiftVal)
- {
- return Kernel.LeftShift (bi1, shiftVal);
- }
-
- public static BigInteger operator >> (BigInteger bi1, int shiftVal)
- {
- return Kernel.RightShift (bi1, shiftVal);
- }
-
- #endregion
-
- #region Friendly names for operators
-
- // with names suggested by FxCop 1.30
-
- public static BigInteger Add (BigInteger bi1, BigInteger bi2)
- {
- return (bi1 + bi2);
- }
-
- public static BigInteger Subtract (BigInteger bi1, BigInteger bi2)
- {
- return (bi1 - bi2);
- }
-
- public static int Modulus (BigInteger bi, int i)
- {
- return (bi % i);
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static uint Modulus (BigInteger bi, uint ui)
- {
- return (bi % ui);
- }
-
- public static BigInteger Modulus (BigInteger bi1, BigInteger bi2)
- {
- return (bi1 % bi2);
- }
-
- public static BigInteger Divid (BigInteger bi, int i)
- {
- return (bi / i);
- }
-
- public static BigInteger Divid (BigInteger bi1, BigInteger bi2)
- {
- return (bi1 / bi2);
- }
-
- public static BigInteger Multiply (BigInteger bi1, BigInteger bi2)
- {
- return (bi1 * bi2);
- }
-
- public static BigInteger Multiply (BigInteger bi, int i)
- {
- return (bi * i);
- }
-
- #endregion
-
- #region Random
- private static RandomNumberGenerator rng;
- private static RandomNumberGenerator Rng {
- get {
- if (rng == null)
- rng = RandomNumberGenerator.Create ();
- return rng;
- }
- }
-
- /// <summary>
- /// Generates a new, random BigInteger of the specified length.
- /// </summary>
- /// <param name="bits">The number of bits for the new number.</param>
- /// <param name="rng">A random number generator to use to obtain the bits.</param>
- /// <returns>A random number of the specified length.</returns>
- public static BigInteger GenerateRandom (int bits, RandomNumberGenerator rng)
- {
- int dwords = bits >> 5;
- int remBits = bits & 0x1F;
-
- if (remBits != 0)
- dwords++;
-
- BigInteger ret = new BigInteger (Sign.Positive, (uint)dwords + 1);
- byte [] random = new byte [dwords << 2];
-
- rng.GetBytes (random);
- Buffer.BlockCopy (random, 0, ret.data, 0, (int)dwords << 2);
-
- if (remBits != 0) {
- uint mask = (uint)(0x01 << (remBits-1));
- ret.data [dwords-1] |= mask;
-
- mask = (uint)(0xFFFFFFFF >> (32 - remBits));
- ret.data [dwords-1] &= mask;
- }
- else
- ret.data [dwords-1] |= 0x80000000;
-
- ret.Normalize ();
- return ret;
- }
-
- /// <summary>
- /// Generates a new, random BigInteger of the specified length using the default RNG crypto service provider.
- /// </summary>
- /// <param name="bits">The number of bits for the new number.</param>
- /// <returns>A random number of the specified length.</returns>
- public static BigInteger GenerateRandom (int bits)
- {
- return GenerateRandom (bits, Rng);
- }
-
- /// <summary>
- /// Randomizes the bits in "this" from the specified RNG.
- /// </summary>
- /// <param name="rng">A RNG.</param>
- public void Randomize (RandomNumberGenerator rng)
- {
- if (this == 0)
- return;
-
- int bits = this.BitCount ();
- int dwords = bits >> 5;
- int remBits = bits & 0x1F;
-
- if (remBits != 0)
- dwords++;
-
- byte [] random = new byte [dwords << 2];
-
- rng.GetBytes (random);
- Buffer.BlockCopy (random, 0, data, 0, (int)dwords << 2);
-
- if (remBits != 0) {
- uint mask = (uint)(0x01 << (remBits-1));
- data [dwords-1] |= mask;
-
- mask = (uint)(0xFFFFFFFF >> (32 - remBits));
- data [dwords-1] &= mask;
- }
-
- else
- data [dwords-1] |= 0x80000000;
-
- Normalize ();
- }
-
- /// <summary>
- /// Randomizes the bits in "this" from the default RNG.
- /// </summary>
- public void Randomize ()
- {
- Randomize (Rng);
- }
-
- #endregion
-
- #region Bitwise
-
- public int BitCount ()
- {
- this.Normalize ();
-
- uint value = data [length - 1];
- uint mask = 0x80000000;
- uint bits = 32;
-
- while (bits > 0 && (value & mask) == 0) {
- bits--;
- mask >>= 1;
- }
- bits += ((length - 1) << 5);
-
- return (int)bits;
- }
-
- /// <summary>
- /// Tests if the specified bit is 1.
- /// </summary>
- /// <param name="bitNum">The bit to test. The least significant bit is 0.</param>
- /// <returns>True if bitNum is set to 1, else false.</returns>
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public bool TestBit (uint bitNum)
- {
- uint bytePos = bitNum >> 5; // divide by 32
- byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
-
- uint mask = (uint)1 << bitPos;
- return ((this.data [bytePos] & mask) != 0);
- }
-
- public bool TestBit (int bitNum)
- {
- if (bitNum < 0) throw new IndexOutOfRangeException ("bitNum out of range");
-
- uint bytePos = (uint)bitNum >> 5; // divide by 32
- byte bitPos = (byte)(bitNum & 0x1F); // get the lowest 5 bits
-
- uint mask = (uint)1 << bitPos;
- return ((this.data [bytePos] | mask) == this.data [bytePos]);
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public void SetBit (uint bitNum)
- {
- SetBit (bitNum, true);
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public void ClearBit (uint bitNum)
- {
- SetBit (bitNum, false);
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public void SetBit (uint bitNum, bool value)
- {
- uint bytePos = bitNum >> 5; // divide by 32
-
- if (bytePos < this.length) {
- uint mask = (uint)1 << (int)(bitNum & 0x1F);
- if (value)
- this.data [bytePos] |= mask;
- else
- this.data [bytePos] &= ~mask;
- }
- }
-
- public int LowestSetBit ()
- {
- if (this == 0) return -1;
- int i = 0;
- while (!TestBit (i)) i++;
- return i;
- }
-
- public byte[] GetBytes ()
- {
- if (this == 0) return new byte [1];
-
- int numBits = BitCount ();
- int numBytes = numBits >> 3;
- if ((numBits & 0x7) != 0)
- numBytes++;
-
- byte [] result = new byte [numBytes];
-
- int numBytesInWord = numBytes & 0x3;
- if (numBytesInWord == 0) numBytesInWord = 4;
-
- int pos = 0;
- for (int i = (int)length - 1; i >= 0; i--) {
- uint val = data [i];
- for (int j = numBytesInWord - 1; j >= 0; j--) {
- result [pos+j] = (byte)(val & 0xFF);
- val >>= 8;
- }
- pos += numBytesInWord;
- numBytesInWord = 4;
- }
- return result;
- }
-
- #endregion
-
- #region Compare
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static bool operator == (BigInteger bi1, uint ui)
- {
- if (bi1.length != 1) bi1.Normalize ();
- return bi1.length == 1 && bi1.data [0] == ui;
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public static bool operator != (BigInteger bi1, uint ui)
- {
- if (bi1.length != 1) bi1.Normalize ();
- return !(bi1.length == 1 && bi1.data [0] == ui);
- }
-
- public static bool operator == (BigInteger bi1, BigInteger bi2)
- {
- // we need to compare with null
- if ((bi1 as object) == (bi2 as object))
- return true;
- if (null == bi1 || null == bi2)
- return false;
- return Kernel.Compare (bi1, bi2) == 0;
- }
-
- public static bool operator != (BigInteger bi1, BigInteger bi2)
- {
- // we need to compare with null
- if ((bi1 as object) == (bi2 as object))
- return false;
- if (null == bi1 || null == bi2)
- return true;
- return Kernel.Compare (bi1, bi2) != 0;
- }
-
- public static bool operator > (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.Compare (bi1, bi2) > 0;
- }
-
- public static bool operator < (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.Compare (bi1, bi2) < 0;
- }
-
- public static bool operator >= (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.Compare (bi1, bi2) >= 0;
- }
-
- public static bool operator <= (BigInteger bi1, BigInteger bi2)
- {
- return Kernel.Compare (bi1, bi2) <= 0;
- }
-
- public Sign Compare (BigInteger bi)
- {
- return Kernel.Compare (this, bi);
- }
-
- #endregion
-
- #region Formatting
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public string ToString (uint radix)
- {
- return ToString (radix, "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ");
- }
-
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
- public string ToString (uint radix, string characterSet)
- {
- if (characterSet.Length < radix)
- throw new ArgumentException ("charSet length less than radix", "characterSet");
- if (radix == 1)
- throw new ArgumentException ("There is no such thing as radix one notation", "radix");
-
- if (this == 0) return "0";
- if (this == 1) return "1";
-
- string result = "";
-
- BigInteger a = new BigInteger (this);
-
- while (a != 0) {
- uint rem = Kernel.SingleByteDivideInPlace (a, radix);
- result = characterSet [(int) rem] + result;
- }
-
- return result;
- }
-
- #endregion
-
- #region Misc
-
- /// <summary>
- /// Normalizes this by setting the length to the actual number of
- /// uints used in data and by setting the sign to Sign.Zero if the
- /// value of this is 0.
- /// </summary>
- private void Normalize ()
- {
- // Normalize length
- while (length > 0 && data [length-1] == 0) length--;
-
- // Check for zero
- if (length == 0)
- length++;
- }
-
- public void Clear ()
- {
- for (int i=0; i < length; i++)
- data [i] = 0x00;
- }
-
- #endregion
-
- #region Object Impl
-
- public override int GetHashCode ()
- {
- uint val = 0;
-
- for (uint i = 0; i < this.length; i++)
- val ^= this.data [i];
-
- return (int)val;
- }
-
- public override string ToString ()
- {
- return ToString (10);
- }
-
- public override bool Equals (object o)
- {
- if (o == null)
- return false;
- if (o is int)
- return (int)o >= 0 && this == (uint)o;
-
- BigInteger bi = o as BigInteger;
- if (bi == null)
- return false;
-
- return Kernel.Compare (this, bi) == 0;
- }
-
- #endregion
-
- #region Number Theory
-
- public BigInteger GCD (BigInteger bi)
- {
- return Kernel.gcd (this, bi);
- }
-
- public BigInteger ModInverse (BigInteger modulus)
- {
- return Kernel.modInverse (this, modulus);
- }
-
- public BigInteger ModPow (BigInteger exp, BigInteger n)
- {
- ModulusRing mr = new ModulusRing (n);
- return mr.Pow (this, exp);
- }
-
- #endregion
-
- #region Prime Testing
-
- public bool IsProbablePrime ()
- {
- // can we use our small-prime table ?
- if (this <= smallPrimes[smallPrimes.Length - 1]) {
- for (int p = 0; p < smallPrimes.Length; p++) {
- if (this == smallPrimes[p])
- return true;
- }
- // the list is complete, so it's not a prime
- return false;
- }
-
- // otherwise check if we can divide by one of the small primes
- for (int p = 0; p < smallPrimes.Length; p++) {
- if (this % smallPrimes[p] == 0)
- return false;
- }
- // the last step is to confirm the "large" prime with the SPP or Miller-Rabin test
- return PrimalityTests.Test (this, Prime.ConfidenceFactor.Medium);
- }
-
- #endregion
-
- #region Prime Number Generation
-
- /// <summary>
- /// Generates the smallest prime >= bi
- /// </summary>
- /// <param name="bi">A BigInteger</param>
- /// <returns>The smallest prime >= bi. More mathematically, if bi is prime: bi, else Prime [PrimePi [bi] + 1].</returns>
- public static BigInteger NextHighestPrime (BigInteger bi)
- {
- NextPrimeFinder npf = new NextPrimeFinder ();
- return npf.GenerateNewPrime (0, bi);
- }
-
- public static BigInteger GeneratePseudoPrime (int bits)
- {
- SequentialSearchPrimeGeneratorBase sspg = new SequentialSearchPrimeGeneratorBase ();
- return sspg.GenerateNewPrime (bits);
- }
-
- /// <summary>
- /// Increments this by two
- /// </summary>
- public void Incr2 ()
- {
- int i = 0;
-
- data [0] += 2;
-
- // If there was no carry, nothing to do
- if (data [0] < 2) {
-
- // Account for the first carry
- data [++i]++;
-
- // Keep adding until no carry
- while (data [i++] == 0x0)
- data [i]++;
-
- // See if we increased the data length
- if (length == (uint)i)
- length++;
- }
- }
-
- #endregion
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class ModulusRing {
-
- BigInteger mod, constant;
-
- public ModulusRing (BigInteger modulus)
- {
- this.mod = modulus;
-
- // calculate constant = b^ (2k) / m
- uint i = mod.length << 1;
-
- constant = new BigInteger (Sign.Positive, i + 1);
- constant.data [i] = 0x00000001;
-
- constant = constant / mod;
- }
-
- public void BarrettReduction (BigInteger x)
- {
- BigInteger n = mod;
- uint k = n.length,
- kPlusOne = k+1,
- kMinusOne = k-1;
-
- // x < mod, so nothing to do.
- if (x.length < k) return;
-
- BigInteger q3;
-
- //
- // Validate pointers
- //
- if (x.data.Length < x.length) throw new IndexOutOfRangeException ("x out of range");
-
- // q1 = x / b^ (k-1)
- // q2 = q1 * constant
- // q3 = q2 / b^ (k+1), Needs to be accessed with an offset of kPlusOne
-
- // TODO: We should the method in HAC p 604 to do this (14.45)
- q3 = new BigInteger (Sign.Positive, x.length - kMinusOne + constant.length);
- Kernel.Multiply (x.data, kMinusOne, x.length - kMinusOne, constant.data, 0, constant.length, q3.data, 0);
-
- // r1 = x mod b^ (k+1)
- // i.e. keep the lowest (k+1) words
-
- uint lengthToCopy = (x.length > kPlusOne) ? kPlusOne : x.length;
-
- x.length = lengthToCopy;
- x.Normalize ();
-
- // r2 = (q3 * n) mod b^ (k+1)
- // partial multiplication of q3 and n
-
- BigInteger r2 = new BigInteger (Sign.Positive, kPlusOne);
- Kernel.MultiplyMod2p32pmod (q3.data, (int)kPlusOne, (int)q3.length - (int)kPlusOne, n.data, 0, (int)n.length, r2.data, 0, (int)kPlusOne);
-
- r2.Normalize ();
-
- if (r2 <= x) {
- Kernel.MinusEq (x, r2);
- } else {
- BigInteger val = new BigInteger (Sign.Positive, kPlusOne + 1);
- val.data [kPlusOne] = 0x00000001;
-
- Kernel.MinusEq (val, r2);
- Kernel.PlusEq (x, val);
- }
-
- while (x >= n)
- Kernel.MinusEq (x, n);
- }
-
- public BigInteger Multiply (BigInteger a, BigInteger b)
- {
- if (a == 0 || b == 0) return 0;
-
- if (a > mod)
- a %= mod;
-
- if (b > mod)
- b %= mod;
-
- BigInteger ret = a * b;
- BarrettReduction (ret);
-
- return ret;
- }
-
- public BigInteger Difference (BigInteger a, BigInteger b)
- {
- Sign cmp = Kernel.Compare (a, b);
- BigInteger diff;
-
- switch (cmp) {
- case Sign.Zero:
- return 0;
- case Sign.Positive:
- diff = a - b; break;
- case Sign.Negative:
- diff = b - a; break;
- default:
- throw new Exception ();
- }
-
- if (diff >= mod) {
- if (diff.length >= mod.length << 1)
- diff %= mod;
- else
- BarrettReduction (diff);
- }
- if (cmp == Sign.Negative)
- diff = mod - diff;
- return diff;
- }
-#if true
- public BigInteger Pow (BigInteger a, BigInteger k)
- {
- BigInteger b = new BigInteger (1);
- if (k == 0)
- return b;
-
- BigInteger A = a;
- if (k.TestBit (0))
- b = a;
-
- for (int i = 1; i < k.BitCount (); i++) {
- A = Multiply (A, A);
- if (k.TestBit (i))
- b = Multiply (A, b);
- }
- return b;
- }
-#else
- public BigInteger Pow (BigInteger b, BigInteger exp)
- {
- if ((mod.data [0] & 1) == 1) return OddPow (b, exp);
- else return EvenPow (b, exp);
- }
-
- public BigInteger EvenPow (BigInteger b, BigInteger exp)
- {
- BigInteger resultNum = new BigInteger ((BigInteger)1, mod.length << 1);
- BigInteger tempNum = new BigInteger (b % mod, mod.length << 1); // ensures (tempNum * tempNum) < b^ (2k)
-
- uint totalBits = (uint)exp.BitCount ();
-
- uint [] wkspace = new uint [mod.length << 1];
-
- // perform squaring and multiply exponentiation
- for (uint pos = 0; pos < totalBits; pos++) {
- if (exp.TestBit (pos)) {
-
- Array.Clear (wkspace, 0, wkspace.Length);
- Kernel.Multiply (resultNum.data, 0, resultNum.length, tempNum.data, 0, tempNum.length, wkspace, 0);
- resultNum.length += tempNum.length;
- uint [] t = wkspace;
- wkspace = resultNum.data;
- resultNum.data = t;
-
- BarrettReduction (resultNum);
- }
-
- Kernel.SquarePositive (tempNum, ref wkspace);
- BarrettReduction (tempNum);
-
- if (tempNum == 1) {
- return resultNum;
- }
- }
-
- return resultNum;
- }
-
- private BigInteger OddPow (BigInteger b, BigInteger exp)
- {
- BigInteger resultNum = new BigInteger (Montgomery.ToMont (1, mod), mod.length << 1);
- BigInteger tempNum = new BigInteger (Montgomery.ToMont (b, mod), mod.length << 1); // ensures (tempNum * tempNum) < b^ (2k)
- uint mPrime = Montgomery.Inverse (mod.data [0]);
- uint totalBits = (uint)exp.BitCount ();
-
- uint [] wkspace = new uint [mod.length << 1];
-
- // perform squaring and multiply exponentiation
- for (uint pos = 0; pos < totalBits; pos++) {
- if (exp.TestBit (pos)) {
-
- Array.Clear (wkspace, 0, wkspace.Length);
- Kernel.Multiply (resultNum.data, 0, resultNum.length, tempNum.data, 0, tempNum.length, wkspace, 0);
- resultNum.length += tempNum.length;
- uint [] t = wkspace;
- wkspace = resultNum.data;
- resultNum.data = t;
-
- Montgomery.Reduce (resultNum, mod, mPrime);
- }
-
- // the value of tempNum is required in the last loop
- if (pos < totalBits - 1) {
- Kernel.SquarePositive (tempNum, ref wkspace);
- Montgomery.Reduce (tempNum, mod, mPrime);
- }
- }
-
- Montgomery.Reduce (resultNum, mod, mPrime);
- return resultNum;
- }
-#endif
- #region Pow Small Base
-
- // TODO: Make tests for this, not really needed b/c prime stuff
- // checks it, but still would be nice
-#if !INSIDE_CORLIB
- [CLSCompliant (false)]
-#endif
-#if true
- public BigInteger Pow (uint b, BigInteger exp)
- {
- return Pow (new BigInteger (b), exp);
- }
-#else
- public BigInteger Pow (uint b, BigInteger exp)
- {
-// if (b != 2) {
- if ((mod.data [0] & 1) == 1)
- return OddPow (b, exp);
- else
- return EvenPow (b, exp);
-/* buggy in some cases (like the well tested primes)
- } else {
- if ((mod.data [0] & 1) == 1)
- return OddModTwoPow (exp);
- else
- return EvenModTwoPow (exp);
- }*/
- }
-
- private unsafe BigInteger OddPow (uint b, BigInteger exp)
- {
- exp.Normalize ();
- uint [] wkspace = new uint [mod.length << 1 + 1];
-
- BigInteger resultNum = Montgomery.ToMont ((BigInteger)b, this.mod);
- resultNum = new BigInteger (resultNum, mod.length << 1 +1);
-
- uint mPrime = Montgomery.Inverse (mod.data [0]);
-
- int bc = exp.BitCount () - 2;
- uint pos = (bc > 1 ? (uint) bc : 1);
-
- //
- // We know that the first itr will make the val b
- //
-
- do {
- //
- // r = r ^ 2 % m
- //
- Kernel.SquarePositive (resultNum, ref wkspace);
- resultNum = Montgomery.Reduce (resultNum, mod, mPrime);
-
- if (exp.TestBit (pos)) {
-
- //
- // r = r * b % m
- //
-
- // TODO: Is Unsafe really speeding things up?
- fixed (uint* u = resultNum.data) {
-
- uint i = 0;
- ulong mc = 0;
-
- do {
- mc += (ulong)u [i] * (ulong)b;
- u [i] = (uint)mc;
- mc >>= 32;
- } while (++i < resultNum.length);
-
- if (resultNum.length < mod.length) {
- if (mc != 0) {
- u [i] = (uint)mc;
- resultNum.length++;
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- }
- } else if (mc != 0) {
-
- //
- // First, we estimate the quotient by dividing
- // the first part of each of the numbers. Then
- // we correct this, if necessary, with a subtraction.
- //
-
- uint cc = (uint)mc;
-
- // We would rather have this estimate overshoot,
- // so we add one to the divisor
- uint divEstimate;
- if (mod.data [mod.length - 1] < UInt32.MaxValue) {
- divEstimate = (uint) ((((ulong)cc << 32) | (ulong) u [i -1]) /
- (mod.data [mod.length-1] + 1));
- }
- else {
- // guess but don't divide by 0
- divEstimate = (uint) ((((ulong)cc << 32) | (ulong) u [i -1]) /
- (mod.data [mod.length-1]));
- }
-
- uint t;
-
- i = 0;
- mc = 0;
- do {
- mc += (ulong)mod.data [i] * (ulong)divEstimate;
- t = u [i];
- u [i] -= (uint)mc;
- mc >>= 32;
- if (u [i] > t) mc++;
- i++;
- } while (i < resultNum.length);
- cc -= (uint)mc;
-
- if (cc != 0) {
-
- uint sc = 0, j = 0;
- uint [] s = mod.data;
- do {
- uint a = s [j];
- if (((a += sc) < sc) | ((u [j] -= a) > ~a)) sc = 1;
- else sc = 0;
- j++;
- } while (j < resultNum.length);
- cc -= sc;
- }
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- } else {
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- }
- }
- }
- } while (pos-- > 0);
-
- resultNum = Montgomery.Reduce (resultNum, mod, mPrime);
- return resultNum;
-
- }
-
- private unsafe BigInteger EvenPow (uint b, BigInteger exp)
- {
- exp.Normalize ();
- uint [] wkspace = new uint [mod.length << 1 + 1];
- BigInteger resultNum = new BigInteger ((BigInteger)b, mod.length << 1 + 1);
-
- uint pos = (uint)exp.BitCount () - 2;
-
- //
- // We know that the first itr will make the val b
- //
-
- do {
- //
- // r = r ^ 2 % m
- //
- Kernel.SquarePositive (resultNum, ref wkspace);
- if (!(resultNum.length < mod.length))
- BarrettReduction (resultNum);
-
- if (exp.TestBit (pos)) {
-
- //
- // r = r * b % m
- //
-
- // TODO: Is Unsafe really speeding things up?
- fixed (uint* u = resultNum.data) {
-
- uint i = 0;
- ulong mc = 0;
-
- do {
- mc += (ulong)u [i] * (ulong)b;
- u [i] = (uint)mc;
- mc >>= 32;
- } while (++i < resultNum.length);
-
- if (resultNum.length < mod.length) {
- if (mc != 0) {
- u [i] = (uint)mc;
- resultNum.length++;
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- }
- } else if (mc != 0) {
-
- //
- // First, we estimate the quotient by dividing
- // the first part of each of the numbers. Then
- // we correct this, if necessary, with a subtraction.
- //
-
- uint cc = (uint)mc;
-
- // We would rather have this estimate overshoot,
- // so we add one to the divisor
- uint divEstimate = (uint) ((((ulong)cc << 32) | (ulong) u [i -1]) /
- (mod.data [mod.length-1] + 1));
-
- uint t;
-
- i = 0;
- mc = 0;
- do {
- mc += (ulong)mod.data [i] * (ulong)divEstimate;
- t = u [i];
- u [i] -= (uint)mc;
- mc >>= 32;
- if (u [i] > t) mc++;
- i++;
- } while (i < resultNum.length);
- cc -= (uint)mc;
-
- if (cc != 0) {
-
- uint sc = 0, j = 0;
- uint [] s = mod.data;
- do {
- uint a = s [j];
- if (((a += sc) < sc) | ((u [j] -= a) > ~a)) sc = 1;
- else sc = 0;
- j++;
- } while (j < resultNum.length);
- cc -= sc;
- }
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- } else {
- while (resultNum >= mod)
- Kernel.MinusEq (resultNum, mod);
- }
- }
- }
- } while (pos-- > 0);
-
- return resultNum;
- }
-#endif
-/* known to be buggy in some cases */
-#if false
- private unsafe BigInteger EvenModTwoPow (BigInteger exp)
- {
- exp.Normalize ();
- uint [] wkspace = new uint [mod.length << 1 + 1];
-
- BigInteger resultNum = new BigInteger (2, mod.length << 1 +1);
-
- uint value = exp.data [exp.length - 1];
- uint mask = 0x80000000;
-
- // Find the first bit of the exponent
- while ((value & mask) == 0)
- mask >>= 1;
-
- //
- // We know that the first itr will make the val 2,
- // so eat one bit of the exponent
- //
- mask >>= 1;
-
- uint wPos = exp.length - 1;
-
- do {
- value = exp.data [wPos];
- do {
- Kernel.SquarePositive (resultNum, ref wkspace);
- if (resultNum.length >= mod.length)
- BarrettReduction (resultNum);
-
- if ((value & mask) != 0) {
- //
- // resultNum = (resultNum * 2) % mod
- //
-
- fixed (uint* u = resultNum.data) {
- //
- // Double
- //
- uint* uu = u;
- uint* uuE = u + resultNum.length;
- uint x, carry = 0;
- while (uu < uuE) {
- x = *uu;
- *uu = (x << 1) | carry;
- carry = x >> (32 - 1);
- uu++;
- }
-
- // subtraction inlined because we know it is square
- if (carry != 0 || resultNum >= mod) {
- uu = u;
- uint c = 0;
- uint [] s = mod.data;
- uint i = 0;
- do {
- uint a = s [i];
- if (((a += c) < c) | ((* (uu++) -= a) > ~a))
- c = 1;
- else
- c = 0;
- i++;
- } while (uu < uuE);
- }
- }
- }
- } while ((mask >>= 1) > 0);
- mask = 0x80000000;
- } while (wPos-- > 0);
-
- return resultNum;
- }
-
- private unsafe BigInteger OddModTwoPow (BigInteger exp)
- {
-
- uint [] wkspace = new uint [mod.length << 1 + 1];
-
- BigInteger resultNum = Montgomery.ToMont ((BigInteger)2, this.mod);
- resultNum = new BigInteger (resultNum, mod.length << 1 +1);
-
- uint mPrime = Montgomery.Inverse (mod.data [0]);
-
- //
- // TODO: eat small bits, the ones we can do with no modular reduction
- //
- uint pos = (uint)exp.BitCount () - 2;
-
- do {
- Kernel.SquarePositive (resultNum, ref wkspace);
- resultNum = Montgomery.Reduce (resultNum, mod, mPrime);
-
- if (exp.TestBit (pos)) {
- //
- // resultNum = (resultNum * 2) % mod
- //
-
- fixed (uint* u = resultNum.data) {
- //
- // Double
- //
- uint* uu = u;
- uint* uuE = u + resultNum.length;
- uint x, carry = 0;
- while (uu < uuE) {
- x = *uu;
- *uu = (x << 1) | carry;
- carry = x >> (32 - 1);
- uu++;
- }
-
- // subtraction inlined because we know it is square
- if (carry != 0 || resultNum >= mod) {
- fixed (uint* s = mod.data) {
- uu = u;
- uint c = 0;
- uint* ss = s;
- do {
- uint a = *ss++;
- if (((a += c) < c) | ((* (uu++) -= a) > ~a))
- c = 1;
- else
- c = 0;
- } while (uu < uuE);
- }
- }
- }
- }
- } while (pos-- > 0);
-
- resultNum = Montgomery.Reduce (resultNum, mod, mPrime);
- return resultNum;
- }
-#endif
- #endregion
- }
-
- /// <summary>
- /// Low level functions for the BigInteger
- /// </summary>
- private sealed class Kernel {
-
- #region Addition/Subtraction
-
- /// <summary>
- /// Adds two numbers with the same sign.
- /// </summary>
- /// <param name="bi1">A BigInteger</param>
- /// <param name="bi2">A BigInteger</param>
- /// <returns>bi1 + bi2</returns>
- public static BigInteger AddSameSign (BigInteger bi1, BigInteger bi2)
- {
- uint [] x, y;
- uint yMax, xMax, i = 0;
-
- // x should be bigger
- if (bi1.length < bi2.length) {
- x = bi2.data;
- xMax = bi2.length;
- y = bi1.data;
- yMax = bi1.length;
- } else {
- x = bi1.data;
- xMax = bi1.length;
- y = bi2.data;
- yMax = bi2.length;
- }
-
- BigInteger result = new BigInteger (Sign.Positive, xMax + 1);
-
- uint [] r = result.data;
-
- ulong sum = 0;
-
- // Add common parts of both numbers
- do {
- sum = ((ulong)x [i]) + ((ulong)y [i]) + sum;
- r [i] = (uint)sum;
- sum >>= 32;
- } while (++i < yMax);
-
- // Copy remainder of longer number while carry propagation is required
- bool carry = (sum != 0);
-
- if (carry) {
-
- if (i < xMax) {
- do
- carry = ((r [i] = x [i] + 1) == 0);
- while (++i < xMax && carry);
- }
-
- if (carry) {
- r [i] = 1;
- result.length = ++i;
- return result;
- }
- }
-
- // Copy the rest
- if (i < xMax) {
- do
- r [i] = x [i];
- while (++i < xMax);
- }
-
- result.Normalize ();
- return result;
- }
-
- public static BigInteger Subtract (BigInteger big, BigInteger small)
- {
- BigInteger result = new BigInteger (Sign.Positive, big.length);
-
- uint [] r = result.data, b = big.data, s = small.data;
- uint i = 0, c = 0;
-
- do {
-
- uint x = s [i];
- if (((x += c) < c) | ((r [i] = b [i] - x) > ~x))
- c = 1;
- else
- c = 0;
-
- } while (++i < small.length);
-
- if (i == big.length) goto fixup;
-
- if (c == 1) {
- do
- r [i] = b [i] - 1;
- while (b [i++] == 0 && i < big.length);
-
- if (i == big.length) goto fixup;
- }
-
- do
- r [i] = b [i];
- while (++i < big.length);
-
- fixup:
-
- result.Normalize ();
- return result;
- }
-
- public static void MinusEq (BigInteger big, BigInteger small)
- {
- uint [] b = big.data, s = small.data;
- uint i = 0, c = 0;
-
- do {
- uint x = s [i];
- if (((x += c) < c) | ((b [i] -= x) > ~x))
- c = 1;
- else
- c = 0;
- } while (++i < small.length);
-
- if (i == big.length) goto fixup;
-
- if (c == 1) {
- do
- b [i]--;
- while (b [i++] == 0 && i < big.length);
- }
-
- fixup:
-
- // Normalize length
- while (big.length > 0 && big.data [big.length-1] == 0) big.length--;
-
- // Check for zero
- if (big.length == 0)
- big.length++;
-
- }
-
- public static void PlusEq (BigInteger bi1, BigInteger bi2)
- {
- uint [] x, y;
- uint yMax, xMax, i = 0;
- bool flag = false;
-
- // x should be bigger
- if (bi1.length < bi2.length){
- flag = true;
- x = bi2.data;
- xMax = bi2.length;
- y = bi1.data;
- yMax = bi1.length;
- } else {
- x = bi1.data;
- xMax = bi1.length;
- y = bi2.data;
- yMax = bi2.length;
- }
-
- uint [] r = bi1.data;
-
- ulong sum = 0;
-
- // Add common parts of both numbers
- do {
- sum += ((ulong)x [i]) + ((ulong)y [i]);
- r [i] = (uint)sum;
- sum >>= 32;
- } while (++i < yMax);
-
- // Copy remainder of longer number while carry propagation is required
- bool carry = (sum != 0);
-
- if (carry){
-
- if (i < xMax) {
- do
- carry = ((r [i] = x [i] + 1) == 0);
- while (++i < xMax && carry);
- }
-
- if (carry) {
- r [i] = 1;
- bi1.length = ++i;
- return;
- }
- }
-
- // Copy the rest
- if (flag && i < xMax - 1) {
- do
- r [i] = x [i];
- while (++i < xMax);
- }
-
- bi1.length = xMax + 1;
- bi1.Normalize ();
- }
-
- #endregion
-
- #region Compare
-
- /// <summary>
- /// Compares two BigInteger
- /// </summary>
- /// <param name="bi1">A BigInteger</param>
- /// <param name="bi2">A BigInteger</param>
- /// <returns>The sign of bi1 - bi2</returns>
- public static Sign Compare (BigInteger bi1, BigInteger bi2)
- {
- //
- // Step 1. Compare the lengths
- //
- uint l1 = bi1.length, l2 = bi2.length;
-
- while (l1 > 0 && bi1.data [l1-1] == 0) l1--;
- while (l2 > 0 && bi2.data [l2-1] == 0) l2--;
-
- if (l1 == 0 && l2 == 0) return Sign.Zero;
-
- // bi1 len < bi2 len
- if (l1 < l2) return Sign.Negative;
- // bi1 len > bi2 len
- else if (l1 > l2) return Sign.Positive;
-
- //
- // Step 2. Compare the bits
- //
-
- uint pos = l1 - 1;
-
- while (pos != 0 && bi1.data [pos] == bi2.data [pos]) pos--;
-
- if (bi1.data [pos] < bi2.data [pos])
- return Sign.Negative;
- else if (bi1.data [pos] > bi2.data [pos])
- return Sign.Positive;
- else
- return Sign.Zero;
- }
-
- #endregion
-
- #region Division
-
- #region Dword
-
- /// <summary>
- /// Performs n / d and n % d in one operation.
- /// </summary>
- /// <param name="n">A BigInteger, upon exit this will hold n / d</param>
- /// <param name="d">The divisor</param>
- /// <returns>n % d</returns>
- public static uint SingleByteDivideInPlace (BigInteger n, uint d)
- {
- ulong r = 0;
- uint i = n.length;
-
- while (i-- > 0) {
- r <<= 32;
- r |= n.data [i];
- n.data [i] = (uint)(r / d);
- r %= d;
- }
- n.Normalize ();
-
- return (uint)r;
- }
-
- public static uint DwordMod (BigInteger n, uint d)
- {
- ulong r = 0;
- uint i = n.length;
-
- while (i-- > 0) {
- r <<= 32;
- r |= n.data [i];
- r %= d;
- }
-
- return (uint)r;
- }
-
- public static BigInteger DwordDiv (BigInteger n, uint d)
- {
- BigInteger ret = new BigInteger (Sign.Positive, n.length);
-
- ulong r = 0;
- uint i = n.length;
-
- while (i-- > 0) {
- r <<= 32;
- r |= n.data [i];
- ret.data [i] = (uint)(r / d);
- r %= d;
- }
- ret.Normalize ();
-
- return ret;
- }
-
- public static BigInteger [] DwordDivMod (BigInteger n, uint d)
- {
- BigInteger ret = new BigInteger (Sign.Positive , n.length);
-
- ulong r = 0;
- uint i = n.length;
-
- while (i-- > 0) {
- r <<= 32;
- r |= n.data [i];
- ret.data [i] = (uint)(r / d);
- r %= d;
- }
- ret.Normalize ();
-
- BigInteger rem = (uint)r;
-
- return new BigInteger [] {ret, rem};
- }
-
- #endregion
-
- #region BigNum
-
- public static BigInteger [] multiByteDivide (BigInteger bi1, BigInteger bi2)
- {
- if (Kernel.Compare (bi1, bi2) == Sign.Negative)
- return new BigInteger [2] { 0, new BigInteger (bi1) };
-
- bi1.Normalize (); bi2.Normalize ();
-
- if (bi2.length == 1)
- return DwordDivMod (bi1, bi2.data [0]);
-
- uint remainderLen = bi1.length + 1;
- int divisorLen = (int)bi2.length + 1;
-
- uint mask = 0x80000000;
- uint val = bi2.data [bi2.length - 1];
- int shift = 0;
- int resultPos = (int)bi1.length - (int)bi2.length;
-
- while (mask != 0 && (val & mask) == 0) {
- shift++; mask >>= 1;
- }
-
- BigInteger quot = new BigInteger (Sign.Positive, bi1.length - bi2.length + 1);
- BigInteger rem = (bi1 << shift);
-
- uint [] remainder = rem.data;
-
- bi2 = bi2 << shift;
-
- int j = (int)(remainderLen - bi2.length);
- int pos = (int)remainderLen - 1;
-
- uint firstDivisorByte = bi2.data [bi2.length-1];
- ulong secondDivisorByte = bi2.data [bi2.length-2];
-
- while (j > 0) {
- ulong dividend = ((ulong)remainder [pos] << 32) + (ulong)remainder [pos-1];
-
- ulong q_hat = dividend / (ulong)firstDivisorByte;
- ulong r_hat = dividend % (ulong)firstDivisorByte;
-
- do {
-
- if (q_hat == 0x100000000 ||
- (q_hat * secondDivisorByte) > ((r_hat << 32) + remainder [pos-2])) {
- q_hat--;
- r_hat += (ulong)firstDivisorByte;
-
- if (r_hat < 0x100000000)
- continue;
- }
- break;
- } while (true);
-
- //
- // At this point, q_hat is either exact, or one too large
- // (more likely to be exact) so, we attempt to multiply the
- // divisor by q_hat, if we get a borrow, we just subtract
- // one from q_hat and add the divisor back.
- //
-
- uint t;
- uint dPos = 0;
- int nPos = pos - divisorLen + 1;
- ulong mc = 0;
- uint uint_q_hat = (uint)q_hat;
- do {
- mc += (ulong)bi2.data [dPos] * (ulong)uint_q_hat;
- t = remainder [nPos];
- remainder [nPos] -= (uint)mc;
- mc >>= 32;
- if (remainder [nPos] > t) mc++;
- dPos++; nPos++;
- } while (dPos < divisorLen);
-
- nPos = pos - divisorLen + 1;
- dPos = 0;
-
- // Overestimate
- if (mc != 0) {
- uint_q_hat--;
- ulong sum = 0;
-
- do {
- sum = ((ulong)remainder [nPos]) + ((ulong)bi2.data [dPos]) + sum;
- remainder [nPos] = (uint)sum;
- sum >>= 32;
- dPos++; nPos++;
- } while (dPos < divisorLen);
-
- }
-
- quot.data [resultPos--] = (uint)uint_q_hat;
-
- pos--;
- j--;
- }
-
- quot.Normalize ();
- rem.Normalize ();
- BigInteger [] ret = new BigInteger [2] { quot, rem };
-
- if (shift != 0)
- ret [1] >>= shift;
-
- return ret;
- }
-
- #endregion
-
- #endregion
-
- #region Shift
- public static BigInteger LeftShift (BigInteger bi, int n)
- {
- if (n == 0) return new BigInteger (bi, bi.length + 1);
-
- int w = n >> 5;
- n &= ((1 << 5) - 1);
-
- BigInteger ret = new BigInteger (Sign.Positive, bi.length + 1 + (uint)w);
-
- uint i = 0, l = bi.length;
- if (n != 0) {
- uint x, carry = 0;
- while (i < l) {
- x = bi.data [i];
- ret.data [i + w] = (x << n) | carry;
- carry = x >> (32 - n);
- i++;
- }
- ret.data [i + w] = carry;
- } else {
- while (i < l) {
- ret.data [i + w] = bi.data [i];
- i++;
- }
- }
-
- ret.Normalize ();
- return ret;
- }
-
- public static BigInteger RightShift (BigInteger bi, int n)
- {
- if (n == 0) return new BigInteger (bi);
-
- int w = n >> 5;
- int s = n & ((1 << 5) - 1);
-
- BigInteger ret = new BigInteger (Sign.Positive, bi.length - (uint)w + 1);
- uint l = (uint)ret.data.Length - 1;
-
- if (s != 0) {
-
- uint x, carry = 0;
-
- while (l-- > 0) {
- x = bi.data [l + w];
- ret.data [l] = (x >> n) | carry;
- carry = x << (32 - n);
- }
- } else {
- while (l-- > 0)
- ret.data [l] = bi.data [l + w];
-
- }
- ret.Normalize ();
- return ret;
- }
-
- #endregion
-
- #region Multiply
-
- public static BigInteger MultiplyByDword (BigInteger n, uint f)
- {
- BigInteger ret = new BigInteger (Sign.Positive, n.length + 1);
-
- uint i = 0;
- ulong c = 0;
-
- do {
- c += (ulong)n.data [i] * (ulong)f;
- ret.data [i] = (uint)c;
- c >>= 32;
- } while (++i < n.length);
- ret.data [i] = (uint)c;
- ret.Normalize ();
- return ret;
-
- }
-
- /// <summary>
- /// Multiplies the data in x [xOffset:xOffset+xLen] by
- /// y [yOffset:yOffset+yLen] and puts it into
- /// d [dOffset:dOffset+xLen+yLen].
- /// </summary>
- /// <remarks>
- /// This code is unsafe! It is the caller's responsibility to make
- /// sure that it is safe to access x [xOffset:xOffset+xLen],
- /// y [yOffset:yOffset+yLen], and d [dOffset:dOffset+xLen+yLen].
- /// </remarks>
- public static unsafe void Multiply (uint [] x, uint xOffset, uint xLen, uint [] y, uint yOffset, uint yLen, uint [] d, uint dOffset)
- {
- fixed (uint* xx = x, yy = y, dd = d) {
- uint* xP = xx + xOffset,
- xE = xP + xLen,
- yB = yy + yOffset,
- yE = yB + yLen,
- dB = dd + dOffset;
-
- for (; xP < xE; xP++, dB++) {
-
- if (*xP == 0) continue;
-
- ulong mcarry = 0;
-
- uint* dP = dB;
- for (uint* yP = yB; yP < yE; yP++, dP++) {
- mcarry += ((ulong)*xP * (ulong)*yP) + (ulong)*dP;
-
- *dP = (uint)mcarry;
- mcarry >>= 32;
- }
-
- if (mcarry != 0)
- *dP = (uint)mcarry;
- }
- }
- }
-
- /// <summary>
- /// Multiplies the data in x [xOffset:xOffset+xLen] by
- /// y [yOffset:yOffset+yLen] and puts the low mod words into
- /// d [dOffset:dOffset+mod].
- /// </summary>
- /// <remarks>
- /// This code is unsafe! It is the caller's responsibility to make
- /// sure that it is safe to access x [xOffset:xOffset+xLen],
- /// y [yOffset:yOffset+yLen], and d [dOffset:dOffset+mod].
- /// </remarks>
- public static unsafe void MultiplyMod2p32pmod (uint [] x, int xOffset, int xLen, uint [] y, int yOffest, int yLen, uint [] d, int dOffset, int mod)
- {
- fixed (uint* xx = x, yy = y, dd = d) {
- uint* xP = xx + xOffset,
- xE = xP + xLen,
- yB = yy + yOffest,
- yE = yB + yLen,
- dB = dd + dOffset,
- dE = dB + mod;
-
- for (; xP < xE; xP++, dB++) {
-
- if (*xP == 0) continue;
-
- ulong mcarry = 0;
- uint* dP = dB;
- for (uint* yP = yB; yP < yE && dP < dE; yP++, dP++) {
- mcarry += ((ulong)*xP * (ulong)*yP) + (ulong)*dP;
-
- *dP = (uint)mcarry;
- mcarry >>= 32;
- }
-
- if (mcarry != 0 && dP < dE)
- *dP = (uint)mcarry;
- }
- }
- }
-
- public static unsafe void SquarePositive (BigInteger bi, ref uint [] wkSpace)
- {
- uint [] t = wkSpace;
- wkSpace = bi.data;
- uint [] d = bi.data;
- uint dl = bi.length;
- bi.data = t;
-
- fixed (uint* dd = d, tt = t) {
-
- uint* ttE = tt + t.Length;
- // Clear the dest
- for (uint* ttt = tt; ttt < ttE; ttt++)
- *ttt = 0;
-
- uint* dP = dd, tP = tt;
-
- for (uint i = 0; i < dl; i++, dP++) {
- if (*dP == 0)
- continue;
-
- ulong mcarry = 0;
- uint bi1val = *dP;
-
- uint* dP2 = dP + 1, tP2 = tP + 2*i + 1;
-
- for (uint j = i + 1; j < dl; j++, tP2++, dP2++) {
- // k = i + j
- mcarry += ((ulong)bi1val * (ulong)*dP2) + *tP2;
-
- *tP2 = (uint)mcarry;
- mcarry >>= 32;
- }
-
- if (mcarry != 0)
- *tP2 = (uint)mcarry;
- }
-
- // Double t. Inlined for speed.
-
- tP = tt;
-
- uint x, carry = 0;
- while (tP < ttE) {
- x = *tP;
- *tP = (x << 1) | carry;
- carry = x >> (32 - 1);
- tP++;
- }
- if (carry != 0) *tP = carry;
-
- // Add in the diagnals
-
- dP = dd;
- tP = tt;
- for (uint* dE = dP + dl; (dP < dE); dP++, tP++) {
- ulong val = (ulong)*dP * (ulong)*dP + *tP;
- *tP = (uint)val;
- val >>= 32;
- *(++tP) += (uint)val;
- if (*tP < (uint)val) {
- uint* tP3 = tP;
- // Account for the first carry
- (*++tP3)++;
-
- // Keep adding until no carry
- while ((*tP3++) == 0)
- (*tP3)++;
- }
-
- }
-
- bi.length <<= 1;
-
- // Normalize length
- while (tt [bi.length-1] == 0 && bi.length > 1) bi.length--;
-
- }
- }
-
-/*
- * Never called in BigInteger (and part of a private class)
- * public static bool Double (uint [] u, int l)
- {
- uint x, carry = 0;
- uint i = 0;
- while (i < l) {
- x = u [i];
- u [i] = (x << 1) | carry;
- carry = x >> (32 - 1);
- i++;
- }
- if (carry != 0) u [l] = carry;
- return carry != 0;
- }*/
-
- #endregion
-
- #region Number Theory
-
- public static BigInteger gcd (BigInteger a, BigInteger b)
- {
- BigInteger x = a;
- BigInteger y = b;
-
- BigInteger g = y;
-
- while (x.length > 1) {
- g = x;
- x = y % x;
- y = g;
-
- }
- if (x == 0) return g;
-
- // TODO: should we have something here if we can convert to long?
-
- //
- // Now we can just do it with single precision. I am using the binary gcd method,
- // as it should be faster.
- //
-
- uint yy = x.data [0];
- uint xx = y % yy;
-
- int t = 0;
-
- while (((xx | yy) & 1) == 0) {
- xx >>= 1; yy >>= 1; t++;
- }
- while (xx != 0) {
- while ((xx & 1) == 0) xx >>= 1;
- while ((yy & 1) == 0) yy >>= 1;
- if (xx >= yy)
- xx = (xx - yy) >> 1;
- else
- yy = (yy - xx) >> 1;
- }
-
- return yy << t;
- }
-
- public static uint modInverse (BigInteger bi, uint modulus)
- {
- uint a = modulus, b = bi % modulus;
- uint p0 = 0, p1 = 1;
-
- while (b != 0) {
- if (b == 1)
- return p1;
- p0 += (a / b) * p1;
- a %= b;
-
- if (a == 0)
- break;
- if (a == 1)
- return modulus-p0;
-
- p1 += (b / a) * p0;
- b %= a;
-
- }
- return 0;
- }
-
- public static BigInteger modInverse (BigInteger bi, BigInteger modulus)
- {
- if (modulus.length == 1) return modInverse (bi, modulus.data [0]);
-
- BigInteger [] p = { 0, 1 };
- BigInteger [] q = new BigInteger [2]; // quotients
- BigInteger [] r = { 0, 0 }; // remainders
-
- int step = 0;
-
- BigInteger a = modulus;
- BigInteger b = bi;
-
- ModulusRing mr = new ModulusRing (modulus);
-
- while (b != 0) {
-
- if (step > 1) {
-
- BigInteger pval = mr.Difference (p [0], p [1] * q [0]);
- p [0] = p [1]; p [1] = pval;
- }
-
- BigInteger [] divret = multiByteDivide (a, b);
-
- q [0] = q [1]; q [1] = divret [0];
- r [0] = r [1]; r [1] = divret [1];
- a = b;
- b = divret [1];
-
- step++;
- }
-
- if (r [0] != 1)
- throw (new ArithmeticException ("No inverse!"));
-
- return mr.Difference (p [0], p [1] * q [0]);
-
- }
- #endregion
- }
- }
-}
+++ /dev/null
-2007-05-31 Alan McGovern <alan.mcgovern@gmail.com>
-
- * BigInteger.cs: Don't instantiate a new BigInteger after
- multiplying - it's not needed.
-
-2007-09-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Updated to match Mono.Security sources.
-
-2007-07-28 Miguel de Icaza <miguel@novell.com>
-
- * BigInteger.cs: Do not cast inside Equals,instead use the as
- operator, as reported by Jesse Jones.
-
-2004-12-03 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Fix issue #70169 in ModPow when modulus is a power of
- two.
-
-2004-10-19 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Fix issue #68452 when Randomize was being called on a
- 0 BigInteger (i.e. BitCount == 0).
-
-2004-05-14 Marek Safar <marek.safar@seznam.cz>
-
- * BigInteger.cs: Removed useless [CLSCompliant (false)]
-
-2004-05-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: In sync with Mono.Security.dll version.
-
-2004-04-30 Ben Maurer <bmaurer@users.sourceforge.net>
-
- * BigInteger.cs: use readonly for prime array.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: In sync with Mono.Security.dll version.
-
-2004-02-23 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Corrected isProbablePrime by removing the redundant
- loop. Fix #54750.
-
-2004-02-13 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Fixed isProbablePrime() and added Parse method from
- patch provided by Pieter (#51229). Changed SmallPrimeSppTest to
- RabinMillerTest (#51229, #54262). Removed obsoleted method
- isProbablePrime(int).
-
-2004-02-09 Sebastien Pouliot <sebastien@ximian.com>
-
- * BigInteger.cs: Added INSIDE_CORLIB to define ModulusRing as
- internal. Without this the unit tests for Mono.Math (now in
- Mono.Security assembly) wont compile (see bugzilla #44845).
-
-2003-11-20 Ben Maurer <bmaurer@users.sourceforge.net>
-
- * BigInteger.cs: Fix prob. prime test for small numbers (Pieter Philippaerts)
-
-2003-06-11 Sebastien Pouliot <spouliot@motus.com>
-
- * BigInteger.cs: Added Clear to zeroize big integers and code to allow
- compares with null (because operators == and != are re-defined). Note:
- The class may still leak some private info in temp arrays (thanks Ben).
-
-2003-04-22 Sebastien Pouliot <spouliot@videotron.ca>
-
- * BigInteger.cs: New, much faster, version by Ben Maurer.
- Warning: this version requires "unsafe" compilation switch
- (which isn't a problem in corlib but may be elsewhere)
-
-2003-02-08 Sebastien Pouliot <spouliot@videotron.ca>
-
- * BigInteger.cs: Renamed namespace to match new location.
-
+++ /dev/null
-//
-// AuthenticodeBase.cs: Authenticode signature base class
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004, 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Security.Cryptography;
-
-namespace Mono.Security.Authenticode {
-
- // References:
- // a. http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- enum Authority {
- Individual,
- Commercial,
- Maximum
- }
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class AuthenticodeBase {
-
- public const string spcIndirectDataContext = "1.3.6.1.4.1.311.2.1.4";
-
- private byte[] fileblock;
- private FileStream fs;
- private int blockNo;
- private int blockLength;
- private int peOffset;
- private int dirSecurityOffset;
- private int dirSecuritySize;
- private int coffSymbolTableOffset;
-
- public AuthenticodeBase ()
- {
- fileblock = new byte [4096];
- }
-
- internal int PEOffset {
- get {
- if (blockNo < 1)
- ReadFirstBlock ();
- return peOffset;
- }
- }
-
- internal int CoffSymbolTableOffset {
- get {
- if (blockNo < 1)
- ReadFirstBlock ();
- return coffSymbolTableOffset;
- }
- }
-
- internal int SecurityOffset {
- get {
- if (blockNo < 1)
- ReadFirstBlock ();
- return dirSecurityOffset;
- }
- }
-
- internal void Open (string filename)
- {
- if (fs != null)
- Close ();
- fs = new FileStream (filename, FileMode.Open, FileAccess.Read, FileShare.Read);
- }
-
- internal void Close ()
- {
- if (fs != null) {
- fs.Close ();
- fs = null;
- blockNo = 0;
- }
- }
-
- internal bool ReadFirstBlock ()
- {
- if (fs == null)
- return false;
-
- fs.Position = 0;
- // read first block - it will include (100% sure)
- // the MZ header and (99.9% sure) the PE header
- blockLength = fs.Read (fileblock, 0, fileblock.Length);
- blockNo = 1;
- if (blockLength < 64)
- return false; // invalid PE file
-
- // 1. Validate the MZ header informations
- // 1.1. Check for magic MZ at start of header
- if (BitConverterLE.ToUInt16 (fileblock, 0) != 0x5A4D)
- return false;
-
- // 1.2. Find the offset of the PE header
- peOffset = BitConverterLE.ToInt32 (fileblock, 60);
- if (peOffset > fileblock.Length) {
- // just in case (0.1%) this can actually happen
- string msg = String.Format (Locale.GetText (
- "Header size too big (> {0} bytes)."),
- fileblock.Length);
- throw new NotSupportedException (msg);
- }
- if (peOffset > fs.Length)
- return false;
-
- // 2. Read between DOS header and first part of PE header
- // 2.1. Check for magic PE at start of header
- // PE - NT header ('P' 'E' 0x00 0x00)
- if (BitConverterLE.ToUInt32 (fileblock, peOffset) != 0x4550)
- return false;
-
- // 2.2. Locate IMAGE_DIRECTORY_ENTRY_SECURITY (offset and size)
- dirSecurityOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 152);
- dirSecuritySize = BitConverterLE.ToInt32 (fileblock, peOffset + 156);
-
- // COFF symbol tables are deprecated - we'll strip them if we see them!
- // (otherwise the signature won't work on MS and we don't want to support COFF for that)
- coffSymbolTableOffset = BitConverterLE.ToInt32 (fileblock, peOffset + 12);
-
- return true;
- }
-
- internal byte[] GetSecurityEntry ()
- {
- if (blockNo < 1)
- ReadFirstBlock ();
-
- if (dirSecuritySize > 8) {
- // remove header from size (not ASN.1 based)
- byte[] secEntry = new byte [dirSecuritySize - 8];
- // position after header and read entry
- fs.Position = dirSecurityOffset + 8;
- fs.Read (secEntry, 0, secEntry.Length);
- return secEntry;
- }
- return null;
- }
-
- internal byte[] GetHash (HashAlgorithm hash)
- {
- if (blockNo < 1)
- ReadFirstBlock ();
- fs.Position = blockLength;
-
- // hash the rest of the file
- long n;
- int addsize = 0;
- // minus any authenticode signature (with 8 bytes header)
- if (dirSecurityOffset > 0) {
- // it is also possible that the signature block
- // starts within the block in memory (small EXE)
- if (dirSecurityOffset < blockLength) {
- blockLength = dirSecurityOffset;
- n = 0;
- } else {
- n = dirSecurityOffset - blockLength;
- }
- } else if (coffSymbolTableOffset > 0) {
- fileblock[PEOffset + 12] = 0;
- fileblock[PEOffset + 13] = 0;
- fileblock[PEOffset + 14] = 0;
- fileblock[PEOffset + 15] = 0;
- fileblock[PEOffset + 16] = 0;
- fileblock[PEOffset + 17] = 0;
- fileblock[PEOffset + 18] = 0;
- fileblock[PEOffset + 19] = 0;
- // it is also possible that the signature block
- // starts within the block in memory (small EXE)
- if (coffSymbolTableOffset < blockLength) {
- blockLength = coffSymbolTableOffset;
- n = 0;
- } else {
- n = coffSymbolTableOffset - blockLength;
- }
- } else {
- addsize = (int) (fs.Length & 7);
- if (addsize > 0)
- addsize = 8 - addsize;
-
- n = fs.Length - blockLength;
- }
-
- // Authenticode(r) gymnastics
- // Hash from (generally) 0 to 215 (216 bytes)
- int pe = peOffset + 88;
- hash.TransformBlock (fileblock, 0, pe, fileblock, 0);
- // then skip 4 for checksum
- pe += 4;
- // Continue hashing from (generally) 220 to 279 (60 bytes)
- hash.TransformBlock (fileblock, pe, 60, fileblock, pe);
- // then skip 8 bytes for IMAGE_DIRECTORY_ENTRY_SECURITY
- pe += 68;
-
- // everything is present so start the hashing
- if (n == 0) {
- // hash the (only) block
- hash.TransformFinalBlock (fileblock, pe, blockLength - pe);
- }
- else {
- // hash the last part of the first (already in memory) block
- hash.TransformBlock (fileblock, pe, blockLength - pe, fileblock, pe);
-
- // hash by blocks of 4096 bytes
- long blocks = (n >> 12);
- int remainder = (int)(n - (blocks << 12));
- if (remainder == 0) {
- blocks--;
- remainder = 4096;
- }
- // blocks
- while (blocks-- > 0) {
- fs.Read (fileblock, 0, fileblock.Length);
- hash.TransformBlock (fileblock, 0, fileblock.Length, fileblock, 0);
- }
- // remainder
- if (fs.Read (fileblock, 0, remainder) != remainder)
- return null;
-
- if (addsize > 0) {
- hash.TransformBlock (fileblock, 0, remainder, fileblock, 0);
- hash.TransformFinalBlock (new byte [addsize], 0, addsize);
- } else {
- hash.TransformFinalBlock (fileblock, 0, remainder);
- }
- }
- return hash.Hash;
- }
-
- // for compatibility only
- protected byte[] HashFile (string fileName, string hashName)
- {
- try {
- Open (fileName);
- HashAlgorithm hash = HashAlgorithm.Create (hashName);
- byte[] result = GetHash (hash);
- Close ();
- return result;
- }
- catch {
- return null;
- }
- }
- }
-}
+++ /dev/null
-//
-// AuthenticodeDeformatter.cs: Authenticode signature validator
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.IO;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Security.Cryptography;
-
-using Mono.Security.Cryptography;
-using Mono.Security.X509;
-
-namespace Mono.Security.Authenticode {
-
- // References:
- // a. http://www.cs.auckland.ac.nz/~pgut001/pubs/authenticode.txt
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class AuthenticodeDeformatter : AuthenticodeBase {
-
- private string filename;
- private byte[] hash;
- private X509CertificateCollection coll;
- private ASN1 signedHash;
- private DateTime timestamp;
- private X509Certificate signingCertificate;
- private int reason;
- private bool trustedRoot;
- private bool trustedTimestampRoot;
- private byte[] entry;
-
- private X509Chain signerChain;
- private X509Chain timestampChain;
-
- public AuthenticodeDeformatter () : base ()
- {
- reason = -1;
- signerChain = new X509Chain ();
- timestampChain = new X509Chain ();
- }
-
- public AuthenticodeDeformatter (string fileName) : this ()
- {
- FileName = fileName;
- }
-
- public string FileName {
- get { return filename; }
- set {
- Reset ();
- try {
- CheckSignature (value);
- }
- catch (SecurityException) {
- throw;
- }
- catch (Exception) {
- reason = 1;
- }
- }
- }
-
- public byte[] Hash {
- get {
- if (signedHash == null)
- return null;
- return (byte[]) signedHash.Value.Clone ();
- }
- }
-
- public int Reason {
- get {
- if (reason == -1)
- IsTrusted ();
- return reason;
- }
- }
-
- public bool IsTrusted ()
- {
- if (entry == null) {
- reason = 1;
- return false;
- }
-
- if (signingCertificate == null) {
- reason = 7;
- return false;
- }
-
- if ((signerChain.Root == null) || !trustedRoot) {
- reason = 6;
- return false;
- }
-
- if (timestamp != DateTime.MinValue) {
- if ((timestampChain.Root == null) || !trustedTimestampRoot) {
- reason = 6;
- return false;
- }
-
- // check that file was timestamped when certificates were valid
- if (!signingCertificate.WasCurrent (Timestamp)) {
- reason = 4;
- return false;
- }
- }
- else if (!signingCertificate.IsCurrent) {
- // signature only valid if the certificate is valid
- reason = 8;
- return false;
- }
-
- if (reason == -1)
- reason = 0;
- return true;
- }
-
- public byte[] Signature {
- get {
- if (entry == null)
- return null;
- return (byte[]) entry.Clone ();
- }
- }
-
- public DateTime Timestamp {
- get { return timestamp; }
- }
-
- public X509CertificateCollection Certificates {
- get { return coll; }
- }
-
- public X509Certificate SigningCertificate {
- get { return signingCertificate; }
- }
-
- private bool CheckSignature (string fileName)
- {
- filename = fileName;
- Open (filename);
- entry = GetSecurityEntry ();
- if (entry == null) {
- // no signature is present
- reason = 1;
- Close ();
- return false;
- }
-
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo (entry);
- if (ci.ContentType != PKCS7.Oid.signedData) {
- Close ();
- return false;
- }
-
- PKCS7.SignedData sd = new PKCS7.SignedData (ci.Content);
- if (sd.ContentInfo.ContentType != spcIndirectDataContext) {
- Close ();
- return false;
- }
-
- coll = sd.Certificates;
-
- ASN1 spc = sd.ContentInfo.Content;
- signedHash = spc [0][1][1];
-
- HashAlgorithm ha = null;
- switch (signedHash.Length) {
- case 16:
- ha = HashAlgorithm.Create ("MD5");
- hash = GetHash (ha);
- break;
- case 20:
- ha = HashAlgorithm.Create ("SHA1");
- hash = GetHash (ha);
- break;
- default:
- reason = 5;
- Close ();
- return false;
- }
- Close ();
-
- if (!signedHash.CompareValue (hash)) {
- reason = 2;
- }
-
- // messageDigest is a hash of spcIndirectDataContext (which includes the file hash)
- byte[] spcIDC = spc [0].Value;
- ha.Initialize (); // re-using hash instance
- byte[] messageDigest = ha.ComputeHash (spcIDC);
-
- bool sign = VerifySignature (sd, messageDigest, ha);
- return (sign && (reason == 0));
- }
-
- private bool CompareIssuerSerial (string issuer, byte[] serial, X509Certificate x509)
- {
- if (issuer != x509.IssuerName)
- return false;
- if (serial.Length != x509.SerialNumber.Length)
- return false;
- // MS shows the serial number inversed (so is Mono.Security.X509.X509Certificate)
- int n = serial.Length;
- for (int i=0; i < serial.Length; i++) {
- if (serial [i] != x509.SerialNumber [--n])
- return false;
- }
- // must be true
- return true;
- }
-
- //private bool VerifySignature (ASN1 cs, byte[] calculatedMessageDigest, string hashName)
- private bool VerifySignature (PKCS7.SignedData sd, byte[] calculatedMessageDigest, HashAlgorithm ha)
- {
- string contentType = null;
- ASN1 messageDigest = null;
-// string spcStatementType = null;
-// string spcSpOpusInfo = null;
-
- for (int i=0; i < sd.SignerInfo.AuthenticatedAttributes.Count; i++) {
- ASN1 attr = (ASN1) sd.SignerInfo.AuthenticatedAttributes [i];
- string oid = ASN1Convert.ToOid (attr[0]);
- switch (oid) {
- case "1.2.840.113549.1.9.3":
- // contentType
- contentType = ASN1Convert.ToOid (attr[1][0]);
- break;
- case "1.2.840.113549.1.9.4":
- // messageDigest
- messageDigest = attr[1][0];
- break;
- case "1.3.6.1.4.1.311.2.1.11":
- // spcStatementType (Microsoft code signing)
- // possible values
- // - individualCodeSigning (1 3 6 1 4 1 311 2 1 21)
- // - commercialCodeSigning (1 3 6 1 4 1 311 2 1 22)
-// spcStatementType = ASN1Convert.ToOid (attr[1][0][0]);
- break;
- case "1.3.6.1.4.1.311.2.1.12":
- // spcSpOpusInfo (Microsoft code signing)
-/* try {
- spcSpOpusInfo = System.Text.Encoding.UTF8.GetString (attr[1][0][0][0].Value);
- }
- catch (NullReferenceException) {
- spcSpOpusInfo = null;
- }*/
- break;
- default:
- break;
- }
- }
- if (contentType != spcIndirectDataContext)
- return false;
-
- // verify message digest
- if (messageDigest == null)
- return false;
- if (!messageDigest.CompareValue (calculatedMessageDigest))
- return false;
-
- // verify signature
- string hashOID = CryptoConfig.MapNameToOID (ha.ToString ());
-
- // change to SET OF (not [0]) as per PKCS #7 1.5
- ASN1 aa = new ASN1 (0x31);
- foreach (ASN1 a in sd.SignerInfo.AuthenticatedAttributes)
- aa.Add (a);
- ha.Initialize ();
- byte[] p7hash = ha.ComputeHash (aa.GetBytes ());
-
- byte[] signature = sd.SignerInfo.Signature;
- // we need to find the specified certificate
- string issuer = sd.SignerInfo.IssuerName;
- byte[] serial = sd.SignerInfo.SerialNumber;
- foreach (X509Certificate x509 in coll) {
- if (CompareIssuerSerial (issuer, serial, x509)) {
- // don't verify is key size don't match
- if (x509.PublicKey.Length > (signature.Length >> 3)) {
- // return the signing certificate even if the signature isn't correct
- // (required behaviour for 2.0 support)
- signingCertificate = x509;
- RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA;
- if (rsa.VerifyHash (p7hash, hashOID, signature)) {
- signerChain.LoadCertificates (coll);
- trustedRoot = signerChain.Build (x509);
- break;
- }
- }
- }
- }
-
- // timestamp signature is optional
- if (sd.SignerInfo.UnauthenticatedAttributes.Count == 0) {
- trustedTimestampRoot = true;
- } else {
- for (int i = 0; i < sd.SignerInfo.UnauthenticatedAttributes.Count; i++) {
- ASN1 attr = (ASN1) sd.SignerInfo.UnauthenticatedAttributes[i];
- string oid = ASN1Convert.ToOid (attr[0]);
- switch (oid) {
- case PKCS7.Oid.countersignature:
- // SEQUENCE {
- // OBJECT IDENTIFIER
- // countersignature (1 2 840 113549 1 9 6)
- // SET {
- PKCS7.SignerInfo cs = new PKCS7.SignerInfo (attr[1]);
- trustedTimestampRoot = VerifyCounterSignature (cs, signature);
- break;
- default:
- // we don't support other unauthenticated attributes
- break;
- }
- }
- }
-
- return (trustedRoot && trustedTimestampRoot);
- }
-
- private bool VerifyCounterSignature (PKCS7.SignerInfo cs, byte[] signature)
- {
- // SEQUENCE {
- // INTEGER 1
- if (cs.Version != 1)
- return false;
- // SEQUENCE {
- // SEQUENCE {
-
- string contentType = null;
- ASN1 messageDigest = null;
- for (int i=0; i < cs.AuthenticatedAttributes.Count; i++) {
- // SEQUENCE {
- // OBJECT IDENTIFIER
- ASN1 attr = (ASN1) cs.AuthenticatedAttributes [i];
- string oid = ASN1Convert.ToOid (attr[0]);
- switch (oid) {
- case "1.2.840.113549.1.9.3":
- // contentType
- contentType = ASN1Convert.ToOid (attr[1][0]);
- break;
- case "1.2.840.113549.1.9.4":
- // messageDigest
- messageDigest = attr[1][0];
- break;
- case "1.2.840.113549.1.9.5":
- // SEQUENCE {
- // OBJECT IDENTIFIER
- // signingTime (1 2 840 113549 1 9 5)
- // SET {
- // UTCTime '030124013651Z'
- // }
- // }
- timestamp = ASN1Convert.ToDateTime (attr[1][0]);
- break;
- default:
- break;
- }
- }
-
- if (contentType != PKCS7.Oid.data)
- return false;
-
- // verify message digest
- if (messageDigest == null)
- return false;
- // TODO: must be read from the ASN.1 structure
- string hashName = null;
- switch (messageDigest.Length) {
- case 16:
- hashName = "MD5";
- break;
- case 20:
- hashName = "SHA1";
- break;
- }
- HashAlgorithm ha = HashAlgorithm.Create (hashName);
- if (!messageDigest.CompareValue (ha.ComputeHash (signature)))
- return false;
-
- // verify signature
- byte[] counterSignature = cs.Signature;
-
- // change to SET OF (not [0]) as per PKCS #7 1.5
- ASN1 aa = new ASN1 (0x31);
- foreach (ASN1 a in cs.AuthenticatedAttributes)
- aa.Add (a);
- byte[] p7hash = ha.ComputeHash (aa.GetBytes ());
-
- // we need to try all certificates
- string issuer = cs.IssuerName;
- byte[] serial = cs.SerialNumber;
- foreach (X509Certificate x509 in coll) {
- if (CompareIssuerSerial (issuer, serial, x509)) {
- if (x509.PublicKey.Length > counterSignature.Length) {
- RSACryptoServiceProvider rsa = (RSACryptoServiceProvider) x509.RSA;
- // we need to HACK around bad (PKCS#1 1.5) signatures made by Verisign Timestamp Service
- // and this means copying stuff into our own RSAManaged to get the required flexibility
- RSAManaged rsam = new RSAManaged ();
- rsam.ImportParameters (rsa.ExportParameters (false));
- if (PKCS1.Verify_v15 (rsam, ha, p7hash, counterSignature, true)) {
- timestampChain.LoadCertificates (coll);
- return (timestampChain.Build (x509));
- }
- }
- }
- }
- // no certificate can verify this signature!
- return false;
- }
-
- private void Reset ()
- {
- filename = null;
- entry = null;
- hash = null;
- signedHash = null;
- signingCertificate = null;
- reason = -1;
- trustedRoot = false;
- trustedTimestampRoot = false;
- signerChain.Reset ();
- timestampChain.Reset ();
- timestamp = DateTime.MinValue;
- }
- }
-}
+++ /dev/null
-2010-03-16 Jb Evain <jbevain@novell.com>
-
- * AuthenticodeBase.cs, AuthenticodeDeformatter.cs: use MOONLIGHT
- symbol to disambiguate MonoTouch and Moonlight code.
-
-2009-04-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeBase.cs, AuthenticodeDeformatter.cs: Remove from NET_2_1
-
-2008-01-10 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeDeformatter.cs: Use RSAManaged and the new overloaded
- PKCS1.Verify_v15 with tryNonStandardEncoding == true when verifying
- timestamping certificate signatures. Fix for #350958
-
-2007-04-26 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeBase.cs: Synch with latest Mono.Security version
- * AuthenticodeDeformatter.cs: Synch with latest Mono.Security version
-
-2006-11-08 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeDeformatter.cs: Return (find) the SigningCertificate
- even if the signature isn't verifiable. This is the behaviour required
- for 2.0.
-
-2006-06-14 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeBase.cs: Fix destination offset. Note that this works
- under MS but not under Mono.
- * AuthenticodeDeformatter.cs: Report a more useful error if the file
- hash doesn't match the signed hash.
-
-2005-03-24 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeDeformatter.cs: Don't hide the SecurityException (e.g.
- file access).
-
-2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeDeformatter.cs: Fixed warning (l4) for unused variables.
-
-2004-09-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeBase.cs: Merge from Mono.Security.dll. This version is
- less memory consuming (it works by 4kb blocks instead of loading the
- entire assembly).
- * AuthenticodeDeformatter.cs: Merge from Mono.Security.dll. Hash will
- only be created if the assembly is signed. Benefits from Authenticode
- Base changes.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * AuthenticodeBase.cs: In sync with Mono.Security.dll version.
- * AuthenticodeDeformatter.cs: In sync with Mono.Security.dll version.
-
-2004-04-08 Bernie Solomon <bernard@ugsolutions.com>
-
- * AuthenticodeBase.cs: Use BitConverterLE
-
-2003-12-15 Sebastien Pouliot <spouliot@videotron.ca>
-
- * AuthenticodeDeformatter.cs: Now throw a COMException for invalid
- signature. Added a SigningCertificate property (to be independant of
- the certificate collection ordering).
-
-2003-10-12 Sebastien Pouliot <spouliot@videotron.ca>
-
- * AuthenticodeBase.cs: Added from Mono.Security assembly for
- Authenticode support in X509Certificate.CreateFromSignedFile
- * AuthenticodeDeformatter.cs: Added from Mono.Security assembly for
- Authenticode support in X509Certificate.CreateFromSignedFile
+++ /dev/null
-//
-// CryptoConvert.cs - Crypto Convertion Routines
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace Mono.Security.Cryptography {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class CryptoConvert {
-
- private CryptoConvert ()
- {
- }
-
- static private int ToInt32LE (byte [] bytes, int offset)
- {
- return (bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset];
- }
-
- static private uint ToUInt32LE (byte [] bytes, int offset)
- {
- return (uint)((bytes [offset+3] << 24) | (bytes [offset+2] << 16) | (bytes [offset+1] << 8) | bytes [offset]);
- }
-
- static private byte [] GetBytesLE (int val)
- {
- return new byte [] {
- (byte) (val & 0xff),
- (byte) ((val >> 8) & 0xff),
- (byte) ((val >> 16) & 0xff),
- (byte) ((val >> 24) & 0xff)
- };
- }
-
- static private byte[] Trim (byte[] array)
- {
- for (int i=0; i < array.Length; i++) {
- if (array [i] != 0x00) {
- byte[] result = new byte [array.Length - i];
- Buffer.BlockCopy (array, i, result, 0, result.Length);
- return result;
- }
- }
- return null;
- }
-
- // convert the key from PRIVATEKEYBLOB to RSA
- // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/security/Security/private_key_blobs.asp
- // e.g. SNK files, PVK files
- static public RSA FromCapiPrivateKeyBlob (byte[] blob)
- {
- return FromCapiPrivateKeyBlob (blob, 0);
- }
-
- static public RSA FromCapiPrivateKeyBlob (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- RSAParameters rsap = new RSAParameters ();
- try {
- if ((blob [offset] != 0x07) || // PRIVATEKEYBLOB (0x07)
- (blob [offset+1] != 0x02) || // Version (0x02)
- (blob [offset+2] != 0x00) || // Reserved (word)
- (blob [offset+3] != 0x00) ||
- (ToUInt32LE (blob, offset+8) != 0x32415352)) // DWORD magic = RSA2
- throw new CryptographicException ("Invalid blob header");
-
- // ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
- // int algId = ToInt32LE (blob, offset+4);
-
- // DWORD bitlen
- int bitLen = ToInt32LE (blob, offset+12);
-
- // DWORD public exponent
- byte[] exp = new byte [4];
- Buffer.BlockCopy (blob, offset+16, exp, 0, 4);
- Array.Reverse (exp);
- rsap.Exponent = Trim (exp);
-
- int pos = offset+20;
- // BYTE modulus[rsapubkey.bitlen/8];
- int byteLen = (bitLen >> 3);
- rsap.Modulus = new byte [byteLen];
- Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
- Array.Reverse (rsap.Modulus);
- pos += byteLen;
-
- // BYTE prime1[rsapubkey.bitlen/16];
- int byteHalfLen = (byteLen >> 1);
- rsap.P = new byte [byteHalfLen];
- Buffer.BlockCopy (blob, pos, rsap.P, 0, byteHalfLen);
- Array.Reverse (rsap.P);
- pos += byteHalfLen;
-
- // BYTE prime2[rsapubkey.bitlen/16];
- rsap.Q = new byte [byteHalfLen];
- Buffer.BlockCopy (blob, pos, rsap.Q, 0, byteHalfLen);
- Array.Reverse (rsap.Q);
- pos += byteHalfLen;
-
- // BYTE exponent1[rsapubkey.bitlen/16];
- rsap.DP = new byte [byteHalfLen];
- Buffer.BlockCopy (blob, pos, rsap.DP, 0, byteHalfLen);
- Array.Reverse (rsap.DP);
- pos += byteHalfLen;
-
- // BYTE exponent2[rsapubkey.bitlen/16];
- rsap.DQ = new byte [byteHalfLen];
- Buffer.BlockCopy (blob, pos, rsap.DQ, 0, byteHalfLen);
- Array.Reverse (rsap.DQ);
- pos += byteHalfLen;
-
- // BYTE coefficient[rsapubkey.bitlen/16];
- rsap.InverseQ = new byte [byteHalfLen];
- Buffer.BlockCopy (blob, pos, rsap.InverseQ, 0, byteHalfLen);
- Array.Reverse (rsap.InverseQ);
- pos += byteHalfLen;
-
- // ok, this is hackish but CryptoAPI support it so...
- // note: only works because CRT is used by default
- // http://bugzilla.ximian.com/show_bug.cgi?id=57941
- rsap.D = new byte [byteLen]; // must be allocated
- if (pos + byteLen + offset <= blob.Length) {
- // BYTE privateExponent[rsapubkey.bitlen/8];
- Buffer.BlockCopy (blob, pos, rsap.D, 0, byteLen);
- Array.Reverse (rsap.D);
- }
- }
- catch (Exception e) {
- throw new CryptographicException ("Invalid blob.", e);
- }
-
-#if NET_2_1
- RSA rsa = RSA.Create ();
- rsa.ImportParameters (rsap);
-#else
- RSA rsa = null;
- try {
- rsa = RSA.Create ();
- rsa.ImportParameters (rsap);
- }
- catch (CryptographicException ce) {
- // this may cause problem when this code is run under
- // the SYSTEM identity on Windows (e.g. ASP.NET). See
- // http://bugzilla.ximian.com/show_bug.cgi?id=77559
- try {
- CspParameters csp = new CspParameters ();
- csp.Flags = CspProviderFlags.UseMachineKeyStore;
- rsa = new RSACryptoServiceProvider (csp);
- rsa.ImportParameters (rsap);
- }
- catch {
- // rethrow original, not the later, exception if this fails
- throw ce;
- }
- }
-#endif
- return rsa;
- }
-
- static public DSA FromCapiPrivateKeyBlobDSA (byte[] blob)
- {
- return FromCapiPrivateKeyBlobDSA (blob, 0);
- }
-
- static public DSA FromCapiPrivateKeyBlobDSA (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- DSAParameters dsap = new DSAParameters ();
- try {
- if ((blob [offset] != 0x07) || // PRIVATEKEYBLOB (0x07)
- (blob [offset + 1] != 0x02) || // Version (0x02)
- (blob [offset + 2] != 0x00) || // Reserved (word)
- (blob [offset + 3] != 0x00) ||
- (ToUInt32LE (blob, offset + 8) != 0x32535344)) // DWORD magic
- throw new CryptographicException ("Invalid blob header");
-
- int bitlen = ToInt32LE (blob, offset + 12);
- int bytelen = bitlen >> 3;
- int pos = offset + 16;
-
- dsap.P = new byte [bytelen];
- Buffer.BlockCopy (blob, pos, dsap.P, 0, bytelen);
- Array.Reverse (dsap.P);
- pos += bytelen;
-
- dsap.Q = new byte [20];
- Buffer.BlockCopy (blob, pos, dsap.Q, 0, 20);
- Array.Reverse (dsap.Q);
- pos += 20;
-
- dsap.G = new byte [bytelen];
- Buffer.BlockCopy (blob, pos, dsap.G, 0, bytelen);
- Array.Reverse (dsap.G);
- pos += bytelen;
-
- dsap.X = new byte [20];
- Buffer.BlockCopy (blob, pos, dsap.X, 0, 20);
- Array.Reverse (dsap.X);
- pos += 20;
-
- dsap.Counter = ToInt32LE (blob, pos);
- pos += 4;
-
- dsap.Seed = new byte [20];
- Buffer.BlockCopy (blob, pos, dsap.Seed, 0, 20);
- Array.Reverse (dsap.Seed);
- pos += 20;
- }
- catch (Exception e) {
- throw new CryptographicException ("Invalid blob.", e);
- }
-
-#if NET_2_1
- DSA dsa = (DSA)DSA.Create ();
- dsa.ImportParameters (dsap);
-#else
- DSA dsa = null;
- try {
- dsa = (DSA)DSA.Create ();
- dsa.ImportParameters (dsap);
- }
- catch (CryptographicException ce) {
- // this may cause problem when this code is run under
- // the SYSTEM identity on Windows (e.g. ASP.NET). See
- // http://bugzilla.ximian.com/show_bug.cgi?id=77559
- try {
- CspParameters csp = new CspParameters ();
- csp.Flags = CspProviderFlags.UseMachineKeyStore;
- dsa = new DSACryptoServiceProvider (csp);
- dsa.ImportParameters (dsap);
- }
- catch {
- // rethrow original, not the later, exception if this fails
- throw ce;
- }
- }
-#endif
- return dsa;
- }
-
- static public byte[] ToCapiPrivateKeyBlob (RSA rsa)
- {
- RSAParameters p = rsa.ExportParameters (true);
- int keyLength = p.Modulus.Length; // in bytes
- byte[] blob = new byte [20 + (keyLength << 2) + (keyLength >> 1)];
-
- blob [0] = 0x07; // Type - PRIVATEKEYBLOB (0x07)
- blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
- // [2], [3] // RESERVED - Always 0
- blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
- blob [8] = 0x52; // Magic - RSA2 (ASCII in hex)
- blob [9] = 0x53;
- blob [10] = 0x41;
- blob [11] = 0x32;
-
- byte[] bitlen = GetBytesLE (keyLength << 3);
- blob [12] = bitlen [0]; // bitlen
- blob [13] = bitlen [1];
- blob [14] = bitlen [2];
- blob [15] = bitlen [3];
-
- // public exponent (DWORD)
- int pos = 16;
- int n = p.Exponent.Length;
- while (n > 0)
- blob [pos++] = p.Exponent [--n];
- // modulus
- pos = 20;
- byte[] part = p.Modulus;
- int len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
- // private key
- part = p.P;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
-
- part = p.Q;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
-
- part = p.DP;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
-
- part = p.DQ;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
-
- part = p.InverseQ;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
-
- part = p.D;
- len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
-
- return blob;
- }
-
- static public byte[] ToCapiPrivateKeyBlob (DSA dsa)
- {
- DSAParameters p = dsa.ExportParameters (true);
- int keyLength = p.P.Length; // in bytes
-
- // header + P + Q + G + X + count + seed
- byte[] blob = new byte [16 + keyLength + 20 + keyLength + 20 + 4 + 20];
-
- blob [0] = 0x07; // Type - PRIVATEKEYBLOB (0x07)
- blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
- // [2], [3] // RESERVED - Always 0
- blob [5] = 0x22; // ALGID
- blob [8] = 0x44; // Magic
- blob [9] = 0x53;
- blob [10] = 0x53;
- blob [11] = 0x32;
-
- byte[] bitlen = GetBytesLE (keyLength << 3);
- blob [12] = bitlen [0];
- blob [13] = bitlen [1];
- blob [14] = bitlen [2];
- blob [15] = bitlen [3];
-
- int pos = 16;
- byte[] part = p.P;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, keyLength);
- pos += keyLength;
-
- part = p.Q;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, 20);
- pos += 20;
-
- part = p.G;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, keyLength);
- pos += keyLength;
-
- part = p.X;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, 20);
- pos += 20;
-
- Buffer.BlockCopy (GetBytesLE (p.Counter), 0, blob, pos, 4);
- pos += 4;
-
- part = p.Seed;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, 20);
-
- return blob;
- }
-
- static public RSA FromCapiPublicKeyBlob (byte[] blob)
- {
- return FromCapiPublicKeyBlob (blob, 0);
- }
-
- static public RSA FromCapiPublicKeyBlob (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- try {
- if ((blob [offset] != 0x06) || // PUBLICKEYBLOB (0x06)
- (blob [offset+1] != 0x02) || // Version (0x02)
- (blob [offset+2] != 0x00) || // Reserved (word)
- (blob [offset+3] != 0x00) ||
- (ToUInt32LE (blob, offset+8) != 0x31415352)) // DWORD magic = RSA1
- throw new CryptographicException ("Invalid blob header");
-
- // ALGID (CALG_RSA_SIGN, CALG_RSA_KEYX, ...)
- // int algId = ToInt32LE (blob, offset+4);
-
- // DWORD bitlen
- int bitLen = ToInt32LE (blob, offset+12);
-
- // DWORD public exponent
- RSAParameters rsap = new RSAParameters ();
- rsap.Exponent = new byte [3];
- rsap.Exponent [0] = blob [offset+18];
- rsap.Exponent [1] = blob [offset+17];
- rsap.Exponent [2] = blob [offset+16];
-
- int pos = offset+20;
- // BYTE modulus[rsapubkey.bitlen/8];
- int byteLen = (bitLen >> 3);
- rsap.Modulus = new byte [byteLen];
- Buffer.BlockCopy (blob, pos, rsap.Modulus, 0, byteLen);
- Array.Reverse (rsap.Modulus);
-#if NET_2_1
- RSA rsa = RSA.Create ();
- rsa.ImportParameters (rsap);
-#else
- RSA rsa = null;
- try {
- rsa = RSA.Create ();
- rsa.ImportParameters (rsap);
- }
- catch (CryptographicException) {
- // this may cause problem when this code is run under
- // the SYSTEM identity on Windows (e.g. ASP.NET). See
- // http://bugzilla.ximian.com/show_bug.cgi?id=77559
- CspParameters csp = new CspParameters ();
- csp.Flags = CspProviderFlags.UseMachineKeyStore;
- rsa = new RSACryptoServiceProvider (csp);
- rsa.ImportParameters (rsap);
- }
-#endif
- return rsa;
- }
- catch (Exception e) {
- throw new CryptographicException ("Invalid blob.", e);
- }
- }
-
- static public DSA FromCapiPublicKeyBlobDSA (byte[] blob)
- {
- return FromCapiPublicKeyBlobDSA (blob, 0);
- }
-
- static public DSA FromCapiPublicKeyBlobDSA (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- try {
- if ((blob [offset] != 0x06) || // PUBLICKEYBLOB (0x06)
- (blob [offset + 1] != 0x02) || // Version (0x02)
- (blob [offset + 2] != 0x00) || // Reserved (word)
- (blob [offset + 3] != 0x00) ||
- (ToUInt32LE (blob, offset + 8) != 0x31535344)) // DWORD magic
- throw new CryptographicException ("Invalid blob header");
-
- int bitlen = ToInt32LE (blob, offset + 12);
- DSAParameters dsap = new DSAParameters ();
- int bytelen = bitlen >> 3;
- int pos = offset + 16;
-
- dsap.P = new byte [bytelen];
- Buffer.BlockCopy (blob, pos, dsap.P, 0, bytelen);
- Array.Reverse (dsap.P);
- pos += bytelen;
-
- dsap.Q = new byte [20];
- Buffer.BlockCopy (blob, pos, dsap.Q, 0, 20);
- Array.Reverse (dsap.Q);
- pos += 20;
-
- dsap.G = new byte [bytelen];
- Buffer.BlockCopy (blob, pos, dsap.G, 0, bytelen);
- Array.Reverse (dsap.G);
- pos += bytelen;
-
- dsap.Y = new byte [bytelen];
- Buffer.BlockCopy (blob, pos, dsap.Y, 0, bytelen);
- Array.Reverse (dsap.Y);
- pos += bytelen;
-
- dsap.Counter = ToInt32LE (blob, pos);
- pos += 4;
-
- dsap.Seed = new byte [20];
- Buffer.BlockCopy (blob, pos, dsap.Seed, 0, 20);
- Array.Reverse (dsap.Seed);
- pos += 20;
-
- DSA dsa = (DSA)DSA.Create ();
- dsa.ImportParameters (dsap);
- return dsa;
- }
- catch (Exception e) {
- throw new CryptographicException ("Invalid blob.", e);
- }
- }
-
- static public byte[] ToCapiPublicKeyBlob (RSA rsa)
- {
- RSAParameters p = rsa.ExportParameters (false);
- int keyLength = p.Modulus.Length; // in bytes
- byte[] blob = new byte [20 + keyLength];
-
- blob [0] = 0x06; // Type - PUBLICKEYBLOB (0x06)
- blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
- // [2], [3] // RESERVED - Always 0
- blob [5] = 0x24; // ALGID - Always 00 24 00 00 (for CALG_RSA_SIGN)
- blob [8] = 0x52; // Magic - RSA1 (ASCII in hex)
- blob [9] = 0x53;
- blob [10] = 0x41;
- blob [11] = 0x31;
-
- byte[] bitlen = GetBytesLE (keyLength << 3);
- blob [12] = bitlen [0]; // bitlen
- blob [13] = bitlen [1];
- blob [14] = bitlen [2];
- blob [15] = bitlen [3];
-
- // public exponent (DWORD)
- int pos = 16;
- int n = p.Exponent.Length;
- while (n > 0)
- blob [pos++] = p.Exponent [--n];
- // modulus
- pos = 20;
- byte[] part = p.Modulus;
- int len = part.Length;
- Array.Reverse (part, 0, len);
- Buffer.BlockCopy (part, 0, blob, pos, len);
- pos += len;
- return blob;
- }
-
- static public byte[] ToCapiPublicKeyBlob (DSA dsa)
- {
- DSAParameters p = dsa.ExportParameters (false);
- int keyLength = p.P.Length; // in bytes
-
- // header + P + Q + G + Y + count + seed
- byte[] blob = new byte [16 + keyLength + 20 + keyLength + keyLength + 4 + 20];
-
- blob [0] = 0x06; // Type - PUBLICKEYBLOB (0x06)
- blob [1] = 0x02; // Version - Always CUR_BLOB_VERSION (0x02)
- // [2], [3] // RESERVED - Always 0
- blob [5] = 0x22; // ALGID
- blob [8] = 0x44; // Magic
- blob [9] = 0x53;
- blob [10] = 0x53;
- blob [11] = 0x31;
-
- byte[] bitlen = GetBytesLE (keyLength << 3);
- blob [12] = bitlen [0];
- blob [13] = bitlen [1];
- blob [14] = bitlen [2];
- blob [15] = bitlen [3];
-
- int pos = 16;
- byte[] part;
-
- part = p.P;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, keyLength);
- pos += keyLength;
-
- part = p.Q;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, 20);
- pos += 20;
-
- part = p.G;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, keyLength);
- pos += keyLength;
-
- part = p.Y;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, keyLength);
- pos += keyLength;
-
- Buffer.BlockCopy (GetBytesLE (p.Counter), 0, blob, pos, 4);
- pos += 4;
-
- part = p.Seed;
- Array.Reverse (part);
- Buffer.BlockCopy (part, 0, blob, pos, 20);
-
- return blob;
- }
-
- // PRIVATEKEYBLOB
- // PUBLICKEYBLOB
- static public RSA FromCapiKeyBlob (byte[] blob)
- {
- return FromCapiKeyBlob (blob, 0);
- }
-
- static public RSA FromCapiKeyBlob (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- switch (blob [offset]) {
- case 0x00:
- // this could be a public key inside an header
- // like "sn -e" would produce
- if (blob [offset + 12] == 0x06) {
- return FromCapiPublicKeyBlob (blob, offset + 12);
- }
- break;
- case 0x06:
- return FromCapiPublicKeyBlob (blob, offset);
- case 0x07:
- return FromCapiPrivateKeyBlob (blob, offset);
- }
- throw new CryptographicException ("Unknown blob format.");
- }
-
- static public DSA FromCapiKeyBlobDSA (byte[] blob)
- {
- return FromCapiKeyBlobDSA (blob, 0);
- }
-
- static public DSA FromCapiKeyBlobDSA (byte[] blob, int offset)
- {
- if (blob == null)
- throw new ArgumentNullException ("blob");
- if (offset >= blob.Length)
- throw new ArgumentException ("blob is too small.");
-
- switch (blob [offset]) {
- case 0x06:
- return FromCapiPublicKeyBlobDSA (blob, offset);
- case 0x07:
- return FromCapiPrivateKeyBlobDSA (blob, offset);
- }
- throw new CryptographicException ("Unknown blob format.");
- }
-
- static public byte[] ToCapiKeyBlob (AsymmetricAlgorithm keypair, bool includePrivateKey)
- {
- if (keypair == null)
- throw new ArgumentNullException ("keypair");
-
- // check between RSA and DSA (and potentially others like DH)
- if (keypair is RSA)
- return ToCapiKeyBlob ((RSA)keypair, includePrivateKey);
- else if (keypair is DSA)
- return ToCapiKeyBlob ((DSA)keypair, includePrivateKey);
- else
- return null; // TODO
- }
-
- static public byte[] ToCapiKeyBlob (RSA rsa, bool includePrivateKey)
- {
- if (rsa == null)
- throw new ArgumentNullException ("rsa");
-
- if (includePrivateKey)
- return ToCapiPrivateKeyBlob (rsa);
- else
- return ToCapiPublicKeyBlob (rsa);
- }
-
- static public byte[] ToCapiKeyBlob (DSA dsa, bool includePrivateKey)
- {
- if (dsa == null)
- throw new ArgumentNullException ("dsa");
-
- if (includePrivateKey)
- return ToCapiPrivateKeyBlob (dsa);
- else
- return ToCapiPublicKeyBlob (dsa);
- }
-
- static public string ToHex (byte[] input)
- {
- if (input == null)
- return null;
-
- StringBuilder sb = new StringBuilder (input.Length * 2);
- foreach (byte b in input) {
- sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture));
- }
- return sb.ToString ();
- }
-
- static private byte FromHexChar (char c)
- {
- if ((c >= 'a') && (c <= 'f'))
- return (byte) (c - 'a' + 10);
- if ((c >= 'A') && (c <= 'F'))
- return (byte) (c - 'A' + 10);
- if ((c >= '0') && (c <= '9'))
- return (byte) (c - '0');
- throw new ArgumentException ("invalid hex char");
- }
-
- static public byte[] FromHex (string hex)
- {
- if (hex == null)
- return null;
- if ((hex.Length & 0x1) == 0x1)
- throw new ArgumentException ("Length must be a multiple of 2");
-
- byte[] result = new byte [hex.Length >> 1];
- int n = 0;
- int i = 0;
- while (n < result.Length) {
- result [n] = (byte) (FromHexChar (hex [i++]) << 4);
- result [n++] += FromHexChar (hex [i++]);
- }
- return result;
- }
- }
-}
+++ /dev/null
-//
-// Mono.Security.Cryptography.CryptoTools
-// Shared class for common cryptographic functionalities
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004, 2008 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.Security.Cryptography;
-
-namespace Mono.Security.Cryptography {
-
-#if INSIDE_CORLIB || INSIDE_SYSCORE
- internal
-#else
- public
-#endif
- sealed class KeyBuilder {
-
- static private RandomNumberGenerator rng;
-
- private KeyBuilder ()
- {
- }
-
- static RandomNumberGenerator Rng {
- get {
- if (rng == null)
- rng = RandomNumberGenerator.Create ();
- return rng;
- }
- }
-
- static public byte[] Key (int size)
- {
- byte[] key = new byte [size];
- Rng.GetBytes (key);
- return key;
- }
-
- static public byte[] IV (int size)
- {
- byte[] iv = new byte [size];
- Rng.GetBytes (iv);
- return iv;
- }
- }
-
- // Process an array as a sequence of blocks
-#if INSIDE_CORLIB || INSIDE_SYSCORE
- internal
-#else
- public
-#endif
- class BlockProcessor {
- private ICryptoTransform transform;
- private byte[] block;
- private int blockSize; // in bytes (not in bits)
- private int blockCount;
-
- public BlockProcessor (ICryptoTransform transform)
- : this (transform, transform.InputBlockSize) {}
-
- // some Transforms (like HashAlgorithm descendant) return 1 for
- // block size (which isn't their real internal block size)
- public BlockProcessor (ICryptoTransform transform, int blockSize)
- {
- this.transform = transform;
- this.blockSize = blockSize;
- block = new byte [blockSize];
- }
-
- ~BlockProcessor ()
- {
- // zeroize our block (so we don't retain any information)
- Array.Clear (block, 0, blockSize);
- }
-
- public void Initialize ()
- {
- Array.Clear (block, 0, blockSize);
- blockCount = 0;
- }
-
- public void Core (byte[] rgb)
- {
- Core (rgb, 0, rgb.Length);
- }
-
- public void Core (byte[] rgb, int ib, int cb)
- {
- // 1. fill the rest of the "block"
- int n = System.Math.Min (blockSize - blockCount, cb);
- Buffer.BlockCopy (rgb, ib, block, blockCount, n);
- blockCount += n;
-
- // 2. if block is full then transform it
- if (blockCount == blockSize) {
- transform.TransformBlock (block, 0, blockSize, block, 0);
-
- // 3. transform any other full block in specified buffer
- int b = (int) ((cb - n) / blockSize);
- for (int i=0; i < b; i++) {
- transform.TransformBlock (rgb, n + ib, blockSize, block, 0);
- n += blockSize;
- }
-
- // 4. if data is still present fill the "block" with the remainder
- blockCount = cb - n;
- if (blockCount > 0)
- Buffer.BlockCopy (rgb, n + ib, block, 0, blockCount);
- }
- }
-
- public byte[] Final ()
- {
- return transform.TransformFinalBlock (block, 0, blockCount);
- }
- }
-}
+++ /dev/null
-//
-// KeyPairPersistence.cs: Keypair persistence
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Copyright (C) 2004 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.Globalization;
-using System.IO;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-using System.Security;
-using System.Security.Cryptography;
-using System.Security.Permissions;
-using System.Text;
-
-using Mono.Xml;
-
-namespace Mono.Security.Cryptography {
-
- /* File name
- * [type][unique name][key number].xml
- *
- * where
- * type CspParameters.ProviderType
- * unique name A unique name for the keypair, which is
- * a. default (for a provider default keypair)
- * b. a GUID derived from
- * i. random if no container name was
- * specified at generation time
- * ii. the MD5 hash of the container
- * name (CspParameters.KeyContainerName)
- * key number CspParameters.KeyNumber
- *
- * File format
- * <KeyPair>
- * <Properties>
- * <Provider Name="" Type=""/>
- * <Container Name=""/>
- * </Properties>
- * <KeyValue Id="">
- * RSAKeyValue, DSAKeyValue ...
- * </KeyValue>
- * </KeyPair>
- */
-
- /* NOTES
- *
- * - There's NO confidentiality / integrity built in this
- * persistance mechanism. The container directories (both user and
- * machine) are created with restrited ACL. The ACL is also checked
- * when a key is accessed (so totally public keys won't be used).
- * see /mono/mono/metadata/security.c for implementation
- *
- * - As we do not use CSP we limit ourselves to provider types (not
- * names). This means that for a same type and container type, but
- * two different provider names) will return the same keypair. This
- * should work as CspParameters always requires a csp type in its
- * constructors.
- *
- * - Assert (CAS) are used so only the OS permission will limit access
- * to the keypair files. I.e. this will work even in high-security
- * scenarios where users do not have access to file system (e.g. web
- * application). We can allow this because the filename used is
- * TOTALLY under our control (no direct user input is used).
- *
- * - You CAN'T changes properties of the keypair once it's been
- * created (saved). You must remove the container than save it
- * back. This is the same behaviour as CSP under Windows.
- */
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class KeyPairPersistence {
-
- private static bool _userPathExists; // check at 1st use
- private static string _userPath;
-
- private static bool _machinePathExists; // check at 1st use
- private static string _machinePath;
-
- private CspParameters _params;
- private string _keyvalue;
- private string _filename;
- private string _container;
-
- // constructors
-
- public KeyPairPersistence (CspParameters parameters)
- : this (parameters, null)
- {
- }
-
- public KeyPairPersistence (CspParameters parameters, string keyPair)
- {
- if (parameters == null)
- throw new ArgumentNullException ("parameters");
-
- _params = Copy (parameters);
- _keyvalue = keyPair;
- }
-
- // properties
-
- public string Filename {
- get {
- if (_filename == null) {
- _filename = String.Format (CultureInfo.InvariantCulture,
- "[{0}][{1}][{2}].xml",
- _params.ProviderType,
- this.ContainerName,
- _params.KeyNumber);
- if (UseMachineKeyStore)
- _filename = Path.Combine (MachinePath, _filename);
- else
- _filename = Path.Combine (UserPath, _filename);
- }
- return _filename;
- }
- }
-
- public string KeyValue {
- get { return _keyvalue; }
- set {
- if (this.CanChange)
- _keyvalue = value;
- }
- }
-
- // return a (read-only) copy
- public CspParameters Parameters {
- get { return Copy (_params); }
- }
-
- // methods
-
- public bool Load ()
- {
- // see NOTES
-// FIXME new FileIOPermission (FileIOPermissionAccess.Read, this.Filename).Assert ();
-
- bool result = File.Exists (this.Filename);
- if (result) {
- using (StreamReader sr = File.OpenText (this.Filename)) {
- FromXml (sr.ReadToEnd ());
- }
- }
- return result;
- }
-
- public void Save ()
- {
- // see NOTES
-// FIXME new FileIOPermission (FileIOPermissionAccess.Write, this.Filename).Assert ();
-
- using (FileStream fs = File.Open (this.Filename, FileMode.Create)) {
- StreamWriter sw = new StreamWriter (fs, Encoding.UTF8);
- sw.Write (this.ToXml ());
- sw.Close ();
- }
- // apply protection to newly created files
- if (UseMachineKeyStore)
- ProtectMachine (Filename);
- else
- ProtectUser (Filename);
- }
-
- public void Remove ()
- {
- // see NOTES
-// FIXME new FileIOPermission (FileIOPermissionAccess.Write, this.Filename).Assert ();
-
- File.Delete (this.Filename);
- // it's now possible to change the keypair un the container
- }
-
- // private static stuff
-
- static object lockobj = new object ();
-
- private static string UserPath {
- get {
- lock (lockobj) {
- if ((_userPath == null) || (!_userPathExists)) {
- _userPath = Path.Combine (
- Environment.GetFolderPath (Environment.SpecialFolder.ApplicationData),
- ".mono");
- _userPath = Path.Combine (_userPath, "keypairs");
-
- _userPathExists = Directory.Exists (_userPath);
- if (!_userPathExists) {
- try {
- Directory.CreateDirectory (_userPath);
- ProtectUser (_userPath);
- _userPathExists = true;
- }
- catch (Exception e) {
- string msg = Locale.GetText ("Could not create user key store '{0}'.");
- throw new CryptographicException (String.Format (msg, _userPath), e);
- }
- }
- }
- }
- // is it properly protected ?
- if (!IsUserProtected (_userPath)) {
- string msg = Locale.GetText ("Improperly protected user's key pairs in '{0}'.");
- throw new CryptographicException (String.Format (msg, _userPath));
- }
- return _userPath;
- }
- }
-
- private static string MachinePath {
- get {
- lock (lockobj) {
- if ((_machinePath == null) || (!_machinePathExists)) {
- _machinePath = Path.Combine (
- Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData),
- ".mono");
- _machinePath = Path.Combine (_machinePath, "keypairs");
-
- _machinePathExists = Directory.Exists (_machinePath);
- if (!_machinePathExists) {
- try {
- Directory.CreateDirectory (_machinePath);
- ProtectMachine (_machinePath);
- _machinePathExists = true;
- }
- catch (Exception e) {
- string msg = Locale.GetText ("Could not create machine key store '{0}'.");
- throw new CryptographicException (String.Format (msg, _machinePath), e);
- }
- }
- }
- }
- // is it properly protected ?
- if (!IsMachineProtected (_machinePath)) {
- string msg = Locale.GetText ("Improperly protected machine's key pairs in '{0}'.");
- throw new CryptographicException (String.Format (msg, _machinePath));
- }
- return _machinePath;
- }
- }
-
-#if INSIDE_CORLIB
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal static extern bool _CanSecure (string root);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal static extern bool _ProtectUser (string path);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal static extern bool _ProtectMachine (string path);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal static extern bool _IsUserProtected (string path);
-
- [MethodImplAttribute (MethodImplOptions.InternalCall)]
- internal static extern bool _IsMachineProtected (string path);
-#else
- // Mono.Security.dll assembly can't use the internal
- // call (and still run with other runtimes)
-
- // Note: Class is only available in Mono.Security.dll as
- // a management helper (e.g. build a GUI app)
-
- internal static bool _CanSecure (string root)
- {
- return true;
- }
-
- internal static bool _ProtectUser (string path)
- {
- return true;
- }
-
- internal static bool _ProtectMachine (string path)
- {
- return true;
- }
-
- internal static bool _IsUserProtected (string path)
- {
- return true;
- }
-
- internal static bool _IsMachineProtected (string path)
- {
- return true;
- }
-#endif
- // private stuff
-
- private static bool CanSecure (string path)
- {
- // we assume POSIX filesystems can always be secured
-
- // check for Unix platforms - see FAQ for more details
- // http://www.mono-project.com/FAQ:_Technical#How_to_detect_the_execution_platform_.3F
- int platform = (int) Environment.OSVersion.Platform;
- if ((platform == 4) || (platform == 128) || (platform == 6))
- return true;
-
- // while we ask the runtime for Windows OS
- return _CanSecure (Path.GetPathRoot (path));
- }
-
- private static bool ProtectUser (string path)
- {
- // we cannot protect on some filsystem (like FAT)
- if (CanSecure (path)) {
- return _ProtectUser (path);
- }
- // but Mono still needs to run on them :(
- return true;
- }
-
- private static bool ProtectMachine (string path)
- {
- // we cannot protect on some filsystem (like FAT)
- if (CanSecure (path)) {
- return _ProtectMachine (path);
- }
- // but Mono still needs to run on them :(
- return true;
- }
-
- private static bool IsUserProtected (string path)
- {
- // we cannot protect on some filsystem (like FAT)
- if (CanSecure (path)) {
- return _IsUserProtected (path);
- }
- // but Mono still needs to run on them :(
- return true;
- }
-
- private static bool IsMachineProtected (string path)
- {
- // we cannot protect on some filsystem (like FAT)
- if (CanSecure (path)) {
- return _IsMachineProtected (path);
- }
- // but Mono still needs to run on them :(
- return true;
- }
-
- private bool CanChange {
- get { return (_keyvalue == null); }
- }
-
- private bool UseDefaultKeyContainer {
- get { return ((_params.Flags & CspProviderFlags.UseDefaultKeyContainer) == CspProviderFlags.UseDefaultKeyContainer); }
- }
-
- private bool UseMachineKeyStore {
- get { return ((_params.Flags & CspProviderFlags.UseMachineKeyStore) == CspProviderFlags.UseMachineKeyStore); }
- }
-
- private string ContainerName {
- get {
- if (_container == null) {
- if (UseDefaultKeyContainer) {
- // easy to spot
- _container = "default";
- }
- else if ((_params.KeyContainerName == null) || (_params.KeyContainerName.Length == 0)) {
- _container = Guid.NewGuid ().ToString ();
- }
- else {
- // we don't want to trust the key container name as we don't control it
- // anyway some characters may not be compatible with the file system
- byte[] data = Encoding.UTF8.GetBytes (_params.KeyContainerName);
- // Note: We use MD5 as it is faster than SHA1 and has the same length
- // as a GUID. Recent problems found in MD5 (like collisions) aren't a
- // problem in this case.
- MD5 hash = MD5.Create ();
- byte[] result = hash.ComputeHash (data);
- _container = new Guid (result).ToString ();
- }
- }
- return _container;
- }
- }
-
- // we do not want any changes after receiving the csp informations
- private CspParameters Copy (CspParameters p)
- {
- CspParameters copy = new CspParameters (p.ProviderType, p.ProviderName, p.KeyContainerName);
- copy.KeyNumber = p.KeyNumber;
- copy.Flags = p.Flags;
- return copy;
- }
-
- private void FromXml (string xml)
- {
- SecurityParser sp = new SecurityParser ();
- sp.LoadXml (xml);
-
- SecurityElement root = sp.ToXml ();
- if (root.Tag == "KeyPair") {
- //SecurityElement prop = root.SearchForChildByTag ("Properties");
- SecurityElement keyv = root.SearchForChildByTag ("KeyValue");
- if (keyv.Children.Count > 0)
- _keyvalue = keyv.Children [0].ToString ();
- // Note: we do not read other stuff because
- // it can't be changed after key creation
- }
- }
-
- private string ToXml ()
- {
- // note: we do not use SecurityElement here because the
- // keypair is a XML string (requiring parsing)
- StringBuilder xml = new StringBuilder ();
- xml.AppendFormat ("<KeyPair>{0}\t<Properties>{0}\t\t<Provider ", Environment.NewLine);
- if ((_params.ProviderName != null) && (_params.ProviderName.Length != 0)) {
- xml.AppendFormat ("Name=\"{0}\" ", _params.ProviderName);
- }
- xml.AppendFormat ("Type=\"{0}\" />{1}\t\t<Container ", _params.ProviderType, Environment.NewLine);
- xml.AppendFormat ("Name=\"{0}\" />{1}\t</Properties>{1}\t<KeyValue", this.ContainerName, Environment.NewLine);
- if (_params.KeyNumber != -1) {
- xml.AppendFormat (" Id=\"{0}\" ", _params.KeyNumber);
- }
- xml.AppendFormat (">{1}\t\t{0}{1}\t</KeyValue>{1}</KeyPair>{1}", this.KeyValue, Environment.NewLine);
- return xml.ToString ();
- }
- }
-}
+++ /dev/null
-//
-// PKCS1.cs - Implements PKCS#1 primitives.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 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.Security.Cryptography;
-
-namespace Mono.Security.Cryptography {
-
- // References:
- // a. PKCS#1: RSA Cryptography Standard
- // http://www.rsasecurity.com/rsalabs/pkcs/pkcs-1/index.html
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class PKCS1 {
-
- private PKCS1 ()
- {
- }
-
- private static bool Compare (byte[] array1, byte[] array2)
- {
- bool result = (array1.Length == array2.Length);
- if (result) {
- for (int i=0; i < array1.Length; i++)
- if (array1[i] != array2[i])
- return false;
- }
- return result;
- }
-
- private static byte[] xor (byte[] array1, byte[] array2)
- {
- byte[] result = new byte [array1.Length];
- for (int i=0; i < result.Length; i++)
- result[i] = (byte) (array1[i] ^ array2[i]);
- return result;
- }
-
- private static byte[] emptySHA1 = { 0xda, 0x39, 0xa3, 0xee, 0x5e, 0x6b, 0x4b, 0x0d, 0x32, 0x55, 0xbf, 0xef, 0x95, 0x60, 0x18, 0x90, 0xaf, 0xd8, 0x07, 0x09 };
- private static byte[] emptySHA256 = { 0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55 };
- private static byte[] emptySHA384 = { 0x38, 0xb0, 0x60, 0xa7, 0x51, 0xac, 0x96, 0x38, 0x4c, 0xd9, 0x32, 0x7e, 0xb1, 0xb1, 0xe3, 0x6a, 0x21, 0xfd, 0xb7, 0x11, 0x14, 0xbe, 0x07, 0x43, 0x4c, 0x0c, 0xc7, 0xbf, 0x63, 0xf6, 0xe1, 0xda, 0x27, 0x4e, 0xde, 0xbf, 0xe7, 0x6f, 0x65, 0xfb, 0xd5, 0x1a, 0xd2, 0xf1, 0x48, 0x98, 0xb9, 0x5b };
- private static byte[] emptySHA512 = { 0xcf, 0x83, 0xe1, 0x35, 0x7e, 0xef, 0xb8, 0xbd, 0xf1, 0x54, 0x28, 0x50, 0xd6, 0x6d, 0x80, 0x07, 0xd6, 0x20, 0xe4, 0x05, 0x0b, 0x57, 0x15, 0xdc, 0x83, 0xf4, 0xa9, 0x21, 0xd3, 0x6c, 0xe9, 0xce, 0x47, 0xd0, 0xd1, 0x3c, 0x5d, 0x85, 0xf2, 0xb0, 0xff, 0x83, 0x18, 0xd2, 0x87, 0x7e, 0xec, 0x2f, 0x63, 0xb9, 0x31, 0xbd, 0x47, 0x41, 0x7a, 0x81, 0xa5, 0x38, 0x32, 0x7a, 0xf9, 0x27, 0xda, 0x3e };
-
- private static byte[] GetEmptyHash (HashAlgorithm hash)
- {
- if (hash is SHA1)
- return emptySHA1;
- else if (hash is SHA256)
- return emptySHA256;
- else if (hash is SHA384)
- return emptySHA384;
- else if (hash is SHA512)
- return emptySHA512;
- else
- return hash.ComputeHash ((byte[])null);
- }
-
- // PKCS #1 v.2.1, Section 4.1
- // I2OSP converts a non-negative integer to an octet string of a specified length.
- public static byte[] I2OSP (int x, int size)
- {
- byte[] array = BitConverterLE.GetBytes (x);
- Array.Reverse (array, 0, array.Length);
- return I2OSP (array, size);
- }
-
- public static byte[] I2OSP (byte[] x, int size)
- {
- byte[] result = new byte [size];
- Buffer.BlockCopy (x, 0, result, (result.Length - x.Length), x.Length);
- return result;
- }
-
- // PKCS #1 v.2.1, Section 4.2
- // OS2IP converts an octet string to a nonnegative integer.
- public static byte[] OS2IP (byte[] x)
- {
- int i = 0;
- while ((x [i++] == 0x00) && (i < x.Length)) {
- // confuse compiler into reporting a warning with {}
- }
- i--;
- if (i > 0) {
- byte[] result = new byte [x.Length - i];
- Buffer.BlockCopy (x, i, result, 0, result.Length);
- return result;
- }
- else
- return x;
- }
-
- // PKCS #1 v.2.1, Section 5.1.1
- public static byte[] RSAEP (RSA rsa, byte[] m)
- {
- // c = m^e mod n
- return rsa.EncryptValue (m);
- }
-
- // PKCS #1 v.2.1, Section 5.1.2
- public static byte[] RSADP (RSA rsa, byte[] c)
- {
- // m = c^d mod n
- // Decrypt value may apply CRT optimizations
- return rsa.DecryptValue (c);
- }
-
- // PKCS #1 v.2.1, Section 5.2.1
- public static byte[] RSASP1 (RSA rsa, byte[] m)
- {
- // first form: s = m^d mod n
- // Decrypt value may apply CRT optimizations
- return rsa.DecryptValue (m);
- }
-
- // PKCS #1 v.2.1, Section 5.2.2
- public static byte[] RSAVP1 (RSA rsa, byte[] s)
- {
- // m = s^e mod n
- return rsa.EncryptValue (s);
- }
-
- // PKCS #1 v.2.1, Section 7.1.1
- // RSAES-OAEP-ENCRYPT ((n, e), M, L)
- public static byte[] Encrypt_OAEP (RSA rsa, HashAlgorithm hash, RandomNumberGenerator rng, byte[] M)
- {
- int size = rsa.KeySize / 8;
- int hLen = hash.HashSize / 8;
- if (M.Length > size - 2 * hLen - 2)
- throw new CryptographicException ("message too long");
- // empty label L SHA1 hash
- byte[] lHash = GetEmptyHash (hash);
- int PSLength = (size - M.Length - 2 * hLen - 2);
- // DB = lHash || PS || 0x01 || M
- byte[] DB = new byte [lHash.Length + PSLength + 1 + M.Length];
- Buffer.BlockCopy (lHash, 0, DB, 0, lHash.Length);
- DB [(lHash.Length + PSLength)] = 0x01;
- Buffer.BlockCopy (M, 0, DB, (DB.Length - M.Length), M.Length);
-
- byte[] seed = new byte [hLen];
- rng.GetBytes (seed);
-
- byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
- byte[] maskedDB = xor (DB, dbMask);
- byte[] seedMask = MGF1 (hash, maskedDB, hLen);
- byte[] maskedSeed = xor (seed, seedMask);
- // EM = 0x00 || maskedSeed || maskedDB
- byte[] EM = new byte [maskedSeed.Length + maskedDB.Length + 1];
- Buffer.BlockCopy (maskedSeed, 0, EM, 1, maskedSeed.Length);
- Buffer.BlockCopy (maskedDB, 0, EM, maskedSeed.Length + 1, maskedDB.Length);
-
- byte[] m = OS2IP (EM);
- byte[] c = RSAEP (rsa, m);
- return I2OSP (c, size);
- }
-
- // PKCS #1 v.2.1, Section 7.1.2
- // RSAES-OAEP-DECRYPT (K, C, L)
- public static byte[] Decrypt_OAEP (RSA rsa, HashAlgorithm hash, byte[] C)
- {
- int size = rsa.KeySize / 8;
- int hLen = hash.HashSize / 8;
- if ((size < (2 * hLen + 2)) || (C.Length != size))
- throw new CryptographicException ("decryption error");
-
- byte[] c = OS2IP (C);
- byte[] m = RSADP (rsa, c);
- byte[] EM = I2OSP (m, size);
-
- // split EM = Y || maskedSeed || maskedDB
- byte[] maskedSeed = new byte [hLen];
- Buffer.BlockCopy (EM, 1, maskedSeed, 0, maskedSeed.Length);
- byte[] maskedDB = new byte [size - hLen - 1];
- Buffer.BlockCopy (EM, (EM.Length - maskedDB.Length), maskedDB, 0, maskedDB.Length);
-
- byte[] seedMask = MGF1 (hash, maskedDB, hLen);
- byte[] seed = xor (maskedSeed, seedMask);
- byte[] dbMask = MGF1 (hash, seed, size - hLen - 1);
- byte[] DB = xor (maskedDB, dbMask);
-
- byte[] lHash = GetEmptyHash (hash);
- // split DB = lHash' || PS || 0x01 || M
- byte[] dbHash = new byte [lHash.Length];
- Buffer.BlockCopy (DB, 0, dbHash, 0, dbHash.Length);
- bool h = Compare (lHash, dbHash);
-
- // find separator 0x01
- int nPos = lHash.Length;
- while (DB[nPos] == 0)
- nPos++;
-
- int Msize = DB.Length - nPos - 1;
- byte[] M = new byte [Msize];
- Buffer.BlockCopy (DB, (nPos + 1), M, 0, Msize);
-
- // we could have returned EM[0] sooner but would be helping a timing attack
- if ((EM[0] != 0) || (!h) || (DB[nPos] != 0x01))
- return null;
- return M;
- }
-
- // PKCS #1 v.2.1, Section 7.2.1
- // RSAES-PKCS1-V1_5-ENCRYPT ((n, e), M)
- public static byte[] Encrypt_v15 (RSA rsa, RandomNumberGenerator rng, byte[] M)
- {
- int size = rsa.KeySize / 8;
- if (M.Length > size - 11)
- throw new CryptographicException ("message too long");
- int PSLength = System.Math.Max (8, (size - M.Length - 3));
- byte[] PS = new byte [PSLength];
- rng.GetNonZeroBytes (PS);
- byte[] EM = new byte [size];
- EM [1] = 0x02;
- Buffer.BlockCopy (PS, 0, EM, 2, PSLength);
- Buffer.BlockCopy (M, 0, EM, (size - M.Length), M.Length);
-
- byte[] m = OS2IP (EM);
- byte[] c = RSAEP (rsa, m);
- byte[] C = I2OSP (c, size);
- return C;
- }
-
- // PKCS #1 v.2.1, Section 7.2.2
- // RSAES-PKCS1-V1_5-DECRYPT (K, C)
- public static byte[] Decrypt_v15 (RSA rsa, byte[] C)
- {
- int size = rsa.KeySize >> 3; // div by 8
- if ((size < 11) || (C.Length > size))
- throw new CryptographicException ("decryption error");
- byte[] c = OS2IP (C);
- byte[] m = RSADP (rsa, c);
- byte[] EM = I2OSP (m, size);
-
- if ((EM [0] != 0x00) || (EM [1] != 0x02))
- return null;
-
- int mPos = 10;
- // PS is a minimum of 8 bytes + 2 bytes for header
- while ((EM [mPos] != 0x00) && (mPos < EM.Length))
- mPos++;
- if (EM [mPos] != 0x00)
- return null;
- mPos++;
- byte[] M = new byte [EM.Length - mPos];
- Buffer.BlockCopy (EM, mPos, M, 0, M.Length);
- return M;
- }
-
- // PKCS #1 v.2.1, Section 8.2.1
- // RSASSA-PKCS1-V1_5-SIGN (K, M)
- public static byte[] Sign_v15 (RSA rsa, HashAlgorithm hash, byte[] hashValue)
- {
- int size = (rsa.KeySize >> 3); // div 8
- byte[] EM = Encode_v15 (hash, hashValue, size);
- byte[] m = OS2IP (EM);
- byte[] s = RSASP1 (rsa, m);
- byte[] S = I2OSP (s, size);
- return S;
- }
-
- // PKCS #1 v.2.1, Section 8.2.2
- // RSASSA-PKCS1-V1_5-VERIFY ((n, e), M, S)
- public static bool Verify_v15 (RSA rsa, HashAlgorithm hash, byte[] hashValue, byte[] signature)
- {
- return Verify_v15 (rsa, hash, hashValue, signature, false);
- }
-
- // DO NOT USE WITHOUT A VERY GOOD REASON
- public static bool Verify_v15 (RSA rsa, HashAlgorithm hash, byte [] hashValue, byte [] signature, bool tryNonStandardEncoding)
- {
- int size = (rsa.KeySize >> 3); // div 8
- byte[] s = OS2IP (signature);
- byte[] m = RSAVP1 (rsa, s);
- byte[] EM2 = I2OSP (m, size);
- byte[] EM = Encode_v15 (hash, hashValue, size);
- bool result = Compare (EM, EM2);
- if (result || !tryNonStandardEncoding)
- return result;
-
- // NOTE: some signatures don't include the hash OID (pretty lame but real)
- // and compatible with MS implementation. E.g. Verisign Authenticode Timestamps
-
- // we're making this "as safe as possible"
- if ((EM2 [0] != 0x00) || (EM2 [1] != 0x01))
- return false;
- int i;
- for (i = 2; i < EM2.Length - hashValue.Length - 1; i++) {
- if (EM2 [i] != 0xFF)
- return false;
- }
- if (EM2 [i++] != 0x00)
- return false;
-
- byte [] decryptedHash = new byte [hashValue.Length];
- Buffer.BlockCopy (EM2, i, decryptedHash, 0, decryptedHash.Length);
- return Compare (decryptedHash, hashValue);
- }
-
- // PKCS #1 v.2.1, Section 9.2
- // EMSA-PKCS1-v1_5-Encode
- public static byte[] Encode_v15 (HashAlgorithm hash, byte[] hashValue, int emLength)
- {
- if (hashValue.Length != (hash.HashSize >> 3))
- throw new CryptographicException ("bad hash length for " + hash.ToString ());
-
- // DigestInfo ::= SEQUENCE {
- // digestAlgorithm AlgorithmIdentifier,
- // digest OCTET STRING
- // }
-
- byte[] t = null;
-
- string oid = CryptoConfig.MapNameToOID (hash.ToString ());
- if (oid != null)
- {
- ASN1 digestAlgorithm = new ASN1 (0x30);
- digestAlgorithm.Add (new ASN1 (CryptoConfig.EncodeOID (oid)));
- digestAlgorithm.Add (new ASN1 (0x05)); // NULL
- ASN1 digest = new ASN1 (0x04, hashValue);
- ASN1 digestInfo = new ASN1 (0x30);
- digestInfo.Add (digestAlgorithm);
- digestInfo.Add (digest);
-
- t = digestInfo.GetBytes ();
- }
- else
- {
- // There are no valid OID, in this case t = hashValue
- // This is the case of the MD5SHA hash algorithm
- t = hashValue;
- }
-
- Buffer.BlockCopy (hashValue, 0, t, t.Length - hashValue.Length, hashValue.Length);
-
- int PSLength = System.Math.Max (8, emLength - t.Length - 3);
- // PS = PSLength of 0xff
-
- // EM = 0x00 | 0x01 | PS | 0x00 | T
- byte[] EM = new byte [PSLength + t.Length + 3];
- EM [1] = 0x01;
- for (int i=2; i < PSLength + 2; i++)
- EM[i] = 0xff;
- Buffer.BlockCopy (t, 0, EM, PSLength + 3, t.Length);
-
- return EM;
- }
-
- // PKCS #1 v.2.1, Section B.2.1
- public static byte[] MGF1 (HashAlgorithm hash, byte[] mgfSeed, int maskLen)
- {
- // 1. If maskLen > 2^32 hLen, output "mask too long" and stop.
- // easy - this is impossible by using a int (31bits) as parameter ;-)
- // BUT with a signed int we do have to check for negative values!
- if (maskLen < 0)
- throw new OverflowException();
-
- int mgfSeedLength = mgfSeed.Length;
- int hLen = (hash.HashSize >> 3); // from bits to bytes
- int iterations = (maskLen / hLen);
- if (maskLen % hLen != 0)
- iterations++;
- // 2. Let T be the empty octet string.
- byte[] T = new byte [iterations * hLen];
-
- byte[] toBeHashed = new byte [mgfSeedLength + 4];
- int pos = 0;
- // 3. For counter from 0 to \ceil (maskLen / hLen) - 1, do the following:
- for (int counter = 0; counter < iterations; counter++) {
- // a. Convert counter to an octet string C of length 4 octets
- byte[] C = I2OSP (counter, 4);
-
- // b. Concatenate the hash of the seed mgfSeed and C to the octet string T:
- // T = T || Hash (mgfSeed || C)
- Buffer.BlockCopy (mgfSeed, 0, toBeHashed, 0, mgfSeedLength);
- Buffer.BlockCopy (C, 0, toBeHashed, mgfSeedLength, 4);
- byte[] output = hash.ComputeHash (toBeHashed);
- Buffer.BlockCopy (output, 0, T, pos, hLen);
- pos += hLen;
- }
-
- // 4. Output the leading maskLen octets of T as the octet string mask.
- byte[] mask = new byte [maskLen];
- Buffer.BlockCopy (T, 0, mask, 0, maskLen);
- return mask;
- }
- }
-}
+++ /dev/null
-//
-// PKCS8.cs: PKCS #8 - Private-Key Information Syntax Standard
-// ftp://ftp.rsasecurity.com/pub/pkcs/doc/pkcs-8.doc
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2006 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Security.Cryptography;
-using System.Text;
-
-using Mono.Security.X509;
-
-namespace Mono.Security.Cryptography {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class PKCS8 {
-
- public enum KeyInfo {
- PrivateKey,
- EncryptedPrivateKey,
- Unknown
- }
-
- private PKCS8 ()
- {
- }
-
- static public KeyInfo GetType (byte[] data)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
-
- KeyInfo ki = KeyInfo.Unknown;
- try {
- ASN1 top = new ASN1 (data);
- if ((top.Tag == 0x30) && (top.Count > 0)) {
- ASN1 firstLevel = top [0];
- switch (firstLevel.Tag) {
- case 0x02:
- ki = KeyInfo.PrivateKey;
- break;
- case 0x30:
- ki = KeyInfo.EncryptedPrivateKey;
- break;
- }
- }
- }
- catch {
- throw new CryptographicException ("invalid ASN.1 data");
- }
- return ki;
- }
-
- /*
- * PrivateKeyInfo ::= SEQUENCE {
- * version Version,
- * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier,
- * privateKey PrivateKey,
- * attributes [0] IMPLICIT Attributes OPTIONAL
- * }
- *
- * Version ::= INTEGER
- *
- * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier
- *
- * PrivateKey ::= OCTET STRING
- *
- * Attributes ::= SET OF Attribute
- */
- public class PrivateKeyInfo {
-
- private int _version;
- private string _algorithm;
- private byte[] _key;
- private ArrayList _list;
-
- public PrivateKeyInfo ()
- {
- _version = 0;
- _list = new ArrayList ();
- }
-
- public PrivateKeyInfo (byte[] data) : this ()
- {
- Decode (data);
- }
-
- // properties
-
- public string Algorithm {
- get { return _algorithm; }
- set { _algorithm = value; }
- }
-
- public ArrayList Attributes {
- get { return _list; }
- }
-
- public byte[] PrivateKey {
- get {
- if (_key == null)
- return null;
- return (byte[]) _key.Clone ();
- }
- set {
- if (value == null)
- throw new ArgumentNullException ("PrivateKey");
- _key = (byte[]) value.Clone ();
- }
- }
-
- public int Version {
- get { return _version; }
- set {
- if (value < 0)
- throw new ArgumentOutOfRangeException ("negative version");
- _version = value;
- }
- }
-
- // methods
-
- private void Decode (byte[] data)
- {
- ASN1 privateKeyInfo = new ASN1 (data);
- if (privateKeyInfo.Tag != 0x30)
- throw new CryptographicException ("invalid PrivateKeyInfo");
-
- ASN1 version = privateKeyInfo [0];
- if (version.Tag != 0x02)
- throw new CryptographicException ("invalid version");
- _version = version.Value [0];
-
- ASN1 privateKeyAlgorithm = privateKeyInfo [1];
- if (privateKeyAlgorithm.Tag != 0x30)
- throw new CryptographicException ("invalid algorithm");
-
- ASN1 algorithm = privateKeyAlgorithm [0];
- if (algorithm.Tag != 0x06)
- throw new CryptographicException ("missing algorithm OID");
- _algorithm = ASN1Convert.ToOid (algorithm);
-
- ASN1 privateKey = privateKeyInfo [2];
- _key = privateKey.Value;
-
- // attributes [0] IMPLICIT Attributes OPTIONAL
- if (privateKeyInfo.Count > 3) {
- ASN1 attributes = privateKeyInfo [3];
- for (int i=0; i < attributes.Count; i++) {
- _list.Add (attributes [i]);
- }
- }
- }
-
- public byte[] GetBytes ()
- {
- ASN1 privateKeyAlgorithm = new ASN1 (0x30);
- privateKeyAlgorithm.Add (ASN1Convert.FromOid (_algorithm));
- privateKeyAlgorithm.Add (new ASN1 (0x05)); // ASN.1 NULL
-
- ASN1 pki = new ASN1 (0x30);
- pki.Add (new ASN1 (0x02, new byte [1] { (byte) _version }));
- pki.Add (privateKeyAlgorithm);
- pki.Add (new ASN1 (0x04, _key));
-
- if (_list.Count > 0) {
- ASN1 attributes = new ASN1 (0xA0);
- foreach (ASN1 attribute in _list) {
- attributes.Add (attribute);
- }
- pki.Add (attributes);
- }
-
- return pki.GetBytes ();
- }
-
- // static methods
-
- static private byte[] RemoveLeadingZero (byte[] bigInt)
- {
- int start = 0;
- int length = bigInt.Length;
- if (bigInt [0] == 0x00) {
- start = 1;
- length--;
- }
- byte[] bi = new byte [length];
- Buffer.BlockCopy (bigInt, start, bi, 0, length);
- return bi;
- }
-
- static private byte[] Normalize (byte[] bigInt, int length)
- {
- if (bigInt.Length == length)
- return bigInt;
- else if (bigInt.Length > length)
- return RemoveLeadingZero (bigInt);
- else {
- // pad with 0
- byte[] bi = new byte [length];
- Buffer.BlockCopy (bigInt, 0, bi, (length - bigInt.Length), bigInt.Length);
- return bi;
- }
- }
-
- /*
- * RSAPrivateKey ::= SEQUENCE {
- * version Version,
- * modulus INTEGER, -- n
- * publicExponent INTEGER, -- e
- * privateExponent INTEGER, -- d
- * prime1 INTEGER, -- p
- * prime2 INTEGER, -- q
- * exponent1 INTEGER, -- d mod (p-1)
- * exponent2 INTEGER, -- d mod (q-1)
- * coefficient INTEGER, -- (inverse of q) mod p
- * otherPrimeInfos OtherPrimeInfos OPTIONAL
- * }
- */
- static public RSA DecodeRSA (byte[] keypair)
- {
- ASN1 privateKey = new ASN1 (keypair);
- if (privateKey.Tag != 0x30)
- throw new CryptographicException ("invalid private key format");
-
- ASN1 version = privateKey [0];
- if (version.Tag != 0x02)
- throw new CryptographicException ("missing version");
-
- if (privateKey.Count < 9)
- throw new CryptographicException ("not enough key parameters");
-
- RSAParameters param = new RSAParameters ();
- // note: MUST remove leading 0 - else MS wont import the key
- param.Modulus = RemoveLeadingZero (privateKey [1].Value);
- int keysize = param.Modulus.Length;
- int keysize2 = (keysize >> 1); // half-size
- // size must be normalized - else MS wont import the key
- param.D = Normalize (privateKey [3].Value, keysize);
- param.DP = Normalize (privateKey [6].Value, keysize2);
- param.DQ = Normalize (privateKey [7].Value, keysize2);
- param.Exponent = RemoveLeadingZero (privateKey [2].Value);
- param.InverseQ = Normalize (privateKey [8].Value, keysize2);
- param.P = Normalize (privateKey [4].Value, keysize2);
- param.Q = Normalize (privateKey [5].Value, keysize2);
- RSA rsa = null;
- try {
- rsa = RSA.Create ();
- rsa.ImportParameters (param);
- }
- catch (CryptographicException) {
- // this may cause problem when this code is run under
- // the SYSTEM identity on Windows (e.g. ASP.NET). See
- // http://bugzilla.ximian.com/show_bug.cgi?id=77559
- CspParameters csp = new CspParameters ();
- csp.Flags = CspProviderFlags.UseMachineKeyStore;
- rsa = new RSACryptoServiceProvider (csp);
- rsa.ImportParameters (param);
- }
- return rsa;
- }
-
- /*
- * RSAPrivateKey ::= SEQUENCE {
- * version Version,
- * modulus INTEGER, -- n
- * publicExponent INTEGER, -- e
- * privateExponent INTEGER, -- d
- * prime1 INTEGER, -- p
- * prime2 INTEGER, -- q
- * exponent1 INTEGER, -- d mod (p-1)
- * exponent2 INTEGER, -- d mod (q-1)
- * coefficient INTEGER, -- (inverse of q) mod p
- * otherPrimeInfos OtherPrimeInfos OPTIONAL
- * }
- */
- static public byte[] Encode (RSA rsa)
- {
- RSAParameters param = rsa.ExportParameters (true);
-
- ASN1 rsaPrivateKey = new ASN1 (0x30);
- rsaPrivateKey.Add (new ASN1 (0x02, new byte [1] { 0x00 }));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.Modulus));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.Exponent));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.D));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.P));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.Q));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.DP));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.DQ));
- rsaPrivateKey.Add (ASN1Convert.FromUnsignedBigInteger (param.InverseQ));
-
- return rsaPrivateKey.GetBytes ();
- }
-
- // DSA only encode it's X private key inside an ASN.1 INTEGER (Hint: Tag == 0x02)
- // which isn't enough for rebuilding the keypair. The other parameters
- // can be found (98% of the time) in the X.509 certificate associated
- // with the private key or (2% of the time) the parameters are in it's
- // issuer X.509 certificate (not supported in the .NET framework).
- static public DSA DecodeDSA (byte[] privateKey, DSAParameters dsaParameters)
- {
- ASN1 pvk = new ASN1 (privateKey);
- if (pvk.Tag != 0x02)
- throw new CryptographicException ("invalid private key format");
-
- // X is ALWAYS 20 bytes (no matter if the key length is 512 or 1024 bits)
- dsaParameters.X = Normalize (pvk.Value, 20);
- DSA dsa = DSA.Create ();
- dsa.ImportParameters (dsaParameters);
- return dsa;
- }
-
- static public byte[] Encode (DSA dsa)
- {
- DSAParameters param = dsa.ExportParameters (true);
- return ASN1Convert.FromUnsignedBigInteger (param.X).GetBytes ();
- }
-
- static public byte[] Encode (AsymmetricAlgorithm aa)
- {
- if (aa is RSA)
- return Encode ((RSA)aa);
- else if (aa is DSA)
- return Encode ((DSA)aa);
- else
- throw new CryptographicException ("Unknown asymmetric algorithm {0}", aa.ToString ());
- }
- }
-
- /*
- * EncryptedPrivateKeyInfo ::= SEQUENCE {
- * encryptionAlgorithm EncryptionAlgorithmIdentifier,
- * encryptedData EncryptedData
- * }
- *
- * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
- *
- * EncryptedData ::= OCTET STRING
- *
- * --
- * AlgorithmIdentifier ::= SEQUENCE {
- * algorithm OBJECT IDENTIFIER,
- * parameters ANY DEFINED BY algorithm OPTIONAL
- * }
- *
- * -- from PKCS#5
- * PBEParameter ::= SEQUENCE {
- * salt OCTET STRING SIZE(8),
- * iterationCount INTEGER
- * }
- */
- public class EncryptedPrivateKeyInfo {
-
- private string _algorithm;
- private byte[] _salt;
- private int _iterations;
- private byte[] _data;
-
- public EncryptedPrivateKeyInfo () {}
-
- public EncryptedPrivateKeyInfo (byte[] data) : this ()
- {
- Decode (data);
- }
-
- // properties
-
- public string Algorithm {
- get { return _algorithm; }
- set { _algorithm = value; }
- }
-
- public byte[] EncryptedData {
- get { return (_data == null) ? null : (byte[]) _data.Clone (); }
- set { _data = (value == null) ? null : (byte[]) value.Clone (); }
- }
-
- public byte[] Salt {
- get {
- if (_salt == null) {
- RandomNumberGenerator rng = RandomNumberGenerator.Create ();
- _salt = new byte [8];
- rng.GetBytes (_salt);
- }
- return (byte[]) _salt.Clone ();
- }
- set { _salt = (byte[]) value.Clone (); }
- }
-
- public int IterationCount {
- get { return _iterations; }
- set {
- if (value < 0)
- throw new ArgumentOutOfRangeException ("IterationCount", "Negative");
- _iterations = value;
- }
- }
-
- // methods
-
- private void Decode (byte[] data)
- {
- ASN1 encryptedPrivateKeyInfo = new ASN1 (data);
- if (encryptedPrivateKeyInfo.Tag != 0x30)
- throw new CryptographicException ("invalid EncryptedPrivateKeyInfo");
-
- ASN1 encryptionAlgorithm = encryptedPrivateKeyInfo [0];
- if (encryptionAlgorithm.Tag != 0x30)
- throw new CryptographicException ("invalid encryptionAlgorithm");
- ASN1 algorithm = encryptionAlgorithm [0];
- if (algorithm.Tag != 0x06)
- throw new CryptographicException ("invalid algorithm");
- _algorithm = ASN1Convert.ToOid (algorithm);
- // parameters ANY DEFINED BY algorithm OPTIONAL
- if (encryptionAlgorithm.Count > 1) {
- ASN1 parameters = encryptionAlgorithm [1];
- if (parameters.Tag != 0x30)
- throw new CryptographicException ("invalid parameters");
-
- ASN1 salt = parameters [0];
- if (salt.Tag != 0x04)
- throw new CryptographicException ("invalid salt");
- _salt = salt.Value;
-
- ASN1 iterationCount = parameters [1];
- if (iterationCount.Tag != 0x02)
- throw new CryptographicException ("invalid iterationCount");
- _iterations = ASN1Convert.ToInt32 (iterationCount);
- }
-
- ASN1 encryptedData = encryptedPrivateKeyInfo [1];
- if (encryptedData.Tag != 0x04)
- throw new CryptographicException ("invalid EncryptedData");
- _data = encryptedData.Value;
- }
-
- // Note: PKCS#8 doesn't define how to generate the key required for encryption
- // so you're on your own. Just don't try to copy the big guys too much ;)
- // Netscape: http://www.cs.auckland.ac.nz/~pgut001/pubs/netscape.txt
- // Microsoft: http://www.cs.auckland.ac.nz/~pgut001/pubs/breakms.txt
- public byte[] GetBytes ()
- {
- if (_algorithm == null)
- throw new CryptographicException ("No algorithm OID specified");
-
- ASN1 encryptionAlgorithm = new ASN1 (0x30);
- encryptionAlgorithm.Add (ASN1Convert.FromOid (_algorithm));
-
- // parameters ANY DEFINED BY algorithm OPTIONAL
- if ((_iterations > 0) || (_salt != null)) {
- ASN1 salt = new ASN1 (0x04, _salt);
- ASN1 iterations = ASN1Convert.FromInt32 (_iterations);
-
- ASN1 parameters = new ASN1 (0x30);
- parameters.Add (salt);
- parameters.Add (iterations);
- encryptionAlgorithm.Add (parameters);
- }
-
- // encapsulates EncryptedData into an OCTET STRING
- ASN1 encryptedData = new ASN1 (0x04, _data);
-
- ASN1 encryptedPrivateKeyInfo = new ASN1 (0x30);
- encryptedPrivateKeyInfo.Add (encryptionAlgorithm);
- encryptedPrivateKeyInfo.Add (encryptedData);
-
- return encryptedPrivateKeyInfo.GetBytes ();
- }
- }
- }
-}
+++ /dev/null
-//
-// RSAManaged.cs - Implements the RSA algorithm.
-//
-// Authors:
-// Sebastien Pouliot (sebastien@ximian.com)
-// Ben Maurer (bmaurer@users.sf.net)
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Portions (C) 2003 Ben Maurer
-// Copyright (C) 2004,2006 Novell, Inc (http://www.novell.com)
-//
-// Key generation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
-// See bouncycastle.txt for license.
-//
-// 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.Security.Cryptography;
-using System.Text;
-
-using Mono.Math;
-
-// Big chunks of code are coming from the original RSACryptoServiceProvider class.
-// The class was refactored to :
-// a. ease integration of new hash algorithm (like MD2, RIPEMD160, ...);
-// b. provide better support for the coming SSL implementation (requires
-// EncryptValue/DecryptValue) with, or without, Mono runtime/corlib;
-// c. provide an alternative RSA implementation for all Windows (like using
-// OAEP without Windows XP).
-
-namespace Mono.Security.Cryptography {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class RSAManaged : RSA {
-
- private const int defaultKeySize = 1024;
-
- private bool isCRTpossible = false;
- private bool keyBlinding = true;
- private bool keypairGenerated = false;
- private bool m_disposed = false;
-
- private BigInteger d;
- private BigInteger p;
- private BigInteger q;
- private BigInteger dp;
- private BigInteger dq;
- private BigInteger qInv;
- private BigInteger n; // modulus
- private BigInteger e;
-
- public RSAManaged () : this (defaultKeySize)
- {
- }
-
- public RSAManaged (int keySize)
- {
- LegalKeySizesValue = new KeySizes [1];
- LegalKeySizesValue [0] = new KeySizes (384, 16384, 8);
- base.KeySize = keySize;
- }
-
- ~RSAManaged ()
- {
- // Zeroize private key
- Dispose (false);
- }
-
- private void GenerateKeyPair ()
- {
- // p and q values should have a length of half the strength in bits
- int pbitlength = ((KeySize + 1) >> 1);
- int qbitlength = (KeySize - pbitlength);
- const uint uint_e = 17;
- e = uint_e; // fixed
-
- // generate p, prime and (p-1) relatively prime to e
- for (;;) {
- p = BigInteger.GeneratePseudoPrime (pbitlength);
- if (p % uint_e != 1)
- break;
- }
- // generate a modulus of the required length
- for (;;) {
- // generate q, prime and (q-1) relatively prime to e,
- // and not equal to p
- for (;;) {
- q = BigInteger.GeneratePseudoPrime (qbitlength);
- if ((q % uint_e != 1) && (p != q))
- break;
- }
-
- // calculate the modulus
- n = p * q;
- if (n.BitCount () == KeySize)
- break;
-
- // if we get here our primes aren't big enough, make the largest
- // of the two p and try again
- if (p < q)
- p = q;
- }
-
- BigInteger pSub1 = (p - 1);
- BigInteger qSub1 = (q - 1);
- BigInteger phi = pSub1 * qSub1;
-
- // calculate the private exponent
- d = e.ModInverse (phi);
-
- // calculate the CRT factors
- dp = d % pSub1;
- dq = d % qSub1;
- qInv = q.ModInverse (p);
-
- keypairGenerated = true;
- isCRTpossible = true;
-
- if (KeyGenerated != null)
- KeyGenerated (this, null);
- }
-
- // overrides from RSA class
-
- public override int KeySize {
- get {
- // in case keypair hasn't been (yet) generated
- if (keypairGenerated) {
- int ks = n.BitCount ();
- if ((ks & 7) != 0)
- ks = ks + (8 - (ks & 7));
- return ks;
- }
- else
- return base.KeySize;
- }
- }
- public override string KeyExchangeAlgorithm {
- get { return "RSA-PKCS1-KeyEx"; }
- }
-
- // note: when (if) we generate a keypair then it will have both
- // the public and private keys
- public bool PublicOnly {
- get { return (keypairGenerated && ((d == null) || (n == null))); }
- }
-
- public override string SignatureAlgorithm {
- get { return "http://www.w3.org/2000/09/xmldsig#rsa-sha1"; }
- }
-
- public override byte[] DecryptValue (byte[] rgb)
- {
- if (m_disposed)
- throw new ObjectDisposedException ("private key");
-
- // decrypt operation is used for signature
- if (!keypairGenerated)
- GenerateKeyPair ();
-
- BigInteger input = new BigInteger (rgb);
- BigInteger r = null;
-
- // we use key blinding (by default) against timing attacks
- if (keyBlinding) {
- // x = (r^e * g) mod n
- // *new* random number (so it's timing is also random)
- r = BigInteger.GenerateRandom (n.BitCount ());
- input = r.ModPow (e, n) * input % n;
- }
-
- BigInteger output;
- // decrypt (which uses the private key) can be
- // optimized by using CRT (Chinese Remainder Theorem)
- if (isCRTpossible) {
- // m1 = c^dp mod p
- BigInteger m1 = input.ModPow (dp, p);
- // m2 = c^dq mod q
- BigInteger m2 = input.ModPow (dq, q);
- BigInteger h;
- if (m2 > m1) {
- // thanks to benm!
- h = p - ((m2 - m1) * qInv % p);
- output = m2 + q * h;
- } else {
- // h = (m1 - m2) * qInv mod p
- h = (m1 - m2) * qInv % p;
- // m = m2 + q * h;
- output = m2 + q * h;
- }
- } else if (!PublicOnly) {
- // m = c^d mod n
- output = input.ModPow (d, n);
- } else {
- throw new CryptographicException (Locale.GetText ("Missing private key to decrypt value."));
- }
-
- if (keyBlinding) {
- // Complete blinding
- // x^e / r mod n
- output = output * r.ModInverse (n) % n;
- r.Clear ();
- }
-
- // it's sometimes possible for the results to be a byte short
- // and this can break some software (see #79502) so we 0x00 pad the result
- byte[] result = GetPaddedValue (output, (KeySize >> 3));
- // zeroize values
- input.Clear ();
- output.Clear ();
- return result;
- }
-
- public override byte[] EncryptValue (byte[] rgb)
- {
- if (m_disposed)
- throw new ObjectDisposedException ("public key");
-
- if (!keypairGenerated)
- GenerateKeyPair ();
-
- BigInteger input = new BigInteger (rgb);
- BigInteger output = input.ModPow (e, n);
- // it's sometimes possible for the results to be a byte short
- // and this can break some software (see #79502) so we 0x00 pad the result
- byte[] result = GetPaddedValue (output, (KeySize >> 3));
- // zeroize value
- input.Clear ();
- output.Clear ();
- return result;
- }
-
-
-
- public override RSAParameters ExportParameters (bool includePrivateParameters)
- {
- if (m_disposed)
- throw new ObjectDisposedException (Locale.GetText ("Keypair was disposed"));
-
- if (!keypairGenerated)
- GenerateKeyPair ();
-
- RSAParameters param = new RSAParameters ();
- param.Exponent = e.GetBytes ();
- param.Modulus = n.GetBytes ();
- if (includePrivateParameters) {
- // some parameters are required for exporting the private key
- if (d == null)
- throw new CryptographicException ("Missing private key");
- param.D = d.GetBytes ();
- // hack for bugzilla #57941 where D wasn't provided
- if (param.D.Length != param.Modulus.Length) {
- byte[] normalizedD = new byte [param.Modulus.Length];
- Buffer.BlockCopy (param.D, 0, normalizedD, (normalizedD.Length - param.D.Length), param.D.Length);
- param.D = normalizedD;
- }
- // but CRT parameters are optionals
- if ((p != null) && (q != null) && (dp != null) && (dq != null) && (qInv != null)) {
- // and we include them only if we have them all
- int length = (KeySize >> 4);
- param.P = GetPaddedValue (p, length);
- param.Q = GetPaddedValue (q, length);
- param.DP = GetPaddedValue (dp, length);
- param.DQ = GetPaddedValue (dq, length);
- param.InverseQ = GetPaddedValue (qInv, length);
- }
- }
- return param;
- }
-
- public override void ImportParameters (RSAParameters parameters)
- {
- if (m_disposed)
- throw new ObjectDisposedException (Locale.GetText ("Keypair was disposed"));
-
- // if missing "mandatory" parameters
- if (parameters.Exponent == null)
- throw new CryptographicException (Locale.GetText ("Missing Exponent"));
- if (parameters.Modulus == null)
- throw new CryptographicException (Locale.GetText ("Missing Modulus"));
-
- e = new BigInteger (parameters.Exponent);
- n = new BigInteger (parameters.Modulus);
- // only if the private key is present
- if (parameters.D != null)
- d = new BigInteger (parameters.D);
- if (parameters.DP != null)
- dp = new BigInteger (parameters.DP);
- if (parameters.DQ != null)
- dq = new BigInteger (parameters.DQ);
- if (parameters.InverseQ != null)
- qInv = new BigInteger (parameters.InverseQ);
- if (parameters.P != null)
- p = new BigInteger (parameters.P);
- if (parameters.Q != null)
- q = new BigInteger (parameters.Q);
-
- // we now have a keypair
- keypairGenerated = true;
- bool privateKey = ((p != null) && (q != null) && (dp != null));
- isCRTpossible = (privateKey && (dq != null) && (qInv != null));
-
- // check if the public/private keys match
- // the way the check is made allows a bad D to work if CRT is available (like MS does, see unit tests)
- if (!privateKey)
- return;
-
- // always check n == p * q
- bool ok = (n == (p * q));
- if (ok) {
- // we now know that p and q are correct, so (p - 1), (q - 1) and phi will be ok too
- BigInteger pSub1 = (p - 1);
- BigInteger qSub1 = (q - 1);
- BigInteger phi = pSub1 * qSub1;
- // e is fairly static but anyway we can ensure it makes sense by recomputing d
- BigInteger dcheck = e.ModInverse (phi);
-
- // now if our new d(check) is different than the d we're provided then we cannot
- // be sure if 'd' or 'e' is invalid... (note that, from experience, 'd' is more
- // likely to be invalid since it's twice as large as DP (or DQ) and sits at the
- // end of the structure (e.g. truncation).
- ok = (d == dcheck);
-
- // ... unless we have the pre-computed CRT parameters
- if (!ok && isCRTpossible) {
- // we can override the previous decision since Mono always prefer, for
- // performance reasons, using the CRT algorithm
- ok = (dp == (dcheck % pSub1)) && (dq == (dcheck % qSub1)) &&
- (qInv == q.ModInverse (p));
- }
- }
-
- if (!ok)
- throw new CryptographicException (Locale.GetText ("Private/public key mismatch"));
- }
-
- protected override void Dispose (bool disposing)
- {
- if (!m_disposed) {
- // Always zeroize private key
- if (d != null) {
- d.Clear ();
- d = null;
- }
- if (p != null) {
- p.Clear ();
- p = null;
- }
- if (q != null) {
- q.Clear ();
- q = null;
- }
- if (dp != null) {
- dp.Clear ();
- dp = null;
- }
- if (dq != null) {
- dq.Clear ();
- dq = null;
- }
- if (qInv != null) {
- qInv.Clear ();
- qInv = null;
- }
-
- if (disposing) {
- // clear public key
- if (e != null) {
- e.Clear ();
- e = null;
- }
- if (n != null) {
- n.Clear ();
- n = null;
- }
- }
- }
- // call base class
- // no need as they all are abstract before us
- m_disposed = true;
- }
-
- public delegate void KeyGeneratedEventHandler (object sender, EventArgs e);
-
- public event KeyGeneratedEventHandler KeyGenerated;
-
- public override string ToXmlString (bool includePrivateParameters)
- {
- StringBuilder sb = new StringBuilder ();
- RSAParameters rsaParams = ExportParameters (includePrivateParameters);
- try {
- sb.Append ("<RSAKeyValue>");
-
- sb.Append ("<Modulus>");
- sb.Append (Convert.ToBase64String (rsaParams.Modulus));
- sb.Append ("</Modulus>");
-
- sb.Append ("<Exponent>");
- sb.Append (Convert.ToBase64String (rsaParams.Exponent));
- sb.Append ("</Exponent>");
-
- if (includePrivateParameters) {
- if (rsaParams.P != null) {
- sb.Append ("<P>");
- sb.Append (Convert.ToBase64String (rsaParams.P));
- sb.Append ("</P>");
- }
- if (rsaParams.Q != null) {
- sb.Append ("<Q>");
- sb.Append (Convert.ToBase64String (rsaParams.Q));
- sb.Append ("</Q>");
- }
- if (rsaParams.DP != null) {
- sb.Append ("<DP>");
- sb.Append (Convert.ToBase64String (rsaParams.DP));
- sb.Append ("</DP>");
- }
- if (rsaParams.DQ != null) {
- sb.Append ("<DQ>");
- sb.Append (Convert.ToBase64String (rsaParams.DQ));
- sb.Append ("</DQ>");
- }
- if (rsaParams.InverseQ != null) {
- sb.Append ("<InverseQ>");
- sb.Append (Convert.ToBase64String (rsaParams.InverseQ));
- sb.Append ("</InverseQ>");
- }
- sb.Append ("<D>");
- sb.Append (Convert.ToBase64String (rsaParams.D));
- sb.Append ("</D>");
- }
-
- sb.Append ("</RSAKeyValue>");
- }
- catch {
- if (rsaParams.P != null)
- Array.Clear (rsaParams.P, 0, rsaParams.P.Length);
- if (rsaParams.Q != null)
- Array.Clear (rsaParams.Q, 0, rsaParams.Q.Length);
- if (rsaParams.DP != null)
- Array.Clear (rsaParams.DP, 0, rsaParams.DP.Length);
- if (rsaParams.DQ != null)
- Array.Clear (rsaParams.DQ, 0, rsaParams.DQ.Length);
- if (rsaParams.InverseQ != null)
- Array.Clear (rsaParams.InverseQ, 0, rsaParams.InverseQ.Length);
- if (rsaParams.D != null)
- Array.Clear (rsaParams.D, 0, rsaParams.D.Length);
- throw;
- }
-
- return sb.ToString ();
- }
-
- // internal for Mono 1.0.x in order to preserve public contract
- // they are public for Mono 1.1.x (for 1.2) as the API isn't froze ATM
-
- public bool UseKeyBlinding {
- get { return keyBlinding; }
- // you REALLY shoudn't touch this (true is fine ;-)
- set { keyBlinding = value; }
- }
-
- public bool IsCrtPossible {
- // either the key pair isn't generated (and will be
- // generated with CRT parameters) or CRT is (or isn't)
- // possible (in case the key was imported)
- get { return (!keypairGenerated || isCRTpossible); }
- }
-
- private byte[] GetPaddedValue (BigInteger value, int length)
- {
- byte[] result = value.GetBytes ();
- if (result.Length >= length)
- return result;
-
- // left-pad 0x00 value on the result (same integer, correct length)
- byte[] padded = new byte[length];
- Buffer.BlockCopy (result, 0, padded, (length - result.Length), result.Length);
- // temporary result may contain decrypted (plaintext) data, clear it
- Array.Clear (result, 0, result.Length);
- return padded;
- }
- }
-}
+++ /dev/null
-//
-// Mono.Security.Cryptography.SymmetricTransform implementation
-//
-// Authors:
-// Thomas Neidhart (tome@sbox.tugraz.at)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Portions (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2008 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.Security.Cryptography;
-
-namespace Mono.Security.Cryptography {
-
- // This class implement most of the common code required for symmetric
- // algorithm transforms, like:
- // - CipherMode: Builds CBC and CFB on top of (descendant supplied) ECB
- // - PaddingMode, transform properties, multiple blocks, reuse...
- //
- // Descendants MUST:
- // - intialize themselves (like key expansion, ...)
- // - override the ECB (Electronic Code Book) method which will only be
- // called using BlockSize byte[] array.
- internal abstract class SymmetricTransform : ICryptoTransform {
- protected SymmetricAlgorithm algo;
- protected bool encrypt;
- protected int BlockSizeByte;
- protected byte[] temp;
- protected byte[] temp2;
- private byte[] workBuff;
- private byte[] workout;
- protected PaddingMode padmode;
- // Silverlight 2.0 does not support any feedback mode
- protected int FeedBackByte;
- private bool m_disposed = false;
- protected bool lastBlock;
-
- public SymmetricTransform (SymmetricAlgorithm symmAlgo, bool encryption, byte[] rgbIV)
- {
- algo = symmAlgo;
- encrypt = encryption;
- BlockSizeByte = (algo.BlockSize >> 3);
-
- if (rgbIV == null) {
- rgbIV = KeyBuilder.IV (BlockSizeByte);
- } else {
- rgbIV = (byte[]) rgbIV.Clone ();
- }
- // compare the IV length with the "currently selected" block size and *ignore* IV that are too big
- if (rgbIV.Length < BlockSizeByte) {
- string msg = Locale.GetText ("IV is too small ({0} bytes), it should be {1} bytes long.",
- rgbIV.Length, BlockSizeByte);
- throw new CryptographicException (msg);
- }
- padmode = algo.Padding;
- // mode buffers
- temp = new byte [BlockSizeByte];
- Buffer.BlockCopy (rgbIV, 0, temp, 0, System.Math.Min (BlockSizeByte, rgbIV.Length));
- temp2 = new byte [BlockSizeByte];
- FeedBackByte = (algo.FeedbackSize >> 3);
- // transform buffers
- workBuff = new byte [BlockSizeByte];
- workout = new byte [BlockSizeByte];
- }
-
- ~SymmetricTransform ()
- {
- Dispose (false);
- }
-
- void IDisposable.Dispose ()
- {
- Dispose (true);
- GC.SuppressFinalize (this); // Finalization is now unnecessary
- }
-
- // MUST be overriden by classes using unmanaged ressources
- // the override method must call the base class
- protected virtual void Dispose (bool disposing)
- {
- if (!m_disposed) {
- if (disposing) {
- // dispose managed object: zeroize and free
- Array.Clear (temp, 0, BlockSizeByte);
- temp = null;
- Array.Clear (temp2, 0, BlockSizeByte);
- temp2 = null;
- }
- m_disposed = true;
- }
- }
-
- public virtual bool CanTransformMultipleBlocks {
- get { return true; }
- }
-
- public virtual bool CanReuseTransform {
- get { return false; }
- }
-
- public virtual int InputBlockSize {
- get { return BlockSizeByte; }
- }
-
- public virtual int OutputBlockSize {
- get { return BlockSizeByte; }
- }
-
- // note: Each block MUST be BlockSizeValue in size!!!
- // i.e. Any padding must be done before calling this method
- protected virtual void Transform (byte[] input, byte[] output)
- {
- switch (algo.Mode) {
- case CipherMode.ECB:
- ECB (input, output);
- break;
- case CipherMode.CBC:
- CBC (input, output);
- break;
- case CipherMode.CFB:
- CFB (input, output);
- break;
- case CipherMode.OFB:
- OFB (input, output);
- break;
- case CipherMode.CTS:
- CTS (input, output);
- break;
- default:
- throw new NotImplementedException ("Unkown CipherMode" + algo.Mode.ToString ());
- }
- }
-
- // Electronic Code Book (ECB)
- protected abstract void ECB (byte[] input, byte[] output);
-
- // Cipher-Block-Chaining (CBC)
- protected virtual void CBC (byte[] input, byte[] output)
- {
- if (encrypt) {
- for (int i = 0; i < BlockSizeByte; i++)
- temp[i] ^= input[i];
- ECB (temp, output);
- Buffer.BlockCopy (output, 0, temp, 0, BlockSizeByte);
- }
- else {
- Buffer.BlockCopy (input, 0, temp2, 0, BlockSizeByte);
- ECB (input, output);
- for (int i = 0; i < BlockSizeByte; i++)
- output[i] ^= temp[i];
- Buffer.BlockCopy (temp2, 0, temp, 0, BlockSizeByte);
- }
- }
-
- // Cipher-FeedBack (CFB)
- // this is how *CryptoServiceProvider implements CFB
- // only AesCryptoServiceProvider support CFB > 8
- // RijndaelManaged is incompatible with this implementation (and overrides it in it's own transform)
- protected virtual void CFB (byte[] input, byte[] output)
- {
- if (encrypt) {
- for (int x = 0; x < BlockSizeByte; x++) {
- // temp is first initialized with the IV
- ECB (temp, temp2);
- output [x] = (byte) (temp2 [0] ^ input [x]);
- Buffer.BlockCopy (temp, 1, temp, 0, BlockSizeByte - 1);
- Buffer.BlockCopy (output, x, temp, BlockSizeByte - 1, 1);
- }
- }
- else {
- for (int x = 0; x < BlockSizeByte; x++) {
- // we do not really decrypt this data!
- encrypt = true;
- // temp is first initialized with the IV
- ECB (temp, temp2);
- encrypt = false;
-
- Buffer.BlockCopy (temp, 1, temp, 0, BlockSizeByte - 1);
- Buffer.BlockCopy (input, x, temp, BlockSizeByte - 1, 1);
- output [x] = (byte) (temp2 [0] ^ input [x]);
- }
- }
- }
-
- // Output-FeedBack (OFB)
- protected virtual void OFB (byte[] input, byte[] output)
- {
- throw new CryptographicException ("OFB isn't supported by the framework");
- }
-
- // Cipher Text Stealing (CTS)
- protected virtual void CTS (byte[] input, byte[] output)
- {
- throw new CryptographicException ("CTS isn't supported by the framework");
- }
-
- private void CheckInput (byte[] inputBuffer, int inputOffset, int inputCount)
- {
- if (inputBuffer == null)
- throw new ArgumentNullException ("inputBuffer");
- if (inputOffset < 0)
- throw new ArgumentOutOfRangeException ("inputOffset", "< 0");
- if (inputCount < 0)
- throw new ArgumentOutOfRangeException ("inputCount", "< 0");
- // ordered to avoid possible integer overflow
- if (inputOffset > inputBuffer.Length - inputCount)
- throw new ArgumentException ("inputBuffer", Locale.GetText ("Overflow"));
- }
-
- // this method may get called MANY times so this is the one to optimize
- public virtual int TransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
- {
- if (m_disposed)
- throw new ObjectDisposedException ("Object is disposed");
- CheckInput (inputBuffer, inputOffset, inputCount);
- // check output parameters
- if (outputBuffer == null)
- throw new ArgumentNullException ("outputBuffer");
- if (outputOffset < 0)
- throw new ArgumentOutOfRangeException ("outputOffset", "< 0");
-
- // ordered to avoid possible integer overflow
- int len = outputBuffer.Length - inputCount - outputOffset;
- if (!encrypt && (0 > len) && ((padmode == PaddingMode.None) || (padmode == PaddingMode.Zeros))) {
- throw new CryptographicException ("outputBuffer", Locale.GetText ("Overflow"));
- } else if (KeepLastBlock) {
- if (0 > len + BlockSizeByte) {
- throw new CryptographicException ("outputBuffer", Locale.GetText ("Overflow"));
- }
- } else {
- if (0 > len) {
- // there's a special case if this is the end of the decryption process
- if (inputBuffer.Length - inputOffset - outputBuffer.Length == BlockSizeByte)
- inputCount = outputBuffer.Length - outputOffset;
- else
- throw new CryptographicException ("outputBuffer", Locale.GetText ("Overflow"));
- }
- }
- return InternalTransformBlock (inputBuffer, inputOffset, inputCount, outputBuffer, outputOffset);
- }
-
- private bool KeepLastBlock {
- get {
- return ((!encrypt) && (padmode != PaddingMode.None) && (padmode != PaddingMode.Zeros));
- }
- }
-
- private int InternalTransformBlock (byte[] inputBuffer, int inputOffset, int inputCount, byte[] outputBuffer, int outputOffset)
- {
- int offs = inputOffset;
- int full;
-
- // this way we don't do a modulo every time we're called
- // and we may save a division
- if (inputCount != BlockSizeByte) {
- if ((inputCount % BlockSizeByte) != 0)
- throw new CryptographicException ("Invalid input block size.");
-
- full = inputCount / BlockSizeByte;
- }
- else
- full = 1;
-
- if (KeepLastBlock)
- full--;
-
- int total = 0;
-
- if (lastBlock) {
- Transform (workBuff, workout);
- Buffer.BlockCopy (workout, 0, outputBuffer, outputOffset, BlockSizeByte);
- outputOffset += BlockSizeByte;
- total += BlockSizeByte;
- lastBlock = false;
- }
-
- for (int i = 0; i < full; i++) {
- Buffer.BlockCopy (inputBuffer, offs, workBuff, 0, BlockSizeByte);
- Transform (workBuff, workout);
- Buffer.BlockCopy (workout, 0, outputBuffer, outputOffset, BlockSizeByte);
- offs += BlockSizeByte;
- outputOffset += BlockSizeByte;
- total += BlockSizeByte;
- }
-
- if (KeepLastBlock) {
- Buffer.BlockCopy (inputBuffer, offs, workBuff, 0, BlockSizeByte);
- lastBlock = true;
- }
-
- return total;
- }
-
- RandomNumberGenerator _rng;
-
- private void Random (byte[] buffer, int start, int length)
- {
- if (_rng == null) {
- _rng = RandomNumberGenerator.Create ();
- }
- byte[] random = new byte [length];
- _rng.GetBytes (random);
- Buffer.BlockCopy (random, 0, buffer, start, length);
- }
-
- private void ThrowBadPaddingException (PaddingMode padding, int length, int position)
- {
- string msg = String.Format (Locale.GetText ("Bad {0} padding."), padding);
- if (length >= 0)
- msg += String.Format (Locale.GetText (" Invalid length {0}."), length);
- if (position >= 0)
- msg += String.Format (Locale.GetText (" Error found at position {0}."), position);
- throw new CryptographicException (msg);
- }
-
- protected virtual byte[] FinalEncrypt (byte[] inputBuffer, int inputOffset, int inputCount)
- {
- // are there still full block to process ?
- int full = (inputCount / BlockSizeByte) * BlockSizeByte;
- int rem = inputCount - full;
- int total = full;
-
- switch (padmode) {
- case PaddingMode.ANSIX923:
- case PaddingMode.ISO10126:
- case PaddingMode.PKCS7:
- // we need to add an extra block for padding
- total += BlockSizeByte;
- break;
- default:
- if (inputCount == 0)
- return new byte [0];
- if (rem != 0) {
- if (padmode == PaddingMode.None)
- throw new CryptographicException ("invalid block length");
- // zero padding the input (by adding a block for the partial data)
- byte[] paddedInput = new byte [full + BlockSizeByte];
- Buffer.BlockCopy (inputBuffer, inputOffset, paddedInput, 0, inputCount);
- inputBuffer = paddedInput;
- inputOffset = 0;
- inputCount = paddedInput.Length;
- total = inputCount;
- }
- break;
- }
-
- byte[] res = new byte [total];
- int outputOffset = 0;
-
- // process all blocks except the last (final) block
- while (total > BlockSizeByte) {
- InternalTransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset);
- inputOffset += BlockSizeByte;
- outputOffset += BlockSizeByte;
- total -= BlockSizeByte;
- }
-
- // now we only have a single last block to encrypt
- byte padding = (byte) (BlockSizeByte - rem);
- switch (padmode) {
- case PaddingMode.ANSIX923:
- // XX 00 00 00 00 00 00 07 (zero + padding length)
- res [res.Length - 1] = padding;
- Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
- // the last padded block will be transformed in-place
- InternalTransformBlock (res, full, BlockSizeByte, res, full);
- break;
- case PaddingMode.ISO10126:
- // XX 3F 52 2A 81 AB F7 07 (random + padding length)
- Random (res, res.Length - padding, padding - 1);
- res [res.Length - 1] = padding;
- Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
- // the last padded block will be transformed in-place
- InternalTransformBlock (res, full, BlockSizeByte, res, full);
- break;
- case PaddingMode.PKCS7:
- // XX 07 07 07 07 07 07 07 (padding length)
- for (int i = res.Length; --i >= (res.Length - padding);)
- res [i] = padding;
- Buffer.BlockCopy (inputBuffer, inputOffset, res, full, rem);
- // the last padded block will be transformed in-place
- InternalTransformBlock (res, full, BlockSizeByte, res, full);
- break;
- default:
- InternalTransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset);
- break;
- }
- return res;
- }
-
- protected virtual byte[] FinalDecrypt (byte[] inputBuffer, int inputOffset, int inputCount)
- {
- int full = inputCount;
- int total = inputCount;
- if (lastBlock)
- total += BlockSizeByte;
-
- byte[] res = new byte [total];
- int outputOffset = 0;
-
- while (full > 0) {
- int len = InternalTransformBlock (inputBuffer, inputOffset, BlockSizeByte, res, outputOffset);
- inputOffset += BlockSizeByte;
- outputOffset += len;
- full -= BlockSizeByte;
- }
-
- if (lastBlock) {
- Transform (workBuff, workout);
- Buffer.BlockCopy (workout, 0, res, outputOffset, BlockSizeByte);
- outputOffset += BlockSizeByte;
- lastBlock = false;
- }
-
- // total may be 0 (e.g. PaddingMode.None)
- byte padding = ((total > 0) ? res [total - 1] : (byte) 0);
- switch (padmode) {
- case PaddingMode.ANSIX923:
- if ((padding == 0) || (padding > BlockSizeByte))
- ThrowBadPaddingException (padmode, padding, -1);
- for (int i = padding - 1; i > 0; i--) {
- if (res [total - 1 - i] != 0x00)
- ThrowBadPaddingException (padmode, -1, i);
- }
- total -= padding;
- break;
- case PaddingMode.ISO10126:
- if ((padding == 0) || (padding > BlockSizeByte))
- ThrowBadPaddingException (padmode, padding, -1);
- total -= padding;
- break;
- case PaddingMode.PKCS7:
- if ((padding == 0) || (padding > BlockSizeByte))
- ThrowBadPaddingException (padmode, padding, -1);
- for (int i = padding - 1; i > 0; i--) {
- if (res [total - 1 - i] != padding)
- ThrowBadPaddingException (padmode, -1, i);
- }
- total -= padding;
- break;
- case PaddingMode.None: // nothing to do - it's a multiple of block size
- case PaddingMode.Zeros: // nothing to do - user must unpad himself
- break;
- }
-
- // return output without padding
- if (total > 0) {
- byte[] data = new byte [total];
- Buffer.BlockCopy (res, 0, data, 0, total);
- // zeroize decrypted data (copy with padding)
- Array.Clear (res, 0, res.Length);
- return data;
- }
- else
- return new byte [0];
- }
-
- public virtual byte[] TransformFinalBlock (byte[] inputBuffer, int inputOffset, int inputCount)
- {
- if (m_disposed)
- throw new ObjectDisposedException ("Object is disposed");
- CheckInput (inputBuffer, inputOffset, inputCount);
-
- if (encrypt)
- return FinalEncrypt (inputBuffer, inputOffset, inputCount);
- else
- return FinalDecrypt (inputBuffer, inputOffset, inputCount);
- }
- }
-}
+++ /dev/null
-//
-// BasicConstraintsExtension.cs: Handles X.509 BasicConstrains extensions.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.X509;
-
-namespace Mono.Security.X509.Extensions {
-
- // References:
- // 1. RFC 3280: Internet X.509 Public Key Infrastructure, Section 4.2.1.10
- // http://www.ietf.org/rfc/rfc3280.txt
-
- /* id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 }
- *
- * BasicConstraints ::= SEQUENCE {
- * cA BOOLEAN DEFAULT FALSE,
- * pathLenConstraint INTEGER (0..MAX) OPTIONAL
- * }
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class BasicConstraintsExtension : X509Extension {
-
- public const int NoPathLengthConstraint = -1;
-
- private bool cA;
- private int pathLenConstraint;
-
- public BasicConstraintsExtension () : base ()
- {
- extnOid = "2.5.29.19";
- pathLenConstraint = NoPathLengthConstraint;
- }
-
- public BasicConstraintsExtension (ASN1 asn1) : base (asn1) {}
-
- public BasicConstraintsExtension (X509Extension extension) : base (extension) {}
-
- protected override void Decode ()
- {
- // default values
- cA = false;
- pathLenConstraint = NoPathLengthConstraint;
-
- ASN1 sequence = new ASN1 (extnValue.Value);
- if (sequence.Tag != 0x30)
- throw new ArgumentException ("Invalid BasicConstraints extension");
- int n = 0;
- ASN1 a = sequence [n++];
- if ((a != null) && (a.Tag == 0x01)) {
- cA = (a.Value [0] == 0xFF);
- a = sequence [n++];
- }
- if ((a != null) && (a.Tag == 0x02))
- pathLenConstraint = ASN1Convert.ToInt32 (a);
- }
-
- protected override void Encode ()
- {
- ASN1 seq = new ASN1 (0x30);
- if (cA)
- seq.Add (new ASN1 (0x01, new byte[] { 0xFF }));
- // CAs MUST NOT include the pathLenConstraint field unless the cA boolean is asserted
- if (cA && (pathLenConstraint >= 0))
- seq.Add (ASN1Convert.FromInt32 (pathLenConstraint));
-
- extnValue = new ASN1 (0x04);
- extnValue.Add (seq);
- }
-
- public bool CertificateAuthority {
- get { return cA; }
- set { cA = value; }
- }
-
- public override string Name {
- get { return "Basic Constraints"; }
- }
-
- public int PathLenConstraint {
- get { return pathLenConstraint; }
- set {
- if (value < NoPathLengthConstraint) {
- string msg = Locale.GetText ("PathLenConstraint must be positive or -1 for none ({0}).", value);
- throw new ArgumentOutOfRangeException (msg);
- }
- pathLenConstraint = value;
- }
- }
-
- public override string ToString ()
- {
- StringBuilder sb = new StringBuilder ();
- sb.Append ("Subject Type=");
- sb.Append ((cA) ? "CA" : "End Entity");
- sb.Append (Environment.NewLine);
- sb.Append ("Path Length Constraint=");
- if (pathLenConstraint == NoPathLengthConstraint)
- sb.Append ("None");
- else
- sb.Append (pathLenConstraint.ToString (CultureInfo.InvariantCulture));
- sb.Append (Environment.NewLine);
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-2006-01-04 Sebastien Pouliot <sebastien@ximian.com>
-
- * BasicConstraintsExtension.cs: Keep in sync with Mono.Security.dll.
- * KeyUsageExtension.cs: Keep in sync with Mono.Security.dll.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * BasicConstaintExtension.cs: New in corlib. In sync with
- Mono.Security.dll version.
- * KeyUsageExtension.cs: New in corlib. In sync with Mono.Security.dll
- version.
- * SubjectKeyIdentifierExtension.cs: New in corlib. In sync with
- Mono.Security.dll version.
+++ /dev/null
-//
-// KeyUsageExtension.cs: Handles X.509 KeyUsage extensions.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.X509;
-
-namespace Mono.Security.X509.Extensions {
-
- /*
- * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 }
- *
- * KeyUsage ::= BIT STRING {
- * digitalSignature (0),
- * nonRepudiation (1),
- * keyEncipherment (2),
- * dataEncipherment (3),
- * keyAgreement (4),
- * keyCertSign (5),
- * cRLSign (6),
- * encipherOnly (7),
- * decipherOnly (8)
- * }
- */
- // note: because nothing is simple in ASN.1 bits are reversed
- [Flags]
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- enum KeyUsages {
- digitalSignature = 0x80,
- nonRepudiation = 0x40,
- keyEncipherment = 0x20,
- dataEncipherment = 0x10,
- keyAgreement = 0x08,
- keyCertSign = 0x04,
- cRLSign = 0x02,
- encipherOnly = 0x01,
- decipherOnly = 0x800,
- none = 0x0
- }
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class KeyUsageExtension : X509Extension {
-
- private int kubits;
-
- public KeyUsageExtension (ASN1 asn1) : base (asn1) {}
-
- public KeyUsageExtension (X509Extension extension) : base (extension) {}
-
- public KeyUsageExtension () : base ()
- {
- extnOid = "2.5.29.15";
- }
-
- protected override void Decode ()
- {
- ASN1 bitString = new ASN1 (extnValue.Value);
- if (bitString.Tag != 0x03)
- throw new ArgumentException ("Invalid KeyUsage extension");
- int i = 1; // byte zero has the number of unused bits (ASN1's BITSTRING)
- while (i < bitString.Value.Length)
- kubits = (kubits << 8) + bitString.Value [i++];
- }
-
- protected override void Encode ()
- {
- extnValue = new ASN1 (0x04);
-
- ushort ku = (ushort) kubits;
- byte unused = 16;
- if (ku > 0) {
- // count the unused bits
- for (unused = 15; unused > 0; unused--) {
- if ((ku & 0x8000) == 0x8000)
- break;
- ku <<= 1;
- }
-
- if (kubits > Byte.MaxValue) {
- unused -= 8;
- extnValue.Add (new ASN1 (0x03, new byte[] { unused, (byte) kubits, (byte) (kubits >> 8) }));
- } else {
- extnValue.Add (new ASN1 (0x03, new byte[] { unused, (byte) kubits }));
- }
- } else {
- // note: a BITSTRING with a 0 length is invalid (in ASN.1), so would an
- // empty OCTETSTRING (at the parent level) so we're encoding a 0
- extnValue.Add (new ASN1 (0x03, new byte[] { 7, 0 }));
- }
- }
-
- public KeyUsages KeyUsage {
- get { return (KeyUsages) kubits; }
- set { kubits = Convert.ToInt32 (value, CultureInfo.InvariantCulture); }
- }
-
- public override string Name {
- get { return "Key Usage"; }
- }
-
- public bool Support (KeyUsages usage)
- {
- int x = Convert.ToInt32 (usage, CultureInfo.InvariantCulture);
- return ((x & kubits) == x);
- }
-
- public override string ToString ()
- {
- const string separator = " , ";
- StringBuilder sb = new StringBuilder ();
- if (Support (KeyUsages.digitalSignature))
- sb.Append ("Digital Signature");
- if (Support (KeyUsages.nonRepudiation)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Non-Repudiation");
- }
- if (Support (KeyUsages.keyEncipherment)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Key Encipherment");
- }
- if (Support (KeyUsages.dataEncipherment)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Data Encipherment");
- }
- if (Support (KeyUsages.keyAgreement)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Key Agreement");
- }
- if (Support (KeyUsages.keyCertSign)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Certificate Signing");
- }
- if (Support (KeyUsages.cRLSign)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("CRL Signing");
- }
- if (Support (KeyUsages.encipherOnly)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Encipher Only "); // ???
- }
- if (Support (KeyUsages.decipherOnly)) {
- if (sb.Length > 0)
- sb.Append (separator);
- sb.Append ("Decipher Only"); // ???
- }
- sb.Append ("(");
- sb.Append (kubits.ToString ("X2", CultureInfo.InvariantCulture));
- sb.Append (")");
- sb.Append (Environment.NewLine);
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-//
-// SubjectKeyIdentifierExtension.cs: Handles X.509 SubjectKeyIdentifier extensions.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 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.Globalization;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.X509;
-
-namespace Mono.Security.X509.Extensions {
-
- /*
- * id-ce-subjectKeyIdentifier OBJECT IDENTIFIER ::= { id-ce 14 }
- *
- * SubjectKeyIdentifier ::= KeyIdentifier
- *
- * KeyIdentifier ::= OCTET STRING
- */
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class SubjectKeyIdentifierExtension : X509Extension {
-
- private byte[] ski;
-
- public SubjectKeyIdentifierExtension () : base ()
- {
- extnOid = "2.5.29.14";
- }
-
- public SubjectKeyIdentifierExtension (ASN1 asn1) : base (asn1)
- {
- }
-
- public SubjectKeyIdentifierExtension (X509Extension extension) : base (extension)
- {
- }
-
- protected override void Decode ()
- {
- ASN1 sequence = new ASN1 (extnValue.Value);
- if (sequence.Tag != 0x04)
- throw new ArgumentException ("Invalid SubjectKeyIdentifier extension");
- ski = sequence.Value;
- }
-
- public override string Name {
- get { return "Subject Key Identifier"; }
- }
-
- public byte[] Identifier {
- get {
- if (ski == null)
- return null;
- return (byte[]) ski.Clone ();
- }
- }
-
- public override string ToString ()
- {
- if (ski == null)
- return null;
-
- StringBuilder sb = new StringBuilder ();
- int x = 0;
- while (x < ski.Length) {
- sb.Append (ski [x].ToString ("X2", CultureInfo.InvariantCulture));
- if (x % 2 == 1)
- sb.Append (" ");
- x++;
- }
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-2010-05-10 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509CertificateCollection.cs:
- * X509Certificate.cs:
- * X509Extension.cs:
- * X509Extensions.cs:
- Keep them public for Moonlight. Other types in other
- assemblies needs it and the linker will eventually
- internalize everything.
-
-2010-03-16 Jb Evain <jbevain@novell.com>
-
- * X509Certificate.cs: use MOONLIGHT symbol to disambiguate
- MonoTouch and Moonlight code.
-
-2009-04-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Adapt to work with only [DSA|RSA]Managed when
- built for NET_2_1, i.e. remove use of [DSA|RSA]CryptoServiceProvider
-
-2008-09-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS12.cs, X509Store.cs: Use File.Create instead of OpenWrite to
- make sure nothing else if left at the end of the file. Issue reported
- by Christophe Chevalier.
-
-2008-06-03 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Accept text before the PEM certificate itself.
- [Fix bug #396486]
-
-2008-01-10 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS12.cs, X509Certificate.cs, X509Chain.cs, X509Extension.cs:
- Synchronize/update with Mono.Security assembly
-
-2006-12-14 Sebastien Pouliot <sebastien@ximian.com>
-
- * X501Name.cs: Added support for (some cases of) T.61 strings, like
- the latin-1 encoded accentued characters founds in some DN. Fix bug
- #77295.
-
-2006-12-11 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS12.cs: Synchronize source with Mono.Security.dll
- * X501Name.cs: Synchronize source with Mono.Security.dll
- * X509Certificate.cs: Synchronize source with Mono.Security.dll
- * X509CRL.cs: Synchronize source with Mono.Security.dll
- * X509Store.cs: Synchronize source with Mono.Security.dll
- * X509Stores.cs: Synchronize source with Mono.Security.dll
- * X520Attributes.cs: Synchronize source with Mono.Security.dll
-
-2006-11-13 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Add support for PEM encoded (base64) x.509
- certificates (supported in 2.0).
-
-2006-11-08 Sebastien Pouliot <sebastien@ximian.com>
-
- * X501Name.cs: Refactor ToString method to allow most options available
- when using fx 2.0.
- * X509Certificate.cs: Add methods to retrieve the Issuer and Subject
- Distinguished Names in binary (ASN.1) form. Reverse (actually correct)
- the text representation of Issuer and Subject for 2.0.
- * X520Attributes.cs: Keep in sync with latest version from
- Mono.Security.dll assembly (required for X501Name update).
-
-2006-10-08 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS12.cs: Synch implementation with Mono.Security.dll. Fix bug
- #79617.
-
-2006-09-05 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Keep in sync with Mono.Security.dll (#79262).
-
-2006-01-04 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Extension.cs: Keep in sync with Mono.Security.dll.
-
-2005-11-18 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Extension.cs: Keep in sync with Mono.Security.dll.
-
-2005-10-11 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Fixed bug #76407. ValidFrom and ValidUntil are
- local date/time so IsCurrent most also use a local date/time.
- * X509CRL.cs: Updated from Mono.Security.dll (same IsCurrent problem
- and another previously fixed bug).
-
-2005-09-09 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Fixed version property (bug #76012). Added
- ISerializable (for 2.0 so we're not breaking current compatibility).
-
-2005-04-27 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS12.cs: New. Copied from Mono.Security.dll to allow support of
- PKCS#12 files in X509Certificate for 2.0.
- * X509Certificate.cs: Added new features required to support 2.0.
-
-2005-02-25 Sebastien Pouliot <sebastien@ximian.com>
-
- * X501Name.cs: In sync with Mono.Security.dll version.
- * X520Attributes.cs: In sync with Mono.Security.dll version.
-
-2005-01-10 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Fixed NullReferenceException when asking for
- data that wasn't a proper X.509 certificate.
-
-2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Fixed warning (l4) for unused variable.
- * X509Extension.cs: Fixed warning (l4) for unused variable.
-
-2004-09-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Chain.cs: Merge from Mono.Security. Fix two bugs (chain
- construction from collection) and Reset-ing empty chain.
-
-2004-05-27 Sebastien Pouliot <sebastien@ximian.com>
-
- * X509Certificate.cs: Rethrow original exception when parsing X.509
- certificates (inside a CryptographicException) so people can see if
- their changes affects certificate decoding.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * X501Name.cs: In sync with Mono.Security.dll version.
- * X509CRL.cs: New in corlib. In sync with Mono.Security.dll version.
- * X509Certificate.cs: In sync with Mono.Security.dll version.
- * X509CertificateCollection.cs: In sync with Mono.Security.dll version.
- * X509Chain.cs: In sync with Mono.Security.dll version.
- * X509ChainStatusFlag.cs: New in corlib. In sync with Mono.Security.dll
- version.
- * X509Extension.cs: In sync with Mono.Security.dll version.
- * X509Extensions.cs: In sync with Mono.Security.dll version.
- * X509Store.cs: New in corlib. In sync with Mono.Security.dll version.
- * X509StoreManager.cs: New in corlib. In sync with Mono.Security.dll version.
- * X509Stores.cs: New in corlib. In sync with Mono.Security.dll version.
- * X520Attributes.cs: In sync with Mono.Security.dll version.
-
-2003-12-15 Sebastien Pouliot <spouliot@videotron.ca>
-
- * TrustAnchors.cs: Added a new trusted root, Thawte, for code signing.
-
-2003-10-12 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ITrustAnchors.cs: Added from Mono.Security assembly to
- support Authenticode in X509Certificate.CreateFromSignedFile
- * TestAnchors.cs: Added from Mono.Security assembly to
- support Authenticode in X509Certificate.CreateFromSignedFile
- * TrustAnchors.cs: Added from Mono.Security assembly to
- support Authenticode in X509Certificate.CreateFromSignedFile
- * X509CertificateCollection.cs: Added from Mono.Security assembly to
- support Authenticode in X509Certificate.CreateFromSignedFile
- * X509Chain.cs: Added from Mono.Security assembly to
- support Authenticode in X509Certificate.CreateFromSignedFile
-
-2003-05-16 Sebastien Pouliot <spouliot@videotron.ca>
-
- * X509Certificate.cs: Added support for "really" NULL key parameters
- (i.e. not ASN.1 encoded NULL).
-
-2003-03-15 Sebastien Pouliot <spouliot@videotron.ca>
-
- * X501Name.cs: New. X.501 Distinguished Names stuff
- * X509Certificate.cs: New. A more complete class to handle X.509
- certificates.
- * X509Extension.cs: New. A base class for all X.509 extensions.
- * X509Extensions.cs: New. X509Extension collection.
- * X520Attributes.cs: New. X.520 attributes (mainly for X501 names)
+++ /dev/null
-//
-// ITrustAnchors.cs: Trust Anchors Interface
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- interface ITrustAnchors
- {
- X509CertificateCollection Anchors { get; }
- }
-}
+++ /dev/null
-//
-// PKCS12.cs: PKCS 12 - Personal Information Exchange Syntax
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004,2005,2006 Novell Inc. (http://www.novell.com)
-//
-// Key derivation translated from Bouncy Castle JCE (http://www.bouncycastle.org/)
-// See bouncycastle.txt for license.
-//
-// 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;
-using System.IO;
-using System.Security.Cryptography;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.Cryptography;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class PKCS5 {
-
- public const string pbeWithMD2AndDESCBC = "1.2.840.113549.1.5.1";
- public const string pbeWithMD5AndDESCBC = "1.2.840.113549.1.5.3";
- public const string pbeWithMD2AndRC2CBC = "1.2.840.113549.1.5.4";
- public const string pbeWithMD5AndRC2CBC = "1.2.840.113549.1.5.6";
- public const string pbeWithSHA1AndDESCBC = "1.2.840.113549.1.5.10";
- public const string pbeWithSHA1AndRC2CBC = "1.2.840.113549.1.5.11";
-
- public PKCS5 () {}
- }
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class PKCS9 {
-
- public const string friendlyName = "1.2.840.113549.1.9.20";
- public const string localKeyId = "1.2.840.113549.1.9.21";
-
- public PKCS9 () {}
- }
-
-
- internal class SafeBag {
- private string _bagOID;
- private ASN1 _asn1;
-
- public SafeBag(string bagOID, ASN1 asn1) {
- _bagOID = bagOID;
- _asn1 = asn1;
- }
-
- public string BagOID {
- get { return _bagOID; }
- }
-
- public ASN1 ASN1 {
- get { return _asn1; }
- }
- }
-
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class PKCS12 : ICloneable {
-
- public const string pbeWithSHAAnd128BitRC4 = "1.2.840.113549.1.12.1.1";
- public const string pbeWithSHAAnd40BitRC4 = "1.2.840.113549.1.12.1.2";
- public const string pbeWithSHAAnd3KeyTripleDESCBC = "1.2.840.113549.1.12.1.3";
- public const string pbeWithSHAAnd2KeyTripleDESCBC = "1.2.840.113549.1.12.1.4";
- public const string pbeWithSHAAnd128BitRC2CBC = "1.2.840.113549.1.12.1.5";
- public const string pbeWithSHAAnd40BitRC2CBC = "1.2.840.113549.1.12.1.6";
-
- // bags
- public const string keyBag = "1.2.840.113549.1.12.10.1.1";
- public const string pkcs8ShroudedKeyBag = "1.2.840.113549.1.12.10.1.2";
- public const string certBag = "1.2.840.113549.1.12.10.1.3";
- public const string crlBag = "1.2.840.113549.1.12.10.1.4";
- public const string secretBag = "1.2.840.113549.1.12.10.1.5";
- public const string safeContentsBag = "1.2.840.113549.1.12.10.1.6";
-
- // types
- public const string x509Certificate = "1.2.840.113549.1.9.22.1";
- public const string sdsiCertificate = "1.2.840.113549.1.9.22.2";
- public const string x509Crl = "1.2.840.113549.1.9.23.1";
-
- // Adapted from BouncyCastle PKCS12ParametersGenerator.java
- public class DeriveBytes {
-
- public enum Purpose {
- Key,
- IV,
- MAC
- }
-
- static private byte[] keyDiversifier = { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 };
- static private byte[] ivDiversifier = { 2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2 };
- static private byte[] macDiversifier = { 3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3 };
-
- private string _hashName;
- private int _iterations;
- private byte[] _password;
- private byte[] _salt;
-
- public DeriveBytes () {}
-
- public string HashName {
- get { return _hashName; }
- set { _hashName = value; }
- }
-
- public int IterationCount {
- get { return _iterations; }
- set { _iterations = value; }
- }
-
- public byte[] Password {
- get { return (byte[]) _password.Clone (); }
- set {
- if (value == null)
- _password = new byte [0];
- else
- _password = (byte[]) value.Clone ();
- }
- }
-
- public byte[] Salt {
- get { return (byte[]) _salt.Clone (); }
- set {
- if (value != null)
- _salt = (byte[]) value.Clone ();
- else
- _salt = null;
- }
- }
-
- private void Adjust (byte[] a, int aOff, byte[] b)
- {
- int x = (b[b.Length - 1] & 0xff) + (a [aOff + b.Length - 1] & 0xff) + 1;
-
- a [aOff + b.Length - 1] = (byte) x;
- x >>= 8;
-
- for (int i = b.Length - 2; i >= 0; i--) {
- x += (b [i] & 0xff) + (a [aOff + i] & 0xff);
- a [aOff + i] = (byte) x;
- x >>= 8;
- }
- }
-
- private byte[] Derive (byte[] diversifier, int n)
- {
- HashAlgorithm digest = HashAlgorithm.Create (_hashName);
- int u = (digest.HashSize >> 3); // div 8
- int v = 64;
- byte[] dKey = new byte [n];
-
- byte[] S;
- if ((_salt != null) && (_salt.Length != 0)) {
- S = new byte[v * ((_salt.Length + v - 1) / v)];
-
- for (int i = 0; i != S.Length; i++) {
- S[i] = _salt[i % _salt.Length];
- }
- }
- else {
- S = new byte[0];
- }
-
- byte[] P;
- if ((_password != null) && (_password.Length != 0)) {
- P = new byte[v * ((_password.Length + v - 1) / v)];
-
- for (int i = 0; i != P.Length; i++) {
- P[i] = _password[i % _password.Length];
- }
- }
- else {
- P = new byte[0];
- }
-
- byte[] I = new byte [S.Length + P.Length];
-
- Buffer.BlockCopy (S, 0, I, 0, S.Length);
- Buffer.BlockCopy (P, 0, I, S.Length, P.Length);
-
- byte[] B = new byte[v];
- int c = (n + u - 1) / u;
-
- for (int i = 1; i <= c; i++) {
- digest.TransformBlock (diversifier, 0, diversifier.Length, diversifier, 0);
- digest.TransformFinalBlock (I, 0, I.Length);
- byte[] A = digest.Hash;
- digest.Initialize ();
- for (int j = 1; j != _iterations; j++) {
- A = digest.ComputeHash (A, 0, A.Length);
- }
-
- for (int j = 0; j != B.Length; j++) {
- B [j] = A [j % A.Length];
- }
-
- for (int j = 0; j != I.Length / v; j++) {
- Adjust (I, j * v, B);
- }
-
- if (i == c) {
- Buffer.BlockCopy(A, 0, dKey, (i - 1) * u, dKey.Length - ((i - 1) * u));
- }
- else {
- Buffer.BlockCopy(A, 0, dKey, (i - 1) * u, A.Length);
- }
- }
-
- return dKey;
- }
-
- public byte[] DeriveKey (int size)
- {
- return Derive (keyDiversifier, size);
- }
-
- public byte[] DeriveIV (int size)
- {
- return Derive (ivDiversifier, size);
- }
-
- public byte[] DeriveMAC (int size)
- {
- return Derive (macDiversifier, size);
- }
- }
-
- const int recommendedIterationCount = 2000;
-
- //private int _version;
- private byte[] _password;
- private ArrayList _keyBags;
- private ArrayList _secretBags;
- private X509CertificateCollection _certs;
- private bool _keyBagsChanged;
- private bool _secretBagsChanged;
- private bool _certsChanged;
- private int _iterations;
- private ArrayList _safeBags;
- private RandomNumberGenerator _rng;
-
- // constructors
-
- public PKCS12 ()
- {
- _iterations = recommendedIterationCount;
- _keyBags = new ArrayList ();
- _secretBags = new ArrayList ();
- _certs = new X509CertificateCollection ();
- _keyBagsChanged = false;
- _secretBagsChanged = false;
- _certsChanged = false;
- _safeBags = new ArrayList ();
- }
-
- public PKCS12 (byte[] data)
- : this ()
- {
- Password = null;
- Decode (data);
- }
-
- /*
- * PFX ::= SEQUENCE {
- * version INTEGER {v3(3)}(v3,...),
- * authSafe ContentInfo,
- * macData MacData OPTIONAL
- * }
- *
- * MacData ::= SEQUENCE {
- * mac DigestInfo,
- * macSalt OCTET STRING,
- * iterations INTEGER DEFAULT 1
- * -- Note: The default is for historical reasons and its use is deprecated. A higher
- * -- value, like 1024 is recommended.
- * }
- *
- * SafeContents ::= SEQUENCE OF SafeBag
- *
- * SafeBag ::= SEQUENCE {
- * bagId BAG-TYPE.&id ({PKCS12BagSet}),
- * bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}),
- * bagAttributes SET OF PKCS12Attribute OPTIONAL
- * }
- */
- public PKCS12 (byte[] data, string password)
- : this ()
- {
- Password = password;
- Decode (data);
- }
-
- public PKCS12 (byte[] data, byte[] password)
- : this ()
- {
- _password = password;
- Decode (data);
- }
-
- private void Decode (byte[] data)
- {
- ASN1 pfx = new ASN1 (data);
- if (pfx.Tag != 0x30)
- throw new ArgumentException ("invalid data");
-
- ASN1 version = pfx [0];
- if (version.Tag != 0x02)
- throw new ArgumentException ("invalid PFX version");
- //_version = version.Value [0];
-
- PKCS7.ContentInfo authSafe = new PKCS7.ContentInfo (pfx [1]);
- if (authSafe.ContentType != PKCS7.Oid.data)
- throw new ArgumentException ("invalid authenticated safe");
-
- // now that we know it's a PKCS#12 file, check the (optional) MAC
- // before decoding anything else in the file
- if (pfx.Count > 2) {
- ASN1 macData = pfx [2];
- if (macData.Tag != 0x30)
- throw new ArgumentException ("invalid MAC");
-
- ASN1 mac = macData [0];
- if (mac.Tag != 0x30)
- throw new ArgumentException ("invalid MAC");
- ASN1 macAlgorithm = mac [0];
- string macOid = ASN1Convert.ToOid (macAlgorithm [0]);
- if (macOid != "1.3.14.3.2.26")
- throw new ArgumentException ("unsupported HMAC");
- byte[] macValue = mac [1].Value;
-
- ASN1 macSalt = macData [1];
- if (macSalt.Tag != 0x04)
- throw new ArgumentException ("missing MAC salt");
-
- _iterations = 1; // default value
- if (macData.Count > 2) {
- ASN1 iters = macData [2];
- if (iters.Tag != 0x02)
- throw new ArgumentException ("invalid MAC iteration");
- _iterations = ASN1Convert.ToInt32 (iters);
- }
-
- byte[] authSafeData = authSafe.Content [0].Value;
- byte[] calculatedMac = MAC (_password, macSalt.Value, _iterations, authSafeData);
- if (!Compare (macValue, calculatedMac))
- throw new CryptographicException ("Invalid MAC - file may have been tampered!");
- }
-
- // we now returns to our original presentation - PFX
- ASN1 authenticatedSafe = new ASN1 (authSafe.Content [0].Value);
- for (int i=0; i < authenticatedSafe.Count; i++) {
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo (authenticatedSafe [i]);
- switch (ci.ContentType) {
- case PKCS7.Oid.data:
- // unencrypted (by PKCS#12)
- ASN1 safeContents = new ASN1 (ci.Content [0].Value);
- for (int j=0; j < safeContents.Count; j++) {
- ASN1 safeBag = safeContents [j];
- ReadSafeBag (safeBag);
- }
- break;
- case PKCS7.Oid.encryptedData:
- // password encrypted
- PKCS7.EncryptedData ed = new PKCS7.EncryptedData (ci.Content [0]);
- ASN1 decrypted = new ASN1 (Decrypt (ed));
- for (int j=0; j < decrypted.Count; j++) {
- ASN1 safeBag = decrypted [j];
- ReadSafeBag (safeBag);
- }
- break;
- case PKCS7.Oid.envelopedData:
- // public key encrypted
- throw new NotImplementedException ("public key encrypted");
- default:
- throw new ArgumentException ("unknown authenticatedSafe");
- }
- }
- }
-
- ~PKCS12 ()
- {
- if (_password != null) {
- Array.Clear (_password, 0, _password.Length);
- }
- _password = null;
- }
-
- // properties
-
- public string Password {
- set {
- if (value != null) {
- if (value.Length > 0) {
- int size = value.Length;
- int nul = 0;
- if (size < MaximumPasswordLength) {
- // if not present, add space for a NULL (0x00) character
- if (value[size - 1] != 0x00)
- nul = 1;
- } else {
- size = MaximumPasswordLength;
- }
- _password = new byte[(size + nul) << 1]; // double for unicode
- Encoding.BigEndianUnicode.GetBytes (value, 0, size, _password, 0);
- } else {
- // double-byte (Unicode) NULL (0x00) - see bug #79617
- _password = new byte[2];
- }
- } else {
- // no password
- _password = null;
- }
- }
- }
-
- public int IterationCount {
- get { return _iterations; }
- set { _iterations = value; }
- }
-
- public ArrayList Keys {
- get {
- if (_keyBagsChanged) {
- _keyBags.Clear ();
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (keyBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (bagValue.Value);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p));
- break;
- case 0x30:
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeRSA (privateKey));
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
-
- } else if (sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (decrypted);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p));
- break;
- case 0x30:
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeRSA (privateKey));
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- Array.Clear (decrypted, 0, decrypted.Length);
- }
- }
- _keyBagsChanged = false;
- }
- return ArrayList.ReadOnly(_keyBags);
- }
- }
-
- public ArrayList Secrets {
- get {
- if (_secretBagsChanged) {
- _secretBags.Clear ();
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (secretBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- byte[] secret = bagValue.Value;
- _secretBags.Add(secret);
- }
- }
- _secretBagsChanged = false;
- }
- return ArrayList.ReadOnly(_secretBags);
- }
- }
-
- public X509CertificateCollection Certificates {
- get {
- if (_certsChanged) {
- _certs.Clear ();
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo cert = new PKCS7.ContentInfo (bagValue.Value);
- _certs.Add (new X509Certificate (cert.Content [0].Value));
- }
- }
- _certsChanged = false;
- }
- return _certs;
- }
- }
-
- internal RandomNumberGenerator RNG {
- get {
- if (_rng == null)
- _rng = RandomNumberGenerator.Create ();
- return _rng;
- }
- }
-
- // private methods
-
- private bool Compare (byte[] expected, byte[] actual)
- {
- bool compare = false;
- if (expected.Length == actual.Length) {
- for (int i=0; i < expected.Length; i++) {
- if (expected [i] != actual [i])
- return false;
- }
- compare = true;
- }
- return compare;
- }
-
- private SymmetricAlgorithm GetSymmetricAlgorithm (string algorithmOid, byte[] salt, int iterationCount)
- {
- string algorithm = null;
- int keyLength = 8; // 64 bits (default)
- int ivLength = 8; // 64 bits (default)
-
- PKCS12.DeriveBytes pd = new PKCS12.DeriveBytes ();
- pd.Password = _password;
- pd.Salt = salt;
- pd.IterationCount = iterationCount;
-
- switch (algorithmOid) {
- case PKCS5.pbeWithMD2AndDESCBC: // no unit test available
- pd.HashName = "MD2";
- algorithm = "DES";
- break;
- case PKCS5.pbeWithMD5AndDESCBC: // no unit test available
- pd.HashName = "MD5";
- algorithm = "DES";
- break;
- case PKCS5.pbeWithMD2AndRC2CBC: // no unit test available
- // TODO - RC2-CBC-Parameter (PKCS5)
- // if missing default to 32 bits !!!
- pd.HashName = "MD2";
- algorithm = "RC2";
- keyLength = 4; // default
- break;
- case PKCS5.pbeWithMD5AndRC2CBC: // no unit test available
- // TODO - RC2-CBC-Parameter (PKCS5)
- // if missing default to 32 bits !!!
- pd.HashName = "MD5";
- algorithm = "RC2";
- keyLength = 4; // default
- break;
- case PKCS5.pbeWithSHA1AndDESCBC: // no unit test available
- pd.HashName = "SHA1";
- algorithm = "DES";
- break;
- case PKCS5.pbeWithSHA1AndRC2CBC: // no unit test available
- // TODO - RC2-CBC-Parameter (PKCS5)
- // if missing default to 32 bits !!!
- pd.HashName = "SHA1";
- algorithm = "RC2";
- keyLength = 4; // default
- break;
- case PKCS12.pbeWithSHAAnd128BitRC4: // no unit test available
- pd.HashName = "SHA1";
- algorithm = "RC4";
- keyLength = 16;
- ivLength = 0; // N/A
- break;
- case PKCS12.pbeWithSHAAnd40BitRC4: // no unit test available
- pd.HashName = "SHA1";
- algorithm = "RC4";
- keyLength = 5;
- ivLength = 0; // N/A
- break;
- case PKCS12.pbeWithSHAAnd3KeyTripleDESCBC:
- pd.HashName = "SHA1";
- algorithm = "TripleDES";
- keyLength = 24;
- break;
- case PKCS12.pbeWithSHAAnd2KeyTripleDESCBC: // no unit test available
- pd.HashName = "SHA1";
- algorithm = "TripleDES";
- keyLength = 16;
- break;
- case PKCS12.pbeWithSHAAnd128BitRC2CBC: // no unit test available
- pd.HashName = "SHA1";
- algorithm = "RC2";
- keyLength = 16;
- break;
- case PKCS12.pbeWithSHAAnd40BitRC2CBC:
- pd.HashName = "SHA1";
- algorithm = "RC2";
- keyLength = 5;
- break;
- default:
- throw new NotSupportedException ("unknown oid " + algorithm);
- }
-
- SymmetricAlgorithm sa = SymmetricAlgorithm.Create (algorithm);
- sa.Key = pd.DeriveKey (keyLength);
- // IV required only for block ciphers (not stream ciphers)
- if (ivLength > 0) {
- sa.IV = pd.DeriveIV (ivLength);
- sa.Mode = CipherMode.CBC;
- }
- return sa;
- }
-
- public byte[] Decrypt (string algorithmOid, byte[] salt, int iterationCount, byte[] encryptedData)
- {
- SymmetricAlgorithm sa = null;
- byte[] result = null;
- try {
- sa = GetSymmetricAlgorithm (algorithmOid, salt, iterationCount);
- ICryptoTransform ct = sa.CreateDecryptor ();
- result = ct.TransformFinalBlock (encryptedData, 0, encryptedData.Length);
- }
- finally {
- if (sa != null)
- sa.Clear ();
- }
- return result;
- }
-
- public byte[] Decrypt (PKCS7.EncryptedData ed)
- {
- return Decrypt (ed.EncryptionAlgorithm.ContentType,
- ed.EncryptionAlgorithm.Content [0].Value,
- ASN1Convert.ToInt32 (ed.EncryptionAlgorithm.Content [1]),
- ed.EncryptedContent);
- }
-
- public byte[] Encrypt (string algorithmOid, byte[] salt, int iterationCount, byte[] data)
- {
- byte[] result = null;
- using (SymmetricAlgorithm sa = GetSymmetricAlgorithm (algorithmOid, salt, iterationCount)) {
- ICryptoTransform ct = sa.CreateEncryptor ();
- result = ct.TransformFinalBlock (data, 0, data.Length);
- }
- return result;
- }
-
- private DSAParameters GetExistingParameters (out bool found)
- {
- foreach (X509Certificate cert in Certificates) {
- // FIXME: that won't work if parts of the parameters are missing
- if (cert.KeyAlgorithmParameters != null) {
- DSA dsa = cert.DSA;
- if (dsa != null) {
- found = true;
- return dsa.ExportParameters (false);
- }
- }
- }
- found = false;
- return new DSAParameters ();
- }
-
- private void AddPrivateKey (PKCS8.PrivateKeyInfo pki)
- {
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- bool found;
- DSAParameters p = GetExistingParameters (out found);
- if (found) {
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p));
- }
- break;
- case 0x30:
- _keyBags.Add (PKCS8.PrivateKeyInfo.DecodeRSA (privateKey));
- break;
- default:
- Array.Clear (privateKey, 0, privateKey.Length);
- throw new CryptographicException ("Unknown private key format");
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- }
-
- private void ReadSafeBag (ASN1 safeBag)
- {
- if (safeBag.Tag != 0x30)
- throw new ArgumentException ("invalid safeBag");
-
- ASN1 bagId = safeBag [0];
- if (bagId.Tag != 0x06)
- throw new ArgumentException ("invalid safeBag id");
-
- ASN1 bagValue = safeBag [1];
- string oid = ASN1Convert.ToOid (bagId);
- switch (oid) {
- case keyBag:
- // NEED UNIT TEST
- AddPrivateKey (new PKCS8.PrivateKeyInfo (bagValue.Value));
- break;
- case pkcs8ShroudedKeyBag:
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- AddPrivateKey (new PKCS8.PrivateKeyInfo (decrypted));
- Array.Clear (decrypted, 0, decrypted.Length);
- break;
- case certBag:
- PKCS7.ContentInfo cert = new PKCS7.ContentInfo (bagValue.Value);
- if (cert.ContentType != x509Certificate)
- throw new NotSupportedException ("unsupport certificate type");
- X509Certificate x509 = new X509Certificate (cert.Content [0].Value);
- _certs.Add (x509);
- break;
- case crlBag:
- // TODO
- break;
- case secretBag:
- byte[] secret = bagValue.Value;
- _secretBags.Add(secret);
- break;
- case safeContentsBag:
- // TODO - ? recurse ?
- break;
- default:
- throw new ArgumentException ("unknown safeBag oid");
- }
-
- if (safeBag.Count > 2) {
- ASN1 bagAttributes = safeBag [2];
- if (bagAttributes.Tag != 0x31)
- throw new ArgumentException ("invalid safeBag attributes id");
-
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes[i];
-
- if (pkcs12Attribute.Tag != 0x30)
- throw new ArgumentException ("invalid PKCS12 attributes id");
-
- ASN1 attrId = pkcs12Attribute [0];
- if (attrId.Tag != 0x06)
- throw new ArgumentException ("invalid attribute id");
-
- string attrOid = ASN1Convert.ToOid (attrId);
-
- ASN1 attrValues = pkcs12Attribute[1];
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues[j];
-
- switch (attrOid) {
- case PKCS9.friendlyName:
- if (attrValue.Tag != 0x1e)
- throw new ArgumentException ("invalid attribute value id");
- break;
- case PKCS9.localKeyId:
- if (attrValue.Tag != 0x04)
- throw new ArgumentException ("invalid attribute value id");
- break;
- default:
- // Unknown OID -- don't check Tag
- break;
- }
- }
- }
- }
-
- _safeBags.Add (new SafeBag(oid, safeBag));
- }
-
- private ASN1 Pkcs8ShroudedKeyBagSafeBag (AsymmetricAlgorithm aa, IDictionary attributes)
- {
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo ();
- if (aa is RSA) {
- pki.Algorithm = "1.2.840.113549.1.1.1";
- pki.PrivateKey = PKCS8.PrivateKeyInfo.Encode ((RSA)aa);
- }
- else if (aa is DSA) {
- pki.Algorithm = null;
- pki.PrivateKey = PKCS8.PrivateKeyInfo.Encode ((DSA)aa);
- }
- else
- throw new CryptographicException ("Unknown asymmetric algorithm {0}", aa.ToString ());
-
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo ();
- epki.Algorithm = pbeWithSHAAnd3KeyTripleDESCBC;
- epki.IterationCount = _iterations;
- epki.EncryptedData = Encrypt (pbeWithSHAAnd3KeyTripleDESCBC, epki.Salt, _iterations, pki.GetBytes ());
-
- ASN1 safeBag = new ASN1 (0x30);
- safeBag.Add (ASN1Convert.FromOid (pkcs8ShroudedKeyBag));
- ASN1 bagValue = new ASN1 (0xA0);
- bagValue.Add (new ASN1 (epki.GetBytes ()));
- safeBag.Add (bagValue);
-
- if (attributes != null) {
- ASN1 bagAttributes = new ASN1 (0x31);
- IDictionaryEnumerator de = attributes.GetEnumerator ();
-
- while (de.MoveNext ()) {
- string oid = (string)de.Key;
- switch (oid) {
- case PKCS9.friendlyName:
- ArrayList names = (ArrayList)de.Value;
- if (names.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.friendlyName));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] name in names) {
- ASN1 attrValue = new ASN1 (0x1e);
- attrValue.Value = name;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- case PKCS9.localKeyId:
- ArrayList keys = (ArrayList)de.Value;
- if (keys.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.localKeyId));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] key in keys) {
- ASN1 attrValue = new ASN1 (0x04);
- attrValue.Value = key;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- default:
- break;
- }
- }
-
- if (bagAttributes.Count > 0) {
- safeBag.Add (bagAttributes);
- }
- }
-
- return safeBag;
- }
-
- private ASN1 KeyBagSafeBag (AsymmetricAlgorithm aa, IDictionary attributes)
- {
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo ();
- if (aa is RSA) {
- pki.Algorithm = "1.2.840.113549.1.1.1";
- pki.PrivateKey = PKCS8.PrivateKeyInfo.Encode ((RSA)aa);
- }
- else if (aa is DSA) {
- pki.Algorithm = null;
- pki.PrivateKey = PKCS8.PrivateKeyInfo.Encode ((DSA)aa);
- }
- else
- throw new CryptographicException ("Unknown asymmetric algorithm {0}", aa.ToString ());
-
- ASN1 safeBag = new ASN1 (0x30);
- safeBag.Add (ASN1Convert.FromOid (keyBag));
- ASN1 bagValue = new ASN1 (0xA0);
- bagValue.Add (new ASN1 (pki.GetBytes ()));
- safeBag.Add (bagValue);
-
- if (attributes != null) {
- ASN1 bagAttributes = new ASN1 (0x31);
- IDictionaryEnumerator de = attributes.GetEnumerator ();
-
- while (de.MoveNext ()) {
- string oid = (string)de.Key;
- switch (oid) {
- case PKCS9.friendlyName:
- ArrayList names = (ArrayList)de.Value;
- if (names.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.friendlyName));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] name in names) {
- ASN1 attrValue = new ASN1 (0x1e);
- attrValue.Value = name;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- case PKCS9.localKeyId:
- ArrayList keys = (ArrayList)de.Value;
- if (keys.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.localKeyId));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] key in keys) {
- ASN1 attrValue = new ASN1 (0x04);
- attrValue.Value = key;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- default:
- break;
- }
- }
-
- if (bagAttributes.Count > 0) {
- safeBag.Add (bagAttributes);
- }
- }
-
- return safeBag;
- }
-
- private ASN1 SecretBagSafeBag (byte[] secret, IDictionary attributes)
- {
- ASN1 safeBag = new ASN1 (0x30);
- safeBag.Add (ASN1Convert.FromOid (secretBag));
- ASN1 bagValue = new ASN1 (0x80, secret);
- safeBag.Add (bagValue);
-
- if (attributes != null) {
- ASN1 bagAttributes = new ASN1 (0x31);
- IDictionaryEnumerator de = attributes.GetEnumerator ();
-
- while (de.MoveNext ()) {
- string oid = (string)de.Key;
- switch (oid) {
- case PKCS9.friendlyName:
- ArrayList names = (ArrayList)de.Value;
- if (names.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.friendlyName));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] name in names) {
- ASN1 attrValue = new ASN1 (0x1e);
- attrValue.Value = name;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- case PKCS9.localKeyId:
- ArrayList keys = (ArrayList)de.Value;
- if (keys.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.localKeyId));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] key in keys) {
- ASN1 attrValue = new ASN1 (0x04);
- attrValue.Value = key;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- default:
- break;
- }
- }
-
- if (bagAttributes.Count > 0) {
- safeBag.Add (bagAttributes);
- }
- }
-
- return safeBag;
- }
-
- private ASN1 CertificateSafeBag (X509Certificate x509, IDictionary attributes)
- {
- ASN1 encapsulatedCertificate = new ASN1 (0x04, x509.RawData);
-
- PKCS7.ContentInfo ci = new PKCS7.ContentInfo ();
- ci.ContentType = x509Certificate;
- ci.Content.Add (encapsulatedCertificate);
-
- ASN1 bagValue = new ASN1 (0xA0);
- bagValue.Add (ci.ASN1);
-
- ASN1 safeBag = new ASN1 (0x30);
- safeBag.Add (ASN1Convert.FromOid (certBag));
- safeBag.Add (bagValue);
-
- if (attributes != null) {
- ASN1 bagAttributes = new ASN1 (0x31);
- IDictionaryEnumerator de = attributes.GetEnumerator ();
-
- while (de.MoveNext ()) {
- string oid = (string)de.Key;
- switch (oid) {
- case PKCS9.friendlyName:
- ArrayList names = (ArrayList)de.Value;
- if (names.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.friendlyName));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] name in names) {
- ASN1 attrValue = new ASN1 (0x1e);
- attrValue.Value = name;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- case PKCS9.localKeyId:
- ArrayList keys = (ArrayList)de.Value;
- if (keys.Count > 0) {
- ASN1 pkcs12Attribute = new ASN1 (0x30);
- pkcs12Attribute.Add (ASN1Convert.FromOid (PKCS9.localKeyId));
- ASN1 attrValues = new ASN1 (0x31);
- foreach (byte[] key in keys) {
- ASN1 attrValue = new ASN1 (0x04);
- attrValue.Value = key;
- attrValues.Add (attrValue);
- }
- pkcs12Attribute.Add (attrValues);
- bagAttributes.Add (pkcs12Attribute);
- }
- break;
- default:
- break;
- }
- }
-
- if (bagAttributes.Count > 0) {
- safeBag.Add (bagAttributes);
- }
- }
-
- return safeBag;
- }
-
- private byte[] MAC (byte[] password, byte[] salt, int iterations, byte[] data)
- {
- PKCS12.DeriveBytes pd = new PKCS12.DeriveBytes ();
- pd.HashName = "SHA1";
- pd.Password = password;
- pd.Salt = salt;
- pd.IterationCount = iterations;
-
- HMACSHA1 hmac = (HMACSHA1) HMACSHA1.Create ();
- hmac.Key = pd.DeriveMAC (20);
- return hmac.ComputeHash (data, 0, data.Length);
- }
-
- /*
- * SafeContents ::= SEQUENCE OF SafeBag
- *
- * SafeBag ::= SEQUENCE {
- * bagId BAG-TYPE.&id ({PKCS12BagSet}),
- * bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}),
- * bagAttributes SET OF PKCS12Attribute OPTIONAL
- * }
- */
- public byte[] GetBytes ()
- {
- // TODO (incomplete)
- ASN1 safeBagSequence = new ASN1 (0x30);
-
- // Sync Safe Bag list since X509CertificateCollection may be updated
- ArrayList scs = new ArrayList ();
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo cert = new PKCS7.ContentInfo (bagValue.Value);
- scs.Add (new X509Certificate (cert.Content [0].Value));
- }
- }
-
- ArrayList addcerts = new ArrayList ();
- ArrayList removecerts = new ArrayList ();
-
- foreach (X509Certificate c in Certificates) {
- bool found = false;
-
- foreach (X509Certificate lc in scs) {
- if (Compare (c.RawData, lc.RawData)) {
- found = true;
- }
- }
-
- if (!found) {
- addcerts.Add (c);
- }
- }
- foreach (X509Certificate c in scs) {
- bool found = false;
-
- foreach (X509Certificate lc in Certificates) {
- if (Compare (c.RawData, lc.RawData)) {
- found = true;
- }
- }
-
- if (!found) {
- removecerts.Add (c);
- }
- }
-
- foreach (X509Certificate c in removecerts) {
- RemoveCertificate (c);
- }
-
- foreach (X509Certificate c in addcerts) {
- AddCertificate (c);
- }
- // Sync done
-
- if (_safeBags.Count > 0) {
- ASN1 certsSafeBag = new ASN1 (0x30);
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (certBag)) {
- certsSafeBag.Add (sb.ASN1);
- }
- }
-
- if (certsSafeBag.Count > 0) {
- PKCS7.ContentInfo contentInfo = EncryptedContentInfo (certsSafeBag, pbeWithSHAAnd3KeyTripleDESCBC);
- safeBagSequence.Add (contentInfo.ASN1);
- }
- }
-
- if (_safeBags.Count > 0) {
- ASN1 safeContents = new ASN1 (0x30);
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (keyBag) ||
- sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- safeContents.Add (sb.ASN1);
- }
- }
- if (safeContents.Count > 0) {
- ASN1 content = new ASN1 (0xA0);
- content.Add (new ASN1 (0x04, safeContents.GetBytes ()));
-
- PKCS7.ContentInfo keyBag = new PKCS7.ContentInfo (PKCS7.Oid.data);
- keyBag.Content = content;
- safeBagSequence.Add (keyBag.ASN1);
- }
- }
-
- // Doing SecretBags separately in case we want to change their encryption independently.
- if (_safeBags.Count > 0) {
- ASN1 secretsSafeBag = new ASN1 (0x30);
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (secretBag)) {
- secretsSafeBag.Add (sb.ASN1);
- }
- }
-
- if (secretsSafeBag.Count > 0) {
- PKCS7.ContentInfo contentInfo = EncryptedContentInfo (secretsSafeBag, pbeWithSHAAnd3KeyTripleDESCBC);
- safeBagSequence.Add (contentInfo.ASN1);
- }
- }
-
-
- ASN1 encapsulates = new ASN1 (0x04, safeBagSequence.GetBytes ());
- ASN1 ci = new ASN1 (0xA0);
- ci.Add (encapsulates);
- PKCS7.ContentInfo authSafe = new PKCS7.ContentInfo (PKCS7.Oid.data);
- authSafe.Content = ci;
-
- ASN1 macData = new ASN1 (0x30);
- if (_password != null) {
- // only for password based encryption
- byte[] salt = new byte [20];
- RNG.GetBytes (salt);
- byte[] macValue = MAC (_password, salt, _iterations, authSafe.Content [0].Value);
- ASN1 oidSeq = new ASN1 (0x30);
- oidSeq.Add (ASN1Convert.FromOid ("1.3.14.3.2.26")); // SHA1
- oidSeq.Add (new ASN1 (0x05));
-
- ASN1 mac = new ASN1 (0x30);
- mac.Add (oidSeq);
- mac.Add (new ASN1 (0x04, macValue));
-
- macData.Add (mac);
- macData.Add (new ASN1 (0x04, salt));
- macData.Add (ASN1Convert.FromInt32 (_iterations));
- }
-
- ASN1 version = new ASN1 (0x02, new byte [1] { 0x03 });
-
- ASN1 pfx = new ASN1 (0x30);
- pfx.Add (version);
- pfx.Add (authSafe.ASN1);
- if (macData.Count > 0) {
- // only for password based encryption
- pfx.Add (macData);
- }
-
- return pfx.GetBytes ();
- }
-
- // Creates an encrypted PKCS#7 ContentInfo with safeBags as its SafeContents. Used in GetBytes(), above.
- private PKCS7.ContentInfo EncryptedContentInfo(ASN1 safeBags, string algorithmOid)
- {
- byte[] salt = new byte [8];
- RNG.GetBytes (salt);
-
- ASN1 seqParams = new ASN1 (0x30);
- seqParams.Add (new ASN1 (0x04, salt));
- seqParams.Add (ASN1Convert.FromInt32 (_iterations));
-
- ASN1 seqPbe = new ASN1 (0x30);
- seqPbe.Add (ASN1Convert.FromOid (algorithmOid));
- seqPbe.Add (seqParams);
-
- byte[] encrypted = Encrypt (algorithmOid, salt, _iterations, safeBags.GetBytes ());
- ASN1 encryptedContent = new ASN1 (0x80, encrypted);
-
- ASN1 seq = new ASN1 (0x30);
- seq.Add (ASN1Convert.FromOid (PKCS7.Oid.data));
- seq.Add (seqPbe);
- seq.Add (encryptedContent);
-
- ASN1 version = new ASN1 (0x02, new byte [1] { 0x00 });
- ASN1 encData = new ASN1 (0x30);
- encData.Add (version);
- encData.Add (seq);
-
- ASN1 finalContent = new ASN1 (0xA0);
- finalContent.Add (encData);
-
- PKCS7.ContentInfo bag = new PKCS7.ContentInfo (PKCS7.Oid.encryptedData);
- bag.Content = finalContent;
- return bag;
- }
-
- public void AddCertificate (X509Certificate cert)
- {
- AddCertificate (cert, null);
- }
-
- public void AddCertificate (X509Certificate cert, IDictionary attributes)
- {
- bool found = false;
-
- for (int i = 0; !found && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo crt = new PKCS7.ContentInfo (bagValue.Value);
- X509Certificate c = new X509Certificate (crt.Content [0].Value);
- if (Compare (cert.RawData, c.RawData)) {
- found = true;
- }
- }
- }
-
- if (!found) {
- _safeBags.Add (new SafeBag (certBag, CertificateSafeBag (cert, attributes)));
- _certsChanged = true;
- }
- }
-
- public void RemoveCertificate (X509Certificate cert)
- {
- RemoveCertificate (cert, null);
- }
-
- public void RemoveCertificate (X509Certificate cert, IDictionary attrs)
- {
- int certIndex = -1;
-
- for (int i = 0; certIndex == -1 && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo crt = new PKCS7.ContentInfo (bagValue.Value);
- X509Certificate c = new X509Certificate (crt.Content [0].Value);
- if (Compare (cert.RawData, c.RawData)) {
- if (attrs != null) {
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
- int bagAttributesFound = 0;
- for (int j = 0; j < bagAttributes.Count; j++) {
- ASN1 pkcs12Attribute = bagAttributes [j];
- ASN1 attrId = pkcs12Attribute [0];
- string ao = ASN1Convert.ToOid (attrId);
- ArrayList dattrValues = (ArrayList)attrs [ao];
-
- if (dattrValues != null) {
- ASN1 attrValues = pkcs12Attribute [1];
-
- if (dattrValues.Count == attrValues.Count) {
- int attrValuesFound = 0;
- for (int k = 0; k < attrValues.Count; k++) {
- ASN1 attrValue = attrValues [k];
- byte[] value = (byte[])dattrValues [k];
-
- if (Compare (value, attrValue.Value)) {
- attrValuesFound += 1;
- }
- }
- if (attrValuesFound == attrValues.Count) {
- bagAttributesFound += 1;
- }
- }
- }
- }
- if (bagAttributesFound == bagAttributes.Count) {
- certIndex = i;
- }
- }
- } else {
- certIndex = i;
- }
- }
- }
- }
-
- if (certIndex != -1) {
- _safeBags.RemoveAt (certIndex);
- _certsChanged = true;
- }
- }
-
- private bool CompareAsymmetricAlgorithm (AsymmetricAlgorithm a1, AsymmetricAlgorithm a2)
- {
- // fast path
- if (a1.KeySize != a2.KeySize)
- return false;
- // compare public keys - if they match we can assume the private match too
- return (a1.ToXmlString (false) == a2.ToXmlString (false));
- }
-
- public void AddPkcs8ShroudedKeyBag (AsymmetricAlgorithm aa)
- {
- AddPkcs8ShroudedKeyBag (aa, null);
- }
-
- public void AddPkcs8ShroudedKeyBag (AsymmetricAlgorithm aa, IDictionary attributes)
- {
- bool found = false;
-
- for (int i = 0; !found && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (decrypted);
- byte[] privateKey = pki.PrivateKey;
-
- AsymmetricAlgorithm saa = null;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- Array.Clear (decrypted, 0, decrypted.Length);
- Array.Clear (privateKey, 0, privateKey.Length);
- throw new CryptographicException ("Unknown private key format");
- }
-
- Array.Clear (decrypted, 0, decrypted.Length);
- Array.Clear (privateKey, 0, privateKey.Length);
-
- if (CompareAsymmetricAlgorithm (aa , saa)) {
- found = true;
- }
- }
- }
-
- if (!found) {
- _safeBags.Add (new SafeBag (pkcs8ShroudedKeyBag, Pkcs8ShroudedKeyBagSafeBag (aa, attributes)));
- _keyBagsChanged = true;
- }
- }
-
- public void RemovePkcs8ShroudedKeyBag (AsymmetricAlgorithm aa)
- {
- int aaIndex = -1;
-
- for (int i = 0; aaIndex == -1 && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (decrypted);
- byte[] privateKey = pki.PrivateKey;
-
- AsymmetricAlgorithm saa = null;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- Array.Clear (decrypted, 0, decrypted.Length);
- Array.Clear (privateKey, 0, privateKey.Length);
- throw new CryptographicException ("Unknown private key format");
- }
-
- Array.Clear (decrypted, 0, decrypted.Length);
- Array.Clear (privateKey, 0, privateKey.Length);
-
- if (CompareAsymmetricAlgorithm (aa, saa)) {
- aaIndex = i;
- }
- }
- }
-
- if (aaIndex != -1) {
- _safeBags.RemoveAt (aaIndex);
- _keyBagsChanged = true;
- }
- }
-
- public void AddKeyBag (AsymmetricAlgorithm aa)
- {
- AddKeyBag (aa, null);
- }
-
- public void AddKeyBag (AsymmetricAlgorithm aa, IDictionary attributes)
- {
- bool found = false;
-
- for (int i = 0; !found && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (keyBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (bagValue.Value);
- byte[] privateKey = pki.PrivateKey;
-
- AsymmetricAlgorithm saa = null;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- Array.Clear (privateKey, 0, privateKey.Length);
- throw new CryptographicException ("Unknown private key format");
- }
-
- Array.Clear (privateKey, 0, privateKey.Length);
-
- if (CompareAsymmetricAlgorithm (aa, saa)) {
- found = true;
- }
- }
- }
-
- if (!found) {
- _safeBags.Add (new SafeBag (keyBag, KeyBagSafeBag (aa, attributes)));
- _keyBagsChanged = true;
- }
- }
-
- public void RemoveKeyBag (AsymmetricAlgorithm aa)
- {
- int aaIndex = -1;
-
- for (int i = 0; aaIndex == -1 && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (keyBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (bagValue.Value);
- byte[] privateKey = pki.PrivateKey;
-
- AsymmetricAlgorithm saa = null;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- Array.Clear (privateKey, 0, privateKey.Length);
- throw new CryptographicException ("Unknown private key format");
- }
-
- Array.Clear (privateKey, 0, privateKey.Length);
-
- if (CompareAsymmetricAlgorithm (aa, saa)) {
- aaIndex = i;
- }
- }
- }
-
- if (aaIndex != -1) {
- _safeBags.RemoveAt (aaIndex);
- _keyBagsChanged = true;
- }
- }
-
- public void AddSecretBag (byte[] secret)
- {
- AddSecretBag (secret, null);
- }
-
- public void AddSecretBag (byte[] secret, IDictionary attributes)
- {
- bool found = false;
-
- for (int i = 0; !found && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (secretBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- byte[] ssecret = bagValue.Value;
-
- if (Compare (secret, ssecret)) {
- found = true;
- }
- }
- }
-
- if (!found) {
- _safeBags.Add (new SafeBag (secretBag, SecretBagSafeBag (secret, attributes)));
- _secretBagsChanged = true;
- }
- }
-
- public void RemoveSecretBag (byte[] secret)
- {
- int sIndex = -1;
-
- for (int i = 0; sIndex == -1 && i < _safeBags.Count; i++) {
- SafeBag sb = (SafeBag)_safeBags [i];
-
- if (sb.BagOID.Equals (secretBag)) {
- ASN1 bagValue = sb.ASN1 [1];
- byte[] ssecret = bagValue.Value;
-
- if (Compare (secret, ssecret)) {
- sIndex = i;
- }
- }
- }
-
- if (sIndex != -1) {
- _safeBags.RemoveAt (sIndex);
- _secretBagsChanged = true;
- }
- }
-
- public AsymmetricAlgorithm GetAsymmetricAlgorithm (IDictionary attrs)
- {
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (keyBag) || sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- ASN1 safeBag = sb.ASN1;
-
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
-
- int bagAttributesFound = 0;
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes [i];
- ASN1 attrId = pkcs12Attribute [0];
- string ao = ASN1Convert.ToOid (attrId);
- ArrayList dattrValues = (ArrayList)attrs [ao];
-
- if (dattrValues != null) {
- ASN1 attrValues = pkcs12Attribute [1];
-
- if (dattrValues.Count == attrValues.Count) {
- int attrValuesFound = 0;
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues [j];
- byte[] value = (byte[])dattrValues [j];
-
- if (Compare (value, attrValue.Value)) {
- attrValuesFound += 1;
- }
- }
- if (attrValuesFound == attrValues.Count) {
- bagAttributesFound += 1;
- }
- }
- }
- }
- if (bagAttributesFound == bagAttributes.Count) {
- ASN1 bagValue = safeBag [1];
- AsymmetricAlgorithm aa = null;
- if (sb.BagOID.Equals (keyBag)) {
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (bagValue.Value);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- aa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- aa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- } else if (sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (decrypted);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- aa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- aa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- Array.Clear (decrypted, 0, decrypted.Length);
- }
- return aa;
- }
- }
- }
- }
-
- return null;
- }
-
- public byte[] GetSecret (IDictionary attrs)
- {
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (secretBag)) {
- ASN1 safeBag = sb.ASN1;
-
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
-
- int bagAttributesFound = 0;
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes [i];
- ASN1 attrId = pkcs12Attribute [0];
- string ao = ASN1Convert.ToOid (attrId);
- ArrayList dattrValues = (ArrayList)attrs [ao];
-
- if (dattrValues != null) {
- ASN1 attrValues = pkcs12Attribute [1];
-
- if (dattrValues.Count == attrValues.Count) {
- int attrValuesFound = 0;
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues [j];
- byte[] value = (byte[])dattrValues [j];
-
- if (Compare (value, attrValue.Value)) {
- attrValuesFound += 1;
- }
- }
- if (attrValuesFound == attrValues.Count) {
- bagAttributesFound += 1;
- }
- }
- }
- }
- if (bagAttributesFound == bagAttributes.Count) {
- ASN1 bagValue = safeBag [1];
- return bagValue.Value;
- }
- }
- }
- }
-
- return null;
- }
-
- public X509Certificate GetCertificate (IDictionary attrs)
- {
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
-
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
-
- int bagAttributesFound = 0;
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes [i];
- ASN1 attrId = pkcs12Attribute [0];
- string ao = ASN1Convert.ToOid (attrId);
- ArrayList dattrValues = (ArrayList)attrs [ao];
-
- if (dattrValues != null) {
- ASN1 attrValues = pkcs12Attribute [1];
-
- if (dattrValues.Count == attrValues.Count) {
- int attrValuesFound = 0;
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues [j];
- byte[] value = (byte[])dattrValues [j];
-
- if (Compare (value, attrValue.Value)) {
- attrValuesFound += 1;
- }
- }
- if (attrValuesFound == attrValues.Count) {
- bagAttributesFound += 1;
- }
- }
- }
- }
- if (bagAttributesFound == bagAttributes.Count) {
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo crt = new PKCS7.ContentInfo (bagValue.Value);
- return new X509Certificate (crt.Content [0].Value);
- }
- }
- }
- }
-
- return null;
- }
-
- public IDictionary GetAttributes (AsymmetricAlgorithm aa)
- {
- IDictionary result = new Hashtable ();
-
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (keyBag) || sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- ASN1 safeBag = sb.ASN1;
-
- ASN1 bagValue = safeBag [1];
- AsymmetricAlgorithm saa = null;
- if (sb.BagOID.Equals (keyBag)) {
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (bagValue.Value);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- } else if (sb.BagOID.Equals (pkcs8ShroudedKeyBag)) {
- PKCS8.EncryptedPrivateKeyInfo epki = new PKCS8.EncryptedPrivateKeyInfo (bagValue.Value);
- byte[] decrypted = Decrypt (epki.Algorithm, epki.Salt, epki.IterationCount, epki.EncryptedData);
- PKCS8.PrivateKeyInfo pki = new PKCS8.PrivateKeyInfo (decrypted);
- byte[] privateKey = pki.PrivateKey;
- switch (privateKey [0]) {
- case 0x02:
- DSAParameters p = new DSAParameters (); // FIXME
- saa = PKCS8.PrivateKeyInfo.DecodeDSA (privateKey, p);
- break;
- case 0x30:
- saa = PKCS8.PrivateKeyInfo.DecodeRSA (privateKey);
- break;
- default:
- break;
- }
- Array.Clear (privateKey, 0, privateKey.Length);
- Array.Clear (decrypted, 0, decrypted.Length);
- }
-
- if (saa != null && CompareAsymmetricAlgorithm (saa, aa)) {
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
-
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes [i];
- ASN1 attrId = pkcs12Attribute [0];
- string aOid = ASN1Convert.ToOid (attrId);
- ArrayList aValues = new ArrayList ();
-
- ASN1 attrValues = pkcs12Attribute [1];
-
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues [j];
- aValues.Add (attrValue.Value);
- }
- result.Add (aOid, aValues);
- }
- }
- }
- }
- }
-
- return result;
- }
-
- public IDictionary GetAttributes (X509Certificate cert)
- {
- IDictionary result = new Hashtable ();
-
- foreach (SafeBag sb in _safeBags) {
- if (sb.BagOID.Equals (certBag)) {
- ASN1 safeBag = sb.ASN1;
- ASN1 bagValue = safeBag [1];
- PKCS7.ContentInfo crt = new PKCS7.ContentInfo (bagValue.Value);
- X509Certificate xc = new X509Certificate (crt.Content [0].Value);
-
- if (Compare (cert.RawData, xc.RawData)) {
- if (safeBag.Count == 3) {
- ASN1 bagAttributes = safeBag [2];
-
- for (int i = 0; i < bagAttributes.Count; i++) {
- ASN1 pkcs12Attribute = bagAttributes [i];
- ASN1 attrId = pkcs12Attribute [0];
-
- string aOid = ASN1Convert.ToOid (attrId);
- ArrayList aValues = new ArrayList ();
-
- ASN1 attrValues = pkcs12Attribute [1];
-
- for (int j = 0; j < attrValues.Count; j++) {
- ASN1 attrValue = attrValues [j];
- aValues.Add (attrValue.Value);
- }
- result.Add (aOid, aValues);
- }
- }
- }
- }
- }
-
- return result;
- }
-
- public void SaveToFile (string filename)
- {
- if (filename == null)
- throw new ArgumentNullException ("filename");
-
- using (FileStream fs = File.Create (filename)) {
- byte[] data = GetBytes ();
- fs.Write (data, 0, data.Length);
- }
- }
-
- public object Clone ()
- {
- PKCS12 clone = null;
- if (_password != null) {
- clone = new PKCS12 (GetBytes (), Encoding.BigEndianUnicode.GetString (_password));
- } else {
- clone = new PKCS12 (GetBytes ());
- }
- clone.IterationCount = this.IterationCount;
-
- return clone;
- }
-
- // static
-
- public const int CryptoApiPasswordLimit = 32;
-
- static private int password_max_length = Int32.MaxValue;
-
- // static properties
-
- // MS CryptoAPI limits the password to a maximum of 31 characters
- // other implementations, like OpenSSL, have no such limitation.
- // Setting a maximum value will truncate the password length to
- // ensure compatibility with MS's PFXImportCertStore API.
- static public int MaximumPasswordLength {
- get { return password_max_length; }
- set {
- if (value < CryptoApiPasswordLimit) {
- string msg = Locale.GetText ("Maximum password length cannot be less than {0}.", CryptoApiPasswordLimit);
- throw new ArgumentOutOfRangeException (msg);
- }
- password_max_length = value;
- }
- }
-
- // static methods
-
- static private byte[] LoadFile (string filename)
- {
- byte[] data = null;
- using (FileStream fs = File.OpenRead (filename)) {
- data = new byte [fs.Length];
- fs.Read (data, 0, data.Length);
- fs.Close ();
- }
- return data;
- }
-
- static public PKCS12 LoadFromFile (string filename)
- {
- if (filename == null)
- throw new ArgumentNullException ("filename");
-
- return new PKCS12 (LoadFile (filename));
- }
-
- static public PKCS12 LoadFromFile (string filename, string password)
- {
- if (filename == null)
- throw new ArgumentNullException ("filename");
-
- return new PKCS12 (LoadFile (filename), password);
- }
- }
-}
+++ /dev/null
-//
-// TestAnchors.cs: Trust Anchors for development and debugging
-// include test certificates for Microsoft (root agency) and Mono
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class TestAnchors : TrustAnchors {
-
- static byte[] rootagency = {
- 0x30, 0x82, 0x01, 0xCA, 0x30, 0x82, 0x01, 0x74, 0xA0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x10, 0x06, 0x37, 0x6C, 0x00, 0xAA, 0x00, 0x64, 0x8A, 0x11,
- 0xCF, 0xB8, 0xD4, 0xAA, 0x5C, 0x35, 0xF4, 0x30, 0x0D, 0x06, 0x09, 0x2A,
- 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x16,
- 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0B, 0x52,
- 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x1E,
- 0x17, 0x0D, 0x39, 0x36, 0x30, 0x35, 0x32, 0x38, 0x32, 0x32, 0x30, 0x32,
- 0x35, 0x39, 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x32,
- 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x16, 0x31, 0x14, 0x30, 0x12,
- 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x0B, 0x52, 0x6F, 0x6F, 0x74, 0x20,
- 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x5B, 0x30, 0x0D, 0x06, 0x09,
- 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
- 0x4A, 0x00, 0x30, 0x47, 0x02, 0x40, 0x81, 0x55, 0x22, 0xB9, 0x8A, 0xA4,
- 0x6F, 0xED, 0xD6, 0xE7, 0xD9, 0x66, 0x0F, 0x55, 0xBC, 0xD7, 0xCD, 0xD5,
- 0xBC, 0x4E, 0x40, 0x02, 0x21, 0xA2, 0xB1, 0xF7, 0x87, 0x30, 0x85, 0x5E,
- 0xD2, 0xF2, 0x44, 0xB9, 0xDC, 0x9B, 0x75, 0xB6, 0xFB, 0x46, 0x5F, 0x42,
- 0xB6, 0x9D, 0x23, 0x36, 0x0B, 0xDE, 0x54, 0x0F, 0xCD, 0xBD, 0x1F, 0x99,
- 0x2A, 0x10, 0x58, 0x11, 0xCB, 0x40, 0xCB, 0xB5, 0xA7, 0x41, 0x02, 0x03,
- 0x01, 0x00, 0x01, 0xA3, 0x81, 0x9E, 0x30, 0x81, 0x9B, 0x30, 0x50, 0x06,
- 0x03, 0x55, 0x04, 0x03, 0x04, 0x49, 0x13, 0x47, 0x46, 0x6F, 0x72, 0x20,
- 0x54, 0x65, 0x73, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x50, 0x75, 0x72, 0x70,
- 0x6F, 0x73, 0x65, 0x73, 0x20, 0x4F, 0x6E, 0x6C, 0x79, 0x20, 0x53, 0x61,
- 0x6D, 0x70, 0x6C, 0x65, 0x20, 0x53, 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72,
- 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73, 0x68, 0x69, 0x6E, 0x67,
- 0x20, 0x43, 0x72, 0x65, 0x64, 0x65, 0x6E, 0x74, 0x69, 0x61, 0x6C, 0x73,
- 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x47, 0x06, 0x03, 0x55,
- 0x1D, 0x01, 0x04, 0x40, 0x30, 0x3E, 0x80, 0x10, 0x12, 0xE4, 0x09, 0x2D,
- 0x06, 0x1D, 0x1D, 0x4F, 0x00, 0x8D, 0x61, 0x21, 0xDC, 0x16, 0x64, 0x63,
- 0xA1, 0x18, 0x30, 0x16, 0x31, 0x14, 0x30, 0x12, 0x06, 0x03, 0x55, 0x04,
- 0x03, 0x13, 0x0B, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E,
- 0x63, 0x79, 0x82, 0x10, 0x06, 0x37, 0x6C, 0x00, 0xAA, 0x00, 0x64, 0x8A,
- 0x11, 0xCF, 0xB8, 0xD4, 0xAA, 0x5C, 0x35, 0xF4, 0x30, 0x0D, 0x06, 0x09,
- 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03,
- 0x41, 0x00, 0x2D, 0x2E, 0x3E, 0x7B, 0x89, 0x42, 0x89, 0x3F, 0xA8, 0x21,
- 0x17, 0xFA, 0xF0, 0xF5, 0xC3, 0x95, 0xDB, 0x62, 0x69, 0x5B, 0xC9, 0xDC,
- 0xC1, 0xB3, 0xFA, 0xF0, 0xC4, 0x6F, 0x6F, 0x64, 0x9A, 0xBD, 0xE7, 0x1B,
- 0x25, 0x68, 0x72, 0x83, 0x67, 0xBD, 0x56, 0xB0, 0x8D, 0x01, 0xBD, 0x2A,
- 0xF7, 0xCC, 0x4B, 0xBD, 0x87, 0xA5, 0xBA, 0x87, 0x20, 0x4C, 0x42, 0x11,
- 0x41, 0xAD, 0x10, 0x17, 0x3B, 0x8C };
-
- static byte[] monoTestRoot = {
- 0x30, 0x82, 0x01, 0xC2, 0x30, 0x82, 0x01, 0x2B, 0xA0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x10, 0x28, 0xF4, 0x76, 0x38, 0x91, 0x74, 0x0E, 0x48, 0x85,
- 0xC7, 0x6E, 0x88, 0x4F, 0xE1, 0xB0, 0x69, 0x30, 0x0D, 0x06, 0x09, 0x2A,
- 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x20,
- 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D,
- 0x6F, 0x6E, 0x6F, 0x20, 0x54, 0x65, 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F,
- 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E, 0x63, 0x79, 0x30, 0x1E, 0x17, 0x0D,
- 0x30, 0x33, 0x30, 0x39, 0x30, 0x31, 0x31, 0x35, 0x35, 0x35, 0x34, 0x38,
- 0x5A, 0x17, 0x0D, 0x33, 0x39, 0x31, 0x32, 0x33, 0x31, 0x31, 0x38, 0x35,
- 0x39, 0x35, 0x39, 0x5A, 0x30, 0x20, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x13, 0x15, 0x4D, 0x6F, 0x6E, 0x6F, 0x20, 0x54, 0x65,
- 0x73, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x67, 0x65, 0x6E,
- 0x63, 0x79, 0x30, 0x81, 0x9E, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
- 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8C, 0x00,
- 0x30, 0x81, 0x88, 0x02, 0x81, 0x80, 0xBF, 0xFE, 0x27, 0x00, 0xB0, 0x71,
- 0x08, 0x4F, 0xBD, 0x26, 0x01, 0x02, 0xD0, 0xB9, 0xC3, 0x52, 0xF2, 0xA1,
- 0xE9, 0xEF, 0x7A, 0x3F, 0x04, 0xE9, 0x37, 0x84, 0x63, 0xFA, 0xF5, 0xA7,
- 0xA8, 0xA4, 0xFB, 0x20, 0x0A, 0x75, 0x88, 0xAF, 0xC9, 0x8E, 0xEA, 0xAF,
- 0x02, 0x0E, 0x83, 0x43, 0x6B, 0xD3, 0x7E, 0xFD, 0x1D, 0x4E, 0x5A, 0x9F,
- 0x7E, 0x61, 0xC7, 0xE7, 0x53, 0xB2, 0x8A, 0x8A, 0x6B, 0x71, 0x3E, 0x67,
- 0xCF, 0x17, 0x12, 0x4E, 0xC6, 0x5B, 0xFF, 0xD8, 0xDC, 0x1D, 0x27, 0x06,
- 0xD2, 0xCD, 0xFF, 0x15, 0x12, 0x16, 0x9D, 0x77, 0x8B, 0x93, 0xF7, 0xE0,
- 0x9B, 0xB9, 0x92, 0x62, 0x18, 0xD4, 0x68, 0x73, 0x48, 0xD2, 0x6D, 0x7F,
- 0x35, 0x34, 0xE4, 0xB6, 0x2A, 0x62, 0x72, 0x32, 0xB1, 0xA3, 0xBD, 0x61,
- 0x18, 0x88, 0x3D, 0xAA, 0xE7, 0x02, 0x5A, 0x70, 0xEE, 0x9B, 0xE2, 0xAB,
- 0x87, 0xF9, 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A,
- 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81,
- 0x81, 0x00, 0x8E, 0x08, 0xD7, 0x0F, 0x30, 0xB2, 0xFD, 0x3A, 0x5C, 0x94,
- 0xA9, 0x56, 0xBE, 0x44, 0x77, 0xE3, 0xA3, 0x92, 0xBC, 0xB9, 0xE4, 0x95,
- 0x68, 0xD4, 0xF4, 0xF9, 0x24, 0x4B, 0x2A, 0x79, 0x93, 0x57, 0x7E, 0x84,
- 0x50, 0x3F, 0xA9, 0xC8, 0xDA, 0x9E, 0x08, 0x9C, 0x21, 0xE1, 0x10, 0xFC,
- 0x1C, 0x5C, 0x4B, 0x60, 0x97, 0xBA, 0x55, 0xCB, 0x7C, 0xEA, 0xC3, 0x04,
- 0x2F, 0x55, 0xBB, 0x16, 0x26, 0xCD, 0x87, 0x90, 0x30, 0x7F, 0xE0, 0xCF,
- 0x24, 0x27, 0xB4, 0x3A, 0xD0, 0x9F, 0xC7, 0x55, 0xF8, 0x7C, 0xC9, 0xA0,
- 0x72, 0xE4, 0x06, 0xF1, 0x4A, 0x5B, 0xBB, 0x71, 0x84, 0x8B, 0x76, 0x23,
- 0x65, 0x1F, 0x1B, 0xEA, 0x96, 0x85, 0x13, 0x84, 0x0C, 0x8C, 0xCD, 0xDA,
- 0x3D, 0x1F, 0xEB, 0xA9, 0xA7, 0xDF, 0xE0, 0xD1, 0xDC, 0x93, 0x21, 0x7A,
- 0x10, 0xA7, 0x92, 0x63, 0x5D, 0xAB, 0xA2, 0x13, 0x37, 0xA4 };
-
- static TestAnchors ()
- {
- // add Microsoft Test Root for people who used MS makecert to create
- // their Authenticode(tm) test certificates
- coll.Add (new X509Certificate (rootagency));
-
- // add Mono Test Root for people who used Mono makecert to create
- // their Authenticode(tm) test certificates
- coll.Add (new X509Certificate (monoTestRoot));
- }
- }
-}
+++ /dev/null
-//
-// TrustAnchors.cs: "Official" default Trust Anchors for Mono
-//
-// Author:
-// Sebastien Pouliot (spouliot@motus.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class TrustAnchors : ITrustAnchors {
-
- static byte[] msroot = {
- 0x30, 0x82, 0x04, 0x12, 0x30, 0x82, 0x02, 0xFA, 0xA0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x0F, 0x00, 0xC1, 0x00, 0x8B, 0x3C, 0x3C, 0x88, 0x11, 0xD1,
- 0x3E, 0xF6, 0x63, 0xEC, 0xDF, 0x40, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86,
- 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x70, 0x31,
- 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F,
- 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20,
- 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C,
- 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F,
- 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61,
- 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04,
- 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74,
- 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72,
- 0x69, 0x74, 0x79, 0x30, 0x1E, 0x17, 0x0D, 0x39, 0x37, 0x30, 0x31, 0x31,
- 0x30, 0x30, 0x37, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x30,
- 0x31, 0x32, 0x33, 0x31, 0x30, 0x37, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x30,
- 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x22,
- 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63,
- 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D, 0x69, 0x63, 0x72, 0x6F,
- 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x2E, 0x31, 0x1E,
- 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x15, 0x4D, 0x69, 0x63,
- 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72, 0x70, 0x6F,
- 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21, 0x30, 0x1F, 0x06, 0x03,
- 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F,
- 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20, 0x41, 0x75, 0x74, 0x68,
- 0x6F, 0x72, 0x69, 0x74, 0x79, 0x30, 0x82, 0x01, 0x22, 0x30, 0x0D, 0x06,
- 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00,
- 0x03, 0x82, 0x01, 0x0F, 0x00, 0x30, 0x82, 0x01, 0x0A, 0x02, 0x82, 0x01,
- 0x01, 0x00, 0xA9, 0x02, 0xBD, 0xC1, 0x70, 0xE6, 0x3B, 0xF2, 0x4E, 0x1B,
- 0x28, 0x9F, 0x97, 0x78, 0x5E, 0x30, 0xEA, 0xA2, 0xA9, 0x8D, 0x25, 0x5F,
- 0xF8, 0xFE, 0x95, 0x4C, 0xA3, 0xB7, 0xFE, 0x9D, 0xA2, 0x20, 0x3E, 0x7C,
- 0x51, 0xA2, 0x9B, 0xA2, 0x8F, 0x60, 0x32, 0x6B, 0xD1, 0x42, 0x64, 0x79,
- 0xEE, 0xAC, 0x76, 0xC9, 0x54, 0xDA, 0xF2, 0xEB, 0x9C, 0x86, 0x1C, 0x8F,
- 0x9F, 0x84, 0x66, 0xB3, 0xC5, 0x6B, 0x7A, 0x62, 0x23, 0xD6, 0x1D, 0x3C,
- 0xDE, 0x0F, 0x01, 0x92, 0xE8, 0x96, 0xC4, 0xBF, 0x2D, 0x66, 0x9A, 0x9A,
- 0x68, 0x26, 0x99, 0xD0, 0x3A, 0x2C, 0xBF, 0x0C, 0xB5, 0x58, 0x26, 0xC1,
- 0x46, 0xE7, 0x0A, 0x3E, 0x38, 0x96, 0x2C, 0xA9, 0x28, 0x39, 0xA8, 0xEC,
- 0x49, 0x83, 0x42, 0xE3, 0x84, 0x0F, 0xBB, 0x9A, 0x6C, 0x55, 0x61, 0xAC,
- 0x82, 0x7C, 0xA1, 0x60, 0x2D, 0x77, 0x4C, 0xE9, 0x99, 0xB4, 0x64, 0x3B,
- 0x9A, 0x50, 0x1C, 0x31, 0x08, 0x24, 0x14, 0x9F, 0xA9, 0xE7, 0x91, 0x2B,
- 0x18, 0xE6, 0x3D, 0x98, 0x63, 0x14, 0x60, 0x58, 0x05, 0x65, 0x9F, 0x1D,
- 0x37, 0x52, 0x87, 0xF7, 0xA7, 0xEF, 0x94, 0x02, 0xC6, 0x1B, 0xD3, 0xBF,
- 0x55, 0x45, 0xB3, 0x89, 0x80, 0xBF, 0x3A, 0xEC, 0x54, 0x94, 0x4E, 0xAE,
- 0xFD, 0xA7, 0x7A, 0x6D, 0x74, 0x4E, 0xAF, 0x18, 0xCC, 0x96, 0x09, 0x28,
- 0x21, 0x00, 0x57, 0x90, 0x60, 0x69, 0x37, 0xBB, 0x4B, 0x12, 0x07, 0x3C,
- 0x56, 0xFF, 0x5B, 0xFB, 0xA4, 0x66, 0x0A, 0x08, 0xA6, 0xD2, 0x81, 0x56,
- 0x57, 0xEF, 0xB6, 0x3B, 0x5E, 0x16, 0x81, 0x77, 0x04, 0xDA, 0xF6, 0xBE,
- 0xAE, 0x80, 0x95, 0xFE, 0xB0, 0xCD, 0x7F, 0xD6, 0xA7, 0x1A, 0x72, 0x5C,
- 0x3C, 0xCA, 0xBC, 0xF0, 0x08, 0xA3, 0x22, 0x30, 0xB3, 0x06, 0x85, 0xC9,
- 0xB3, 0x20, 0x77, 0x13, 0x85, 0xDF, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3,
- 0x81, 0xA8, 0x30, 0x81, 0xA5, 0x30, 0x81, 0xA2, 0x06, 0x03, 0x55, 0x1D,
- 0x01, 0x04, 0x81, 0x9A, 0x30, 0x81, 0x97, 0x80, 0x10, 0x5B, 0xD0, 0x70,
- 0xEF, 0x69, 0x72, 0x9E, 0x23, 0x51, 0x7E, 0x14, 0xB2, 0x4D, 0x8E, 0xFF,
- 0xCB, 0xA1, 0x72, 0x30, 0x70, 0x31, 0x2B, 0x30, 0x29, 0x06, 0x03, 0x55,
- 0x04, 0x0B, 0x13, 0x22, 0x43, 0x6F, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68,
- 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x37, 0x20, 0x4D,
- 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43, 0x6F, 0x72,
- 0x70, 0x2E, 0x31, 0x1E, 0x30, 0x1C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
- 0x15, 0x4D, 0x69, 0x63, 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x43,
- 0x6F, 0x72, 0x70, 0x6F, 0x72, 0x61, 0x74, 0x69, 0x6F, 0x6E, 0x31, 0x21,
- 0x30, 0x1F, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x18, 0x4D, 0x69, 0x63,
- 0x72, 0x6F, 0x73, 0x6F, 0x66, 0x74, 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x20,
- 0x41, 0x75, 0x74, 0x68, 0x6F, 0x72, 0x69, 0x74, 0x79, 0x82, 0x0F, 0x00,
- 0xC1, 0x00, 0x8B, 0x3C, 0x3C, 0x88, 0x11, 0xD1, 0x3E, 0xF6, 0x63, 0xEC,
- 0xDF, 0x40, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x82, 0x01, 0x01, 0x00, 0x95, 0xE8,
- 0x0B, 0xC0, 0x8D, 0xF3, 0x97, 0x18, 0x35, 0xED, 0xB8, 0x01, 0x24, 0xD8,
- 0x77, 0x11, 0xF3, 0x5C, 0x60, 0x32, 0x9F, 0x9E, 0x0B, 0xCB, 0x3E, 0x05,
- 0x91, 0x88, 0x8F, 0xC9, 0x3A, 0xE6, 0x21, 0xF2, 0xF0, 0x57, 0x93, 0x2C,
- 0xB5, 0xA0, 0x47, 0xC8, 0x62, 0xEF, 0xFC, 0xD7, 0xCC, 0x3B, 0x3B, 0x5A,
- 0xA9, 0x36, 0x54, 0x69, 0xFE, 0x24, 0x6D, 0x3F, 0xC9, 0xCC, 0xAA, 0xDE,
- 0x05, 0x7C, 0xDD, 0x31, 0x8D, 0x3D, 0x9F, 0x10, 0x70, 0x6A, 0xBB, 0xFE,
- 0x12, 0x4F, 0x18, 0x69, 0xC0, 0xFC, 0xD0, 0x43, 0xE3, 0x11, 0x5A, 0x20,
- 0x4F, 0xEA, 0x62, 0x7B, 0xAF, 0xAA, 0x19, 0xC8, 0x2B, 0x37, 0x25, 0x2D,
- 0xBE, 0x65, 0xA1, 0x12, 0x8A, 0x25, 0x0F, 0x63, 0xA3, 0xF7, 0x54, 0x1C,
- 0xF9, 0x21, 0xC9, 0xD6, 0x15, 0xF3, 0x52, 0xAC, 0x6E, 0x43, 0x32, 0x07,
- 0xFD, 0x82, 0x17, 0xF8, 0xE5, 0x67, 0x6C, 0x0D, 0x51, 0xF6, 0xBD, 0xF1,
- 0x52, 0xC7, 0xBD, 0xE7, 0xC4, 0x30, 0xFC, 0x20, 0x31, 0x09, 0x88, 0x1D,
- 0x95, 0x29, 0x1A, 0x4D, 0xD5, 0x1D, 0x02, 0xA5, 0xF1, 0x80, 0xE0, 0x03,
- 0xB4, 0x5B, 0xF4, 0xB1, 0xDD, 0xC8, 0x57, 0xEE, 0x65, 0x49, 0xC7, 0x52,
- 0x54, 0xB6, 0xB4, 0x03, 0x28, 0x12, 0xFF, 0x90, 0xD6, 0xF0, 0x08, 0x8F,
- 0x7E, 0xB8, 0x97, 0xC5, 0xAB, 0x37, 0x2C, 0xE4, 0x7A, 0xE4, 0xA8, 0x77,
- 0xE3, 0x76, 0xA0, 0x00, 0xD0, 0x6A, 0x3F, 0xC1, 0xD2, 0x36, 0x8A, 0xE0,
- 0x41, 0x12, 0xA8, 0x35, 0x6A, 0x1B, 0x6A, 0xDB, 0x35, 0xE1, 0xD4, 0x1C,
- 0x04, 0xE4, 0xA8, 0x45, 0x04, 0xC8, 0x5A, 0x33, 0x38, 0x6E, 0x4D, 0x1C,
- 0x0D, 0x62, 0xB7, 0x0A, 0xA2, 0x8C, 0xD3, 0xD5, 0x54, 0x3F, 0x46, 0xCD,
- 0x1C, 0x55, 0xA6, 0x70, 0xDB, 0x12, 0x3A, 0x87, 0x93, 0x75, 0x9F, 0xA7,
- 0xD2, 0xA0 };
-
- static byte[] verisign = {
- 0x30, 0x82, 0x02, 0x40, 0x30, 0x82, 0x01, 0xA9, 0x02, 0x10, 0x03, 0xC7,
- 0x8F, 0x37, 0xDB, 0x92, 0x28, 0xDF, 0x3C, 0xBB, 0x1A, 0xAD, 0x82, 0xFA,
- 0x67, 0x10, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x02, 0x05, 0x00, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06,
- 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E,
- 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13,
- 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49,
- 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B,
- 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43,
- 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F,
- 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69,
- 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x1E, 0x17, 0x0D,
- 0x39, 0x36, 0x30, 0x34, 0x30, 0x39, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30,
- 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, 0x30, 0x37, 0x32, 0x33, 0x35,
- 0x39, 0x35, 0x39, 0x5A, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03,
- 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E, 0x65,
- 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x0E,
- 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E,
- 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13,
- 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43, 0x6F,
- 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F, 0x66,
- 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69, 0x73,
- 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x81, 0x9F, 0x30, 0x0D,
- 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05,
- 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00,
- 0xC3, 0xD3, 0x69, 0x65, 0x52, 0x01, 0x94, 0x54, 0xAB, 0x28, 0xC6, 0x62,
- 0x18, 0xB3, 0x54, 0x55, 0xC5, 0x44, 0x87, 0x45, 0x4A, 0x3B, 0xC2, 0x7E,
- 0xD8, 0xD3, 0xD7, 0xC8, 0x80, 0x86, 0x8D, 0xD8, 0x0C, 0xF1, 0x16, 0x9C,
- 0xCC, 0x6B, 0xA9, 0x29, 0xB2, 0x8F, 0x76, 0x73, 0x92, 0xC8, 0xC5, 0x62,
- 0xA6, 0x3C, 0xED, 0x1E, 0x05, 0x75, 0xF0, 0x13, 0x00, 0x6C, 0x14, 0x4D,
- 0xD4, 0x98, 0x90, 0x07, 0xBE, 0x69, 0x73, 0x81, 0xB8, 0x62, 0x4E, 0x31,
- 0x1E, 0xD1, 0xFC, 0xC9, 0x0C, 0xEB, 0x7D, 0x90, 0xBF, 0xAE, 0xB4, 0x47,
- 0x51, 0xEC, 0x6F, 0xCE, 0x64, 0x35, 0x02, 0xD6, 0x7D, 0x67, 0x05, 0x77,
- 0xE2, 0x8F, 0xD9, 0x51, 0xD7, 0xFB, 0x97, 0x19, 0xBC, 0x3E, 0xD7, 0x77,
- 0x81, 0xC6, 0x43, 0xDD, 0xF2, 0xDD, 0xDF, 0xCA, 0xA3, 0x83, 0x8B, 0xCB,
- 0x41, 0xC1, 0x3D, 0x22, 0x48, 0x48, 0xA6, 0x19, 0x02, 0x03, 0x01, 0x00,
- 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01,
- 0x01, 0x02, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0xB5, 0xBC, 0xB0, 0x75,
- 0x6A, 0x89, 0xA2, 0x86, 0xBD, 0x64, 0x78, 0xC3, 0xA7, 0x32, 0x75, 0x72,
- 0x11, 0xAA, 0x26, 0x02, 0x17, 0x60, 0x30, 0x4C, 0xE3, 0x48, 0x34, 0x19,
- 0xB9, 0x52, 0x4A, 0x51, 0x18, 0x80, 0xFE, 0x53, 0x2D, 0x7B, 0xD5, 0x31,
- 0x8C, 0xC5, 0x65, 0x99, 0x41, 0x41, 0x2F, 0xF2, 0xAE, 0x63, 0x7A, 0xE8,
- 0x73, 0x99, 0x15, 0x90, 0x1A, 0x1F, 0x7A, 0x8B, 0x41, 0xD0, 0x8E, 0x3A,
- 0xD0, 0xCD, 0x38, 0x34, 0x44, 0xD0, 0x75, 0xF8, 0xEA, 0x71, 0xC4, 0x81,
- 0x19, 0x38, 0x17, 0x35, 0x4A, 0xAE, 0xC5, 0x3E, 0x32, 0xE6, 0x21, 0xB8,
- 0x05, 0xC0, 0x93, 0xE1, 0xC7, 0x38, 0x5C, 0xD8, 0xF7, 0x93, 0x38, 0x64,
- 0x90, 0xED, 0x54, 0xCE, 0xCA, 0xD3, 0xD3, 0xD0, 0x5F, 0xEF, 0x04, 0x9B,
- 0xDE, 0x02, 0x82, 0xDD, 0x88, 0x29, 0xB1, 0xC3, 0x4F, 0xA5, 0xCD, 0x71,
- 0x64, 0x31, 0x3C, 0x3C };
-
- static byte[] verisign_ts_root = {
- 0x30, 0x82, 0x02, 0xBC, 0x30, 0x82, 0x02, 0x25, 0x02, 0x10, 0x4A, 0x19,
- 0xD2, 0x38, 0x8C, 0x82, 0x59, 0x1C, 0xA5, 0x5D, 0x73, 0x5F, 0x15, 0x5D,
- 0xDC, 0xA3, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0x9E, 0x31, 0x1F, 0x30, 0x1D,
- 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69, 0x53,
- 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x4E, 0x65,
- 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55,
- 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E,
- 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, 0x2A, 0x06, 0x03,
- 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67,
- 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6D, 0x70,
- 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x20,
- 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55, 0x04,
- 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, 0x42, 0x49, 0x4C,
- 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45, 0x44,
- 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72, 0x69,
- 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x30, 0x1E,
- 0x17, 0x0D, 0x39, 0x37, 0x30, 0x35, 0x31, 0x32, 0x30, 0x30, 0x30, 0x30,
- 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x30, 0x34, 0x30, 0x31, 0x30, 0x37, 0x32,
- 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81, 0x9E, 0x31, 0x1F, 0x30,
- 0x1D, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x16, 0x56, 0x65, 0x72, 0x69,
- 0x53, 0x69, 0x67, 0x6E, 0x20, 0x54, 0x72, 0x75, 0x73, 0x74, 0x20, 0x4E,
- 0x65, 0x74, 0x77, 0x6F, 0x72, 0x6B, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03,
- 0x55, 0x04, 0x0B, 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67,
- 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x2C, 0x30, 0x2A, 0x06,
- 0x03, 0x55, 0x04, 0x0B, 0x13, 0x23, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69,
- 0x67, 0x6E, 0x20, 0x54, 0x69, 0x6D, 0x65, 0x20, 0x53, 0x74, 0x61, 0x6D,
- 0x70, 0x69, 0x6E, 0x67, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x20, 0x52, 0x6F, 0x6F, 0x74, 0x31, 0x34, 0x30, 0x32, 0x06, 0x03, 0x55,
- 0x04, 0x0B, 0x13, 0x2B, 0x4E, 0x4F, 0x20, 0x4C, 0x49, 0x41, 0x42, 0x49,
- 0x4C, 0x49, 0x54, 0x59, 0x20, 0x41, 0x43, 0x43, 0x45, 0x50, 0x54, 0x45,
- 0x44, 0x2C, 0x20, 0x28, 0x63, 0x29, 0x39, 0x37, 0x20, 0x56, 0x65, 0x72,
- 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49, 0x6E, 0x63, 0x2E, 0x30,
- 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x01, 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89,
- 0x02, 0x81, 0x81, 0x00, 0xD3, 0x2E, 0x20, 0xF0, 0x68, 0x7C, 0x2C, 0x2D,
- 0x2E, 0x81, 0x1C, 0xB1, 0x06, 0xB2, 0xA7, 0x0B, 0xB7, 0x11, 0x0D, 0x57,
- 0xDA, 0x53, 0xD8, 0x75, 0xE3, 0xC9, 0x33, 0x2A, 0xB2, 0xD4, 0xF6, 0x09,
- 0x5B, 0x34, 0xF3, 0xE9, 0x90, 0xFE, 0x09, 0x0C, 0xD0, 0xDB, 0x1B, 0x5A,
- 0xB9, 0xCD, 0xE7, 0xF6, 0x88, 0xB1, 0x9D, 0xC0, 0x87, 0x25, 0xEB, 0x7D,
- 0x58, 0x10, 0x73, 0x6A, 0x78, 0xCB, 0x71, 0x15, 0xFD, 0xC6, 0x58, 0xF6,
- 0x29, 0xAB, 0x58, 0x5E, 0x96, 0x04, 0xFD, 0x2D, 0x62, 0x11, 0x58, 0x81,
- 0x1C, 0xCA, 0x71, 0x94, 0xD5, 0x22, 0x58, 0x2F, 0xD5, 0xCC, 0x14, 0x05,
- 0x84, 0x36, 0xBA, 0x94, 0xAA, 0xB4, 0x4D, 0x4A, 0xE9, 0xEE, 0x3B, 0x22,
- 0xAD, 0x56, 0x99, 0x7E, 0x21, 0x9C, 0x6C, 0x86, 0xC0, 0x4A, 0x47, 0x97,
- 0x6A, 0xB4, 0xA6, 0x36, 0xD5, 0xFC, 0x09, 0x2D, 0xD3, 0xB4, 0x39, 0x9B,
- 0x02, 0x03, 0x01, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48,
- 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00,
- 0x61, 0x55, 0x0E, 0x3E, 0x7B, 0xC7, 0x92, 0x12, 0x7E, 0x11, 0x10, 0x8E,
- 0x22, 0xCC, 0xD4, 0xB3, 0x13, 0x2B, 0x5B, 0xE8, 0x44, 0xE4, 0x0B, 0x78,
- 0x9E, 0xA4, 0x7E, 0xF3, 0xA7, 0x07, 0x72, 0x1E, 0xE2, 0x59, 0xEF, 0xCC,
- 0x84, 0xE3, 0x89, 0x94, 0x4C, 0xDB, 0x4E, 0x61, 0xEF, 0xB3, 0xA4, 0xFB,
- 0x46, 0x3D, 0x50, 0x34, 0x0B, 0x9F, 0x70, 0x56, 0xF6, 0x8E, 0x2A, 0x7F,
- 0x17, 0xCE, 0xE5, 0x63, 0xBF, 0x79, 0x69, 0x07, 0x73, 0x2E, 0xB0, 0x95,
- 0x28, 0x8A, 0xF5, 0xED, 0xAA, 0xA9, 0xD2, 0x5D, 0xCD, 0x0A, 0xCA, 0x10,
- 0x09, 0x8F, 0xCE, 0xB3, 0xAF, 0x28, 0x96, 0xC4, 0x79, 0x29, 0x84, 0x92,
- 0xDC, 0xFF, 0xBA, 0x67, 0x42, 0x48, 0xA6, 0x90, 0x10, 0xE4, 0xBF, 0x61,
- 0xF8, 0x9C, 0x53, 0xE5, 0x93, 0xD1, 0x73, 0x3F, 0xF8, 0xFD, 0x9D, 0x4F,
- 0x84, 0xAC, 0x55, 0xD1, 0xFD, 0x11, 0x63, 0x63 };
-
- // old verisign code signing certificate (96-99) using MD2
- // still valid because of the timestamps
- static byte[] oldverisign = {
- 0x30, 0x82, 0x02, 0x35, 0x30, 0x82, 0x01, 0x9E, 0x02, 0x05, 0x02, 0xB4,
- 0x00, 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
- 0x0D, 0x01, 0x01, 0x02, 0x05, 0x00, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F,
- 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72,
- 0x6E, 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A,
- 0x13, 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20,
- 0x49, 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04,
- 0x0B, 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20,
- 0x43, 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53,
- 0x6F, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C,
- 0x69, 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x1E, 0x17,
- 0x0D, 0x39, 0x36, 0x30, 0x34, 0x30, 0x39, 0x30, 0x39, 0x33, 0x35, 0x35,
- 0x39, 0x5A, 0x17, 0x0D, 0x39, 0x39, 0x31, 0x32, 0x33, 0x31, 0x30, 0x39,
- 0x33, 0x35, 0x35, 0x38, 0x5A, 0x30, 0x61, 0x31, 0x11, 0x30, 0x0F, 0x06,
- 0x03, 0x55, 0x04, 0x07, 0x13, 0x08, 0x49, 0x6E, 0x74, 0x65, 0x72, 0x6E,
- 0x65, 0x74, 0x31, 0x17, 0x30, 0x15, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13,
- 0x0E, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x2C, 0x20, 0x49,
- 0x6E, 0x63, 0x2E, 0x31, 0x33, 0x30, 0x31, 0x06, 0x03, 0x55, 0x04, 0x0B,
- 0x13, 0x2A, 0x56, 0x65, 0x72, 0x69, 0x53, 0x69, 0x67, 0x6E, 0x20, 0x43,
- 0x6F, 0x6D, 0x6D, 0x65, 0x72, 0x63, 0x69, 0x61, 0x6C, 0x20, 0x53, 0x6F,
- 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x50, 0x75, 0x62, 0x6C, 0x69,
- 0x73, 0x68, 0x65, 0x72, 0x73, 0x20, 0x43, 0x41, 0x30, 0x81, 0x9F, 0x30,
- 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01,
- 0x05, 0x00, 0x03, 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81,
- 0x00, 0xC3, 0xD3, 0x69, 0x65, 0x52, 0x01, 0x94, 0x54, 0xAB, 0x28, 0xC6,
- 0x62, 0x18, 0xB3, 0x54, 0x55, 0xC5, 0x44, 0x87, 0x45, 0x4A, 0x3B, 0xC2,
- 0x7E, 0xD8, 0xD3, 0xD7, 0xC8, 0x80, 0x86, 0x8D, 0xD8, 0x0C, 0xF1, 0x16,
- 0x9C, 0xCC, 0x6B, 0xA9, 0x29, 0xB2, 0x8F, 0x76, 0x73, 0x92, 0xC8, 0xC5,
- 0x62, 0xA6, 0x3C, 0xED, 0x1E, 0x05, 0x75, 0xF0, 0x13, 0x00, 0x6C, 0x14,
- 0x4D, 0xD4, 0x98, 0x90, 0x07, 0xBE, 0x69, 0x73, 0x81, 0xB8, 0x62, 0x4E,
- 0x31, 0x1E, 0xD1, 0xFC, 0xC9, 0x0C, 0xEB, 0x7D, 0x90, 0xBF, 0xAE, 0xB4,
- 0x47, 0x51, 0xEC, 0x6F, 0xCE, 0x64, 0x35, 0x02, 0xD6, 0x7D, 0x67, 0x05,
- 0x77, 0xE2, 0x8F, 0xD9, 0x51, 0xD7, 0xFB, 0x97, 0x19, 0xBC, 0x3E, 0xD7,
- 0x77, 0x81, 0xC6, 0x43, 0xDD, 0xF2, 0xDD, 0xDF, 0xCA, 0xA3, 0x83, 0x8B,
- 0xCB, 0x41, 0xC1, 0x3D, 0x22, 0x48, 0x48, 0xA6, 0x19, 0x02, 0x03, 0x01,
- 0x00, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D,
- 0x01, 0x01, 0x02, 0x05, 0x00, 0x03, 0x81, 0x81, 0x00, 0x31, 0xBB, 0x30,
- 0xC5, 0x6F, 0xA7, 0xBE, 0x23, 0x26, 0x6D, 0xA5, 0x99, 0x76, 0x68, 0xC5,
- 0x2A, 0x03, 0x28, 0x4B, 0xF3, 0x89, 0xB0, 0x99, 0x03, 0x32, 0x5B, 0x94,
- 0xA1, 0x7B, 0xC1, 0xC8, 0x19, 0xD7, 0xF4, 0x95, 0x6C, 0xAC, 0x73, 0x24,
- 0x0A, 0xCB, 0x44, 0x05, 0x7D, 0x78, 0xEE, 0xFA, 0xF6, 0xA7, 0x9F, 0x87,
- 0xA4, 0x7F, 0xE8, 0xF3, 0x4B, 0x4F, 0x32, 0x30, 0x30, 0x15, 0x08, 0x17,
- 0x01, 0xB2, 0x80, 0xFC, 0xA1, 0xD9, 0x24, 0x87, 0xA5, 0x00, 0x5F, 0xCD,
- 0xDD, 0x29, 0xC8, 0xA1, 0xA5, 0xCA, 0x58, 0x75, 0x39, 0x60, 0x45, 0x1F,
- 0xDE, 0x8D, 0xD6, 0x57, 0x08, 0xD3, 0xC0, 0x1B, 0x81, 0xC2, 0xD9, 0xE2,
- 0x00, 0x8C, 0xEC, 0x0A, 0x91, 0x02, 0xC6, 0x9D, 0x36, 0x74, 0x9A, 0x83,
- 0x6B, 0xEF, 0x7C, 0x8C, 0xD2, 0xA5, 0x2A, 0x6A, 0xC9, 0x7E, 0xDB, 0xA9,
- 0xBD, 0x2B, 0x22, 0xFF, 0x1C };
-
- static byte[] thawte = {
- 0x30, 0x82, 0x03, 0x13, 0x30, 0x82, 0x02, 0x7C, 0xA0, 0x03, 0x02, 0x01,
- 0x02, 0x02, 0x01, 0x01, 0x30, 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86,
- 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x30, 0x81, 0xC4, 0x31, 0x0B,
- 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x5A, 0x41, 0x31,
- 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13, 0x0C, 0x57, 0x65,
- 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70, 0x65, 0x31, 0x12,
- 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09, 0x43, 0x61, 0x70,
- 0x65, 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30, 0x1B, 0x06, 0x03,
- 0x55, 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65, 0x20,
- 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E, 0x67, 0x20, 0x63,
- 0x63, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x13, 0x1F,
- 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6F,
- 0x6E, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73, 0x20, 0x44,
- 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19, 0x30, 0x17, 0x06,
- 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61, 0x77, 0x74, 0x65,
- 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43, 0x41, 0x31, 0x26,
- 0x30, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x09,
- 0x01, 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2D, 0x63, 0x65,
- 0x72, 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74, 0x65, 0x2E, 0x63,
- 0x6F, 0x6D, 0x30, 0x1E, 0x17, 0x0D, 0x39, 0x36, 0x30, 0x38, 0x30, 0x31,
- 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x5A, 0x17, 0x0D, 0x32, 0x30, 0x31,
- 0x32, 0x33, 0x31, 0x32, 0x33, 0x35, 0x39, 0x35, 0x39, 0x5A, 0x30, 0x81,
- 0xC4, 0x31, 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x06, 0x13, 0x02,
- 0x5A, 0x41, 0x31, 0x15, 0x30, 0x13, 0x06, 0x03, 0x55, 0x04, 0x08, 0x13,
- 0x0C, 0x57, 0x65, 0x73, 0x74, 0x65, 0x72, 0x6E, 0x20, 0x43, 0x61, 0x70,
- 0x65, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x07, 0x13, 0x09,
- 0x43, 0x61, 0x70, 0x65, 0x20, 0x54, 0x6F, 0x77, 0x6E, 0x31, 0x1D, 0x30,
- 0x1B, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x13, 0x14, 0x54, 0x68, 0x61, 0x77,
- 0x74, 0x65, 0x20, 0x43, 0x6F, 0x6E, 0x73, 0x75, 0x6C, 0x74, 0x69, 0x6E,
- 0x67, 0x20, 0x63, 0x63, 0x31, 0x28, 0x30, 0x26, 0x06, 0x03, 0x55, 0x04,
- 0x0B, 0x13, 0x1F, 0x43, 0x65, 0x72, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61,
- 0x74, 0x69, 0x6F, 0x6E, 0x20, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65,
- 0x73, 0x20, 0x44, 0x69, 0x76, 0x69, 0x73, 0x69, 0x6F, 0x6E, 0x31, 0x19,
- 0x30, 0x17, 0x06, 0x03, 0x55, 0x04, 0x03, 0x13, 0x10, 0x54, 0x68, 0x61,
- 0x77, 0x74, 0x65, 0x20, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x20, 0x43,
- 0x41, 0x31, 0x26, 0x30, 0x24, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7,
- 0x0D, 0x01, 0x09, 0x01, 0x16, 0x17, 0x73, 0x65, 0x72, 0x76, 0x65, 0x72,
- 0x2D, 0x63, 0x65, 0x72, 0x74, 0x73, 0x40, 0x74, 0x68, 0x61, 0x77, 0x74,
- 0x65, 0x2E, 0x63, 0x6F, 0x6D, 0x30, 0x81, 0x9F, 0x30, 0x0D, 0x06, 0x09,
- 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x01, 0x05, 0x00, 0x03,
- 0x81, 0x8D, 0x00, 0x30, 0x81, 0x89, 0x02, 0x81, 0x81, 0x00, 0xD3, 0xA4,
- 0x50, 0x6E, 0xC8, 0xFF, 0x56, 0x6B, 0xE6, 0xCF, 0x5D, 0xB6, 0xEA, 0x0C,
- 0x68, 0x75, 0x47, 0xA2, 0xAA, 0xC2, 0xDA, 0x84, 0x25, 0xFC, 0xA8, 0xF4,
- 0x47, 0x51, 0xDA, 0x85, 0xB5, 0x20, 0x74, 0x94, 0x86, 0x1E, 0x0F, 0x75,
- 0xC9, 0xE9, 0x08, 0x61, 0xF5, 0x06, 0x6D, 0x30, 0x6E, 0x15, 0x19, 0x02,
- 0xE9, 0x52, 0xC0, 0x62, 0xDB, 0x4D, 0x99, 0x9E, 0xE2, 0x6A, 0x0C, 0x44,
- 0x38, 0xCD, 0xFE, 0xBE, 0xE3, 0x64, 0x09, 0x70, 0xC5, 0xFE, 0xB1, 0x6B,
- 0x29, 0xB6, 0x2F, 0x49, 0xC8, 0x3B, 0xD4, 0x27, 0x04, 0x25, 0x10, 0x97,
- 0x2F, 0xE7, 0x90, 0x6D, 0xC0, 0x28, 0x42, 0x99, 0xD7, 0x4C, 0x43, 0xDE,
- 0xC3, 0xF5, 0x21, 0x6D, 0x54, 0x9F, 0x5D, 0xC3, 0x58, 0xE1, 0xC0, 0xE4,
- 0xD9, 0x5B, 0xB0, 0xB8, 0xDC, 0xB4, 0x7B, 0xDF, 0x36, 0x3A, 0xC2, 0xB5,
- 0x66, 0x22, 0x12, 0xD6, 0x87, 0x0D, 0x02, 0x03, 0x01, 0x00, 0x01, 0xA3,
- 0x13, 0x30, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 0x1D, 0x13, 0x01, 0x01,
- 0xFF, 0x04, 0x05, 0x30, 0x03, 0x01, 0x01, 0xFF, 0x30, 0x0D, 0x06, 0x09,
- 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 0x04, 0x05, 0x00, 0x03,
- 0x81, 0x81, 0x00, 0x07, 0xFA, 0x4C, 0x69, 0x5C, 0xFB, 0x95, 0xCC, 0x46,
- 0xEE, 0x85, 0x83, 0x4D, 0x21, 0x30, 0x8E, 0xCA, 0xD9, 0xA8, 0x6F, 0x49,
- 0x1A, 0xE6, 0xDA, 0x51, 0xE3, 0x60, 0x70, 0x6C, 0x84, 0x61, 0x11, 0xA1,
- 0x1A, 0xC8, 0x48, 0x3E, 0x59, 0x43, 0x7D, 0x4F, 0x95, 0x3D, 0xA1, 0x8B,
- 0xB7, 0x0B, 0x62, 0x98, 0x7A, 0x75, 0x8A, 0xDD, 0x88, 0x4E, 0x4E, 0x9E,
- 0x40, 0xDB, 0xA8, 0xCC, 0x32, 0x74, 0xB9, 0x6F, 0x0D, 0xC6, 0xE3, 0xB3,
- 0x44, 0x0B, 0xD9, 0x8A, 0x6F, 0x9A, 0x29, 0x9B, 0x99, 0x18, 0x28, 0x3B,
- 0xD1, 0xE3, 0x40, 0x28, 0x9A, 0x5A, 0x3C, 0xD5, 0xB5, 0xE7, 0x20, 0x1B,
- 0x8B, 0xCA, 0xA4, 0xAB, 0x8D, 0xE9, 0x51, 0xD9, 0xE2, 0x4C, 0x2C, 0x59,
- 0xA9, 0xDA, 0xB9, 0xB2, 0x75, 0x1B, 0xF6, 0x42, 0xF2, 0xEF, 0xC7, 0xF2,
- 0x18, 0xF9, 0x89, 0xBC, 0xA3, 0xFF, 0x8A, 0x23, 0x2E, 0x70, 0x47 };
-
- static internal X509CertificateCollection coll;
-
- static TrustAnchors ()
- {
- coll = new X509CertificateCollection ();
- coll.Add (new X509Certificate (msroot));
- coll.Add (new X509Certificate (verisign));
- coll.Add (new X509Certificate (verisign_ts_root));
- coll.Add (new X509Certificate (thawte));
- }
-
- public X509CertificateCollection Anchors {
- get { return coll; }
- }
- }
-}
+++ /dev/null
-//
-// X501Name.cs: X.501 Distinguished Names stuff
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Text;
-
-using Mono.Security;
-using Mono.Security.Cryptography;
-
-namespace Mono.Security.X509 {
-
- // References:
- // 1. Information technology - Open Systems Interconnection - The Directory: Models
- // http://www.itu.int/rec/recommendation.asp?type=items&lang=e&parent=T-REC-X.501-200102-I
- // 2. RFC2253: Lightweight Directory Access Protocol (v3): UTF-8 String Representation of Distinguished Names
- // http://www.ietf.org/rfc/rfc2253.txt
-
- /*
- * Name ::= CHOICE { RDNSequence }
- *
- * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
- *
- * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class X501 {
-
- static byte[] countryName = { 0x55, 0x04, 0x06 };
- static byte[] organizationName = { 0x55, 0x04, 0x0A };
- static byte[] organizationalUnitName = { 0x55, 0x04, 0x0B };
- static byte[] commonName = { 0x55, 0x04, 0x03 };
- static byte[] localityName = { 0x55, 0x04, 0x07 };
- static byte[] stateOrProvinceName = { 0x55, 0x04, 0x08 };
- static byte[] streetAddress = { 0x55, 0x04, 0x09 };
- //static byte[] serialNumber = { 0x55, 0x04, 0x05 };
- static byte[] domainComponent = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x19 };
- static byte[] userid = { 0x09, 0x92, 0x26, 0x89, 0x93, 0xF2, 0x2C, 0x64, 0x01, 0x01 };
- static byte[] email = { 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x09, 0x01 };
- static byte[] dnQualifier = { 0x55, 0x04, 0x2E };
- static byte[] title = { 0x55, 0x04, 0x0C };
- static byte[] surname = { 0x55, 0x04, 0x04 };
- static byte[] givenName = { 0x55, 0x04, 0x2A };
- static byte[] initial = { 0x55, 0x04, 0x2B };
-
- private X501 ()
- {
- }
-
- static public string ToString (ASN1 seq)
- {
- StringBuilder sb = new StringBuilder ();
- for (int i = 0; i < seq.Count; i++) {
- ASN1 entry = seq [i];
- AppendEntry (sb, entry, true);
-
- // separator (not on last iteration)
- if (i < seq.Count - 1)
- sb.Append (", ");
- }
- return sb.ToString ();
- }
-
- static public string ToString (ASN1 seq, bool reversed, string separator, bool quotes)
- {
- StringBuilder sb = new StringBuilder ();
-
- if (reversed) {
- for (int i = seq.Count - 1; i >= 0; i--) {
- ASN1 entry = seq [i];
- AppendEntry (sb, entry, quotes);
-
- // separator (not on last iteration)
- if (i > 0)
- sb.Append (separator);
- }
- } else {
- for (int i = 0; i < seq.Count; i++) {
- ASN1 entry = seq [i];
- AppendEntry (sb, entry, quotes);
-
- // separator (not on last iteration)
- if (i < seq.Count - 1)
- sb.Append (separator);
- }
- }
- return sb.ToString ();
- }
-
- static private void AppendEntry (StringBuilder sb, ASN1 entry, bool quotes)
- {
- // multiple entries are valid
- for (int k = 0; k < entry.Count; k++) {
- ASN1 pair = entry [k];
- ASN1 s = pair [1];
- if (s == null)
- continue;
-
- ASN1 poid = pair [0];
- if (poid == null)
- continue;
-
- if (poid.CompareValue (countryName))
- sb.Append ("C=");
- else if (poid.CompareValue (organizationName))
- sb.Append ("O=");
- else if (poid.CompareValue (organizationalUnitName))
- sb.Append ("OU=");
- else if (poid.CompareValue (commonName))
- sb.Append ("CN=");
- else if (poid.CompareValue (localityName))
- sb.Append ("L=");
- else if (poid.CompareValue (stateOrProvinceName))
- sb.Append ("S="); // NOTE: RFC2253 uses ST=
- else if (poid.CompareValue (streetAddress))
- sb.Append ("STREET=");
- else if (poid.CompareValue (domainComponent))
- sb.Append ("DC=");
- else if (poid.CompareValue (userid))
- sb.Append ("UID=");
- else if (poid.CompareValue (email))
- sb.Append ("E="); // NOTE: Not part of RFC2253
- else if (poid.CompareValue (dnQualifier))
- sb.Append ("dnQualifier=");
- else if (poid.CompareValue (title))
- sb.Append ("T=");
- else if (poid.CompareValue (surname))
- sb.Append ("SN=");
- else if (poid.CompareValue (givenName))
- sb.Append ("G=");
- else if (poid.CompareValue (initial))
- sb.Append ("I=");
- else {
- // unknown OID
- sb.Append ("OID."); // NOTE: Not present as RFC2253
- sb.Append (ASN1Convert.ToOid (poid));
- sb.Append ("=");
- }
-
- string sValue = null;
- // 16bits or 8bits string ? TODO not complete (+special chars!)
- if (s.Tag == 0x1E) {
- // BMPSTRING
- StringBuilder sb2 = new StringBuilder ();
- for (int j = 1; j < s.Value.Length; j += 2)
- sb2.Append ((char)s.Value[j]);
- sValue = sb2.ToString ();
- } else {
- if (s.Tag == 0x14)
- sValue = Encoding.UTF7.GetString (s.Value);
- else
- sValue = Encoding.UTF8.GetString (s.Value);
- // in some cases we must quote (") the value
- // Note: this doesn't seems to conform to RFC2253
- char[] specials = { ',', '+', '"', '\\', '<', '>', ';' };
- if (quotes) {
- if ((sValue.IndexOfAny (specials, 0, sValue.Length) > 0) ||
- sValue.StartsWith (" ") || (sValue.EndsWith (" ")))
- sValue = "\"" + sValue + "\"";
- }
- }
-
- sb.Append (sValue);
-
- // separator (not on last iteration)
- if (k < entry.Count - 1)
- sb.Append (", ");
- }
- }
-
- static private X520.AttributeTypeAndValue GetAttributeFromOid (string attributeType)
- {
- string s = attributeType.ToUpper (CultureInfo.InvariantCulture).Trim ();
- switch (s) {
- case "C":
- return new X520.CountryName ();
- case "O":
- return new X520.OrganizationName ();
- case "OU":
- return new X520.OrganizationalUnitName ();
- case "CN":
- return new X520.CommonName ();
- case "L":
- return new X520.LocalityName ();
- case "S": // Microsoft
- case "ST": // RFC2253
- return new X520.StateOrProvinceName ();
- case "E": // NOTE: Not part of RFC2253
- return new X520.EmailAddress ();
- case "DC": // RFC2247
- return new X520.DomainComponent ();
- case "UID": // RFC1274
- return new X520.UserId ();
- case "DNQUALIFIER":
- return new X520.DnQualifier ();
- case "T":
- return new X520.Title ();
- case "SN":
- return new X520.Surname ();
- case "G":
- return new X520.GivenName ();
- case "I":
- return new X520.Initial ();
- default:
- if (s.StartsWith ("OID.")) {
- // MUST support it but it OID may be without it
- return new X520.Oid (s.Substring (4));
- } else {
- if (IsOid (s))
- return new X520.Oid (s);
- else
- return null;
- }
- }
- }
-
- static private bool IsOid (string oid)
- {
- try {
- ASN1 asn = ASN1Convert.FromOid (oid);
- return (asn.Tag == 0x06);
- }
- catch {
- return false;
- }
- }
-
- // no quote processing
- static private X520.AttributeTypeAndValue ReadAttribute (string value, ref int pos)
- {
- while ((value[pos] == ' ') && (pos < value.Length))
- pos++;
-
- // get '=' position in substring
- int equal = value.IndexOf ('=', pos);
- if (equal == -1) {
- string msg = Locale.GetText ("No attribute found.");
- throw new FormatException (msg);
- }
-
- string s = value.Substring (pos, equal - pos);
- X520.AttributeTypeAndValue atv = GetAttributeFromOid (s);
- if (atv == null) {
- string msg = Locale.GetText ("Unknown attribute '{0}'.");
- throw new FormatException (String.Format (msg, s));
- }
- pos = equal + 1; // skip the '='
- return atv;
- }
-
- static private bool IsHex (char c)
- {
- if (Char.IsDigit (c))
- return true;
- char up = Char.ToUpper (c, CultureInfo.InvariantCulture);
- return ((up >= 'A') && (up <= 'F'));
- }
-
- static string ReadHex (string value, ref int pos)
- {
- StringBuilder sb = new StringBuilder ();
- // it is (at least an) 8 bits char
- sb.Append (value[pos++]);
- sb.Append (value[pos]);
- // look ahead for a 16 bits char
- if ((pos < value.Length - 4) && (value[pos+1] == '\\') && IsHex (value[pos+2])) {
- pos += 2; // pass last char and skip \
- sb.Append (value[pos++]);
- sb.Append (value[pos]);
- }
- byte[] data = CryptoConvert.FromHex (sb.ToString ());
- return Encoding.UTF8.GetString (data);
- }
-
- static private int ReadEscaped (StringBuilder sb, string value, int pos)
- {
- switch (value[pos]) {
- case '\\':
- case '"':
- case '=':
- case ';':
- case '<':
- case '>':
- case '+':
- case '#':
- case ',':
- sb.Append (value[pos]);
- return pos;
- default:
- if (pos >= value.Length - 2) {
- string msg = Locale.GetText ("Malformed escaped value '{0}'.");
- throw new FormatException (string.Format (msg, value.Substring (pos)));
- }
- // it's either a 8 bits or 16 bits char
- sb.Append (ReadHex (value, ref pos));
- return pos;
- }
- }
-
- static private int ReadQuoted (StringBuilder sb, string value, int pos)
- {
- int original = pos;
- while (pos <= value.Length) {
- switch (value[pos]) {
- case '"':
- return pos;
- case '\\':
- return ReadEscaped (sb, value, pos);
- default:
- sb.Append (value[pos]);
- pos++;
- break;
- }
- }
- string msg = Locale.GetText ("Malformed quoted value '{0}'.");
- throw new FormatException (string.Format (msg, value.Substring (original)));
- }
-
- static private string ReadValue (string value, ref int pos)
- {
- int original = pos;
- StringBuilder sb = new StringBuilder ();
- while (pos < value.Length) {
- switch (value [pos]) {
- case '\\':
- pos = ReadEscaped (sb, value, ++pos);
- break;
- case '"':
- pos = ReadQuoted (sb, value, ++pos);
- break;
- case '=':
- case ';':
- case '<':
- case '>':
- string msg = Locale.GetText ("Malformed value '{0}' contains '{1}' outside quotes.");
- throw new FormatException (string.Format (msg, value.Substring (original), value[pos]));
- case '+':
- case '#':
- throw new NotImplementedException ();
- case ',':
- pos++;
- return sb.ToString ();
- default:
- sb.Append (value[pos]);
- break;
- }
- pos++;
- }
- return sb.ToString ();
- }
-
- static public ASN1 FromString (string rdn)
- {
- if (rdn == null)
- throw new ArgumentNullException ("rdn");
-
- int pos = 0;
- ASN1 asn1 = new ASN1 (0x30);
- while (pos < rdn.Length) {
- X520.AttributeTypeAndValue atv = ReadAttribute (rdn, ref pos);
- atv.Value = ReadValue (rdn, ref pos);
-
- ASN1 sequence = new ASN1 (0x31);
- sequence.Add (atv.GetASN1 ());
- asn1.Add (sequence);
- }
- return asn1;
- }
- }
-}
+++ /dev/null
-//
-// X509CRL.cs: Handles X.509 certificates revocation lists.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Copyright (C) 2004,2006 Novell Inc. (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Collections;
-using System.Globalization;
-using System.IO;
-using System.Security.Cryptography;
-
-using Mono.Security.X509.Extensions;
-
-namespace Mono.Security.X509 {
- /*
- * CertificateList ::= SEQUENCE {
- * tbsCertList TBSCertList,
- * signatureAlgorithm AlgorithmIdentifier,
- * signature BIT STRING
- * }
- *
- * TBSCertList ::= SEQUENCE {
- * version Version OPTIONAL,
- * -- if present, MUST be v2
- * signature AlgorithmIdentifier,
- * issuer Name,
- * thisUpdate Time,
- * nextUpdate Time OPTIONAL,
- * revokedCertificates SEQUENCE OF SEQUENCE {
- * userCertificate CertificateSerialNumber,
- * revocationDate Time,
- * crlEntryExtensions Extensions OPTIONAL
- * -- if present, MUST be v2
- * } OPTIONAL,
- * crlExtensions [0] Extensions OPTIONAL }
- * -- if present, MUST be v2
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509Crl {
-
- public class X509CrlEntry {
-
- private byte[] sn;
- private DateTime revocationDate;
- private X509ExtensionCollection extensions;
-
- internal X509CrlEntry (byte[] serialNumber, DateTime revocationDate, X509ExtensionCollection extensions)
- {
- sn = serialNumber;
- this.revocationDate = revocationDate;
- if (extensions == null)
- this.extensions = new X509ExtensionCollection ();
- else
- this.extensions = extensions;
- }
-
- internal X509CrlEntry (ASN1 entry)
- {
- sn = entry [0].Value;
- Array.Reverse (sn);
- revocationDate = ASN1Convert.ToDateTime (entry [1]);
- extensions = new X509ExtensionCollection (entry [2]);
- }
-
- public byte[] SerialNumber {
- get { return (byte[]) sn.Clone (); }
- }
-
- public DateTime RevocationDate {
- get { return revocationDate; }
- }
-
- public X509ExtensionCollection Extensions {
- get { return extensions; }
- }
-
- public byte[] GetBytes ()
- {
- ASN1 sequence = new ASN1 (0x30);
- sequence.Add (new ASN1 (0x02, sn));
- sequence.Add (ASN1Convert.FromDateTime (revocationDate));
- if (extensions.Count > 0)
- sequence.Add (new ASN1 (extensions.GetBytes ()));
- return sequence.GetBytes ();
- }
- }
-
- private string issuer;
- private byte version;
- private DateTime thisUpdate;
- private DateTime nextUpdate;
- private ArrayList entries;
- private string signatureOID;
- private byte[] signature;
- private X509ExtensionCollection extensions;
- private byte[] encoded;
- private byte[] hash_value;
-
- public X509Crl (byte[] crl)
- {
- if (crl == null)
- throw new ArgumentNullException ("crl");
- encoded = (byte[]) crl.Clone ();
- Parse (encoded);
- }
-
- private void Parse (byte[] crl)
- {
- string e = "Input data cannot be coded as a valid CRL.";
- try {
- // CertificateList ::= SEQUENCE {
- ASN1 encodedCRL = new ASN1 (encoded);
- if ((encodedCRL.Tag != 0x30) || (encodedCRL.Count != 3))
- throw new CryptographicException (e);
-
- // CertificateList / TBSCertList,
- ASN1 toBeSigned = encodedCRL [0];
- if ((toBeSigned.Tag != 0x30) || (toBeSigned.Count < 3))
- throw new CryptographicException (e);
-
- int n = 0;
- // CertificateList / TBSCertList / Version OPTIONAL, -- if present, MUST be v2
- if (toBeSigned [n].Tag == 0x02) {
- version = (byte) (toBeSigned [n++].Value [0] + 1);
- }
- else
- version = 1; // DEFAULT
- // CertificateList / TBSCertList / AlgorithmIdentifier,
- signatureOID = ASN1Convert.ToOid (toBeSigned [n++][0]);
- // CertificateList / TBSCertList / Name,
- issuer = X501.ToString (toBeSigned [n++]);
- // CertificateList / TBSCertList / Time,
- thisUpdate = ASN1Convert.ToDateTime (toBeSigned [n++]);
- // CertificateList / TBSCertList / Time OPTIONAL,
- ASN1 next = toBeSigned [n++];
- if ((next.Tag == 0x17) || (next.Tag == 0x18)) {
- nextUpdate = ASN1Convert.ToDateTime (next);
- next = toBeSigned [n++];
- }
- // CertificateList / TBSCertList / revokedCertificates SEQUENCE OF SEQUENCE {
- entries = new ArrayList ();
- // this is OPTIONAL so it may not be present if no entries exists
- if ((next != null) && (next.Tag == 0x30)) {
- ASN1 revokedCertificates = next;
- for (int i=0; i < revokedCertificates.Count; i++) {
- entries.Add (new X509CrlEntry (revokedCertificates [i]));
- }
- } else {
- n--;
- }
- // CertificateList / TBSCertList / crlExtensions [0] Extensions OPTIONAL }
- ASN1 extns = toBeSigned [n];
- if ((extns != null) && (extns.Tag == 0xA0) && (extns.Count == 1))
- extensions = new X509ExtensionCollection (extns [0]);
- else
- extensions = new X509ExtensionCollection (null); // result in a read only object
- // CertificateList / AlgorithmIdentifier
- string signatureAlgorithm = ASN1Convert.ToOid (encodedCRL [1][0]);
- if (signatureOID != signatureAlgorithm)
- throw new CryptographicException (e + " [Non-matching signature algorithms in CRL]");
-
- // CertificateList / BIT STRING
- byte[] bitstring = encodedCRL [2].Value;
- // first byte contains unused bits in first byte
- signature = new byte [bitstring.Length - 1];
- Buffer.BlockCopy (bitstring, 1, signature, 0, signature.Length);
- }
- catch {
- throw new CryptographicException (e);
- }
- }
-
- public ArrayList Entries {
- get { return ArrayList.ReadOnly (entries); }
- }
-
- public X509CrlEntry this [int index] {
- get { return (X509CrlEntry) entries [index]; }
- }
-
- public X509CrlEntry this [byte[] serialNumber] {
- get { return GetCrlEntry (serialNumber); }
- }
-
- public X509ExtensionCollection Extensions {
- get { return extensions; }
- }
-
- public byte[] Hash {
- get {
- if (hash_value == null) {
- ASN1 encodedCRL = new ASN1 (encoded);
- byte[] toBeSigned = encodedCRL [0].GetBytes ();
- HashAlgorithm ha = HashAlgorithm.Create (GetHashName ());
- hash_value = ha.ComputeHash (toBeSigned);
- }
- return hash_value;
- }
- }
-
- public string IssuerName {
- get { return issuer; }
- }
-
- public DateTime NextUpdate {
- get { return nextUpdate; }
- }
-
- public DateTime ThisUpdate {
- get { return thisUpdate; }
- }
-
- public string SignatureAlgorithm {
- get { return signatureOID; }
- }
-
- public byte[] Signature {
- get {
- if (signature == null)
- return null;
- return (byte[]) signature.Clone ();
- }
- }
-
- public byte[] RawData {
- get { return (byte[]) encoded.Clone (); }
- }
-
- public byte Version {
- get { return version; }
- }
-
- public bool IsCurrent {
- get { return WasCurrent (DateTime.Now); }
- }
-
- public bool WasCurrent (DateTime instant)
- {
- if (nextUpdate == DateTime.MinValue)
- return (instant >= thisUpdate);
- else
- return ((instant >= thisUpdate) && (instant <= nextUpdate));
- }
-
- public byte[] GetBytes ()
- {
- return (byte[]) encoded.Clone ();
- }
-
- private bool Compare (byte[] array1, byte[] array2)
- {
- if ((array1 == null) && (array2 == null))
- return true;
- if ((array1 == null) || (array2 == null))
- return false;
- if (array1.Length != array2.Length)
- return false;
- for (int i=0; i < array1.Length; i++) {
- if (array1 [i] != array2 [i])
- return false;
- }
- return true;
- }
-
- public X509CrlEntry GetCrlEntry (X509Certificate x509)
- {
- if (x509 == null)
- throw new ArgumentNullException ("x509");
-
- return GetCrlEntry (x509.SerialNumber);
- }
-
- public X509CrlEntry GetCrlEntry (byte[] serialNumber)
- {
- if (serialNumber == null)
- throw new ArgumentNullException ("serialNumber");
-
- for (int i=0; i < entries.Count; i++) {
- X509CrlEntry entry = (X509CrlEntry) entries [i];
- if (Compare (serialNumber, entry.SerialNumber))
- return entry;
- }
- return null;
- }
-
- public bool VerifySignature (X509Certificate x509)
- {
- if (x509 == null)
- throw new ArgumentNullException ("x509");
-
- // 1. x509 certificate must be a CA certificate (unknown for v1 or v2 certs)
- if (x509.Version >= 3) {
- // 1.1. Check for "cRLSign" bit in KeyUsage extension
- X509Extension ext = x509.Extensions ["2.5.29.15"];
- if (ext != null) {
- KeyUsageExtension keyUsage = new KeyUsageExtension (ext);
- if (!keyUsage.Support (KeyUsages.cRLSign))
- return false;
- }
- // 1.2. Check for ca = true in BasicConstraint
- ext = x509.Extensions ["2.5.29.19"];
- if (ext != null) {
- BasicConstraintsExtension basicConstraints = new BasicConstraintsExtension (ext);
- if (!basicConstraints.CertificateAuthority)
- return false;
- }
- }
- // 2. CRL issuer must match CA subject name
- if (issuer != x509.SubjectName)
- return false;
- // 3. Check the CRL signature with the CA certificate public key
- switch (signatureOID) {
- case "1.2.840.10040.4.3":
- return VerifySignature (x509.DSA);
- default:
- return VerifySignature (x509.RSA);
- }
- }
-
- private string GetHashName ()
- {
- switch (signatureOID) {
- // MD2 with RSA encryption
- case "1.2.840.113549.1.1.2":
- // maybe someone installed MD2 ?
- return "MD2";
- // MD5 with RSA encryption
- case "1.2.840.113549.1.1.4":
- return "MD5";
- // SHA-1 with DSA
- case "1.2.840.10040.4.3":
- // SHA-1 with RSA Encryption
- case "1.2.840.113549.1.1.5":
- return "SHA1";
- default:
- throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID);
- }
- }
-
- internal bool VerifySignature (DSA dsa)
- {
- if (signatureOID != "1.2.840.10040.4.3")
- throw new CryptographicException ("Unsupported hash algorithm: " + signatureOID);
- DSASignatureDeformatter v = new DSASignatureDeformatter (dsa);
- // only SHA-1 is supported
- v.SetHashAlgorithm ("SHA1");
- ASN1 sign = new ASN1 (signature);
- if ((sign == null) || (sign.Count != 2))
- return false;
- // parts may be less than 20 bytes (i.e. first bytes were 0x00)
- byte[] part1 = sign [0].Value;
- byte[] part2 = sign [1].Value;
- byte[] sig = new byte [40];
- // parts may be less than 20 bytes (i.e. first bytes were 0x00)
- // parts may be more than 20 bytes (i.e. first byte > 0x80, negative)
- int s1 = System.Math.Max (0, part1.Length - 20);
- int e1 = System.Math.Max (0, 20 - part1.Length);
- Buffer.BlockCopy (part1, s1, sig, e1, part1.Length - s1);
- int s2 = System.Math.Max (0, part2.Length - 20);
- int e2 = System.Math.Max (20, 40 - part2.Length);
- Buffer.BlockCopy (part2, s2, sig, e2, part2.Length - s2);
- return v.VerifySignature (Hash, sig);
- }
-
- internal bool VerifySignature (RSA rsa)
- {
- RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa);
- v.SetHashAlgorithm (GetHashName ());
- return v.VerifySignature (Hash, signature);
- }
-
- public bool VerifySignature (AsymmetricAlgorithm aa)
- {
- if (aa == null)
- throw new ArgumentNullException ("aa");
-
- // only validate the signature (in case we don't have the CA certificate)
- if (aa is RSA)
- return VerifySignature (aa as RSA);
- else if (aa is DSA)
- return VerifySignature (aa as DSA);
- else
- throw new NotSupportedException ("Unknown Asymmetric Algorithm " + aa.ToString ());
- }
-
- static public X509Crl CreateFromFile (string filename)
- {
- byte[] crl = null;
- using (FileStream fs = File.Open (filename, FileMode.Open, FileAccess.Read, FileShare.Read)) {
- crl = new byte [fs.Length];
- fs.Read (crl, 0, crl.Length);
- fs.Close ();
- }
- return new X509Crl (crl);
- }
- }
-}
+++ /dev/null
-//
-// X509Certificates.cs: Handles X.509 certificates.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Runtime.Serialization;
-using System.Security.Cryptography;
-using SSCX = System.Security.Cryptography.X509Certificates;
-using System.Security.Permissions;
-using System.Text;
-
-using Mono.Security.Cryptography;
-
-namespace Mono.Security.X509 {
-
- // References:
- // a. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
- // http://www.ietf.org/rfc/rfc3280.txt
- // b. ITU ASN.1 standards (free download)
- // http://www.itu.int/ITU-T/studygroups/com17/languages/
-
-#if INSIDE_CORLIB
- internal class X509Certificate : ISerializable {
-#else
- public class X509Certificate : ISerializable {
-#endif
- const string encoding_error = "Input data cannot be coded as a valid certificate.";
-
- private ASN1 decoder;
-
- private byte[] m_encodedcert;
- private DateTime m_from;
- private DateTime m_until;
- private ASN1 issuer;
- private string m_issuername;
- private string m_keyalgo;
- private byte[] m_keyalgoparams;
- private ASN1 subject;
- private string m_subject;
- private byte[] m_publickey;
- private byte[] signature;
- private string m_signaturealgo;
- private byte[] m_signaturealgoparams;
- private byte[] certhash;
- private RSA _rsa;
- private DSA _dsa;
-
- // from http://www.ietf.org/rfc/rfc2459.txt
- //
- //Certificate ::= SEQUENCE {
- // tbsCertificate TBSCertificate,
- // signatureAlgorithm AlgorithmIdentifier,
- // signature BIT STRING }
- //
- //TBSCertificate ::= SEQUENCE {
- // version [0] Version DEFAULT v1,
- // serialNumber CertificateSerialNumber,
- // signature AlgorithmIdentifier,
- // issuer Name,
- // validity Validity,
- // subject Name,
- // subjectPublicKeyInfo SubjectPublicKeyInfo,
- // issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL,
- // -- If present, version shall be v2 or v3
- // subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL,
- // -- If present, version shall be v2 or v3
- // extensions [3] Extensions OPTIONAL
- // -- If present, version shall be v3 -- }
- private int version;
- private byte[] serialnumber;
-
- private byte[] issuerUniqueID;
- private byte[] subjectUniqueID;
- private X509ExtensionCollection extensions;
-
- // that's were the real job is!
- private void Parse (byte[] data)
- {
- try {
- decoder = new ASN1 (data);
- // Certificate
- if (decoder.Tag != 0x30)
- throw new CryptographicException (encoding_error);
- // Certificate / TBSCertificate
- if (decoder [0].Tag != 0x30)
- throw new CryptographicException (encoding_error);
-
- ASN1 tbsCertificate = decoder [0];
-
- int tbs = 0;
- // Certificate / TBSCertificate / Version
- ASN1 v = decoder [0][tbs];
- version = 1; // DEFAULT v1
- if ((v.Tag == 0xA0) && (v.Count > 0)) {
- // version (optional) is present only in v2+ certs
- version += v [0].Value [0]; // zero based
- tbs++;
- }
-
- // Certificate / TBSCertificate / CertificateSerialNumber
- ASN1 sn = decoder [0][tbs++];
- if (sn.Tag != 0x02)
- throw new CryptographicException (encoding_error);
- serialnumber = sn.Value;
- Array.Reverse (serialnumber, 0, serialnumber.Length);
-
- // Certificate / TBSCertificate / AlgorithmIdentifier
- tbs++;
- // ASN1 signatureAlgo = tbsCertificate.Element (tbs++, 0x30);
-
- issuer = tbsCertificate.Element (tbs++, 0x30);
- m_issuername = X501.ToString (issuer);
-
- ASN1 validity = tbsCertificate.Element (tbs++, 0x30);
- ASN1 notBefore = validity [0];
- m_from = ASN1Convert.ToDateTime (notBefore);
- ASN1 notAfter = validity [1];
- m_until = ASN1Convert.ToDateTime (notAfter);
-
- subject = tbsCertificate.Element (tbs++, 0x30);
- m_subject = X501.ToString (subject);
-
- ASN1 subjectPublicKeyInfo = tbsCertificate.Element (tbs++, 0x30);
-
- ASN1 algorithm = subjectPublicKeyInfo.Element (0, 0x30);
- ASN1 algo = algorithm.Element (0, 0x06);
- m_keyalgo = ASN1Convert.ToOid (algo);
- // parameters ANY DEFINED BY algorithm OPTIONAL
- // so we dont ask for a specific (Element) type and return DER
- ASN1 parameters = algorithm [1];
- m_keyalgoparams = ((algorithm.Count > 1) ? parameters.GetBytes () : null);
-
- ASN1 subjectPublicKey = subjectPublicKeyInfo.Element (1, 0x03);
- // we must drop th first byte (which is the number of unused bits
- // in the BITSTRING)
- int n = subjectPublicKey.Length - 1;
- m_publickey = new byte [n];
- Buffer.BlockCopy (subjectPublicKey.Value, 1, m_publickey, 0, n);
-
- // signature processing
- byte[] bitstring = decoder [2].Value;
- // first byte contains unused bits in first byte
- signature = new byte [bitstring.Length - 1];
- Buffer.BlockCopy (bitstring, 1, signature, 0, signature.Length);
-
- algorithm = decoder [1];
- algo = algorithm.Element (0, 0x06);
- m_signaturealgo = ASN1Convert.ToOid (algo);
- parameters = algorithm [1];
- if (parameters != null)
- m_signaturealgoparams = parameters.GetBytes ();
- else
- m_signaturealgoparams = null;
-
- // Certificate / TBSCertificate / issuerUniqueID
- ASN1 issuerUID = tbsCertificate.Element (tbs, 0x81);
- if (issuerUID != null) {
- tbs++;
- issuerUniqueID = issuerUID.Value;
- }
-
- // Certificate / TBSCertificate / subjectUniqueID
- ASN1 subjectUID = tbsCertificate.Element (tbs, 0x82);
- if (subjectUID != null) {
- tbs++;
- subjectUniqueID = subjectUID.Value;
- }
-
- // Certificate / TBSCertificate / Extensions
- ASN1 extns = tbsCertificate.Element (tbs, 0xA3);
- if ((extns != null) && (extns.Count == 1))
- extensions = new X509ExtensionCollection (extns [0]);
- else
- extensions = new X509ExtensionCollection (null);
-
- // keep a copy of the original data
- m_encodedcert = (byte[]) data.Clone ();
- }
- catch (Exception ex) {
- throw new CryptographicException (encoding_error, ex);
- }
- }
-
- // constructors
-
- public X509Certificate (byte[] data)
- {
- if (data != null) {
- // does it looks like PEM ?
- if ((data.Length > 0) && (data [0] != 0x30)) {
- try {
- data = PEM ("CERTIFICATE", data);
- }
- catch (Exception ex) {
- throw new CryptographicException (encoding_error, ex);
- }
- }
- Parse (data);
- }
- }
-
- private byte[] GetUnsignedBigInteger (byte[] integer)
- {
- if (integer [0] == 0x00) {
- // this first byte is added so we're sure it's an unsigned integer
- // however we can't feed it into RSAParameters or DSAParameters
- int length = integer.Length - 1;
- byte[] uinteger = new byte [length];
- Buffer.BlockCopy (integer, 1, uinteger, 0, length);
- return uinteger;
- }
- else
- return integer;
- }
-
- // public methods
-
- public DSA DSA {
- get {
- if (m_keyalgoparams == null)
- throw new CryptographicException ("Missing key algorithm parameters.");
-
- if (_dsa == null) {
- DSAParameters dsaParams = new DSAParameters ();
- // for DSA m_publickey contains 1 ASN.1 integer - Y
- ASN1 pubkey = new ASN1 (m_publickey);
- if ((pubkey == null) || (pubkey.Tag != 0x02))
- return null;
- dsaParams.Y = GetUnsignedBigInteger (pubkey.Value);
-
- ASN1 param = new ASN1 (m_keyalgoparams);
- if ((param == null) || (param.Tag != 0x30) || (param.Count < 3))
- return null;
- if ((param [0].Tag != 0x02) || (param [1].Tag != 0x02) || (param [2].Tag != 0x02))
- return null;
- dsaParams.P = GetUnsignedBigInteger (param [0].Value);
- dsaParams.Q = GetUnsignedBigInteger (param [1].Value);
- dsaParams.G = GetUnsignedBigInteger (param [2].Value);
-
- // BUG: MS BCL 1.0 can't import a key which
- // isn't the same size as the one present in
- // the container.
- _dsa = (DSA) new DSACryptoServiceProvider (dsaParams.Y.Length << 3);
- _dsa.ImportParameters (dsaParams);
- }
- return _dsa;
- }
-
- set {
- _dsa = value;
- if (value != null)
- _rsa = null;
- }
- }
-
- public X509ExtensionCollection Extensions {
- get { return extensions; }
- }
-
- public byte[] Hash {
- get {
- if (certhash == null) {
- HashAlgorithm hash = null;
- switch (m_signaturealgo) {
- case "1.2.840.113549.1.1.2": // MD2 with RSA encryption
- // maybe someone installed MD2 ?
-#if INSIDE_CORLIB
- hash = HashAlgorithm.Create ("MD2");
-#else
- hash = Mono.Security.Cryptography.MD2.Create ();
-#endif
- break;
- case "1.2.840.113549.1.1.4": // MD5 with RSA encryption
- hash = MD5.Create ();
- break;
- case "1.2.840.113549.1.1.5": // SHA-1 with RSA Encryption
- case "1.3.14.3.2.29": // SHA1 with RSA signature
- case "1.2.840.10040.4.3": // SHA1-1 with DSA
- hash = SHA1.Create ();
- break;
- default:
- return null;
- }
- if ((decoder == null) || (decoder.Count < 1))
- return null;
- byte[] toBeSigned = decoder [0].GetBytes ();
- certhash = hash.ComputeHash (toBeSigned, 0, toBeSigned.Length);
- }
- return (byte[]) certhash.Clone ();
- }
- }
-
- public virtual string IssuerName {
- get { return m_issuername; }
- }
-
- public virtual string KeyAlgorithm {
- get { return m_keyalgo; }
- }
-
- public virtual byte[] KeyAlgorithmParameters {
- get {
- if (m_keyalgoparams == null)
- return null;
- return (byte[]) m_keyalgoparams.Clone ();
- }
- set { m_keyalgoparams = value; }
- }
-
- public virtual byte[] PublicKey {
- get {
- if (m_publickey == null)
- return null;
- return (byte[]) m_publickey.Clone ();
- }
- }
-
- public virtual RSA RSA {
- get {
- if (_rsa == null) {
- RSAParameters rsaParams = new RSAParameters ();
- // for RSA m_publickey contains 2 ASN.1 integers
- // the modulus and the public exponent
- ASN1 pubkey = new ASN1 (m_publickey);
- ASN1 modulus = pubkey [0];
- if ((modulus == null) || (modulus.Tag != 0x02))
- return null;
- ASN1 exponent = pubkey [1];
- if (exponent.Tag != 0x02)
- return null;
-
- rsaParams.Modulus = GetUnsignedBigInteger (modulus.Value);
- rsaParams.Exponent = exponent.Value;
-
- // BUG: MS BCL 1.0 can't import a key which
- // isn't the same size as the one present in
- // the container.
- int keySize = (rsaParams.Modulus.Length << 3);
- _rsa = (RSA) new RSACryptoServiceProvider (keySize);
- _rsa.ImportParameters (rsaParams);
- }
- return _rsa;
- }
-
- set {
- if (value != null)
- _dsa = null;
- _rsa = value;
- }
- }
-
- public virtual byte[] RawData {
- get {
- if (m_encodedcert == null)
- return null;
- return (byte[]) m_encodedcert.Clone ();
- }
- }
-
- public virtual byte[] SerialNumber {
- get {
- if (serialnumber == null)
- return null;
- return (byte[]) serialnumber.Clone ();
- }
- }
-
- public virtual byte[] Signature {
- get {
- if (signature == null)
- return null;
-
- switch (m_signaturealgo) {
- case "1.2.840.113549.1.1.2": // MD2 with RSA encryption
- case "1.2.840.113549.1.1.4": // MD5 with RSA encryption
- case "1.2.840.113549.1.1.5": // SHA-1 with RSA Encryption
- case "1.3.14.3.2.29": // SHA1 with RSA signature
- return (byte[]) signature.Clone ();
-
- case "1.2.840.10040.4.3": // SHA-1 with DSA
- ASN1 sign = new ASN1 (signature);
- if ((sign == null) || (sign.Count != 2))
- return null;
- byte[] part1 = sign [0].Value;
- byte[] part2 = sign [1].Value;
- byte[] sig = new byte [40];
- // parts may be less than 20 bytes (i.e. first bytes were 0x00)
- // parts may be more than 20 bytes (i.e. first byte > 0x80, negative)
- int s1 = System.Math.Max (0, part1.Length - 20);
- int e1 = System.Math.Max (0, 20 - part1.Length);
- Buffer.BlockCopy (part1, s1, sig, e1, part1.Length - s1);
- int s2 = System.Math.Max (0, part2.Length - 20);
- int e2 = System.Math.Max (20, 40 - part2.Length);
- Buffer.BlockCopy (part2, s2, sig, e2, part2.Length - s2);
- return sig;
-
- default:
- throw new CryptographicException ("Unsupported hash algorithm: " + m_signaturealgo);
- }
- }
- }
-
- public virtual string SignatureAlgorithm {
- get { return m_signaturealgo; }
- }
-
- public virtual byte[] SignatureAlgorithmParameters {
- get {
- if (m_signaturealgoparams == null)
- return m_signaturealgoparams;
- return (byte[]) m_signaturealgoparams.Clone ();
- }
- }
-
- public virtual string SubjectName {
- get { return m_subject; }
- }
-
- public virtual DateTime ValidFrom {
- get { return m_from; }
- }
-
- public virtual DateTime ValidUntil {
- get { return m_until; }
- }
-
- public int Version {
- get { return version; }
- }
-
- public bool IsCurrent {
- get { return WasCurrent (DateTime.UtcNow); }
- }
-
- public bool WasCurrent (DateTime instant)
- {
- return ((instant > ValidFrom) && (instant <= ValidUntil));
- }
-
- // uncommon v2 "extension"
- public byte[] IssuerUniqueIdentifier {
- get {
- if (issuerUniqueID == null)
- return null;
- return (byte[]) issuerUniqueID.Clone ();
- }
- }
-
- // uncommon v2 "extension"
- public byte[] SubjectUniqueIdentifier {
- get {
- if (subjectUniqueID == null)
- return null;
- return (byte[]) subjectUniqueID.Clone ();
- }
- }
-
- internal bool VerifySignature (DSA dsa)
- {
- // signatureOID is check by both this.Hash and this.Signature
- DSASignatureDeformatter v = new DSASignatureDeformatter (dsa);
- // only SHA-1 is supported
- v.SetHashAlgorithm ("SHA1");
- return v.VerifySignature (this.Hash, this.Signature);
- }
-
- internal string GetHashNameFromOID (string oid)
- {
- switch (oid) {
- // MD2 with RSA encryption
- case "1.2.840.113549.1.1.2":
- // maybe someone installed MD2 ?
- return "MD2";
- // MD5 with RSA encryption
- case "1.2.840.113549.1.1.4":
- return "MD5";
- // SHA-1 with RSA Encryption
- case "1.2.840.113549.1.1.5":
- case "1.3.14.3.2.29":
- return "SHA1";
- default:
- return null;
- }
- }
-
- internal bool VerifySignature (RSA rsa)
- {
- RSAPKCS1SignatureDeformatter v = new RSAPKCS1SignatureDeformatter (rsa);
- string hashName = GetHashNameFromOID (m_signaturealgo);
- if (hashName == null)
- throw new CryptographicException ("Unsupported hash algorithm: " + m_signaturealgo);
-
- v.SetHashAlgorithm (hashName);
- return v.VerifySignature (this.Hash, this.Signature);
- }
-
- public bool VerifySignature (AsymmetricAlgorithm aa)
- {
- if (aa == null)
- throw new ArgumentNullException ("aa");
-
- if (aa is RSA)
- return VerifySignature (aa as RSA);
- else if (aa is DSA)
- return VerifySignature (aa as DSA);
- else
- throw new NotSupportedException ("Unknown Asymmetric Algorithm " + aa.ToString ());
- }
-
- public bool CheckSignature (byte[] hash, string hashAlgorithm, byte[] signature)
- {
- RSACryptoServiceProvider r = (RSACryptoServiceProvider) RSA;
- return r.VerifyHash (hash, hashAlgorithm, signature);
- }
-
- public bool IsSelfSigned {
- get {
- if (m_issuername == m_subject)
- return VerifySignature (RSA);
- else
- return false;
- }
- }
-
- public ASN1 GetIssuerName ()
- {
- return issuer;
- }
-
- public ASN1 GetSubjectName ()
- {
- return subject;
- }
-
- protected X509Certificate (SerializationInfo info, StreamingContext context)
- {
- Parse ((byte[]) info.GetValue ("raw", typeof (byte[])));
- }
-
- [SecurityPermission (SecurityAction.Demand, SerializationFormatter = true)]
- public virtual void GetObjectData (SerializationInfo info, StreamingContext context)
- {
- info.AddValue ("raw", m_encodedcert);
- // note: we NEVER serialize the private key
- }
-
- static byte[] PEM (string type, byte[] data)
- {
- string pem = Encoding.ASCII.GetString (data);
- string header = String.Format ("-----BEGIN {0}-----", type);
- string footer = String.Format ("-----END {0}-----", type);
- int start = pem.IndexOf (header) + header.Length;
- int end = pem.IndexOf (footer, start);
- string base64 = pem.Substring (start, (end - start));
- return Convert.FromBase64String (base64);
- }
- }
-}
+++ /dev/null
-//
-// Based on System.Security.Cryptography.X509Certificates.X509CertificateCollection
-// in System assembly
-//
-// Authors:
-// Lawrence Pit (loz@cable.a2000.nl)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security.X509 {
-
- [Serializable]
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509CertificateCollection : CollectionBase, IEnumerable {
-
- public X509CertificateCollection ()
- {
- }
-
- public X509CertificateCollection (X509Certificate [] value)
- {
- AddRange (value);
- }
-
- public X509CertificateCollection (X509CertificateCollection value)
- {
- AddRange (value);
- }
-
- // Properties
-
- public X509Certificate this [int index] {
- get { return (X509Certificate) InnerList [index]; }
- set { InnerList [index] = value; }
- }
-
- // Methods
-
- public int Add (X509Certificate value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- return InnerList.Add (value);
- }
-
- public void AddRange (X509Certificate [] value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- for (int i = 0; i < value.Length; i++)
- InnerList.Add (value [i]);
- }
-
- public void AddRange (X509CertificateCollection value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- for (int i = 0; i < value.InnerList.Count; i++)
- InnerList.Add (value [i]);
- }
-
- public bool Contains (X509Certificate value)
- {
- return (IndexOf (value) != -1);
- }
-
- public void CopyTo (X509Certificate[] array, int index)
- {
- InnerList.CopyTo (array, index);
- }
-
- public new X509CertificateEnumerator GetEnumerator ()
- {
- return new X509CertificateEnumerator (this);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return InnerList.GetEnumerator ();
- }
-
- public override int GetHashCode ()
- {
- return InnerList.GetHashCode ();
- }
-
- public int IndexOf (X509Certificate value)
- {
- if (value == null)
- throw new ArgumentNullException ("value");
-
- byte[] hash = value.Hash;
- for (int i=0; i < InnerList.Count; i++) {
- X509Certificate x509 = (X509Certificate) InnerList [i];
- if (Compare (x509.Hash, hash))
- return i;
- }
- return -1;
- }
-
- public void Insert (int index, X509Certificate value)
- {
- InnerList.Insert (index, value);
- }
-
- public void Remove (X509Certificate value)
- {
- InnerList.Remove (value);
- }
-
- // private stuff
-
- private bool Compare (byte[] array1, byte[] array2)
- {
- if ((array1 == null) && (array2 == null))
- return true;
- if ((array1 == null) || (array2 == null))
- return false;
- if (array1.Length != array2.Length)
- return false;
- for (int i=0; i < array1.Length; i++) {
- if (array1 [i] != array2 [i])
- return false;
- }
- return true;
- }
-
- // Inner Class
-
- public class X509CertificateEnumerator : IEnumerator {
-
- private IEnumerator enumerator;
-
- // Constructors
-
- public X509CertificateEnumerator (X509CertificateCollection mappings)
- {
- enumerator = ((IEnumerable) mappings).GetEnumerator ();
- }
-
- // Properties
-
- public X509Certificate Current {
- get { return (X509Certificate) enumerator.Current; }
- }
-
- object IEnumerator.Current {
- get { return enumerator.Current; }
- }
-
- // Methods
-
- bool IEnumerator.MoveNext ()
- {
- return enumerator.MoveNext ();
- }
-
- void IEnumerator.Reset ()
- {
- enumerator.Reset ();
- }
-
- public bool MoveNext ()
- {
- return enumerator.MoveNext ();
- }
-
- public void Reset ()
- {
- enumerator.Reset ();
- }
- }
- }
-}
+++ /dev/null
-//
-// X509Chain.cs: X.509 Certificate Path
-// This is a VERY simplified and minimal version
-// used for
-// Authenticode support
-// TLS/SSL support
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 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.Security;
-using System.Security.Permissions;
-
-#if !INSIDE_CORLIB
-using System.Net;
-#endif
-
-using Mono.Security.X509.Extensions;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509Chain {
-
- private X509CertificateCollection roots;
- private X509CertificateCollection certs;
- private X509Certificate _root;
-
- private X509CertificateCollection _chain;
- private X509ChainStatusFlags _status;
-
- // constructors
-
- public X509Chain ()
- {
- certs = new X509CertificateCollection ();
- }
-
- // get a pre-builded chain
- public X509Chain (X509CertificateCollection chain) : this ()
- {
- _chain = new X509CertificateCollection ();
- _chain.AddRange (chain);
- }
-
- // properties
-
- public X509CertificateCollection Chain {
- get { return _chain; }
- }
-
- // the root of the specified certificate (may not be trusted!)
- public X509Certificate Root {
- get { return _root; }
- }
-
- public X509ChainStatusFlags Status {
- get { return _status; }
- }
-
- public X509CertificateCollection TrustAnchors {
- get {
- if (roots == null) {
- roots = new X509CertificateCollection ();
- roots.AddRange (X509StoreManager.TrustedRootCertificates);
- return roots;
- }
- return roots;
- }
- [SecurityPermission (SecurityAction.Demand, Flags=SecurityPermissionFlag.ControlPolicy)]
- set { roots = value; }
- }
-
- // methods
-
- public void LoadCertificate (X509Certificate x509)
- {
- certs.Add (x509);
- }
-
- public void LoadCertificates (X509CertificateCollection collection)
- {
- certs.AddRange (collection);
- }
-
- public X509Certificate FindByIssuerName (string issuerName)
- {
- foreach (X509Certificate x in certs) {
- if (x.IssuerName == issuerName)
- return x;
- }
- return null;
- }
-
- public bool Build (X509Certificate leaf)
- {
- _status = X509ChainStatusFlags.NoError;
- if (_chain == null) {
- // chain not supplied - we must build it ourselve
- _chain = new X509CertificateCollection ();
- X509Certificate x = leaf;
- X509Certificate tmp = x;
- while ((x != null) && (!x.IsSelfSigned)) {
- tmp = x; // last valid
- _chain.Add (x);
- x = FindCertificateParent (x);
- }
- // find a trusted root
- _root = FindCertificateRoot (tmp);
- }
- else {
- // chain supplied - still have to check signatures!
- int last = _chain.Count;
- if (last > 0) {
- if (IsParent (leaf, _chain [0])) {
- int i = 1;
- for (; i < last; i++) {
- if (!IsParent (_chain [i-1], _chain [i]))
- break;
- }
- if (i == last)
- _root = FindCertificateRoot (_chain [last - 1]);
- }
- }
- else {
- // is the leaf a root ? (trusted or untrusted)
- _root = FindCertificateRoot (leaf);
- }
- }
-
- // validate the chain
- if ((_chain != null) && (_status == X509ChainStatusFlags.NoError)) {
- foreach (X509Certificate x in _chain) {
- // validate dates for each certificate in the chain
- // note: we DO NOT check for nested date/time
- if (!IsValid (x)) {
- return false;
- }
- }
- // check leaf
- if (!IsValid (leaf)) {
- // switch status code if the failure is expiration
- if (_status == X509ChainStatusFlags.NotTimeNested)
- _status = X509ChainStatusFlags.NotTimeValid;
- return false;
- }
- // check root
- if ((_root != null) && !IsValid (_root)) {
- return false;
- }
- }
- return (_status == X509ChainStatusFlags.NoError);
- }
-
- //
-
- public void Reset ()
- {
- _status = X509ChainStatusFlags.NoError;
- roots = null; // this force a reload
- certs.Clear ();
- if (_chain != null)
- _chain.Clear ();
- }
-
- // private stuff
-
- private bool IsValid (X509Certificate cert)
- {
- if (!cert.IsCurrent) {
- // FIXME: nesting isn't very well implemented
- _status = X509ChainStatusFlags.NotTimeNested;
- return false;
- }
-
- // TODO - we should check for CRITICAL but unknown extensions
- // X509ChainStatusFlags.InvalidExtension
-#if !INSIDE_CORLIB
- if (ServicePointManager.CheckCertificateRevocationList) {
- // TODO - check revocation (CRL, OCSP ...)
- // X509ChainStatusFlags.RevocationStatusUnknown
- // X509ChainStatusFlags.Revoked
- }
-#endif
- return true;
- }
-
- private X509Certificate FindCertificateParent (X509Certificate child)
- {
- foreach (X509Certificate potentialParent in certs) {
- if (IsParent (child, potentialParent))
- return potentialParent;
- }
- return null;
- }
-
- private X509Certificate FindCertificateRoot (X509Certificate potentialRoot)
- {
- if (potentialRoot == null) {
- _status = X509ChainStatusFlags.PartialChain;
- return null;
- }
-
- // if the trusted root is in the chain
- if (IsTrusted (potentialRoot)) {
- return potentialRoot;
- }
-
- // if the root isn't in the chain
- foreach (X509Certificate root in TrustAnchors) {
- if (IsParent (potentialRoot, root)) {
- return root;
- }
- }
-
- // is it a (untrusted) root ?
- if (potentialRoot.IsSelfSigned) {
- _status = X509ChainStatusFlags.UntrustedRoot;
- return potentialRoot;
- }
-
- _status = X509ChainStatusFlags.PartialChain;
- return null;
- }
-
- private bool IsTrusted (X509Certificate potentialTrusted)
- {
- return TrustAnchors.Contains (potentialTrusted);
- }
-
- private bool IsParent (X509Certificate child, X509Certificate parent)
- {
- if (child.IssuerName != parent.SubjectName)
- return false;
-
- // parent MUST have the Basic Constraint CA=true (except for trusted roots)
- // see why at http://www.microsoft.com/technet/security/bulletin/MS02-050.asp
- if ((parent.Version > 2) && (!IsTrusted (parent))) {
- // TODO: we do not support pathLenConstraint
- X509Extension ext = parent.Extensions ["2.5.29.19"];
- if (ext != null) {
- BasicConstraintsExtension bc = new BasicConstraintsExtension (ext);
- if (!bc.CertificateAuthority)
- _status = X509ChainStatusFlags.InvalidBasicConstraints;
- }
- else
- _status = X509ChainStatusFlags.InvalidBasicConstraints;
- }
-
- if (!child.VerifySignature (parent.RSA)) {
- _status = X509ChainStatusFlags.NotSignatureValid;
- return false;
- }
- return true;
- }
- }
-}
+++ /dev/null
-//
-// X509ChainStatusFlags.cs: X.509 Chain Status
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security.X509 {
-
- // definitions from Fx 1.2
- // commented flags aren't implemented in X509Chain
-
- [Serializable]
- [Flags]
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- enum X509ChainStatusFlags {
-// CtlNotSignatureValid = 262144,
-// CtlNotTimeValid = 131072,
-// CtlNotValidForUsage = 524288,
-// Cyclic = 128,
-// HasExcludedNameConstraint = 32768,
-// HasNotDefinedNameConstraint = 8192,
-// HasNotPermittedNameConstraint = 16384,
-// HasNotSupportedNameConstraint = 4096,
- InvalidBasicConstraints = 1024,
-// InvalidExtension = 256,
-// InvalidNameConstraints = 2048,
-// InvalidPolicyConstraints = 512,
- NoError = 0,
-// NoIssuanceChainPolicy = 33554432,
- NotSignatureValid = 8,
- NotTimeNested = 2,
- NotTimeValid = 1,
-// NotValidForUsage = 16,
-// OfflineRevocation = 16777216,
- PartialChain = 65536,
-// RevocationStatusUnknown = 64,
-// Revoked = 4,
- UntrustedRoot = 32
- }
-}
+++ /dev/null
-//
-// X509Extension.cs: Base class for all X.509 extensions.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Text;
-
-using Mono.Security;
-
-namespace Mono.Security.X509 {
- /*
- * Extension ::= SEQUENCE {
- * extnID OBJECT IDENTIFIER,
- * critical BOOLEAN DEFAULT FALSE,
- * extnValue OCTET STRING
- * }
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509Extension {
-
- protected string extnOid;
- protected bool extnCritical;
- protected ASN1 extnValue;
-
- protected X509Extension ()
- {
- extnCritical = false;
- }
-
- public X509Extension (ASN1 asn1)
- {
- if ((asn1.Tag != 0x30) || (asn1.Count < 2))
- throw new ArgumentException (Locale.GetText ("Invalid X.509 extension."));
- if (asn1[0].Tag != 0x06)
- throw new ArgumentException (Locale.GetText ("Invalid X.509 extension."));
-
- extnOid = ASN1Convert.ToOid (asn1[0]);
- extnCritical = ((asn1[1].Tag == 0x01) && (asn1[1].Value[0] == 0xFF));
- // last element is an octet string which may need to be decoded
- extnValue = asn1 [asn1.Count - 1];
- if ((extnValue.Tag == 0x04) && (extnValue.Length > 0) && (extnValue.Count == 0)) {
- try {
- ASN1 encapsulated = new ASN1 (extnValue.Value);
- extnValue.Value = null;
- extnValue.Add (encapsulated);
- }
- catch {
- // data isn't ASN.1
- }
- }
- Decode ();
- }
-
- public X509Extension (X509Extension extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
- if ((extension.Value == null) || (extension.Value.Tag != 0x04) || (extension.Value.Count != 1))
- throw new ArgumentException (Locale.GetText ("Invalid X.509 extension."));
-
- extnOid = extension.Oid;
- extnCritical = extension.Critical;
- extnValue = extension.Value;
- Decode ();
- }
-
- // encode the extension *into* an OCTET STRING
- protected virtual void Decode ()
- {
- }
-
- // decode the extension from *inside* an OCTET STRING
- protected virtual void Encode ()
- {
- }
-
- public ASN1 ASN1 {
- get {
- ASN1 extension = new ASN1 (0x30);
- extension.Add (ASN1Convert.FromOid (extnOid));
- if (extnCritical)
- extension.Add (new ASN1 (0x01, new byte [1] { 0xFF }));
- Encode ();
- extension.Add (extnValue);
- return extension;
- }
- }
-
- public string Oid {
- get { return extnOid; }
- }
-
- public bool Critical {
- get { return extnCritical; }
- set { extnCritical = value; }
- }
-
- // this gets overrided with more meaningful names
- public virtual string Name {
- get { return extnOid; }
- }
-
- public ASN1 Value {
- get {
- if (extnValue == null) {
- Encode ();
- }
- return extnValue;
- }
- }
-
- public override bool Equals (object obj)
- {
- if (obj == null)
- return false;
-
- X509Extension ex = (obj as X509Extension);
- if (ex == null)
- return false;
-
- if (extnCritical != ex.extnCritical)
- return false;
- if (extnOid != ex.extnOid)
- return false;
- if (extnValue.Length != ex.extnValue.Length)
- return false;
-
- for (int i=0; i < extnValue.Length; i++) {
- if (extnValue [i] != ex.extnValue [i])
- return false;
- }
- return true;
- }
-
- public byte[] GetBytes ()
- {
- return ASN1.GetBytes ();
- }
-
- public override int GetHashCode ()
- {
- // OID should be unique in a collection of extensions
- return extnOid.GetHashCode ();
- }
-
- private void WriteLine (StringBuilder sb, int n, int pos)
- {
- byte[] value = extnValue.Value;
- int p = pos;
- for (int j=0; j < 8; j++) {
- if (j < n) {
- sb.Append (value [p++].ToString ("X2", CultureInfo.InvariantCulture));
- sb.Append (" ");
- }
- else
- sb.Append (" ");
- }
- sb.Append (" ");
- p = pos;
- for (int j=0; j < n; j++) {
- byte b = value [p++];
- if (b < 0x20)
- sb.Append (".");
- else
- sb.Append (Convert.ToChar (b));
- }
- sb.Append (Environment.NewLine);
- }
-
- public override string ToString ()
- {
- StringBuilder sb = new StringBuilder ();
- int div = (extnValue.Length >> 3);
- int rem = (extnValue.Length - (div << 3));
- int x = 0;
- for (int i=0; i < div; i++) {
- WriteLine (sb, 8, x);
- x += 8;
- }
- WriteLine (sb, rem, x);
- return sb.ToString ();
- }
- }
-}
+++ /dev/null
-//
-// X509Extensions.cs: Handles X.509 extensions.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (http://www.novell.com)
-//
-
-//
-// Copyright (C) 2004 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;
-
-using Mono.Security;
-
-namespace Mono.Security.X509 {
- /*
- * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension
- *
- * Note: 1..MAX -> There shouldn't be 0 Extensions in the ASN1 structure
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class X509ExtensionCollection : CollectionBase, IEnumerable {
-
- private bool readOnly;
-
- public X509ExtensionCollection () : base ()
- {
- }
-
- public X509ExtensionCollection (ASN1 asn1) : this ()
- {
- readOnly = true;
- if (asn1 == null)
- return;
- if (asn1.Tag != 0x30)
- throw new Exception ("Invalid extensions format");
- for (int i=0; i < asn1.Count; i++) {
- X509Extension extension = new X509Extension (asn1 [i]);
- InnerList.Add (extension);
- }
- }
-
- public int Add (X509Extension extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
- if (readOnly)
- throw new NotSupportedException ("Extensions are read only");
-
- return InnerList.Add (extension);
- }
-
- public void AddRange (X509Extension[] extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
- if (readOnly)
- throw new NotSupportedException ("Extensions are read only");
-
- for (int i = 0; i < extension.Length; i++)
- InnerList.Add (extension [i]);
- }
-
- public void AddRange (X509ExtensionCollection collection)
- {
- if (collection == null)
- throw new ArgumentNullException ("collection");
- if (readOnly)
- throw new NotSupportedException ("Extensions are read only");
-
- for (int i = 0; i < collection.InnerList.Count; i++)
- InnerList.Add (collection [i]);
- }
-
- public bool Contains (X509Extension extension)
- {
- return (IndexOf (extension) != -1);
- }
-
- public bool Contains (string oid)
- {
- return (IndexOf (oid) != -1);
- }
-
- public void CopyTo (X509Extension[] extensions, int index)
- {
- if (extensions == null)
- throw new ArgumentNullException ("extensions");
-
- InnerList.CopyTo (extensions, index);
- }
-
- public int IndexOf (X509Extension extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
-
- for (int i=0; i < InnerList.Count; i++) {
- X509Extension ex = (X509Extension) InnerList [i];
- if (ex.Equals (extension))
- return i;
- }
- return -1;
- }
-
- public int IndexOf (string oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- for (int i=0; i < InnerList.Count; i++) {
- X509Extension ex = (X509Extension) InnerList [i];
- if (ex.Oid == oid)
- return i;
- }
- return -1;
- }
-
- public void Insert (int index, X509Extension extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
-
- InnerList.Insert (index, extension);
- }
-
- public void Remove (X509Extension extension)
- {
- if (extension == null)
- throw new ArgumentNullException ("extension");
-
- InnerList.Remove (extension);
- }
-
- public void Remove (string oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- int index = IndexOf (oid);
- if (index != -1)
- InnerList.RemoveAt (index);
- }
-
- IEnumerator IEnumerable.GetEnumerator ()
- {
- return InnerList.GetEnumerator ();
- }
-
- public X509Extension this [int index] {
- get { return (X509Extension) InnerList [index]; }
- }
-
- public X509Extension this [string oid] {
- get {
- int index = IndexOf (oid);
- if (index == -1)
- return null;
- return (X509Extension) InnerList [index];
- }
- }
-
- public byte[] GetBytes ()
- {
- if (InnerList.Count < 1)
- return null;
- ASN1 sequence = new ASN1 (0x30);
- for (int i=0; i < InnerList.Count; i++) {
- X509Extension x = (X509Extension) InnerList [i];
- sequence.Add (x.ASN1);
- }
- return sequence.GetBytes ();
- }
- }
-}
+++ /dev/null
-//
-// X509Store.cs: Handles a X.509 certificates/CRLs store
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Pablo Ruiz <pruiz@netway.org>
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// (C) 2010 Pablo Ruiz.
-//
-// 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;
-using System.Globalization;
-using System.IO;
-using System.Text;
-using System.Security.Cryptography;
-
-using Mono.Security.Cryptography;
-using Mono.Security.X509.Extensions;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509Store {
-
- private string _storePath;
- private X509CertificateCollection _certificates;
- private ArrayList _crls;
- private bool _crl;
- private string _name;
-
- internal X509Store (string path, bool crl)
- {
- _storePath = path;
- _crl = crl;
- }
-
- // properties
-
- public X509CertificateCollection Certificates {
- get {
- if (_certificates == null) {
- _certificates = BuildCertificatesCollection (_storePath);
- }
- return _certificates;
- }
- }
-
- public ArrayList Crls {
- get {
- // CRL aren't applicable to all stores
- // but returning null is a little rude
- if (!_crl) {
- _crls = new ArrayList ();
- }
- if (_crls == null) {
- _crls = BuildCrlsCollection (_storePath);
- }
- return _crls;
- }
- }
-
- public string Name {
- get {
- if (_name == null) {
- int n = _storePath.LastIndexOf (Path.DirectorySeparatorChar);
- _name = _storePath.Substring (n+1);
- }
- return _name;
- }
- }
-
- // methods
-
- public void Clear ()
- {
- if (_certificates != null)
- _certificates.Clear ();
- _certificates = null;
- if (_crls != null)
- _crls.Clear ();
- _crls = null;
- }
-
- public void Import (X509Certificate certificate)
- {
- CheckStore (_storePath, true);
-
- string filename = Path.Combine (_storePath, GetUniqueName (certificate));
- if (!File.Exists (filename)) {
- using (FileStream fs = File.Create (filename)) {
- byte[] data = certificate.RawData;
- fs.Write (data, 0, data.Length);
- fs.Close ();
- }
- }
-#if !NET_2_1
- // Try to save privateKey if available..
- CspParameters cspParams = new CspParameters ();
- cspParams.KeyContainerName = CryptoConvert.ToHex (certificate.Hash);
-
- // Right now this seems to be the best way to know if we should use LM store.. ;)
- if (_storePath.StartsWith (X509StoreManager.LocalMachinePath))
- cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
-
- ImportPrivateKey (certificate, cspParams);
-#endif
- }
-
- public void Import (X509Crl crl)
- {
- CheckStore (_storePath, true);
-
- string filename = Path.Combine (_storePath, GetUniqueName (crl));
- if (!File.Exists (filename)) {
- using (FileStream fs = File.Create (filename)) {
- byte[] data = crl.RawData;
- fs.Write (data, 0, data.Length);
- }
- }
- }
-
- public void Remove (X509Certificate certificate)
- {
- string filename = Path.Combine (_storePath, GetUniqueName (certificate));
- if (File.Exists (filename)) {
- File.Delete (filename);
- }
- }
-
- public void Remove (X509Crl crl)
- {
- string filename = Path.Combine (_storePath, GetUniqueName (crl));
- if (File.Exists (filename)) {
- File.Delete (filename);
- }
- }
-
- // private stuff
-
- private string GetUniqueName (X509Certificate certificate)
- {
- string method;
- byte[] name = GetUniqueName (certificate.Extensions);
- if (name == null) {
- method = "tbp"; // thumbprint
- name = certificate.Hash;
- } else {
- method = "ski";
- }
- return GetUniqueName (method, name, ".cer");
- }
-
- private string GetUniqueName (X509Crl crl)
- {
- string method;
- byte[] name = GetUniqueName (crl.Extensions);
- if (name == null) {
- method = "tbp"; // thumbprint
- name = crl.Hash;
- } else {
- method = "ski";
- }
- return GetUniqueName (method, name, ".crl");
- }
-
- private byte[] GetUniqueName (X509ExtensionCollection extensions)
- {
- // We prefer Subject Key Identifier as the unique name
- // as it will provide faster lookups
- X509Extension ext = extensions ["2.5.29.14"];
- if (ext == null)
- return null;
-
- SubjectKeyIdentifierExtension ski = new SubjectKeyIdentifierExtension (ext);
- return ski.Identifier;
- }
-
- private string GetUniqueName (string method, byte[] name, string fileExtension)
- {
- StringBuilder sb = new StringBuilder (method);
-
- sb.Append ("-");
- foreach (byte b in name) {
- sb.Append (b.ToString ("X2", CultureInfo.InvariantCulture));
- }
- sb.Append (fileExtension);
-
- return sb.ToString ();
- }
-
- private byte[] Load (string filename)
- {
- byte[] data = null;
- using (FileStream fs = File.OpenRead (filename)) {
- data = new byte [fs.Length];
- fs.Read (data, 0, data.Length);
- fs.Close ();
- }
- return data;
- }
-
- private X509Certificate LoadCertificate (string filename)
- {
- byte[] data = Load (filename);
- X509Certificate cert = new X509Certificate (data);
-#if !NET_2_1
- // If privateKey it's available, load it too..
- CspParameters cspParams = new CspParameters ();
- cspParams.KeyContainerName = CryptoConvert.ToHex (cert.Hash);
- if (_storePath.StartsWith (X509StoreManager.LocalMachinePath))
- cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
- KeyPairPersistence kpp = new KeyPairPersistence (cspParams);
-
- if (!kpp.Load ())
- return cert;
-
- if (cert.RSA != null)
- cert.RSA = new RSACryptoServiceProvider (cspParams);
- else if (cert.DSA != null)
- cert.DSA = new DSACryptoServiceProvider (cspParams);
-#endif
- return cert;
- }
-
- private X509Crl LoadCrl (string filename)
- {
- byte[] data = Load (filename);
- X509Crl crl = new X509Crl (data);
- return crl;
- }
-
- private bool CheckStore (string path, bool throwException)
- {
- try {
- if (Directory.Exists (path))
- return true;
- Directory.CreateDirectory (path);
- return Directory.Exists (path);
- }
- catch {
- if (throwException)
- throw;
- return false;
- }
- }
-
- private X509CertificateCollection BuildCertificatesCollection (string storeName)
- {
- X509CertificateCollection coll = new X509CertificateCollection ();
- string path = Path.Combine (_storePath, storeName);
- if (!CheckStore (path, false))
- return coll; // empty collection
-
- string[] files = Directory.GetFiles (path, "*.cer");
- if ((files != null) && (files.Length > 0)) {
- foreach (string file in files) {
- try {
- X509Certificate cert = LoadCertificate (file);
- coll.Add (cert);
- }
- catch {
- // in case someone is dumb enough
- // (like me) to include a base64
- // encoded certs (or other junk
- // into the store).
- }
- }
- }
- return coll;
- }
-
- private ArrayList BuildCrlsCollection (string storeName)
- {
- ArrayList list = new ArrayList ();
- string path = Path.Combine (_storePath, storeName);
- if (!CheckStore (path, false))
- return list; // empty list
-
- string[] files = Directory.GetFiles (path, "*.crl");
- if ((files != null) && (files.Length > 0)) {
- foreach (string file in files) {
- try {
- X509Crl crl = LoadCrl (file);
- list.Add (crl);
- }
- catch {
- // junk catcher
- }
- }
- }
- return list;
- }
-#if !NET_2_1
- private void ImportPrivateKey (X509Certificate certificate, CspParameters cspParams)
- {
- RSACryptoServiceProvider rsaCsp = certificate.RSA as RSACryptoServiceProvider;
- if (rsaCsp != null) {
- if (rsaCsp.PublicOnly)
- return;
-
- RSACryptoServiceProvider csp = new RSACryptoServiceProvider(cspParams);
- csp.ImportParameters(rsaCsp.ExportParameters(true));
- csp.PersistKeyInCsp = true;
- return;
- }
-
- RSAManaged rsaMng = certificate.RSA as RSAManaged;
- if (rsaMng != null) {
- if (rsaMng.PublicOnly)
- return;
-
- RSACryptoServiceProvider csp = new RSACryptoServiceProvider(cspParams);
- csp.ImportParameters(rsaMng.ExportParameters(true));
- csp.PersistKeyInCsp = true;
- return;
- }
-
- DSACryptoServiceProvider dsaCsp = certificate.DSA as DSACryptoServiceProvider;
- if (dsaCsp != null) {
- if (dsaCsp.PublicOnly)
- return;
-
- DSACryptoServiceProvider csp = new DSACryptoServiceProvider(cspParams);
- csp.ImportParameters(dsaCsp.ExportParameters(true));
- csp.PersistKeyInCsp = true;
- }
- }
-#endif
- }
-}
+++ /dev/null
-//
-// X509StoreManager.cs: X.509 store manager.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2004 Novell (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;
-using System.IO;
-
-using Mono.Security.X509.Extensions;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class X509StoreManager {
-
- static private string _userPath;
- static private string _localMachinePath;
- static private X509Stores _userStore;
- static private X509Stores _machineStore;
-
- private X509StoreManager ()
- {
- }
-
- internal static string CurrentUserPath {
- get {
- if (_userPath == null) {
- _userPath = Path.Combine(
- Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
- ".mono");
- _userPath = Path.Combine(_userPath, "certs");
- }
- return _userPath;
- }
- }
-
- internal static string LocalMachinePath {
- get {
- if (_localMachinePath == null) {
- _localMachinePath = Path.Combine (
- Environment.GetFolderPath (Environment.SpecialFolder.CommonApplicationData),
- ".mono");
- _localMachinePath = Path.Combine (_localMachinePath, "certs");
- }
- return _localMachinePath;
- }
- }
-
- static public X509Stores CurrentUser {
- get {
- if (_userStore == null)
- _userStore = new X509Stores(CurrentUserPath);
-
- return _userStore;
- }
- }
-
- static public X509Stores LocalMachine {
- get {
- if (_machineStore == null)
- _machineStore = new X509Stores (LocalMachinePath);
-
- return _machineStore;
- }
- }
-
- // Merged stores collections
- // we need to look at both the user and the machine (entreprise)
- // certificates/CRLs when building/validating a chain
-
- static public X509CertificateCollection IntermediateCACertificates {
- get {
- X509CertificateCollection intermediateCerts = new X509CertificateCollection ();
- intermediateCerts.AddRange (CurrentUser.IntermediateCA.Certificates);
- intermediateCerts.AddRange (LocalMachine.IntermediateCA.Certificates);
- return intermediateCerts;
- }
- }
-
- static public ArrayList IntermediateCACrls {
- get {
- ArrayList intermediateCRLs = new ArrayList ();
- intermediateCRLs.AddRange (CurrentUser.IntermediateCA.Crls);
- intermediateCRLs.AddRange (LocalMachine.IntermediateCA.Crls);
- return intermediateCRLs;
- }
- }
-
- static public X509CertificateCollection TrustedRootCertificates {
- get {
- X509CertificateCollection trustedCerts = new X509CertificateCollection ();
- trustedCerts.AddRange (CurrentUser.TrustedRoot.Certificates);
- trustedCerts.AddRange (LocalMachine.TrustedRoot.Certificates);
- return trustedCerts;
- }
- }
-
- static public ArrayList TrustedRootCACrls {
- get {
- ArrayList trustedCRLs = new ArrayList ();
- trustedCRLs.AddRange (CurrentUser.TrustedRoot.Crls);
- trustedCRLs.AddRange (LocalMachine.TrustedRoot.Crls);
- return trustedCRLs;
- }
- }
-
- static public X509CertificateCollection UntrustedCertificates {
- get {
- X509CertificateCollection untrustedCerts = new X509CertificateCollection ();
- untrustedCerts.AddRange (CurrentUser.Untrusted.Certificates);
- untrustedCerts.AddRange (LocalMachine.Untrusted.Certificates);
- return untrustedCerts;
- }
- }
- }
-}
+++ /dev/null
-//
-// X509Stores.cs: Handles X.509 certificates/CRLs stores group.
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2004 Novell (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;
-using System.IO;
-
-using Mono.Security.X509.Extensions;
-
-namespace Mono.Security.X509 {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X509Stores {
-
- private string _storePath;
- private X509Store _personal;
- private X509Store _other;
- private X509Store _intermediate;
- private X509Store _trusted;
- private X509Store _untrusted;
-
- internal X509Stores (string path)
- {
- _storePath = path;
- }
-
- // properties
-
- public X509Store Personal {
- get {
- if (_personal == null) {
- string path = Path.Combine (_storePath, Names.Personal);
- _personal = new X509Store (path, false);
- }
- return _personal;
- }
- }
-
- public X509Store OtherPeople {
- get {
- if (_other == null) {
- string path = Path.Combine (_storePath, Names.OtherPeople);
- _other = new X509Store (path, false);
- }
- return _other;
- }
- }
-
- public X509Store IntermediateCA {
- get {
- if (_intermediate == null) {
- string path = Path.Combine (_storePath, Names.IntermediateCA);
- _intermediate = new X509Store (path, true);
- }
- return _intermediate;
- }
- }
-
- public X509Store TrustedRoot {
- get {
- if (_trusted == null) {
- string path = Path.Combine (_storePath, Names.TrustedRoot);
- _trusted = new X509Store (path, true);
- }
- return _trusted;
- }
- }
-
- public X509Store Untrusted {
- get {
- if (_untrusted == null) {
- string path = Path.Combine (_storePath, Names.Untrusted);
- _untrusted = new X509Store (path, false);
- }
- return _untrusted;
- }
- }
-
- // methods
-
- public void Clear ()
- {
- // this will force a reload of all stores
- if (_personal != null)
- _personal.Clear ();
- _personal = null;
- if (_other != null)
- _other.Clear ();
- _other = null;
- if (_intermediate != null)
- _intermediate.Clear ();
- _intermediate = null;
- if (_trusted != null)
- _trusted.Clear ();
- _trusted = null;
- if (_untrusted != null)
- _untrusted.Clear ();
- _untrusted = null;
- }
-
- public X509Store Open (string storeName, bool create)
- {
- if (storeName == null)
- throw new ArgumentNullException ("storeName");
-
- string path = Path.Combine (_storePath, storeName);
- if (!create && !Directory.Exists (path))
- return null;
-
- return new X509Store (path, true);
- }
-
- // names
-
- public class Names {
-
- // do not translate
- public const string Personal = "My";
- public const string OtherPeople = "AddressBook";
- public const string IntermediateCA = "CA";
- public const string TrustedRoot = "Trust";
- public const string Untrusted = "Disallowed";
-
- public Names () {}
- }
- }
-}
+++ /dev/null
-//
-// X520.cs: X.520 related stuff (attributes, RDN)
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
-using System;
-using System.Globalization;
-using System.Text;
-
-using Mono.Security;
-
-namespace Mono.Security.X509 {
-
- // References:
- // 1. Information technology - Open Systems Interconnection - The Directory: Selected attribute types
- // http://www.itu.int/rec/recommendation.asp?type=folders&lang=e&parent=T-REC-X.520
- // 2. Internet X.509 Public Key Infrastructure Certificate and CRL Profile
- // http://www.ietf.org/rfc/rfc3280.txt
- // 3. A Summary of the X.500(96) User Schema for use with LDAPv3
- // http://www.faqs.org/rfcs/rfc2256.html
- // 4. RFC 2247 - Using Domains in LDAP/X.500 Distinguished Names
- // http://www.faqs.org/rfcs/rfc2247.html
-
- /*
- * AttributeTypeAndValue ::= SEQUENCE {
- * type AttributeType,
- * value AttributeValue
- * }
- *
- * AttributeType ::= OBJECT IDENTIFIER
- *
- * AttributeValue ::= ANY DEFINED BY AttributeType
- */
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class X520 {
-
- public abstract class AttributeTypeAndValue {
- private string oid;
- private string attrValue;
- private int upperBound;
- private byte encoding;
-
- protected AttributeTypeAndValue (string oid, int upperBound)
- {
- this.oid = oid;
- this.upperBound = upperBound;
- this.encoding = 0xFF;
- }
-
- protected AttributeTypeAndValue (string oid, int upperBound, byte encoding)
- {
- this.oid = oid;
- this.upperBound = upperBound;
- this.encoding = encoding;
- }
-
- public string Value {
- get { return attrValue; }
- set {
- if ((attrValue != null) && (attrValue.Length > upperBound)) {
- string msg = Locale.GetText ("Value length bigger than upperbound ({0}).");
- throw new FormatException (String.Format (msg, upperBound));
- }
- attrValue = value;
- }
- }
-
- public ASN1 ASN1 {
- get { return GetASN1 (); }
- }
-
- internal ASN1 GetASN1 (byte encoding)
- {
- byte encode = encoding;
- if (encode == 0xFF)
- encode = SelectBestEncoding ();
-
- ASN1 asn1 = new ASN1 (0x30);
- asn1.Add (ASN1Convert.FromOid (oid));
- switch (encode) {
- case 0x13:
- // PRINTABLESTRING
- asn1.Add (new ASN1 (0x13, Encoding.ASCII.GetBytes (attrValue)));
- break;
- case 0x16:
- // IA5STRING
- asn1.Add (new ASN1 (0x16, Encoding.ASCII.GetBytes (attrValue)));
- break;
- case 0x1E:
- // BMPSTRING
- asn1.Add (new ASN1 (0x1E, Encoding.BigEndianUnicode.GetBytes (attrValue)));
- break;
- }
- return asn1;
- }
-
- internal ASN1 GetASN1 ()
- {
- return GetASN1 (encoding);
- }
-
- public byte[] GetBytes (byte encoding)
- {
- return GetASN1 (encoding) .GetBytes ();
- }
-
- public byte[] GetBytes ()
- {
- return GetASN1 () .GetBytes ();
- }
-
- private byte SelectBestEncoding ()
- {
- foreach (char c in attrValue) {
- switch (c) {
- case '@':
- case '_':
- return 0x1E; // BMPSTRING
- default:
- if (c > 127)
- return 0x1E; // BMPSTRING
- break;
- }
- }
- return 0x13; // PRINTABLESTRING
- }
- }
-
- public class Name : AttributeTypeAndValue {
-
- public Name () : base ("2.5.4.41", 32768)
- {
- }
- }
-
- public class CommonName : AttributeTypeAndValue {
-
- public CommonName () : base ("2.5.4.3", 64)
- {
- }
- }
-
- // RFC2256, Section 5.6
- public class SerialNumber : AttributeTypeAndValue {
-
- // max length 64 bytes, Printable String only
- public SerialNumber ()
- : base ("2.5.4.5", 64, 0x13)
- {
- }
- }
-
- public class LocalityName : AttributeTypeAndValue {
-
- public LocalityName () : base ("2.5.4.7", 128)
- {
- }
- }
-
- public class StateOrProvinceName : AttributeTypeAndValue {
-
- public StateOrProvinceName () : base ("2.5.4.8", 128)
- {
- }
- }
-
- public class OrganizationName : AttributeTypeAndValue {
-
- public OrganizationName () : base ("2.5.4.10", 64)
- {
- }
- }
-
- public class OrganizationalUnitName : AttributeTypeAndValue {
-
- public OrganizationalUnitName () : base ("2.5.4.11", 64)
- {
- }
- }
-
- // NOTE: Not part of RFC2253
- public class EmailAddress : AttributeTypeAndValue {
-
- public EmailAddress () : base ("1.2.840.113549.1.9.1", 128, 0x16)
- {
- }
- }
-
- // RFC2247, Section 4
- public class DomainComponent : AttributeTypeAndValue {
-
- // no maximum length defined
- public DomainComponent ()
- : base ("0.9.2342.19200300.100.1.25", Int32.MaxValue, 0x16)
- {
- }
- }
-
- // RFC1274, Section 9.3.1
- public class UserId : AttributeTypeAndValue {
-
- public UserId ()
- : base ("0.9.2342.19200300.100.1.1", 256)
- {
- }
- }
-
- public class Oid : AttributeTypeAndValue {
-
- public Oid (string oid)
- : base (oid, Int32.MaxValue)
- {
- }
- }
-
- /* -- Naming attributes of type X520Title
- * id-at-title AttributeType ::= { id-at 12 }
- *
- * X520Title ::= CHOICE {
- * teletexString TeletexString (SIZE (1..ub-title)),
- * printableString PrintableString (SIZE (1..ub-title)),
- * universalString UniversalString (SIZE (1..ub-title)),
- * utf8String UTF8String (SIZE (1..ub-title)),
- * bmpString BMPString (SIZE (1..ub-title))
- * }
- */
- public class Title : AttributeTypeAndValue {
-
- public Title () : base ("2.5.4.12", 64)
- {
- }
- }
-
- public class CountryName : AttributeTypeAndValue {
-
- // (0x13) PRINTABLESTRING
- public CountryName () : base ("2.5.4.6", 2, 0x13)
- {
- }
- }
-
- public class DnQualifier : AttributeTypeAndValue {
-
- // (0x13) PRINTABLESTRING
- public DnQualifier () : base ("2.5.4.46", 2, 0x13)
- {
- }
- }
-
- public class Surname : AttributeTypeAndValue {
-
- public Surname () : base ("2.5.4.4", 32768)
- {
- }
- }
-
- public class GivenName : AttributeTypeAndValue {
-
- public GivenName () : base ("2.5.4.42", 16)
- {
- }
- }
-
- public class Initial : AttributeTypeAndValue {
-
- public Initial () : base ("2.5.4.43", 5)
- {
- }
- }
-
- }
-
- /* From RFC3280
- * -- specifications of Upper Bounds MUST be regarded as mandatory
- * -- from Annex B of ITU-T X.411 Reference Definition of MTS Parameter
- *
- * -- Upper Bounds
- *
- * ub-name INTEGER ::= 32768
- * ub-common-name INTEGER ::= 64
- * ub-locality-name INTEGER ::= 128
- * ub-state-name INTEGER ::= 128
- * ub-organization-name INTEGER ::= 64
- * ub-organizational-unit-name INTEGER ::= 64
- * ub-title INTEGER ::= 64
- * ub-serial-number INTEGER ::= 64
- * ub-match INTEGER ::= 128
- * ub-emailaddress-length INTEGER ::= 128
- * ub-common-name-length INTEGER ::= 64
- * ub-country-name-alpha-length INTEGER ::= 2
- * ub-country-name-numeric-length INTEGER ::= 3
- * ub-domain-defined-attributes INTEGER ::= 4
- * ub-domain-defined-attribute-type-length INTEGER ::= 8
- * ub-domain-defined-attribute-value-length INTEGER ::= 128
- * ub-domain-name-length INTEGER ::= 16
- * ub-extension-attributes INTEGER ::= 256
- * ub-e163-4-number-length INTEGER ::= 15
- * ub-e163-4-sub-address-length INTEGER ::= 40
- * ub-generation-qualifier-length INTEGER ::= 3
- * ub-given-name-length INTEGER ::= 16
- * ub-initials-length INTEGER ::= 5
- * ub-integer-options INTEGER ::= 256
- * ub-numeric-user-id-length INTEGER ::= 32
- * ub-organization-name-length INTEGER ::= 64
- * ub-organizational-unit-name-length INTEGER ::= 32
- * ub-organizational-units INTEGER ::= 4
- * ub-pds-name-length INTEGER ::= 16
- * ub-pds-parameter-length INTEGER ::= 30
- * ub-pds-physical-address-lines INTEGER ::= 6
- * ub-postal-code-length INTEGER ::= 16
- * ub-pseudonym INTEGER ::= 128
- * ub-surname-length INTEGER ::= 40
- * ub-terminal-id-length INTEGER ::= 24
- * ub-unformatted-address-length INTEGER ::= 180
- * ub-x121-address-length INTEGER ::= 16
- *
- * -- Note - upper bounds on string types, such as TeletexString, are
- * -- measured in characters. Excepting PrintableString or IA5String, a
- * -- significantly greater number of octets will be required to hold
- * -- such a value. As a minimum, 16 octets, or twice the specified
- * -- upper bound, whichever is the larger, should be allowed for
- * -- TeletexString. For UTF8String or UniversalString at least four
- * -- times the upper bound should be allowed.
- */
-}
+++ /dev/null
-//
-// ASN1.cs: Abstract Syntax Notation 1 - micro-parser and generator
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Jesper Pedersen <jep@itplus.dk>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-// (C) 2004 IT+ A/S (http://www.itplus.dk)
-//
-// 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;
-using System.IO;
-using System.Text;
-
-namespace Mono.Security {
-
- // References:
- // a. ITU ASN.1 standards (free download)
- // http://www.itu.int/ITU-T/studygroups/com17/languages/
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- class ASN1 {
-
- private byte m_nTag;
- private byte[] m_aValue;
- private ArrayList elist;
-
- public ASN1 () : this (0x00, null) {}
-
- public ASN1 (byte tag) : this (tag, null) {}
-
- public ASN1 (byte tag, byte[] data)
- {
- m_nTag = tag;
- m_aValue = data;
- }
-
- public ASN1 (byte[] data)
- {
- m_nTag = data [0];
-
- int nLenLength = 0;
- int nLength = data [1];
-
- if (nLength > 0x80) {
- // composed length
- nLenLength = nLength - 0x80;
- nLength = 0;
- for (int i = 0; i < nLenLength; i++) {
- nLength *= 256;
- nLength += data [i + 2];
- }
- }
- else if (nLength == 0x80) {
- // undefined length encoding
- throw new NotSupportedException ("Undefined length encoding.");
- }
-
- m_aValue = new byte [nLength];
- Buffer.BlockCopy (data, (2 + nLenLength), m_aValue, 0, nLength);
-
- if ((m_nTag & 0x20) == 0x20) {
- int nStart = (2 + nLenLength);
- Decode (data, ref nStart, data.Length);
- }
- }
-
- public int Count {
- get {
- if (elist == null)
- return 0;
- return elist.Count;
- }
- }
-
- public byte Tag {
- get { return m_nTag; }
- }
-
- public int Length {
- get {
- if (m_aValue != null)
- return m_aValue.Length;
- else
- return 0;
- }
- }
-
- public byte[] Value {
- get {
- if (m_aValue == null)
- GetBytes ();
- return (byte[]) m_aValue.Clone ();
- }
- set {
- if (value != null)
- m_aValue = (byte[]) value.Clone ();
- }
- }
-
- private bool CompareArray (byte[] array1, byte[] array2)
- {
- bool bResult = (array1.Length == array2.Length);
- if (bResult) {
- for (int i = 0; i < array1.Length; i++) {
- if (array1[i] != array2[i])
- return false;
- }
- }
- return bResult;
- }
-
- public bool Equals (byte[] asn1)
- {
- return CompareArray (this.GetBytes (), asn1);
- }
-
- public bool CompareValue (byte[] value)
- {
- return CompareArray (m_aValue, value);
- }
-
- public ASN1 Add (ASN1 asn1)
- {
- if (asn1 != null) {
- if (elist == null)
- elist = new ArrayList ();
- elist.Add (asn1);
- }
- return asn1;
- }
-
- public virtual byte[] GetBytes ()
- {
- byte[] val = null;
-
- if (Count > 0) {
- int esize = 0;
- ArrayList al = new ArrayList ();
- foreach (ASN1 a in elist) {
- byte[] item = a.GetBytes ();
- al.Add (item);
- esize += item.Length;
- }
- val = new byte [esize];
- int pos = 0;
- for (int i=0; i < elist.Count; i++) {
- byte[] item = (byte[]) al[i];
- Buffer.BlockCopy (item, 0, val, pos, item.Length);
- pos += item.Length;
- }
- } else if (m_aValue != null) {
- val = m_aValue;
- }
-
- byte[] der;
- int nLengthLen = 0;
-
- if (val != null) {
- int nLength = val.Length;
- // special for length > 127
- if (nLength > 127) {
- if (nLength <= Byte.MaxValue) {
- der = new byte [3 + nLength];
- Buffer.BlockCopy (val, 0, der, 3, nLength);
- nLengthLen = 0x81;
- der[2] = (byte)(nLength);
- }
- else if (nLength <= UInt16.MaxValue) {
- der = new byte [4 + nLength];
- Buffer.BlockCopy (val, 0, der, 4, nLength);
- nLengthLen = 0x82;
- der[2] = (byte)(nLength >> 8);
- der[3] = (byte)(nLength);
- }
- else if (nLength <= 0xFFFFFF) {
- // 24 bits
- der = new byte [5 + nLength];
- Buffer.BlockCopy (val, 0, der, 5, nLength);
- nLengthLen = 0x83;
- der [2] = (byte)(nLength >> 16);
- der [3] = (byte)(nLength >> 8);
- der [4] = (byte)(nLength);
- }
- else {
- // max (Length is an integer) 32 bits
- der = new byte [6 + nLength];
- Buffer.BlockCopy (val, 0, der, 6, nLength);
- nLengthLen = 0x84;
- der [2] = (byte)(nLength >> 24);
- der [3] = (byte)(nLength >> 16);
- der [4] = (byte)(nLength >> 8);
- der [5] = (byte)(nLength);
- }
- }
- else {
- // basic case (no encoding)
- der = new byte [2 + nLength];
- Buffer.BlockCopy (val, 0, der, 2, nLength);
- nLengthLen = nLength;
- }
- if (m_aValue == null)
- m_aValue = val;
- }
- else
- der = new byte[2];
-
- der[0] = m_nTag;
- der[1] = (byte)nLengthLen;
-
- return der;
- }
-
- // Note: Recursive
- protected void Decode (byte[] asn1, ref int anPos, int anLength)
- {
- byte nTag;
- int nLength;
- byte[] aValue;
-
- // minimum is 2 bytes (tag + length of 0)
- while (anPos < anLength - 1) {
- DecodeTLV (asn1, ref anPos, out nTag, out nLength, out aValue);
- // sometimes we get trailing 0
- if (nTag == 0)
- continue;
-
- ASN1 elm = Add (new ASN1 (nTag, aValue));
-
- if ((nTag & 0x20) == 0x20) {
- int nConstructedPos = anPos;
- elm.Decode (asn1, ref nConstructedPos, nConstructedPos + nLength);
- }
- anPos += nLength; // value length
- }
- }
-
- // TLV : Tag - Length - Value
- protected void DecodeTLV (byte[] asn1, ref int pos, out byte tag, out int length, out byte[] content)
- {
- tag = asn1 [pos++];
- length = asn1 [pos++];
-
- // special case where L contains the Length of the Length + 0x80
- if ((length & 0x80) == 0x80) {
- int nLengthLen = length & 0x7F;
- length = 0;
- for (int i = 0; i < nLengthLen; i++)
- length = length * 256 + asn1 [pos++];
- }
-
- content = new byte [length];
- Buffer.BlockCopy (asn1, pos, content, 0, length);
- }
-
- public ASN1 this [int index] {
- get {
- try {
- if ((elist == null) || (index >= elist.Count))
- return null;
- return (ASN1) elist [index];
- }
- catch (ArgumentOutOfRangeException) {
- return null;
- }
- }
- }
-
- public ASN1 Element (int index, byte anTag)
- {
- try {
- if ((elist == null) || (index >= elist.Count))
- return null;
-
- ASN1 elm = (ASN1) elist [index];
- if (elm.Tag == anTag)
- return elm;
- else
- return null;
- }
- catch (ArgumentOutOfRangeException) {
- return null;
- }
- }
-
- public override string ToString()
- {
- StringBuilder hexLine = new StringBuilder ();
-
- // Add tag
- hexLine.AppendFormat ("Tag: {0} {1}", m_nTag.ToString ("X2"), Environment.NewLine);
-
- // Add length
- hexLine.AppendFormat ("Length: {0} {1}", Value.Length, Environment.NewLine);
-
- // Add value
- hexLine.Append ("Value: ");
- hexLine.Append (Environment.NewLine);
- for (int i = 0; i < Value.Length; i++) {
- hexLine.AppendFormat ("{0} ", Value [i].ToString ("X2"));
- if ((i+1) % 16 == 0)
- hexLine.AppendFormat (Environment.NewLine);
- }
- return hexLine.ToString ();
- }
-
- public void SaveToFile (string filename)
- {
- if (filename == null)
- throw new ArgumentNullException ("filename");
-
- using (FileStream fs = File.Create (filename)) {
- byte[] data = GetBytes ();
- fs.Write (data, 0, data.Length);
- }
- }
- }
-}
+++ /dev/null
-//
-// ASN1Convert.cs: Abstract Syntax Notation 1 convertion routines
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-// Jesper Pedersen <jep@itplus.dk>
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 IT+ A/S (http://www.itplus.dk)
-// Copyright (C) 2004-2007 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;
-using System.Globalization;
-using System.Security.Cryptography;
-using System.Text;
-
-namespace Mono.Security {
-
- // References:
- // a. ITU ASN.1 standards (free download)
- // http://www.itu.int/ITU-T/studygroups/com17/languages/
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- static class ASN1Convert {
- // RFC3280, section 4.2.1.5
- // CAs conforming to this profile MUST always encode certificate
- // validity dates through the year 2049 as UTCTime; certificate validity
- // dates in 2050 or later MUST be encoded as GeneralizedTime.
-
- // Under 1.x this API requires a Local datetime to be provided
- // Under 2.0 it will also accept a Utc datetime
- static public ASN1 FromDateTime (DateTime dt)
- {
- if (dt.Year < 2050) {
- // UTCTIME
- return new ASN1 (0x17, Encoding.ASCII.GetBytes (
- dt.ToUniversalTime ().ToString ("yyMMddHHmmss",
- CultureInfo.InvariantCulture) + "Z"));
- }
- else {
- // GENERALIZEDTIME
- return new ASN1 (0x18, Encoding.ASCII.GetBytes (
- dt.ToUniversalTime ().ToString ("yyyyMMddHHmmss",
- CultureInfo.InvariantCulture) + "Z"));
- }
- }
-
- static public ASN1 FromInt32 (Int32 value)
- {
- byte[] integer = BitConverterLE.GetBytes (value);
- Array.Reverse (integer);
- int x = 0;
- while ((x < integer.Length) && (integer [x] == 0x00))
- x++;
- ASN1 asn1 = new ASN1 (0x02);
- switch (x) {
- case 0:
- asn1.Value = integer;
- break;
- case 4:
- asn1.Value = new byte [1];
- break;
- default:
- byte[] smallerInt = new byte [4 - x];
- Buffer.BlockCopy (integer, x, smallerInt, 0, smallerInt.Length);
- asn1.Value = smallerInt;
- break;
- }
- return asn1;
- }
-
- static public ASN1 FromOid (string oid)
- {
- if (oid == null)
- throw new ArgumentNullException ("oid");
-
- return new ASN1 (CryptoConfig.EncodeOID (oid));
- }
-
- static public ASN1 FromUnsignedBigInteger (byte[] big)
- {
- if (big == null)
- throw new ArgumentNullException ("big");
-
- // check for numbers that could be interpreted as negative (first bit)
- if (big [0] >= 0x80) {
- // in thie cas we add a new, empty, byte (position 0) so we're
- // sure this will always be interpreted an unsigned integer.
- // However we can't feed it into RSAParameters or DSAParameters
- int length = big.Length + 1;
- byte[] uinteger = new byte [length];
- Buffer.BlockCopy (big, 0, uinteger, 1, length - 1);
- big = uinteger;
- }
- return new ASN1 (0x02, big);
- }
-
- static public int ToInt32 (ASN1 asn1)
- {
- if (asn1 == null)
- throw new ArgumentNullException ("asn1");
- if (asn1.Tag != 0x02)
- throw new FormatException ("Only integer can be converted");
-
- int x = 0;
- for (int i=0; i < asn1.Value.Length; i++)
- x = (x << 8) + asn1.Value [i];
- return x;
- }
-
- // Convert a binary encoded OID to human readable string representation of
- // an OID (IETF style). Based on DUMPASN1.C from Peter Gutmann.
- static public string ToOid (ASN1 asn1)
- {
- if (asn1 == null)
- throw new ArgumentNullException ("asn1");
-
- byte[] aOID = asn1.Value;
- StringBuilder sb = new StringBuilder ();
- // Pick apart the OID
- byte x = (byte) (aOID[0] / 40);
- byte y = (byte) (aOID[0] % 40);
- if (x > 2) {
- // Handle special case for large y if x = 2
- y += (byte) ((x - 2) * 40);
- x = 2;
- }
- sb.Append (x.ToString (CultureInfo.InvariantCulture));
- sb.Append (".");
- sb.Append (y.ToString (CultureInfo.InvariantCulture));
- ulong val = 0;
- for (x = 1; x < aOID.Length; x++) {
- val = ((val << 7) | ((byte) (aOID [x] & 0x7F)));
- if ( !((aOID [x] & 0x80) == 0x80)) {
- sb.Append (".");
- sb.Append (val.ToString (CultureInfo.InvariantCulture));
- val = 0;
- }
- }
- return sb.ToString ();
- }
-
- static public DateTime ToDateTime (ASN1 time)
- {
- if (time == null)
- throw new ArgumentNullException ("time");
-
- string t = Encoding.ASCII.GetString (time.Value);
- // to support both UTCTime and GeneralizedTime (and not so common format)
- string mask = null;
- int year;
- switch (t.Length) {
- case 11:
- // illegal format, still it's supported for compatibility
- mask = "yyMMddHHmmZ";
- break;
- case 13:
- // RFC3280: 4.1.2.5.1 UTCTime
- year = Convert.ToInt16 (t.Substring (0, 2), CultureInfo.InvariantCulture);
- // Where YY is greater than or equal to 50, the
- // year SHALL be interpreted as 19YY; and
- // Where YY is less than 50, the year SHALL be
- // interpreted as 20YY.
- if (year >= 50)
- t = "19" + t;
- else
- t = "20" + t;
- mask = "yyyyMMddHHmmssZ";
- break;
- case 15:
- mask = "yyyyMMddHHmmssZ"; // GeneralizedTime
- break;
- case 17:
- // another illegal format (990630000000+1000), again supported for compatibility
- year = Convert.ToInt16 (t.Substring (0, 2), CultureInfo.InvariantCulture);
- string century = (year >= 50) ? "19" : "20";
- // ASN.1 (see ITU X.680 section 43.3) deals with offset differently than .NET
- char sign = (t[12] == '+') ? '-' : '+';
- t = String.Format ("{0}{1}{2}{3}{4}:{5}{6}", century, t.Substring (0, 12), sign,
- t[13], t[14], t[15], t[16]);
- mask = "yyyyMMddHHmmsszzz";
- break;
- }
- return DateTime.ParseExact (t, mask, CultureInfo.InvariantCulture, DateTimeStyles.AdjustToUniversal);
- }
- }
-}
+++ /dev/null
-//
-// Mono.Security.BitConverterLE.cs
-// Like System.BitConverter but always little endian
-//
-// Author:
-// Bernie Solomon
-//
-
-//
-// Copyright (C) 2004 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;
-
-namespace Mono.Security
-{
- internal sealed class BitConverterLE
- {
- private BitConverterLE ()
- {
- }
-
- unsafe private static byte[] GetUShortBytes (byte *bytes)
- {
- if (BitConverter.IsLittleEndian)
- return new byte [] { bytes [0], bytes [1] };
- else
- return new byte [] { bytes [1], bytes [0] };
- }
-
- unsafe private static byte[] GetUIntBytes (byte *bytes)
- {
- if (BitConverter.IsLittleEndian)
- return new byte [] { bytes [0], bytes [1], bytes [2], bytes [3] };
- else
- return new byte [] { bytes [3], bytes [2], bytes [1], bytes [0] };
- }
-
- unsafe private static byte[] GetULongBytes (byte *bytes)
- {
- if (BitConverter.IsLittleEndian)
- return new byte [] { bytes [0], bytes [1], bytes [2], bytes [3],
- bytes [4], bytes [5], bytes [6], bytes [7] };
- else
- return new byte [] { bytes [7], bytes [6], bytes [5], bytes [4],
- bytes [3], bytes [2], bytes [1], bytes [0] };
- }
-
- unsafe internal static byte[] GetBytes (bool value)
- {
- return new byte [] { value ? (byte)1 : (byte)0 };
- }
-
- unsafe internal static byte[] GetBytes (char value)
- {
- return GetUShortBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (short value)
- {
- return GetUShortBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (int value)
- {
- return GetUIntBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (long value)
- {
- return GetULongBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (ushort value)
- {
- return GetUShortBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (uint value)
- {
- return GetUIntBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (ulong value)
- {
- return GetULongBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (float value)
- {
- return GetUIntBytes ((byte *) &value);
- }
-
- unsafe internal static byte[] GetBytes (double value)
- {
- return GetULongBytes ((byte *) &value);
- }
-
- unsafe private static void UShortFromBytes (byte *dst, byte[] src, int startIndex)
- {
- if (BitConverter.IsLittleEndian) {
- dst [0] = src [startIndex];
- dst [1] = src [startIndex + 1];
- } else {
- dst [0] = src [startIndex + 1];
- dst [1] = src [startIndex];
- }
- }
-
- unsafe private static void UIntFromBytes (byte *dst, byte[] src, int startIndex)
- {
- if (BitConverter.IsLittleEndian) {
- dst [0] = src [startIndex];
- dst [1] = src [startIndex + 1];
- dst [2] = src [startIndex + 2];
- dst [3] = src [startIndex + 3];
- } else {
- dst [0] = src [startIndex + 3];
- dst [1] = src [startIndex + 2];
- dst [2] = src [startIndex + 1];
- dst [3] = src [startIndex];
- }
- }
-
- unsafe private static void ULongFromBytes (byte *dst, byte[] src, int startIndex)
- {
- if (BitConverter.IsLittleEndian) {
- for (int i = 0; i < 8; ++i)
- dst [i] = src [startIndex + i];
- } else {
- for (int i = 0; i < 8; ++i)
- dst [i] = src [startIndex + (7 - i)];
- }
- }
-
- unsafe internal static bool ToBoolean (byte[] value, int startIndex)
- {
- return value [startIndex] != 0;
- }
-
- unsafe internal static char ToChar (byte[] value, int startIndex)
- {
- char ret;
-
- UShortFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static short ToInt16 (byte[] value, int startIndex)
- {
- short ret;
-
- UShortFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static int ToInt32 (byte[] value, int startIndex)
- {
- int ret;
-
- UIntFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static long ToInt64 (byte[] value, int startIndex)
- {
- long ret;
-
- ULongFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static ushort ToUInt16 (byte[] value, int startIndex)
- {
- ushort ret;
-
- UShortFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static uint ToUInt32 (byte[] value, int startIndex)
- {
- uint ret;
-
- UIntFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static ulong ToUInt64 (byte[] value, int startIndex)
- {
- ulong ret;
-
- ULongFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static float ToSingle (byte[] value, int startIndex)
- {
- float ret;
-
- UIntFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
-
- unsafe internal static double ToDouble (byte[] value, int startIndex)
- {
- double ret;
-
- ULongFromBytes ((byte *) &ret, value, startIndex);
-
- return ret;
- }
- }
-}
+++ /dev/null
-2010-05-10 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Keep it public for Moonlight. Other types in other
- assemblies needs it and the linker will eventually internalize
- everything.
-
-2010-03-24 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: Specify CultureInfo.InvariantCulture (instead of
- null) to avoid crash on Windows. Patch by Yoni Shalom.
-
-2010-03-16 Jb Evain <jbevain@novell.com>
-
- * StrongName.cs: use MOONLIGHT symbol to disambiguate
- MonoTouch and Moonlight code.
-
-2009-09-22 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Moonlight NET_2_1 cannot depend on machine.config
- * StrongNameManager_2_1.cs: Minimal version for NET_2_1
-
-2009-04-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Adapt to work with only RSAManaged when built
- for NET_2_1, i.e. remove use of RSACryptoServiceProvider
-
-2008-09-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Use File.Create instead of OpenWrite to make sure nothing
- else if left at the end of the file.
-
-2008-04-25 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: New test cases to verify signatures from streams.
- Patch from Dave Hillier <daveh@lindenlab.com>
-
-2008-03-10 Stephane Delcroix <sdelcroix@novell.com>
-
- * Uri.cs: port the changes I did in System.Uri in r97844.
-
-2007-03-11 Zoltan Varga <vargaz@gmail.com>
-
- * ASN1Convert.cs: Fix a warning.
-
-2007-02-12 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: Add support for decoding ASN.1 dates with an UTC
- offset (e.g. 990630000000+1000) as some certificates use this format.
-
-2007-01-05 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: Added comment to FromDateTime to specify that, under
- 1.x, the DateTime must be a local (not UTC) date time. Fixed ToDateTime
- to return a DateTimeKind.Utc DateTime under 2.0.
-
-2006-08-17 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Fix the (very unlikely) case where an MD5 public key
- token is requested (part of the spec, never seen in the wild).
-
-2006-06-14 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Switch condition not to use the cached data if there is a
- collection being used. Skip extra 0 at the end of the byte[] buffer.
-
-2006-01-04 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: Fix convertion of integer 0 to ASN.1.
-
-2005-11-07 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Synch with Mono.Security.dll to get support for
- strongname keypairs different from 1024 bits.
-
-2005-10-06 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: Better handle big integer than cannot be interpreted
- as a negative number (don't extend). Fix bug #75778.
-
-2004-12-15 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Fixed warning for unused variable.
-
-2004-10-29 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Throw an NotSupportedException when "undefined length
- encoding" is used (#68903 but it's not a fix ;-). Fixed GetBytes to
- encode structures bigger than 64k (fix #68907). Simplified ToString
- and added Length to help debugging.
- * PKCS7.cs: Added a flag to avoid resigning a structure (which was
- duplicating some attributes).
-
-2004-09-16 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Fixed warning (l4) for unused variable.
- * PKCS7.cs: Fixed warning (l4) for unused variable.
- * Uri.cs: Fixed warning (l4) for unused variables. Remove sealed from
- class to reduce number of warnings.
-
-2004-08-30 Sebastien Pouliot <sebastien@ximian.com>
-
- * Uri.cs: Copied from System.dll assembly and started adaptation for
- it's reuse inside the security classes (CAS).
-
-2004-06-08 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Added corlib specific code to load configuration
- from machine.config to allow public key token remapping to work
- with (for example) gacutil.
- * StrongNameManager.cs: Now load configuration from machine.config.
-
-2004-05-19 Sebastien Pouliot <sebastien@ximian.com>
-
- * PKCS7.cs: In sync with Mono.Security.dll version.
-
-2004-05-18 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1Convert.cs: In sync with Mono.Security.dll version.
- * StrongName.cs: In sync with Mono.Security.dll version.
-
-2004-05-03 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Fixed NullReferenceException in xmldsig standalone tests.
-
-2004-04-28 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: In sync with Mono.Security.dll version.
- * ASN1Convert.cs: In sync with Mono.Security.dll version.
- * PKCS7.cs: In sync with Mono.Security.dll version.
- * StrongName.cs: In sync with Mono.Security.dll version.
-
-2004-04-20 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Added SaveToFile for easier debugging. Patch from
- Jesper Pedersen.
- * StrongName.cs: Removed compilation warning (unused variable).
-
-2004-04-08 Bernie Solomon <bernard@ugsolutions.com>
-
- * BitConverterLE.cs: added which always does
- little endian conversion
- * StrongName.cs: Use BitConverterLE
- * ASN1Convert.cs: Use BitConverterLE
-
-2004-04-06 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Added support for ECMA "key" to StringName(byte[])
- constructor.
-
-2004-03-31 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Update to include new static method that can be
- called from the runtime to validate strongname signatures.
- Refactored the existing class to reduce code duplication.
- * StrongNameManager.cs: New. This class keeps the configuration
- required to map a public key token to an alternative public key
- (e.g. ECMA public key token -> Mono public key) and to skip
- strongname validation for specific assemblies/token/users.
-
-2004-03-24 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Added CanSign property for AssemblyBuilder. Current
- Fx design requires an exception to know if the private key is present
- in an RSA instance. In some case (inside corlib) we can do without...
-
-2004-03-23 Sebastien Pouliot <sebastien@ximian.com>
-
- * StrongName.cs: Added exceptions for null or invalid keys.
-
-2004-03-17 Sebastien Pouliot <sebastien@ximian.com>
-
- * ASN1.cs: Class synched with Mono.Security.
- * ASN1Convert.cs: Class synched with Mono.Security.
-
-2003-10-18 Sebastien Pouliot <spouliot@videotron.ca>
-
- * StrongName.cs: Added from Mono.Security assembly for StrongName
- support in AssemblyBuilder.
-
-2003-10-12 Sebastien Pouliot <spouliot@videotron.ca>
-
- * PKCS7.cs: Added from Mono.Security assembly for Authenticode
- support in X509Certificate.CreateFromSignedFile
-
-2003-03-15 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ASN1.cs: Improved version.
- * ASN1Convert.cs: New. Helper class to convert between .NET
- types and ASN.1 structures.
-
-2003-02-08 Sebastien Pouliot <spouliot@videotron.ca>
-
- * ASN1.cs: Renamed namespace to match new location.
-
+++ /dev/null
-//
-// PKCS7.cs: PKCS #7 - Cryptographic Message Syntax Standard
-// http://www.rsasecurity.com/rsalabs/pkcs/pkcs-7/index.html
-//
-// Author:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// (C) 2002, 2003 Motus Technologies Inc. (http://www.motus.com)
-// Copyright (C) 2004 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;
-using System.Security.Cryptography;
-
-using Mono.Security.X509;
-
-namespace Mono.Security {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class PKCS7 {
-
- public class Oid {
- // pkcs 1
- public const string rsaEncryption = "1.2.840.113549.1.1.1";
- // pkcs 7
- public const string data = "1.2.840.113549.1.7.1";
- public const string signedData = "1.2.840.113549.1.7.2";
- public const string envelopedData = "1.2.840.113549.1.7.3";
- public const string signedAndEnvelopedData = "1.2.840.113549.1.7.4";
- public const string digestedData = "1.2.840.113549.1.7.5";
- public const string encryptedData = "1.2.840.113549.1.7.6";
- // pkcs 9
- public const string contentType = "1.2.840.113549.1.9.3";
- public const string messageDigest = "1.2.840.113549.1.9.4";
- public const string signingTime = "1.2.840.113549.1.9.5";
- public const string countersignature = "1.2.840.113549.1.9.6";
-
- public Oid ()
- {
- }
- }
-
- private PKCS7 ()
- {
- }
-
- static public ASN1 Attribute (string oid, ASN1 value)
- {
- ASN1 attr = new ASN1 (0x30);
- attr.Add (ASN1Convert.FromOid (oid));
- ASN1 aset = attr.Add (new ASN1 (0x31));
- aset.Add (value);
- return attr;
- }
-
- static public ASN1 AlgorithmIdentifier (string oid)
- {
- ASN1 ai = new ASN1 (0x30);
- ai.Add (ASN1Convert.FromOid (oid));
- ai.Add (new ASN1 (0x05)); // NULL
- return ai;
- }
-
- static public ASN1 AlgorithmIdentifier (string oid, ASN1 parameters)
- {
- ASN1 ai = new ASN1 (0x30);
- ai.Add (ASN1Convert.FromOid (oid));
- ai.Add (parameters);
- return ai;
- }
-
- /*
- * IssuerAndSerialNumber ::= SEQUENCE {
- * issuer Name,
- * serialNumber CertificateSerialNumber
- * }
- */
- static public ASN1 IssuerAndSerialNumber (X509Certificate x509)
- {
- ASN1 issuer = null;
- ASN1 serial = null;
- ASN1 cert = new ASN1 (x509.RawData);
- int tbs = 0;
- bool flag = false;
- while (tbs < cert[0].Count) {
- ASN1 e = cert[0][tbs++];
- if (e.Tag == 0x02)
- serial = e;
- else if (e.Tag == 0x30) {
- if (flag) {
- issuer = e;
- break;
- }
- flag = true;
- }
- }
- ASN1 iasn = new ASN1 (0x30);
- iasn.Add (issuer);
- iasn.Add (serial);
- return iasn;
- }
-
- /*
- * ContentInfo ::= SEQUENCE {
- * contentType ContentType,
- * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
- * }
- * ContentType ::= OBJECT IDENTIFIER
- */
- public class ContentInfo {
-
- private string contentType;
- private ASN1 content;
-
- public ContentInfo ()
- {
- content = new ASN1 (0xA0);
- }
-
- public ContentInfo (string oid) : this ()
- {
- contentType = oid;
- }
-
- public ContentInfo (byte[] data)
- : this (new ASN1 (data)) {}
-
- public ContentInfo (ASN1 asn1)
- {
- // SEQUENCE with 1 or 2 elements
- if ((asn1.Tag != 0x30) || ((asn1.Count < 1) && (asn1.Count > 2)))
- throw new ArgumentException ("Invalid ASN1");
- if (asn1[0].Tag != 0x06)
- throw new ArgumentException ("Invalid contentType");
- contentType = ASN1Convert.ToOid (asn1[0]);
- if (asn1.Count > 1) {
- if (asn1[1].Tag != 0xA0)
- throw new ArgumentException ("Invalid content");
- content = asn1[1];
- }
- }
-
- public ASN1 ASN1 {
- get { return GetASN1(); }
- }
-
- public ASN1 Content {
- get { return content; }
- set { content = value; }
- }
-
- public string ContentType {
- get { return contentType; }
- set { contentType = value; }
- }
-
- internal ASN1 GetASN1 ()
- {
- // ContentInfo ::= SEQUENCE {
- ASN1 contentInfo = new ASN1 (0x30);
- // contentType ContentType, -> ContentType ::= OBJECT IDENTIFIER
- contentInfo.Add (ASN1Convert.FromOid (contentType));
- // content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL
- if ((content != null) && (content.Count > 0))
- contentInfo.Add (content);
- return contentInfo;
- }
-
- public byte[] GetBytes ()
- {
- return GetASN1 ().GetBytes ();
- }
- }
-
- /*
- * EncryptedData ::= SEQUENCE {
- * version INTEGER {edVer0(0)} (edVer0),
- * encryptedContentInfo EncryptedContentInfo
- * }
- */
- public class EncryptedData {
- private byte _version;
- private ContentInfo _content;
- private ContentInfo _encryptionAlgorithm;
- private byte[] _encrypted;
-
- public EncryptedData ()
- {
- _version = 0;
- }
-
- public EncryptedData (byte[] data)
- : this (new ASN1 (data))
- {
- }
-
- public EncryptedData (ASN1 asn1) : this ()
- {
- if ((asn1.Tag != 0x30) || (asn1.Count < 2))
- throw new ArgumentException ("Invalid EncryptedData");
-
- if (asn1 [0].Tag != 0x02)
- throw new ArgumentException ("Invalid version");
- _version = asn1 [0].Value [0];
-
- ASN1 encryptedContentInfo = asn1 [1];
- if (encryptedContentInfo.Tag != 0x30)
- throw new ArgumentException ("missing EncryptedContentInfo");
-
- ASN1 contentType = encryptedContentInfo [0];
- if (contentType.Tag != 0x06)
- throw new ArgumentException ("missing EncryptedContentInfo.ContentType");
- _content = new ContentInfo (ASN1Convert.ToOid (contentType));
-
- ASN1 contentEncryptionAlgorithm = encryptedContentInfo [1];
- if (contentEncryptionAlgorithm.Tag != 0x30)
- throw new ArgumentException ("missing EncryptedContentInfo.ContentEncryptionAlgorithmIdentifier");
- _encryptionAlgorithm = new ContentInfo (ASN1Convert.ToOid (contentEncryptionAlgorithm [0]));
- _encryptionAlgorithm.Content = contentEncryptionAlgorithm [1];
-
- ASN1 encryptedContent = encryptedContentInfo [2];
- if (encryptedContent.Tag != 0x80)
- throw new ArgumentException ("missing EncryptedContentInfo.EncryptedContent");
- _encrypted = encryptedContent.Value;
- }
-
- public ASN1 ASN1 {
- get { return GetASN1(); }
- }
-
- public ContentInfo ContentInfo {
- get { return _content; }
- }
-
- public ContentInfo EncryptionAlgorithm {
- get { return _encryptionAlgorithm; }
- }
-
- public byte[] EncryptedContent {
- get {
- if (_encrypted == null)
- return null;
- return (byte[]) _encrypted.Clone ();
- }
- }
-
- public byte Version {
- get { return _version; }
- set { _version = value; }
- }
-
- // methods
-
- internal ASN1 GetASN1 ()
- {
- return null;
- }
-
- public byte[] GetBytes ()
- {
- return GetASN1 ().GetBytes ();
- }
- }
-
- /*
- * EnvelopedData ::= SEQUENCE {
- * version Version,
- * recipientInfos RecipientInfos,
- * encryptedContentInfo EncryptedContentInfo
- * }
- *
- * RecipientInfos ::= SET OF RecipientInfo
- *
- * EncryptedContentInfo ::= SEQUENCE {
- * contentType ContentType,
- * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
- * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
- * }
- *
- * EncryptedContent ::= OCTET STRING
- *
- */
- public class EnvelopedData {
- private byte _version;
- private ContentInfo _content;
- private ContentInfo _encryptionAlgorithm;
- private ArrayList _recipientInfos;
- private byte[] _encrypted;
-
- public EnvelopedData ()
- {
- _version = 0;
- _content = new ContentInfo ();
- _encryptionAlgorithm = new ContentInfo ();
- _recipientInfos = new ArrayList ();
- }
-
- public EnvelopedData (byte[] data)
- : this (new ASN1 (data))
- {
- }
-
- public EnvelopedData (ASN1 asn1) : this ()
- {
- if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 3))
- throw new ArgumentException ("Invalid EnvelopedData");
-
- if (asn1[0][0].Tag != 0x02)
- throw new ArgumentException ("Invalid version");
- _version = asn1[0][0].Value[0];
-
- // recipientInfos
-
- ASN1 recipientInfos = asn1 [0][1];
- if (recipientInfos.Tag != 0x31)
- throw new ArgumentException ("missing RecipientInfos");
- for (int i=0; i < recipientInfos.Count; i++) {
- ASN1 recipientInfo = recipientInfos [i];
- _recipientInfos.Add (new RecipientInfo (recipientInfo));
- }
-
- ASN1 encryptedContentInfo = asn1[0][2];
- if (encryptedContentInfo.Tag != 0x30)
- throw new ArgumentException ("missing EncryptedContentInfo");
-
- ASN1 contentType = encryptedContentInfo [0];
- if (contentType.Tag != 0x06)
- throw new ArgumentException ("missing EncryptedContentInfo.ContentType");
- _content = new ContentInfo (ASN1Convert.ToOid (contentType));
-
- ASN1 contentEncryptionAlgorithm = encryptedContentInfo [1];
- if (contentEncryptionAlgorithm.Tag != 0x30)
- throw new ArgumentException ("missing EncryptedContentInfo.ContentEncryptionAlgorithmIdentifier");
- _encryptionAlgorithm = new ContentInfo (ASN1Convert.ToOid (contentEncryptionAlgorithm [0]));
- _encryptionAlgorithm.Content = contentEncryptionAlgorithm [1];
-
- ASN1 encryptedContent = encryptedContentInfo [2];
- if (encryptedContent.Tag != 0x80)
- throw new ArgumentException ("missing EncryptedContentInfo.EncryptedContent");
- _encrypted = encryptedContent.Value;
- }
-
- public ArrayList RecipientInfos {
- get { return _recipientInfos; }
- }
-
- public ASN1 ASN1 {
- get { return GetASN1(); }
- }
-
- public ContentInfo ContentInfo {
- get { return _content; }
- }
-
- public ContentInfo EncryptionAlgorithm {
- get { return _encryptionAlgorithm; }
- }
-
- public byte[] EncryptedContent {
- get {
- if (_encrypted == null)
- return null;
- return (byte[]) _encrypted.Clone ();
- }
- }
-
- public byte Version {
- get { return _version; }
- set { _version = value; }
- }
-
- internal ASN1 GetASN1 ()
- {
- // SignedData ::= SEQUENCE {
- ASN1 signedData = new ASN1 (0x30);
- // version Version -> Version ::= INTEGER
-/* byte[] ver = { _version };
- signedData.Add (new ASN1 (0x02, ver));
- // digestAlgorithms DigestAlgorithmIdentifiers -> DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
- ASN1 digestAlgorithms = signedData.Add (new ASN1 (0x31));
- if (hashAlgorithm != null) {
- string hashOid = CryptoConfig.MapNameToOid (hashAlgorithm);
- digestAlgorithms.Add (AlgorithmIdentifier (hashOid));
- }
-
- // contentInfo ContentInfo,
- ASN1 ci = contentInfo.ASN1;
- signedData.Add (ci);
- if ((mda == null) && (hashAlgorithm != null)) {
- // automatically add the messageDigest authenticated attribute
- HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm);
- byte[] idcHash = ha.ComputeHash (ci[1][0].Value);
- ASN1 md = new ASN1 (0x30);
- mda = Attribute (messageDigest, md.Add (new ASN1 (0x04, idcHash)));
- signerInfo.AuthenticatedAttributes.Add (mda);
- }
-
- // certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,
- if (certs.Count > 0) {
- ASN1 a0 = signedData.Add (new ASN1 (0xA0));
- foreach (X509Certificate x in certs)
- a0.Add (new ASN1 (x.RawData));
- }
- // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
- if (crls.Count > 0) {
- ASN1 a1 = signedData.Add (new ASN1 (0xA1));
- foreach (byte[] crl in crls)
- a1.Add (new ASN1 (crl));
- }
- // signerInfos SignerInfos -> SignerInfos ::= SET OF SignerInfo
- ASN1 signerInfos = signedData.Add (new ASN1 (0x31));
- if (signerInfo.Key != null)
- signerInfos.Add (signerInfo.ASN1);*/
- return signedData;
- }
-
- public byte[] GetBytes () {
- return GetASN1 ().GetBytes ();
- }
- }
-
- /* RecipientInfo ::= SEQUENCE {
- * version Version,
- * issuerAndSerialNumber IssuerAndSerialNumber,
- * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
- * encryptedKey EncryptedKey
- * }
- *
- * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier
- *
- * EncryptedKey ::= OCTET STRING
- */
- public class RecipientInfo {
-
- private int _version;
- private string _oid;
- private byte[] _key;
- private byte[] _ski;
- private string _issuer;
- private byte[] _serial;
-
- public RecipientInfo () {}
-
- public RecipientInfo (ASN1 data)
- {
- if (data.Tag != 0x30)
- throw new ArgumentException ("Invalid RecipientInfo");
-
- ASN1 version = data [0];
- if (version.Tag != 0x02)
- throw new ArgumentException ("missing Version");
- _version = version.Value [0];
-
- // issuerAndSerialNumber IssuerAndSerialNumber
- ASN1 subjectIdentifierType = data [1];
- if ((subjectIdentifierType.Tag == 0x80) && (_version == 3)) {
- _ski = subjectIdentifierType.Value;
- }
- else {
- _issuer = X501.ToString (subjectIdentifierType [0]);
- _serial = subjectIdentifierType [1].Value;
- }
-
- ASN1 keyEncryptionAlgorithm = data [2];
- _oid = ASN1Convert.ToOid (keyEncryptionAlgorithm [0]);
-
- ASN1 encryptedKey = data [3];
- _key = encryptedKey.Value;
- }
-
- public string Oid {
- get { return _oid; }
- }
-
- public byte[] Key {
- get {
- if (_key == null)
- return null;
- return (byte[]) _key.Clone ();
- }
- }
-
- public byte[] SubjectKeyIdentifier {
- get {
- if (_ski == null)
- return null;
- return (byte[]) _ski.Clone ();
- }
- }
-
- public string Issuer {
- get { return _issuer; }
- }
-
- public byte[] Serial {
- get {
- if (_serial == null)
- return null;
- return (byte[]) _serial.Clone ();
- }
- }
-
- public int Version {
- get { return _version; }
- }
- }
-
- /*
- * SignedData ::= SEQUENCE {
- * version Version,
- * digestAlgorithms DigestAlgorithmIdentifiers,
- * contentInfo ContentInfo,
- * certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,
- * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
- * signerInfos SignerInfos
- * }
- */
- public class SignedData {
- private byte version;
- private string hashAlgorithm;
- private ContentInfo contentInfo;
- private X509CertificateCollection certs;
- private ArrayList crls;
- private SignerInfo signerInfo;
- private bool mda;
- private bool signed;
-
- public SignedData ()
- {
- version = 1;
- contentInfo = new ContentInfo ();
- certs = new X509CertificateCollection ();
- crls = new ArrayList ();
- signerInfo = new SignerInfo ();
- mda = true;
- signed = false;
- }
-
- public SignedData (byte[] data)
- : this (new ASN1 (data))
- {
- }
-
- public SignedData (ASN1 asn1)
- {
- if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 4))
- throw new ArgumentException ("Invalid SignedData");
-
- if (asn1[0][0].Tag != 0x02)
- throw new ArgumentException ("Invalid version");
- version = asn1[0][0].Value[0];
-
- contentInfo = new ContentInfo (asn1[0][2]);
-
- int n = 3;
- certs = new X509CertificateCollection ();
- if (asn1[0][n].Tag == 0xA0) {
- for (int i=0; i < asn1[0][n].Count; i++)
- certs.Add (new X509Certificate (asn1[0][n][i].GetBytes ()));
- n++;
- }
-
- crls = new ArrayList ();
- if (asn1[0][n].Tag == 0xA1) {
- for (int i=0; i < asn1[0][n].Count; i++)
- crls.Add (asn1[0][n][i].GetBytes ());
- n++;
- }
-
- if (asn1[0][n].Count > 0)
- signerInfo = new SignerInfo (asn1[0][n]);
- else
- signerInfo = new SignerInfo ();
-
- // Exchange hash algorithm Oid from SignerInfo
- if (signerInfo.HashName != null) {
- HashName = OidToName(signerInfo.HashName);
- }
-
- // Check if SignerInfo has authenticated attributes
- mda = (signerInfo.AuthenticatedAttributes.Count > 0);
- }
-
- public ASN1 ASN1 {
- get { return GetASN1(); }
- }
-
- public X509CertificateCollection Certificates {
- get { return certs; }
- }
-
- public ContentInfo ContentInfo {
- get { return contentInfo; }
- }
-
- public ArrayList Crls {
- get { return crls; }
- }
-
- public string HashName {
- get { return hashAlgorithm; }
- // todo add validation
- set {
- hashAlgorithm = value;
- signerInfo.HashName = value;
- }
- }
-
- public SignerInfo SignerInfo {
- get { return signerInfo; }
- }
-
- public byte Version {
- get { return version; }
- set { version = value; }
- }
-
- public bool UseAuthenticatedAttributes {
- get { return mda; }
- set { mda = value; }
- }
-
- public bool VerifySignature (AsymmetricAlgorithm aa)
- {
- if (aa == null) {
- return false;
- }
-
- RSAPKCS1SignatureDeformatter r = new RSAPKCS1SignatureDeformatter (aa);
- r.SetHashAlgorithm (hashAlgorithm);
- HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm);
-
- byte[] signature = signerInfo.Signature;
- byte[] hash = null;
-
- if (mda) {
- ASN1 asn = new ASN1 (0x31);
- foreach (ASN1 attr in signerInfo.AuthenticatedAttributes)
- asn.Add (attr);
-
- hash = ha.ComputeHash (asn.GetBytes ());
- } else {
- hash = ha.ComputeHash (contentInfo.Content[0].Value);
- }
-
- if (hash != null && signature != null) {
- return r.VerifySignature (hash, signature);
- }
- return false;
- }
-
- internal string OidToName (string oid)
- {
- switch (oid) {
- case "1.3.14.3.2.26" :
- return "SHA1";
- case "1.2.840.113549.2.2" :
- return "MD2";
- case "1.2.840.113549.2.5" :
- return "MD5";
- case "2.16.840.1.101.3.4.1" :
- return "SHA256";
- case "2.16.840.1.101.3.4.2" :
- return "SHA384";
- case "2.16.840.1.101.3.4.3" :
- return "SHA512";
- default :
- break;
- }
- // Unknown Oid
- return oid;
- }
-
- internal ASN1 GetASN1 ()
- {
- // SignedData ::= SEQUENCE {
- ASN1 signedData = new ASN1 (0x30);
- // version Version -> Version ::= INTEGER
- byte[] ver = { version };
- signedData.Add (new ASN1 (0x02, ver));
- // digestAlgorithms DigestAlgorithmIdentifiers -> DigestAlgorithmIdentifiers ::= SET OF DigestAlgorithmIdentifier
- ASN1 digestAlgorithms = signedData.Add (new ASN1 (0x31));
- if (hashAlgorithm != null) {
- string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm);
- digestAlgorithms.Add (AlgorithmIdentifier (hashOid));
- }
-
- // contentInfo ContentInfo,
- ASN1 ci = contentInfo.ASN1;
- signedData.Add (ci);
- if (!signed && (hashAlgorithm != null)) {
- if (mda) {
- // Use authenticated attributes for signature
-
- // Automatically add the contentType authenticated attribute
- ASN1 ctattr = Attribute (Oid.contentType, ci[0]);
- signerInfo.AuthenticatedAttributes.Add (ctattr);
-
- // Automatically add the messageDigest authenticated attribute
- HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm);
- byte[] idcHash = ha.ComputeHash (ci[1][0].Value);
- ASN1 md = new ASN1 (0x30);
- ASN1 mdattr = Attribute (Oid.messageDigest, md.Add (new ASN1 (0x04, idcHash)));
- signerInfo.AuthenticatedAttributes.Add (mdattr);
- } else {
- // Don't use authenticated attributes for signature -- signature is content
- RSAPKCS1SignatureFormatter r = new RSAPKCS1SignatureFormatter (signerInfo.Key);
- r.SetHashAlgorithm (hashAlgorithm);
- HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm);
- byte[] sig = ha.ComputeHash (ci[1][0].Value);
- signerInfo.Signature = r.CreateSignature (sig);
- }
- signed = true;
- }
-
- // certificates [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL,
- if (certs.Count > 0) {
- ASN1 a0 = signedData.Add (new ASN1 (0xA0));
- foreach (X509Certificate x in certs)
- a0.Add (new ASN1 (x.RawData));
- }
- // crls [1] IMPLICIT CertificateRevocationLists OPTIONAL,
- if (crls.Count > 0) {
- ASN1 a1 = signedData.Add (new ASN1 (0xA1));
- foreach (byte[] crl in crls)
- a1.Add (new ASN1 (crl));
- }
- // signerInfos SignerInfos -> SignerInfos ::= SET OF SignerInfo
- ASN1 signerInfos = signedData.Add (new ASN1 (0x31));
- if (signerInfo.Key != null)
- signerInfos.Add (signerInfo.ASN1);
- return signedData;
- }
-
- public byte[] GetBytes ()
- {
- return GetASN1 ().GetBytes ();
- }
- }
-
- /*
- * SignerInfo ::= SEQUENCE {
- * version Version,
- * issuerAndSerialNumber IssuerAndSerialNumber,
- * digestAlgorithm DigestAlgorithmIdentifier,
- * authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
- * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
- * encryptedDigest EncryptedDigest,
- * unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
- * }
- *
- * For version == 3 issuerAndSerialNumber may be replaced by ...
- */
- public class SignerInfo {
-
- private byte version;
- private X509Certificate x509;
- private string hashAlgorithm;
- private AsymmetricAlgorithm key;
- private ArrayList authenticatedAttributes;
- private ArrayList unauthenticatedAttributes;
- private byte[] signature;
- private string issuer;
- private byte[] serial;
- private byte[] ski;
-
- public SignerInfo ()
- {
- version = 1;
- authenticatedAttributes = new ArrayList ();
- unauthenticatedAttributes = new ArrayList ();
- }
-
- public SignerInfo (byte[] data)
- : this (new ASN1 (data)) {}
-
- // TODO: INCOMPLETE
- public SignerInfo (ASN1 asn1) : this ()
- {
- if ((asn1[0].Tag != 0x30) || (asn1[0].Count < 5))
- throw new ArgumentException ("Invalid SignedData");
-
- // version Version
- if (asn1[0][0].Tag != 0x02)
- throw new ArgumentException ("Invalid version");
- version = asn1[0][0].Value[0];
-
- // issuerAndSerialNumber IssuerAndSerialNumber
- ASN1 subjectIdentifierType = asn1 [0][1];
- if ((subjectIdentifierType.Tag == 0x80) && (version == 3)) {
- ski = subjectIdentifierType.Value;
- }
- else {
- issuer = X501.ToString (subjectIdentifierType [0]);
- serial = subjectIdentifierType [1].Value;
- }
-
- // digestAlgorithm DigestAlgorithmIdentifier
- ASN1 digestAlgorithm = asn1 [0][2];
- hashAlgorithm = ASN1Convert.ToOid (digestAlgorithm [0]);
-
- // authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL
- int n = 3;
- ASN1 authAttributes = asn1 [0][n];
- if (authAttributes.Tag == 0xA0) {
- n++;
- for (int i=0; i < authAttributes.Count; i++)
- authenticatedAttributes.Add (authAttributes [i]);
- }
-
- // digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier
- n++;
- // ASN1 digestEncryptionAlgorithm = asn1 [0][n++];
- // string digestEncryptionAlgorithmOid = ASN1Convert.ToOid (digestEncryptionAlgorithm [0]);
-
- // encryptedDigest EncryptedDigest
- ASN1 encryptedDigest = asn1 [0][n++];
- if (encryptedDigest.Tag == 0x04)
- signature = encryptedDigest.Value;
-
- // unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
- ASN1 unauthAttributes = asn1 [0][n];
- if ((unauthAttributes != null) && (unauthAttributes.Tag == 0xA1)) {
- for (int i=0; i < unauthAttributes.Count; i++)
- unauthenticatedAttributes.Add (unauthAttributes [i]);
- }
- }
-
- public string IssuerName {
- get { return issuer; }
- }
-
- public byte[] SerialNumber {
- get {
- if (serial == null)
- return null;
- return (byte[]) serial.Clone ();
- }
- }
-
- public byte[] SubjectKeyIdentifier {
- get {
- if (ski == null)
- return null;
- return (byte[]) ski.Clone ();
- }
- }
-
- public ASN1 ASN1 {
- get { return GetASN1(); }
- }
-
- public ArrayList AuthenticatedAttributes {
- get { return authenticatedAttributes; }
- }
-
- public X509Certificate Certificate {
- get { return x509; }
- set { x509 = value; }
- }
-
- public string HashName {
- get { return hashAlgorithm; }
- set { hashAlgorithm = value; }
- }
-
- public AsymmetricAlgorithm Key {
- get { return key; }
- set { key = value; }
- }
-
- public byte[] Signature {
- get {
- if (signature == null)
- return null;
- return (byte[]) signature.Clone ();
- }
-
- set {
- if (value != null) {
- signature = (byte[]) value.Clone ();
- }
- }
- }
-
- public ArrayList UnauthenticatedAttributes {
- get { return unauthenticatedAttributes; }
- }
-
- public byte Version {
- get { return version; }
- set { version = value; }
- }
-
- internal ASN1 GetASN1 ()
- {
- if ((key == null) || (hashAlgorithm == null))
- return null;
- byte[] ver = { version };
- ASN1 signerInfo = new ASN1 (0x30);
- // version Version -> Version ::= INTEGER
- signerInfo.Add (new ASN1 (0x02, ver));
- // issuerAndSerialNumber IssuerAndSerialNumber,
- signerInfo.Add (PKCS7.IssuerAndSerialNumber (x509));
- // digestAlgorithm DigestAlgorithmIdentifier,
- string hashOid = CryptoConfig.MapNameToOID (hashAlgorithm);
- signerInfo.Add (AlgorithmIdentifier (hashOid));
- // authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL,
- ASN1 aa = null;
- if (authenticatedAttributes.Count > 0) {
- aa = signerInfo.Add (new ASN1 (0xA0));
- foreach (ASN1 attr in authenticatedAttributes)
- aa.Add (attr);
- }
- // digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier,
- if (key is RSA) {
- signerInfo.Add (AlgorithmIdentifier (PKCS7.Oid.rsaEncryption));
-
- if (aa != null) {
- // Calculate the signature here; otherwise it must be set from SignedData
- RSAPKCS1SignatureFormatter r = new RSAPKCS1SignatureFormatter (key);
- r.SetHashAlgorithm (hashAlgorithm);
- byte[] tbs = aa.GetBytes ();
- tbs [0] = 0x31; // not 0xA0 for signature
- HashAlgorithm ha = HashAlgorithm.Create (hashAlgorithm);
- byte[] tbsHash = ha.ComputeHash (tbs);
- signature = r.CreateSignature (tbsHash);
- }
- }
- else if (key is DSA) {
- throw new NotImplementedException ("not yet");
- }
- else
- throw new CryptographicException ("Unknown assymetric algorithm");
- // encryptedDigest EncryptedDigest,
- signerInfo.Add (new ASN1 (0x04, signature));
- // unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL
- if (unauthenticatedAttributes.Count > 0) {
- ASN1 ua = signerInfo.Add (new ASN1 (0xA1));
- foreach (ASN1 attr in unauthenticatedAttributes)
- ua.Add (attr);
- }
- return signerInfo;
- }
-
- public byte[] GetBytes ()
- {
- return GetASN1 ().GetBytes ();
- }
- }
- }
-}
+++ /dev/null
-//
-// StrongName.cs - Strong Name Implementation
-//
-// Author:
-// Sebastien Pouliot (sebastien@ximian.com)
-//
-// (C) 2003 Motus Technologies Inc. (http://www.motus.com)
-// (C) 2004 Novell (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.Configuration.Assemblies;
-using System.Globalization;
-using System.IO;
-using System.Reflection;
-using System.Security.Cryptography;
-
-using Mono.Security.Cryptography;
-
-namespace Mono.Security {
-
-#if INSIDE_CORLIB
- internal
-#else
- public
-#endif
- sealed class StrongName {
-
- internal class StrongNameSignature {
- private byte[] hash;
- private byte[] signature;
- private UInt32 signaturePosition;
- private UInt32 signatureLength;
- private UInt32 metadataPosition;
- private UInt32 metadataLength;
- private byte cliFlag;
- private UInt32 cliFlagPosition;
-
- public byte[] Hash {
- get { return hash; }
- set { hash = value; }
- }
-
- public byte[] Signature {
- get { return signature; }
- set { signature = value; }
- }
-
- public UInt32 MetadataPosition {
- get { return metadataPosition; }
- set { metadataPosition = value; }
- }
-
- public UInt32 MetadataLength {
- get { return metadataLength; }
- set { metadataLength = value; }
- }
-
- public UInt32 SignaturePosition {
- get { return signaturePosition; }
- set { signaturePosition = value; }
- }
-
- public UInt32 SignatureLength {
- get { return signatureLength; }
- set { signatureLength = value; }
- }
-
- // delay signed -> flag = 0x01
- // strongsigned -> flag = 0x09
- public byte CliFlag {
- get { return cliFlag; }
- set { cliFlag = value; }
- }
-
- public UInt32 CliFlagPosition {
- get { return cliFlagPosition; }
- set { cliFlagPosition = value; }
- }
- }
-
- internal enum StrongNameOptions {
- Metadata,
- Signature
- }
-
- private RSA rsa;
- private byte[] publicKey;
- private byte[] keyToken;
- private string tokenAlgorithm;
-
- public StrongName ()
- {
- }
-
- public StrongName (int keySize)
- {
- rsa = new RSAManaged (keySize);
- }
-
- public StrongName (byte[] data)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
-
- // check for ECMA key
- if (data.Length == 16) {
- int i = 0;
- int sum = 0;
- while (i < data.Length)
- sum += data [i++];
- if (sum == 4) {
- // it is the ECMA key
- publicKey = (byte[]) data.Clone ();
- }
- }
- else {
- RSA = CryptoConvert.FromCapiKeyBlob (data);
- if (rsa == null)
- throw new ArgumentException ("data isn't a correctly encoded RSA public key");
- }
- }
-
- public StrongName (RSA rsa)
- {
- if (rsa == null)
- throw new ArgumentNullException ("rsa");
-
- RSA = rsa;
- }
-
- private void InvalidateCache ()
- {
- publicKey = null;
- keyToken = null;
- }
-
- public bool CanSign {
- get {
- if (rsa == null)
- return false;
-#if INSIDE_CORLIB
- // the easy way
- if (RSA is RSACryptoServiceProvider) {
- // available as internal for corlib
- return !(rsa as RSACryptoServiceProvider).PublicOnly;
- }
- else
-#endif
- if (RSA is RSAManaged) {
- return !(rsa as RSAManaged).PublicOnly;
- }
- else {
- // the hard way
- try {
- RSAParameters p = rsa.ExportParameters (true);
- return ((p.D != null) && (p.P != null) && (p.Q != null));
- }
- catch (CryptographicException) {
- return false;
- }
- }
- }
- }
-
- public RSA RSA {
- get {
- // if none then we create a new keypair
- if (rsa == null)
- rsa = (RSA) RSA.Create ();
- return rsa;
- }
- set {
- rsa = value;
- InvalidateCache ();
- }
- }
-
- public byte[] PublicKey {
- get {
- if (publicKey == null) {
- byte[] keyPair = CryptoConvert.ToCapiKeyBlob (rsa, false);
- // since 2.0 public keys can vary from 384 to 16384 bits
- publicKey = new byte [32 + (rsa.KeySize >> 3)];
-
- // The first 12 bytes are documented at:
- // http://msdn.microsoft.com/library/en-us/cprefadd/html/grfungethashfromfile.asp
- // ALG_ID - Signature
- publicKey [0] = keyPair [4];
- publicKey [1] = keyPair [5];
- publicKey [2] = keyPair [6];
- publicKey [3] = keyPair [7];
- // ALG_ID - Hash (SHA1 == 0x8004)
- publicKey [4] = 0x04;
- publicKey [5] = 0x80;
- publicKey [6] = 0x00;
- publicKey [7] = 0x00;
- // Length of Public Key (in bytes)
- byte[] lastPart = BitConverterLE.GetBytes (publicKey.Length - 12);
- publicKey [8] = lastPart [0];
- publicKey [9] = lastPart [1];
- publicKey [10] = lastPart [2];
- publicKey [11] = lastPart [3];
- // Ok from here - Same structure as keypair - expect for public key
- publicKey [12] = 0x06; // PUBLICKEYBLOB
- // we can copy this part
- Buffer.BlockCopy (keyPair, 1, publicKey, 13, publicKey.Length - 13);
- // and make a small adjustment
- publicKey [23] = 0x31; // (RSA1 not RSA2)
- }
- return (byte[]) publicKey.Clone ();
- }
- }
-
- public byte[] PublicKeyToken {
- get {
- if (keyToken == null) {
- byte[] publicKey = PublicKey;
- if (publicKey == null)
- return null;
- HashAlgorithm ha = HashAlgorithm.Create (TokenAlgorithm);
- byte[] hash = ha.ComputeHash (publicKey);
- // we need the last 8 bytes in reverse order
- keyToken = new byte [8];
- Buffer.BlockCopy (hash, (hash.Length - 8), keyToken, 0, 8);
- Array.Reverse (keyToken, 0, 8);
- }
- return (byte[]) keyToken.Clone ();
- }
- }
-
- public string TokenAlgorithm {
- get {
- if (tokenAlgorithm == null)
- tokenAlgorithm = "SHA1";
- return tokenAlgorithm;
- }
- set {
- string algo = value.ToUpper (CultureInfo.InvariantCulture);
- if ((algo == "SHA1") || (algo == "MD5")) {
- tokenAlgorithm = value;
- InvalidateCache ();
- }
- else
- throw new ArgumentException ("Unsupported hash algorithm for token");
- }
- }
-
- public byte[] GetBytes ()
- {
- return CryptoConvert.ToCapiPrivateKeyBlob (RSA);
- }
-
- private UInt32 RVAtoPosition (UInt32 r, int sections, byte[] headers)
- {
- for (int i=0; i < sections; i++) {
- UInt32 p = BitConverterLE.ToUInt32 (headers, i * 40 + 20);
- UInt32 s = BitConverterLE.ToUInt32 (headers, i * 40 + 12);
- int l = (int) BitConverterLE.ToUInt32 (headers, i * 40 + 8);
- if ((s <= r) && (r < s + l)) {
- return p + r - s;
- }
- }
- return 0;
- }
-
- internal StrongNameSignature StrongHash (Stream stream, StrongNameOptions options)
- {
- StrongNameSignature info = new StrongNameSignature ();
-
- HashAlgorithm hash = HashAlgorithm.Create (TokenAlgorithm);
- CryptoStream cs = new CryptoStream (Stream.Null, hash, CryptoStreamMode.Write);
-
- // MS-DOS Header - always 128 bytes
- // ref: Section 24.2.1, Partition II Metadata
- byte[] mz = new byte [128];
- stream.Read (mz, 0, 128);
- if (BitConverterLE.ToUInt16 (mz, 0) != 0x5a4d)
- return null;
- UInt32 peHeader = BitConverterLE.ToUInt32 (mz, 60);
- cs.Write (mz, 0, 128);
- if (peHeader != 128) {
- byte[] mzextra = new byte [peHeader - 128];
- stream.Read (mzextra, 0, mzextra.Length);
- cs.Write (mzextra, 0, mzextra.Length);
- }
-
- // PE File Header - always 248 bytes
- // ref: Section 24.2.2, Partition II Metadata
- byte[] pe = new byte [248];
- stream.Read (pe, 0, 248);
- if (BitConverterLE.ToUInt32 (pe, 0) != 0x4550)
- return null;
- if (BitConverterLE.ToUInt16 (pe, 4) != 0x14c)
- return null;
- // MUST zeroize both CheckSum and Security Directory
- byte[] v = new byte [8];
- Buffer.BlockCopy (v, 0, pe, 88, 4);
- Buffer.BlockCopy (v, 0, pe, 152, 8);
- cs.Write (pe, 0, 248);
-
- UInt16 numSection = BitConverterLE.ToUInt16 (pe, 6);
- int sectionLength = (numSection * 40);
- byte[] sectionHeaders = new byte [sectionLength];
- stream.Read (sectionHeaders, 0, sectionLength);
- cs.Write (sectionHeaders, 0, sectionLength);
-
- UInt32 cliHeaderRVA = BitConverterLE.ToUInt32 (pe, 232);
- UInt32 cliHeaderPos = RVAtoPosition (cliHeaderRVA, numSection, sectionHeaders);
- int cliHeaderSiz = (int) BitConverterLE.ToUInt32 (pe, 236);
-
- // CLI Header
- // ref: Section 24.3.3, Partition II Metadata
- byte[] cli = new byte [cliHeaderSiz];
- stream.Position = cliHeaderPos;
- stream.Read (cli, 0, cliHeaderSiz);
-
- UInt32 strongNameSignatureRVA = BitConverterLE.ToUInt32 (cli, 32);
- info.SignaturePosition = RVAtoPosition (strongNameSignatureRVA, numSection, sectionHeaders);
- info.SignatureLength = BitConverterLE.ToUInt32 (cli, 36);
-
- UInt32 metadataRVA = BitConverterLE.ToUInt32 (cli, 8);
- info.MetadataPosition = RVAtoPosition (metadataRVA, numSection, sectionHeaders);
- info.MetadataLength = BitConverterLE.ToUInt32 (cli, 12);
-
- if (options == StrongNameOptions.Metadata) {
- cs.Close ();
- hash.Initialize ();
- byte[] metadata = new byte [info.MetadataLength];
- stream.Position = info.MetadataPosition;
- stream.Read (metadata, 0, metadata.Length);
- info.Hash = hash.ComputeHash (metadata);
- return info;
- }
-
- // now we hash every section EXCEPT the signature block
- for (int i=0; i < numSection; i++) {
- UInt32 start = BitConverterLE.ToUInt32 (sectionHeaders, i * 40 + 20);
- int length = (int) BitConverterLE.ToUInt32 (sectionHeaders, i * 40 + 16);
- byte[] section = new byte [length];
- stream.Position = start;
- stream.Read (section, 0, length);
- if ((start <= info.SignaturePosition) && (info.SignaturePosition < start + length)) {
- // hash before the signature
- int before = (int)(info.SignaturePosition - start);
- if (before > 0) {
- cs.Write (section, 0, before);
- }
- // copy signature
- info.Signature = new byte [info.SignatureLength];
- Buffer.BlockCopy (section, before, info.Signature, 0, (int)info.SignatureLength);
- Array.Reverse (info.Signature);
- // hash after the signature
- int s = (int)(before + info.SignatureLength);
- int after = (int)(length - s);
- if (after > 0) {
- cs.Write (section, s, after);
- }
- }
- else
- cs.Write (section, 0, length);
- }
-
- cs.Close ();
- info.Hash = hash.Hash;
- return info;
- }
-
- // return the same result as the undocumented and unmanaged GetHashFromAssemblyFile
- public byte[] Hash (string fileName)
- {
- FileStream fs = File.OpenRead (fileName);
- StrongNameSignature sn = StrongHash (fs, StrongNameOptions.Metadata);
- fs.Close ();
-
- return sn.Hash;
- }
-
- public bool Sign (string fileName)
- {
- bool result = false;
- StrongNameSignature sn;
- using (FileStream fs = File.OpenRead (fileName)) {
- sn = StrongHash (fs, StrongNameOptions.Signature);
- fs.Close ();
- }
- if (sn.Hash == null)
- return false;
-
- byte[] signature = null;
- try {
- RSAPKCS1SignatureFormatter sign = new RSAPKCS1SignatureFormatter (rsa);
- sign.SetHashAlgorithm (TokenAlgorithm);
- signature = sign.CreateSignature (sn.Hash);
- Array.Reverse (signature);
- }
- catch (CryptographicException) {
- return false;
- }
-
- using (FileStream fs = File.OpenWrite (fileName)) {
- fs.Position = sn.SignaturePosition;
- fs.Write (signature, 0, signature.Length);
- fs.Close ();
- result = true;
- }
- return result;
- }
-
- public bool Verify (string fileName)
- {
- bool result = false;
- using (FileStream fs = File.OpenRead (fileName)) {
- result = Verify (fs);
- fs.Close ();
- }
- return result;
- }
-
- public bool Verify (Stream stream)
- {
- StrongNameSignature sn = StrongHash (stream, StrongNameOptions.Signature);
- if (sn.Hash == null) {
- return false;
- }
-
- try {
- AssemblyHashAlgorithm algorithm = AssemblyHashAlgorithm.SHA1;
- if (tokenAlgorithm == "MD5")
- algorithm = AssemblyHashAlgorithm.MD5;
- return Verify (rsa, algorithm, sn.Hash, sn.Signature);
- }
- catch (CryptographicException) {
- // no exception allowed
- return false;
- }
- }
-
-#if INSIDE_CORLIB
- static object lockObject = new object ();
- static bool initialized;
-
- // We don't want a dependency on StrongNameManager in Mono.Security.dll
- static public bool IsAssemblyStrongnamed (string assemblyName)
- {
- if (!initialized) {
- lock (lockObject) {
- if (!initialized) {
-#if NET_2_1
- // Moonlight cannot depend on machine.config
-#else
- string config = Environment.GetMachineConfigPath ();
- StrongNameManager.LoadConfig (config);
-#endif
- initialized = true;
- }
- }
- }
-
- try {
- // this doesn't load the assembly (well it unloads it ;)
- // http://weblogs.asp.net/nunitaddin/posts/9991.aspx
- AssemblyName an = AssemblyName.GetAssemblyName (assemblyName);
- if (an == null)
- return false;
-
- byte[] publicKey = StrongNameManager.GetMappedPublicKey (an.GetPublicKeyToken ());
- if ((publicKey == null) || (publicKey.Length < 12)) {
- // no mapping
- publicKey = an.GetPublicKey ();
- if ((publicKey == null) || (publicKey.Length < 12))
- return false;
- }
-
- // Note: MustVerify is based on the original token (by design). Public key
- // remapping won't affect if the assembly is verified or not.
- if (!StrongNameManager.MustVerify (an)) {
- return true;
- }
-
- RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (publicKey, 12);
- StrongName sn = new StrongName (rsa);
- bool result = sn.Verify (assemblyName);
- return result;
- }
- catch {
- // no exception allowed
- return false;
- }
- }
-
- // TODO
- // we would get better performance if the runtime hashed the
- // assembly - as we wouldn't have to load it from disk a
- // second time. The runtime already have implementations of
- // SHA1 (and even MD5 if required someday).
- static public bool VerifySignature (byte[] publicKey, int algorithm, byte[] hash, byte[] signature)
- {
- try {
- RSA rsa = CryptoConvert.FromCapiPublicKeyBlob (publicKey);
- return Verify (rsa, (AssemblyHashAlgorithm) algorithm, hash, signature);
- }
- catch {
- // no exception allowed
- return false;
- }
- }
-#endif
- static private bool Verify (RSA rsa, AssemblyHashAlgorithm algorithm, byte[] hash, byte[] signature)
- {
- RSAPKCS1SignatureDeformatter vrfy = new RSAPKCS1SignatureDeformatter (rsa);
- switch (algorithm) {
- case AssemblyHashAlgorithm.MD5:
- vrfy.SetHashAlgorithm ("MD5");
- break;
- case AssemblyHashAlgorithm.SHA1:
- case AssemblyHashAlgorithm.None:
- default:
- vrfy.SetHashAlgorithm ("SHA1");
- break;
- }
- return vrfy.VerifySignature (hash, signature);
- }
- }
-}
//
-// System.Collections.DebuggableAttribute.cs
+// ConditionalAttribute.cs
//
// Author:
// Nick Drochak II (ndrochak@gol.com)
//
-// System.Collections.DebuggableAttribute.cs
+// DebuggableAttribute.cs
//
// Author:
// Nick Drochak II (ndrochak@gol.com)
IntPtr handle;
MonoIOError error;
FileAttributes rattr;
-
string s = MonoIO.FindFirst (path, path_with_pattern, out rattr, out error, out handle);
try {
while (s != null) {
if (((rattr & FileAttributes.Directory) == 0) && rattr != 0)
rattr |= FileAttributes.Normal;
- if ((rattr & FileAttributes.ReparsePoint) == 0 && (rattr & kind) != 0)
+ if ((rattr & kind) != 0)
yield return s;
s = MonoIO.FindNext (handle, out rattr, out error);
try {
while (s != null) {
- if ((rattr & FileAttributes.Directory) != 0)
+ if ((rattr & FileAttributes.Directory) != 0 && (rattr & FileAttributes.ReparsePoint) == 0)
foreach (string child in EnumerateKind (s, searchPattern, searchOption, kind))
yield return child;
s = MonoIO.FindNext (handle, out rattr, out error);
return fullpath;
}
+ [DllImport("Kernel32.dll", SetLastError = true, CharSet = CharSet.Unicode)]
+ // http://msdn.microsoft.com/en-us/library/windows/desktop/aa364963%28v=vs.85%29.aspx
+ // http://www.codeproject.com/Tips/223321/Win32-API-GetFullPathName
+ private static extern int GetFullPathName(string path, int numBufferChars, StringBuilder buffer, ref IntPtr lpFilePartOrNull);
+
+ internal static string GetFullPathName(string path)
+ {
+ const int MAX_PATH = 260;
+ StringBuilder buffer = new StringBuilder(MAX_PATH);
+ IntPtr ptr = IntPtr.Zero;
+ int length = GetFullPathName(path, MAX_PATH, buffer, ref ptr);
+ if (length == 0)
+ {
+ int error = Marshal.GetLastWin32Error();
+ throw new IOException("Windows API call to GetFullPathName failed, Windows error code: " + error);
+ }
+ else if (length > MAX_PATH)
+ {
+ buffer = new StringBuilder(length);
+ GetFullPathName(path, length, buffer, ref ptr);
+ }
+ return buffer.ToString();
+ }
+
internal static string WindowsDriveAdjustment (string path)
{
// two special cases to consider when a drive is specified
if (current [0] == path [0])
path = current; // we return it
else
- path += '\\';
+ path = GetFullPathName(path); // we have to use the GetFullPathName Windows API
} else if ((path [2] != Path.DirectorySeparatorChar) && (path [2] != Path.AltDirectorySeparatorChar)) {
// second, the drive + a directory is specified *without* a separator between them (e.g. C:dir).
// If the current directory is on the specified drive...
// then specified directory is appended to the current drive directory
path = Path.Combine (current, path.Substring (2, path.Length - 2));
} else {
- // if not, then just pretend there was a separator (Path.Combine won't work in this case)
- path = String.Concat (path.Substring (0, 2), DirectorySeparatorStr, path.Substring (2, path.Length - 2));
+ // we have to use the GetFullPathName Windows API
+ path = GetFullPathName(path);
}
}
return path;
if (ex.hresult != MonoIO.FileAlreadyExistsHResult || count ++ > 65536)
throw;
}
+ catch (UnauthorizedAccessException ex) {
+ if (count ++ > 65536)
+ throw new IOException (ex.Message, ex);
+ }
} while (f == null);
f.Close();
}
static bool ShouldPrintFullName (Type type) {
- return type.IsClass && (!type.IsPointer ||
- (!type.GetElementType ().IsPrimitive && !type.GetElementType ().IsNested));
+ return type.IsGenericType || (type.IsClass && (!type.IsPointer ||
+ (!type.GetElementType ().IsPrimitive && !type.GetElementType ().IsNested)));
}
public override string ToString () {
#endif
}
+ [Serializable()]
[StructLayout (LayoutKind.Sequential)]
internal class MonoCMethod : ConstructorInfo, ISerializable
{
public void GetResult ()
{
- if (task.Status != TaskStatus.RanToCompletion) {
+ if (!task.IsCompleted)
+ task.WaitCore (Timeout.Infinite, CancellationToken.None);
+
+ if (task.Status != TaskStatus.RanToCompletion)
// Merge current and dispatched stack traces if there is any
ExceptionDispatchInfo.Capture (HandleUnexpectedTaskResult (task)).Throw ();
- }
}
internal static Exception HandleUnexpectedTaskResult (Task task)
case TaskStatus.Faulted:
return task.Exception.InnerException;
default:
- return new InvalidOperationException ("The task has not finished yet");
+ throw new ArgumentException ("Should never be reached");
}
}
#if NET_4_5
+using System.Threading;
using System.Threading.Tasks;
using System.Runtime.ExceptionServices;
public TResult GetResult ()
{
+ if (!task.IsCompleted)
+ task.WaitCore (Timeout.Infinite, CancellationToken.None);
+
if (task.Status != TaskStatus.RanToCompletion)
ExceptionDispatchInfo.Capture (TaskAwaiter.HandleUnexpectedTaskResult (task)).Throw ();
case "tripledes":
case "3des":
return new TripleDESCryptoServiceProvider ();
- default:
+ case "x509chain":
+ name = "System.Security.Cryptography.X509Certificates.X509Chain, System";
+ break;
+ case "aes":
+ name = "System.Security.Cryptography.AesManaged, System.Core";
+ break;
+ }
+
+ try {
+ // last resort, the request type might be available (if care is taken for the type not to be linked
+ // away) and that can allow some 3rd party code to work (e.g. extra algorithms) and make a few more
+ // unit tests happy
+ return Activator.CreateInstance (Type.GetType (name));
+ }
+ catch {
// method doesn't throw any exception
return null;
}
// least in the unit tests).
public DSACryptoServiceProvider ()
- : this (1024, null)
+ : this (1024)
{
}
}
public DSACryptoServiceProvider (int dwKeySize)
- : this (dwKeySize, null)
{
+ Common (dwKeySize, false);
}
public DSACryptoServiceProvider (int dwKeySize, CspParameters parameters)
+ {
+ bool has_parameters = parameters != null;
+ Common (dwKeySize, has_parameters);
+ if (has_parameters)
+ Common (parameters);
+ }
+
+ void Common (int dwKeySize, bool parameters)
{
LegalKeySizesValue = new KeySizes [1];
LegalKeySizesValue [0] = new KeySizes (512, 1024, 64);
dsa = new DSAManaged (dwKeySize);
dsa.KeyGenerated += new DSAManaged.KeyGeneratedEventHandler (OnKeyGenerated);
- persistKey = (parameters != null);
- if (parameters == null) {
- parameters = new CspParameters (PROV_DSS_DH);
- if (useMachineKeyStore)
- parameters.Flags |= CspProviderFlags.UseMachineKeyStore;
- store = new KeyPairPersistence (parameters);
- // no need to load - it cannot exists
- }
- else {
- store = new KeyPairPersistence (parameters);
- store.Load ();
- if (store.KeyValue != null) {
- persisted = true;
- this.FromXmlString (store.KeyValue);
- }
+ persistKey = parameters;
+ if (parameters)
+ return;
+
+ var p = new CspParameters (PROV_DSS_DH);
+ if (useMachineKeyStore)
+ p.Flags |= CspProviderFlags.UseMachineKeyStore;
+ store = new KeyPairPersistence (p);
+ // no need to load - it cannot exists
+ }
+
+ void Common (CspParameters parameters)
+ {
+ store = new KeyPairPersistence (parameters);
+ store.Load ();
+ if (store.KeyValue != null) {
+ persisted = true;
+ this.FromXmlString (store.KeyValue);
}
}
using System.Globalization;
using System.Runtime.InteropServices;
+using Mono.Security.Cryptography;
+
namespace System.Security.Cryptography {
[ComVisible (true)]
if (strName == null)
throw new ArgumentNullException ("strName");
- var instance = HashAlgorithm.Create (strName) as SHA1;
+ var instance = PKCS1.CreateFromName (strName) as SHA1;
if (instance == null)
throw new CryptographicUnexpectedOperationException (
Locale.GetText ("DSA requires SHA1"));
using System.Globalization;
using System.Runtime.InteropServices;
+using Mono.Security.Cryptography;
+
namespace System.Security.Cryptography {
[ComVisible (true)]
if (strName == null)
throw new ArgumentNullException ("strName");
- var instance = HashAlgorithm.Create (strName) as SHA1;
+ var instance = PKCS1.CreateFromName (strName) as SHA1;
if (instance == null)
throw new CryptographicUnexpectedOperationException (
Locale.GetText ("DSA requires SHA1"));
private RSAManaged rsa;
public RSACryptoServiceProvider ()
+ : this (1024)
{
// Here it's not clear if we need to generate a keypair
// (note: MS implementation generates a keypair in this case).
// So we'll generate the keypair only when (and if) it's being
// used (or exported). This should save us a lot of time (at
// least in the unit tests).
- Common (1024, null);
}
public RSACryptoServiceProvider (CspParameters parameters)
+ : this (1024, parameters)
{
- Common (1024, parameters);
// no keypair generation done at this stage
}
public RSACryptoServiceProvider (int dwKeySize)
{
// Here it's clear that we need to generate a new keypair
- Common (dwKeySize, null);
+ Common (dwKeySize, false);
// no keypair generation done at this stage
}
public RSACryptoServiceProvider (int dwKeySize, CspParameters parameters)
{
- Common (dwKeySize, parameters);
+ bool has_parameters = parameters != null;
+ Common (dwKeySize, has_parameters);
+ if (has_parameters)
+ Common (parameters);
// no keypair generation done at this stage
}
- private void Common (int dwKeySize, CspParameters p)
+ void Common (int dwKeySize, bool parameters)
{
// Microsoft RSA CSP can do between 384 and 16384 bits keypair
LegalKeySizesValue = new KeySizes [1];
rsa = new RSAManaged (KeySize);
rsa.KeyGenerated += new RSAManaged.KeyGeneratedEventHandler (OnKeyGenerated);
- persistKey = (p != null);
- if (p == null) {
- p = new CspParameters (PROV_RSA_FULL);
- if (useMachineKeyStore)
- p.Flags |= CspProviderFlags.UseMachineKeyStore;
- store = new KeyPairPersistence (p);
- // no need to load - it cannot exists
- }
- else {
- store = new KeyPairPersistence (p);
- bool exists = store.Load ();
- bool required = (p.Flags & CspProviderFlags.UseExistingKey) != 0;
+ persistKey = parameters;
+ if (parameters)
+ return;
+
+ // no need to load - it cannot exists
+ var p = new CspParameters (PROV_RSA_FULL);
+ if (useMachineKeyStore)
+ p.Flags |= CspProviderFlags.UseMachineKeyStore;
+ store = new KeyPairPersistence (p);
+ }
+
+ void Common (CspParameters p)
+ {
+ store = new KeyPairPersistence (p);
+ bool exists = store.Load ();
+ bool required = (p.Flags & CspProviderFlags.UseExistingKey) != 0;
- if (required && !exists)
- throw new CryptographicException ("Keyset does not exist");
+ if (required && !exists)
+ throw new CryptographicException ("Keyset does not exist");
- if (store.KeyValue != null) {
- persisted = true;
- this.FromXmlString (store.KeyValue);
- }
+ if (store.KeyValue != null) {
+ persisted = true;
+ FromXmlString (store.KeyValue);
}
}
if (rgbSignature == null)
throw new ArgumentNullException ("rgbSignature");
- return PKCS1.Verify_v15 (rsa, HashAlgorithm.Create (hashName), rgbHash, rgbSignature);
+ return PKCS1.Verify_v15 (rsa, hashName, rgbHash, rgbSignature);
}
}
}
public class RSAPKCS1SignatureFormatter : AsymmetricSignatureFormatter {
private RSA rsa;
- private HashAlgorithm hash;
+ private string hash;
public RSAPKCS1SignatureFormatter ()
{
public override void SetHashAlgorithm (string strName)
{
- hash = HashAlgorithm.Create (strName);
+ if (strName == null)
+ throw new ArgumentNullException ("strName");
+ hash = strName;
}
public override void SetKey (AsymmetricAlgorithm key)
// Jérémie Laval <jeremie dot laval at xamarin dot com>
//
// Copyright (c) 2008 Jérémie "Garuma" Laval
-// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
+// Copyright 2011-2013 Xamarin Inc (http://www.xamarin.com).
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// and for Parent property.
[System.ThreadStatic]
static Task current;
- [System.ThreadStatic]
- static Action<Task> childWorkAdder;
// parent is the outer task in which this task is created
readonly Task parent;
internal TaskScheduler scheduler;
TaskExceptionSlot exSlot;
+ ManualResetEvent wait_handle;
TaskStatus status;
internal void Schedule ()
{
Status = TaskStatus.WaitingToRun;
-
- // If worker is null it means it is a local one, revert to the old behavior
- // If TaskScheduler.Current is not being used, the scheduler was explicitly provided, so we must use that
- if (scheduler != TaskScheduler.Current || childWorkAdder == null || HasFlag (creationOptions, TaskCreationOptions.PreferFairness)) {
- 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
- * the correct Thread during the creation
- */
- childWorkAdder (this);
- }
+ scheduler.QueueTask (this);
}
void ThreadStart ()
Status = TaskStatus.WaitingForChildrenToComplete;
}
+ if (wait_handle != null)
+ wait_handle.Set ();
+
// Tell parent that we are finished
if (parent != null && HasFlag (creationOptions, TaskCreationOptions.AttachedToParent) &&
#if NET_4_5
internal void CancelReal ()
{
Status = TaskStatus.Canceled;
+
+ if (wait_handle != null)
+ wait_handle.Set ();
+
ProcessCompleteDelegates ();
}
ExceptionSlot.Exception = e;
Thread.MemoryBarrier ();
Status = TaskStatus.Faulted;
+
+ if (wait_handle != null)
+ wait_handle.Set ();
+
ProcessCompleteDelegates ();
}
if (millisecondsTimeout < -1)
throw new ArgumentOutOfRangeException ("millisecondsTimeout");
- bool result = true;
-
- if (!IsCompleted) {
- // If the task is ready to be run and we were supposed to wait on it indefinitely without cancellation, just run it
- if (Status == TaskStatus.WaitingToRun && millisecondsTimeout == Timeout.Infinite && scheduler != null && !cancellationToken.CanBeCanceled)
- scheduler.RunInline (this, true);
-
- if (!IsCompleted) {
- var continuation = new ManualResetContinuation ();
- try {
- ContinueWith (continuation);
- result = continuation.Event.Wait (millisecondsTimeout, cancellationToken);
- } finally {
- if (!result)
- RemoveContinuation (continuation);
- continuation.Dispose ();
- }
- }
- }
+ bool result = WaitCore (millisecondsTimeout, cancellationToken);
if (IsCanceled)
throw new AggregateException (new TaskCanceledException (this));
return result;
}
+
+ internal bool WaitCore (int millisecondsTimeout, CancellationToken cancellationToken)
+ {
+ if (IsCompleted)
+ return true;
+
+ // If the task is ready to be run and we were supposed to wait on it indefinitely without cancellation, just run it
+ if (Status == TaskStatus.WaitingToRun && millisecondsTimeout == Timeout.Infinite && scheduler != null && !cancellationToken.CanBeCanceled)
+ scheduler.RunInline (this, true);
+
+ bool result = true;
+
+ if (!IsCompleted) {
+ var continuation = new ManualResetContinuation ();
+ try {
+ ContinueWith (continuation);
+ result = continuation.Event.Wait (millisecondsTimeout, cancellationToken);
+ } finally {
+ if (!result)
+ RemoveContinuation (continuation);
+ continuation.Dispose ();
+ }
+ }
+
+ return result;
+ }
public static void WaitAll (params Task[] tasks)
{
#region Dispose
public void Dispose ()
{
- Dispose (true);
+ Dispose (true);
}
protected virtual void Dispose (bool disposing)
state = null;
if (cancellationRegistration != null)
cancellationRegistration.Value.Dispose ();
+ if (wait_handle != null)
+ wait_handle.Dispose ();
}
}
#endregion
WaitHandle IAsyncResult.AsyncWaitHandle {
get {
- return null;
+ if (invoker == null)
+ throw new ObjectDisposedException (GetType ().ToString ());
+
+ if (wait_handle == null)
+ Interlocked.CompareExchange (ref wait_handle, new ManualResetEvent (IsCompleted), null);
+
+ return wait_handle;
}
}
this.maxCount = maxCount;
this.currCount = initialCount;
- this.handle = new ManualResetEvent (initialCount == 0);
+ this.handle = new ManualResetEvent (initialCount > 0);
}
public void Dispose ()
long millisecondsTimeOutInterval,
bool executeOnlyOnce)
{
+ if (waitObject == null)
+ throw new ArgumentNullException ("waitObject");
+
+ if (callBack == null)
+ throw new ArgumentNullException ("callBack");
+
if (millisecondsTimeOutInterval < -1)
throw new ArgumentOutOfRangeException ("timeout", "timeout < -1");
T value;
GetGenericValueImpl (i, out value);
if (item == null){
- if (value == null)
+ if (value == null) {
return true;
+ }
continue;
}
-
- if (item.Equals (value))
+
+ if (item.Equals (value)) {
return true;
+ }
}
return false;
clone = clone.prev;
}
+ clone.SetMulticastInvoke ();
clone.prev = (MulticastDelegate)this.Clone ();
for (clone = clone.prev, orig = this.prev; orig != null; orig = orig.prev) {
{
if (value == null)
throw new ArgumentNullException ("value");
- if (value.length == 0)
+ if (value.Length == 0)
return 0;
if (this.length == 0)
return -1;
- return CultureInfo.CurrentCulture.CompareInfo.IndexOf (this, value, 0, length, CompareOptions.Ordinal);
+ return CultureInfo.CurrentCulture.CompareInfo.IndexOf (this, value, 0, length, CompareOptions.None);
}
public int IndexOf (String value, int startIndex)
public bool Contains (String value)
{
- return IndexOf (value) != -1;
+ if (value == null)
+ throw new ArgumentNullException ("value");
+
+ return IndexOfOrdinalUnchecked (value, 0, Length) != -1;
}
public static bool IsNullOrEmpty (String value)
memcpy4 (dest, src, size);
}
+ /* Used by the runtime */
+ internal static unsafe void bzero (byte *dest, int len) {
+ memset (dest, 0, len);
+ }
+
+ internal static unsafe void bzero_aligned_1 (byte *dest, int len) {
+ ((byte*)dest) [0] = 0;
+ }
+
+ internal static unsafe void bzero_aligned_2 (byte *dest, int len) {
+ ((short*)dest) [0] = 0;
+ }
+
+ internal static unsafe void bzero_aligned_4 (byte *dest, int len) {
+ ((int*)dest) [0] = 0;
+ }
+
+ internal static unsafe void bzero_aligned_8 (byte *dest, int len) {
+ ((long*)dest) [0] = 0;
+ }
+
+ internal static unsafe void memcpy_aligned_1 (byte *dest, byte *src, int size) {
+ ((byte*)dest) [0] = ((byte*)src) [0];
+ }
+
+ internal static unsafe void memcpy_aligned_2 (byte *dest, byte *src, int size) {
+ ((short*)dest) [0] = ((short*)src) [0];
+ }
+
+ internal static unsafe void memcpy_aligned_4 (byte *dest, byte *src, int size) {
+ ((int*)dest) [0] = ((int*)src) [0];
+ }
+
+ internal static unsafe void memcpy_aligned_8 (byte *dest, byte *src, int size) {
+ ((long*)dest) [0] = ((long*)src) [0];
+ }
+
internal static unsafe void CharCopy (char *dest, char *src, int count) {
// Same rules as for memcpy, but with the premise that
// chars can only be aligned to even addresses if their
{
result = TimeSpan.Zero;
- if (formats == null || formats.Length == 0)
+ if (input == null || formats == null || formats.Length == 0)
return false;
Parser p = new Parser (input, formatProvider);
//\r
\r
using System;\r
+using System.Collections.Generic;\r
using System.Diagnostics;\r
using System.Globalization;\r
using System.IO;\r
using System.Text;\r
using System.Threading;\r
\r
+#if !MONOTOUCH\r
+using Mono.Unix;\r
+#endif\r
using NUnit.Framework;\r
\r
namespace MonoTests.System.IO\r
if (Directory.Exists (TempFolder))\r
Directory.Delete (TempFolder, true);\r
}\r
+#if !MONOTOUCH\r
+ [Test] //BXC #12461\r
+ public void EnumerateFilesListSymlinks ()\r
+ {\r
+ if (!RunningOnUnix)\r
+ return;\r
\r
+ var afile = Path.Combine (TempFolder, "afile.src");\r
+ var bfile = Path.Combine (TempFolder, "bfile.src");\r
+ var cdir = Path.Combine (TempFolder, "cdir.src");\r
+\r
+ File.AppendAllText (afile, "hello");\r
+ var info = new UnixFileInfo (afile);\r
+ info.CreateSymbolicLink (bfile);\r
+ Directory.CreateDirectory (cdir);\r
+\r
+ var files0 = Directory.GetFiles (TempFolder, "*.src");\r
+ Array.Sort (files0);\r
+ Assert.AreEqual (2, files0.Length, "#1");\r
+ Assert.AreEqual (afile, files0 [0], "#2");\r
+ Assert.AreEqual (bfile, files0 [1], "#3");\r
+\r
+#if NET_4_0\r
+ var files1 = new List<string> (Directory.EnumerateFiles (TempFolder, "*.src")).ToArray ();\r
+ Array.Sort (files1);\r
+ Assert.AreEqual (2, files1.Length, "#1.b");\r
+ Assert.AreEqual (afile, files1 [0], "#2.b");\r
+ Assert.AreEqual (bfile, files1 [1], "#3.b");\r
+#endif\r
+\r
+ var files2 = Directory.GetFileSystemEntries (TempFolder, "*.src");\r
+ Array.Sort (files2);\r
+ Assert.AreEqual (3, files2.Length, "#1.c");\r
+ Assert.AreEqual (afile, files2 [0], "#2.c");\r
+ Assert.AreEqual (bfile, files2 [1], "#3.c");\r
+ Assert.AreEqual (cdir, files2 [2], "#4.c");\r
+\r
+#if NET_4_0\r
+ var files3 = new List<string> (Directory.EnumerateFileSystemEntries (TempFolder, "*.src")).ToArray ();\r
+ Array.Sort (files3);\r
+ Assert.AreEqual (3, files3.Length, "#1.d");\r
+ Assert.AreEqual (afile, files3 [0], "#2.d");\r
+ Assert.AreEqual (bfile, files3 [1], "#3.d");\r
+ Assert.AreEqual (cdir, files3 [2], "#4.d");\r
+#endif\r
+ }\r
+#endif\r
[Test]\r
public void CreateDirectory ()\r
{\r
}
#endif
+
+ public int? Bug12856 ()
+ {
+ return null;
+ }
+
+ [Test] //Bug #12856
+ public void MethodToStringShouldPrintFullNameOfGenericStructs ()
+ {
+ var m = GetType ().GetMethod ("Bug12856");
+ Assert.AreEqual ("System.Nullable`1[System.Int32] Bug12856()", m.ToString (), "#1");
+ }
}
#if NET_2_0
}
}
- [Test]
- public void GetResultNotCompleted ()
- {
- TaskAwaiter awaiter;
-
- var task = new Task (() => { });
- awaiter = task.GetAwaiter ();
-
- try {
- awaiter.GetResult ();
- Assert.Fail ();
- } catch (InvalidOperationException) {
- }
- }
-
[Test]
public void GetResultCanceled ()
{
}
}
- [Test]
- public void GetResultNotCompleted ()
- {
- TaskAwaiter<int> awaiter;
-
- task = new Task<int> (() => 1);
- awaiter = task.GetAwaiter ();
-
- try {
- awaiter.GetResult ();
- Assert.Fail ();
- } catch (InvalidOperationException) {
- }
- }
-
[Test]
public void GetResultCanceled ()
{
}
YieldAwaitable.YieldAwaiter a;
+ SynchronizationContext sc;
[SetUp]
public void Setup ()
{
+ sc = SynchronizationContext.Current;
a = new YieldAwaitable ().GetAwaiter ();
}
+ [TearDown]
+ public void TearDown ()
+ {
+ SynchronizationContext.SetSynchronizationContext (sc);
+ }
+
[Test]
public void IsCompleted ()
{
public void OnCompleted_2 ()
{
TaskScheduler scheduler = null;
+ SynchronizationContext.SetSynchronizationContext (null);
+
var mre = new ManualResetEvent (false);
a.OnCompleted (() => {
{
var scheduler = new MyScheduler ();
TaskScheduler ran_scheduler = null;
+ SynchronizationContext.SetSynchronizationContext (null);
var t = Task.Factory.StartNew (() => {
var mre = new ManualResetEvent (false);
var mre = new ManualResetEvent (false);
var context = new MyContext ();
- var old = SynchronizationContext.Current;
- try {
- SynchronizationContext.SetSynchronizationContext (context);
- a.OnCompleted (() => {
- context_ran = SynchronizationContext.Current;
- mre.Set ();
- });
-
- Assert.IsTrue (mre.WaitOne (1000), "#1");
-
- } finally {
- SynchronizationContext.SetSynchronizationContext (old);
- }
+ SynchronizationContext.SetSynchronizationContext (context);
+ a.OnCompleted (() => {
+ context_ran = SynchronizationContext.Current;
+ mre.Set ();
+ });
+ Assert.IsTrue (mre.WaitOne (1000), "#1");
Assert.IsNull (context_ran, "#2");
}
}
}
[Test]
+#if __IOS__
+ [Ignore ("https://bugzilla.xamarin.com/show_bug.cgi?id=12789")]
+#endif
public void SerializeRoundTrip ()
{
WindowsIdentity wi = WindowsIdentity.GetCurrent ();
Assert.IsTrue (r2);
}
+ [Test]
+ public void AsyncWaitHandleSet ()
+ {
+ var task = new TaskFactory ().StartNew (() => { });
+ var ar = (IAsyncResult)task;
+ ar.AsyncWaitHandle.WaitOne ();
+ }
+
#if NET_4_5
[Test]
public void Delay_Invalid ()
--- /dev/null
+//
+// ThreadPoolTest.cs
+//
+// Authors:
+// Marek Safar <marek.safar@gmail.com>
+//
+// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+using System;
+using System.Threading;
+using NUnit.Framework;
+
+namespace MonoTests.System.Threading
+{
+ [TestFixture]
+ public class ThreadPoolTests
+ {
+ [Test]
+ public void RegisterWaitForSingleObject_InvalidArguments ()
+ {
+ try {
+ ThreadPool.RegisterWaitForSingleObject (null, delegate {}, new object (), 100, false);
+ Assert.Fail ("#1");
+ } catch (ArgumentNullException) {
+ }
+
+ try {
+ ThreadPool.RegisterWaitForSingleObject (new Mutex (), null, new object (), 100, false);
+ Assert.Fail ("#2");
+ } catch (ArgumentNullException) {
+ }
+ }
+ }
+}
\ No newline at end of file
}
#endif
+ public class StuffToPick
+ {
+ public StuffToPick () {}
+ public void Method () {}
+ public int Property { get; set; }
+ public event Action Event;
+ public int Field;
+ public void GenericMethod<T> () {}
+ }
+
+ public class StuffToPick<T>
+ {
+ public StuffToPick () {}
+ public void Method () {}
+ public int Property { get; set; }
+ public event Action Event;
+ public int Field;
+ public void GenericMethod<T> () {}
+ }
+
+ static void TestSerialization (CrossDomainTester tester, object o)
+ {
+ Assert.AreSame (o, tester.ReturnArg0 (o), "serializing_type_" + o.GetType ());
+ }
+
+ [Test] //BXC #12611
+ public void ReflectionObjectsAreSerializableTest ()
+ {
+ ad = CreateTestDomain (tempDir, true);
+ CrossDomainTester tester = CreateCrossDomainTester (ad);
+
+ TestSerialization (tester, typeof (StuffToPick));
+ TestSerialization (tester, typeof (StuffToPick).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("GenericMethod"));
+
+ TestSerialization (tester, typeof (StuffToPick<>));
+ TestSerialization (tester, typeof (StuffToPick<>).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("GenericMethod"));
+
+ TestSerialization (tester, typeof (StuffToPick<int>));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetConstructor(new Type [0]));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("Method"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetProperty ("Property"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetEvent ("Event"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetField ("Field"));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("GenericMethod"));
+ }
+
+ [Test] //BXC #12611
+ [Category ("NotWorking")] // Serialization can't handle generic methods
+ public void GenericReflectionObjectsAreSerializableTest ()
+ {
+ ad = CreateTestDomain (tempDir, true);
+ CrossDomainTester tester = CreateCrossDomainTester (ad);
+
+ TestSerialization (tester, typeof (StuffToPick).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ TestSerialization (tester, typeof (StuffToPick<>).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ TestSerialization (tester, typeof (StuffToPick<int>).GetMethod ("GenericMethod").MakeGenericMethod (typeof (int)));
+ }
+
private static AppDomain CreateTestDomain (string baseDirectory, bool assemblyResolver)
{
AppDomainSetup setup = new AppDomainSetup ();
return true;
}
}
+
+ public object ReturnArg0 (object obj)
+ {
+ return obj;
+ }
}
[Serializable ()]
res = del1( ref val );\r
Assert.AreEqual("abbcbbd", val , "#A05");\r
}\r
+\r
+ [Test] //Bug #12536\r
+ public void TestCombineBothDirections ()\r
+ {\r
+ MyDelegate dela = new MyDelegate( MethodA );\r
+ MyDelegate delb = new MyDelegate( MethodB );\r
+ MyDelegate delc = new MyDelegate( MethodC );\r
+ MyDelegate deld = new MyDelegate( MethodD );\r
+\r
+ string val;\r
+ char res;\r
+\r
+ MyDelegate a = dela + delb;\r
+ val = "";\r
+ res = a (ref val);\r
+ Assert.AreEqual ("ab", val, "#1");\r
+ Assert.AreEqual ('b', res, "#2");\r
+\r
+ MyDelegate b = delc + deld;\r
+ val = "";\r
+ res = b (ref val);\r
+ Assert.AreEqual ("cd", val, "#3");\r
+ Assert.AreEqual ('d', res, "#4");\r
+\r
+ MyDelegate c = a + b;\r
+ val = "";\r
+ res = c (ref val);\r
+ Assert.AreEqual ("abcd", val, "#5");\r
+ Assert.AreEqual ('d', res, "#6");\r
+ }\r
}\r
}\r
Assert.IsTrue ("ABC".Contains ("ABC"));
Assert.IsTrue ("ABC".Contains ("AB"));
Assert.IsTrue (!"ABC".Contains ("AD"));
- Assert.IsTrue (!"encyclop�dia".Contains("encyclopaedia"));
+ Assert.IsTrue (!"encyclopædia".Contains("encyclopaedia"));
+ }
+
+ [Test]
+ public void IndexOfIsCultureAwareWhileContainsIsNot ()
+ {
+ string a = "encyclopædia";
+ string b = "encyclopaedia";
+ Assert.IsFalse (a.Contains (b), "#1");
+ Assert.IsTrue (a.Contains ("æ"), "#1.1");
+ Assert.IsFalse (b.Contains ("æ"), "#1.2");
+ Assert.AreEqual (0, a.IndexOf (b), "#2");
+ Assert.AreEqual (8, a.IndexOf ('æ'), "#3");
+ Assert.AreEqual (-1, b.IndexOf ('æ'), "#4");
+ Assert.AreEqual (8, a.IndexOf ("æ"), "#5");
+ Assert.AreEqual (8, b.IndexOf ("æ"), "#6");
+
+ Assert.AreEqual (0, CultureInfo.CurrentCulture.CompareInfo.IndexOf (a, b, 0, a.Length, CompareOptions.None), "#7");
+ Assert.AreEqual (-1, CultureInfo.CurrentCulture.CompareInfo.IndexOf (a, b, 0, a.Length, CompareOptions.Ordinal), "#8");
}
[Test]
TryParseExactHelper ("10:12", new string [0], true, "dontcare");
TryParseExactHelper ("10:12", new string [] { String.Empty }, true, "dontcare");
TryParseExactHelper ("10:12", new string [] { null }, true, "dontcare");
+
+ TryParseExactHelper (null, new string [] { null }, true, "dontcare");
}
void TryParseExactHelper (string input, string [] formats, bool error, string expected, IFormatProvider formatProvider = null,
Mono.Security/Uri.cs
../Mono.Security/Mono.Security.Authenticode/AuthenticodeBase.cs
../Mono.Security/Mono.Security.Authenticode/AuthenticodeDeformatter.cs
+../Mono.Security/Mono.Security.Cryptography/ARC4Managed.cs
../Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
../Mono.Security/Mono.Security.Cryptography/CryptoTools.cs
Mono.Security.Cryptography/DSAManaged.cs
+Mono.Security.Cryptography/HMACAlgorithm.cs
../Mono.Security/Mono.Security.Cryptography/KeyPairPersistence.cs
+Mono.Security.Cryptography/MACAlgorithm.cs
+../Mono.Security/Mono.Security.Cryptography/MD2.cs
+../Mono.Security/Mono.Security.Cryptography/MD2Managed.cs
+../Mono.Security/Mono.Security.Cryptography/MD4.cs
+../Mono.Security/Mono.Security.Cryptography/MD4Managed.cs
../Mono.Security/Mono.Security.Cryptography/PKCS1.cs
../Mono.Security/Mono.Security.Cryptography/PKCS8.cs
-Mono.Security.Cryptography/HMACAlgorithm.cs
-Mono.Security.Cryptography/MACAlgorithm.cs
-../Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
+../Mono.Security/Mono.Security.Cryptography/RC4.cs
../Mono.Security/Mono.Security.Cryptography/RSAManaged.cs
+../Mono.Security/Mono.Security.Cryptography/SymmetricTransform.cs
../Mono.Security/Mono.Security.X509/PKCS12.cs
../Mono.Security/Mono.Security.X509/X501Name.cs
../Mono.Security/Mono.Security.X509/X509Certificate.cs
System.Threading/LazyInitializerTest.cs
System.Threading/WaitHandleTest.cs
System.Threading/VolatileTest.cs
+System.Threading/ThreadPoolTest.cs
System/TimeSpanTest.cs
System/TimeZoneTest.cs
System/TypeTest.cs
--- /dev/null
+#include corlib.dll.sources
\ No newline at end of file
/r:System.Xml.Linq.dll \
/r:System.Configuration.dll
+CLEAN_FILES += $(the_lib).config
+
TEST_MCS_FLAGS = /r:System.dll /r:System.Core.dll /r:System.Xml.dll
DOC_SOURCE_DIRS = \
public class ExtensionObject
{
bool quiet = true;
+ Dictionary<string, System.Reflection.Assembly> assemblyCache = new Dictionary<string, System.Reflection.Assembly> ();
public string Colorize(string code, string lang)
{
System.Reflection.Assembly assembly = null;
try {
- assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ if (!assemblyCache.TryGetValue (assemblyname, out assembly)) {
+ assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ if (assembly != null)
+ assemblyCache[assemblyname] = assembly;
+ }
} catch (Exception) {
// nothing.
}
if (assemblyname == string.Empty)
return string.Empty;
- var assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ System.Reflection.Assembly assembly;
+ if (!assemblyCache.TryGetValue (assemblyname, out assembly)) {
+ assembly = System.Reflection.Assembly.LoadWithPartialName(assemblyname);
+ if (assembly != null)
+ assemblyCache[assemblyname] = assembly;
+ }
+
if (assembly == null)
return string.Empty;
public static int GetNodeLevel (Node node)
{
int i = 0;
- for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++)
+ for (; !node.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase); i++) {
node = node.Parent;
+ if (node == null)
+ return i - 1;
+ }
return i - 1;
}
Node GetNodeTypeParent (Node node)
{
// Type nodes are always at level 2 so we just need to get there
- while (node != null && node.Parent != null && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase))
+ while (node != null && node.Parent != null
+ && !node.Parent.Parent.Element.StartsWith ("root:/", StringComparison.OrdinalIgnoreCase) && node.Parent.Parent.Parent != null)
node = node.Parent;
return node;
}
<xsl:param name="id" />
<h2>Syntax</h2>
<div class="Signature">
- <xsl:attribute name="id">
- <xsl:copy-of select="$id" />
- </xsl:attribute>
+ <xsl:if test="$id != ''">
+ <xsl:attribute name="id">
+ <xsl:copy-of select="$id" />
+ </xsl:attribute>
+ </xsl:if>
<xsl:copy-of select="$content" />
</div>
</xsl:template>
using Monodoc;
using Monodoc.Generators;
+using Monodoc.Providers;
// Used by ReachabilityWithCrefsTest
// using HtmlAgilityPack;
Assert.IsTrue (rootTree.RenderUrl ("T:System.IComparable{T}", generator, out result), "#6");
}
+ [Test]
+ public void PublicUrlOnUnattachedHelpSourceRoot ()
+ {
+ // Unattached help source have no root:/ URL attributed
+ var hs = new EcmaHelpSource (Path.Combine (BaseDir, "sources", "netdocs"), false);
+ var rootTree = RootTree.LoadTree (Path.GetFullPath (BaseDir), false);
+ hs.RootTree = rootTree;
+ Assert.IsNull (hs.Tree.RootNode.PublicUrl);
+ var nsChildUrl = hs.Tree.RootNode.ChildNodes.First ().PublicUrl;
+ Assert.IsNotNull (nsChildUrl);
+ StringAssert.StartsWith ("N:", nsChildUrl);
+ // Verify GetNodeTypeParent
+ var typeNode = hs.Tree.RootNode.ChildNodes.First ().ChildNodes.First ();
+ var metaNode = typeNode.ChildNodes.First (cn => cn.Element == "M");
+ StringAssert.StartsWith (typeNode.PublicUrl, metaNode.PublicUrl);
+ }
+
/*
[Test, Ignore ("Mono documentation is full of syntax errors so we can't use it reliably for this test")]
public void ReachabilityWithCrefsTest ()
$ csharp -v -v
This will turn on the parser debugging output and will
- generate a lot of data when parsing its input.
+ generate a lot of data when parsing its input (make sure that
+ your parser has been compiled with the -v flag, see above for
+ details).
To start with a new completion scheme, type your C# code and
then hit the tab key to trigger the completion engine. In the
We then rebuild our compiler:
(cd mcs/; make cs-parser.jay)
- (cd tools/csharplib; make install)
+ (cd class/Mono.CSharp; make install)
And re-run csharp:
+++ /dev/null
-// CS0019: Operator `==' cannot be applied to operands of type `int' and `null'
-// Line: 10
-// Compiler options: -langversion:ISO-1
-
-class C
-{
- static int Foo { get { return 3; } set {} }
-
- static void Main ()
- {
- if (Foo == null) {}
- }
-}
+++ /dev/null
-// CS0019: Operator `+' cannot be applied to operands of type `null' and `MyTypeImplicitOnly?'
-// Line: 13
-
-struct MyTypeImplicitOnly
-{
-}
-
-class C
-{
- static void Main ()
- {
- MyTypeImplicitOnly? mt = null;
- mt = null + mt;
- }
-}
--- /dev/null
+// CS0019: Operator `==' cannot be applied to operands of type `S' and `S'
+// Line: 22
+
+struct S
+{
+ public static implicit operator E (S s)
+ {
+ return 0;
+ }
+}
+
+public enum E
+{
+}
+
+class C
+{
+ public static void Main ()
+ {
+ S s;
+ S s2;
+ var x = s == s2;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0019: Operator `&&' cannot be applied to operands of type `S?' and `S?'
+// Line: 20
+
+struct S
+{
+ public static S operator & (S s, S i)
+ {
+ return s;
+ }
+}
+
+class C
+{
+ public static void Main ()
+ {
+ S? s = new S ();
+ S? s2 = null;
+
+ var res = s && s2;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0029: Cannot implicitly convert type `string' to `MyTypeImplicitOnly?'
+// Line: 13
+
+struct MyTypeImplicitOnly
+{
+}
+
+class C
+{
+ static void Main ()
+ {
+ MyTypeImplicitOnly? mt = null;
+ mt = null + mt;
+ }
+}
--- /dev/null
+// CS0034: Operator `==' is ambiguous on operands of type `Foo' and `Foo'
+// Line: 23
+
+public struct Foo
+{
+ public static implicit operator int? (Foo f)
+ {
+ return 1;
+ }
+
+ public static implicit operator bool? (Foo f)
+ {
+ return false;
+ }
+}
+
+class C
+{
+ public static void Main ()
+ {
+ Foo f;
+ Foo f2;
+ var v = f == f2;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0120: An object reference is required to access non-static member `MainClass.Callback()'
+// Line: 9
+
+using System;
+
+class MainClass : BaseClass
+{
+ public MainClass (string a, Action callback)
+ : base (a, () => Callback ())
+ {
+ }
+
+ private void Callback ()
+ {
+ }
+}
+
+public class BaseClass
+{
+ public BaseClass (string a, int b)
+ {
+ }
+
+ public BaseClass (string a, Action callback)
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0161: `T.Main()': not all code paths return a value
+// Line: 6
+// CSC bug: The error is not reported even if it should as in other unreachable cases
+
+class T {
+ public static int Main ()
+ {
+ switch (1) {
+ case 1:
+ return 0;
+ default:
+ break;
+ }
+ }
+}
--- /dev/null
+// CS0266: Cannot implicitly convert type `E?' to `E'. An explicit conversion exists (are you missing a cast?)
+// Line: 13
+
+enum E
+{
+}
+
+class C
+{
+ public static void Main ()
+ {
+ E e = 0;
+ E r = e + null;
+ }
+}
--- /dev/null
+// CS0266: Cannot implicitly convert type `int?' to `E'. An explicit conversion exists (are you missing a cast?)
+// Line: 13
+
+enum E
+{
+}
+
+class C
+{
+ public static void Main ()
+ {
+ E e = 0;
+ E r = e - null;
+ }
+}
--- /dev/null
+// CS0458: The result of the expression is always `null' of type `int?'
+// Line: 14
+// Compiler options: -warnaserror -warn:2
+
+public enum E
+{
+}
+
+class C
+{
+ public static void Main ()
+ {
+ E? e = null;
+ var res = e - null;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0458: The result of the expression is always `null' of type `short?'
+// Line: 24
+// Compiler options: -warnaserror -warn:2
+
+struct S
+{
+ public static short operator + (S s, S i)
+ {
+ return 2;
+ }
+
+ public static int? operator + (S? s, int? i)
+ {
+ return 2;
+ }
+
+}
+
+class C
+{
+ public static void Main ()
+ {
+ S? s = new S ();
+ var x = s + (S?)null;
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0458: The result of the expression is always `null' of type `int?'
+// Line: 9
+// Compiler options: -warnaserror -warn:2
+
+public class C
+{
+ public static void Main ()
+ {
+ int? s = null;
+ int? v = s + null;
+ }
+}
--- /dev/null
+// CS0464: The result of comparing type `int?' with null is always `false'
+// Line: 10
+// Compiler options: -warnaserror -warn:2
+
+class C
+{
+ public static void Main ()
+ {
+ int? k = 1;
+ var x = k > null;
+ }
+}
\ No newline at end of file
-// CS0464: The result of comparing type `int' with null is always `false'
+// CS0464: The result of comparing type `int?' with null is always `false'
// Line: 9
// Compiler options: -warnaserror -warn:2
-// CS0472: The result of comparing value type `int' with null is always `false'
+// CS0472: The result of comparing value type `long' with null is always `false'
// Line: 9
// Compiler options: -warnaserror -warn:2
-// CS0647: Error during emitting `System.Runtime.CompilerServices.MethodImplAttribute' attribute. The reason is `Incorrect argument value.'
+// CS0647: Error during emitting `System.Runtime.CompilerServices.MethodImplAttribute' attribute. The reason is `Incorrect argument value'
// Line: 8
using System.Runtime.CompilerServices;
class Test
{
- [MethodImplAttribute(444)]
+ [MethodImplAttribute(445)]
public void test ()
{
}
--- /dev/null
+// CS0647: Error during emitting `System.Runtime.CompilerServices.MethodImplAttribute' attribute. The reason is `Incorrect argument value'
+// Line: 8
+
+using System.Runtime.CompilerServices;
+
+class Program
+{
+ [MethodImpl((MethodImplOptions)255)]
+ void Foo()
+ {
+ }
+}
\ No newline at end of file
--- /dev/null
+// CS0658: `value' is invalid attribute target. All attributes in this attribute section will be ignored
+// Line : 5
+// Compiler options: -warnaserror -warn:1
+
+[reply] ["asd"]
\ No newline at end of file
// CS1661: Cannot convert `lambda expression' to delegate type `C.WithOutParam' since there is a parameter mismatch
// Line: 10
-
class C
{
delegate void WithOutParam (out string value);
static void Main()
{
WithOutParam o = (string l) => { return; };
- }
+ }
}
--- /dev/null
+// CS1661: Cannot convert `anonymous method' to delegate type `System.Predicate<T>' since there is a parameter mismatch
+// Line: 8
+
+class Test<T>
+{
+ void test (Test<T> t, System.Predicate<T> p)
+ {
+ test (t, delegate (Test<T> item) {
+ return false;
+ });
+ }
+}
return false;
if (p_mod == Parameter.Modifier.NONE)
- ec.Report.Error (1677, loc, "Parameter `{0}' should not be declared with the `{1}' keyword",
- (i + 1).ToString (), Parameter.GetModifierSignature (Parameters.FixedParameters [i].ModFlags));
+ ec.Report.Error (1677, Parameters[i].Location, "Parameter `{0}' should not be declared with the `{1}' keyword",
+ (i + 1).ToString (), Parameter.GetModifierSignature (Parameters [i].ModFlags));
else
- ec.Report.Error (1676, loc, "Parameter `{0}' must be declared with the `{1}' keyword",
+ ec.Report.Error (1676, Parameters[i].Location, "Parameter `{0}' must be declared with the `{1}' keyword",
(i+1).ToString (), Parameter.GetModifierSignature (p_mod));
error = true;
}
TypeSpec type = invoke_pd.Types [i];
- // We assume that generic parameters are always inflated
- if (TypeManager.IsGenericParameter (type))
- continue;
-
- if (TypeManager.HasElementType (type) && TypeManager.IsGenericParameter (TypeManager.GetElementType (type)))
+ //
+ // Assumes that generic mvar parameters are always inflated
+ //
+ if (ImplicitDelegateCreation.ContainsMethodTypeParameter (type))
continue;
if (!TypeSpecComparer.IsEqual (invoke_pd.Types [i], Parameters.Types [i])) {
if (ignore_errors)
return false;
- ec.Report.Error (1678, loc, "Parameter `{0}' is declared as type `{1}' but should be `{2}'",
+ ec.Report.Error (1678, Parameters [i].Location, "Parameter `{0}' is declared as type `{1}' but should be `{2}'",
(i+1).ToString (),
Parameters.Types [i].GetSignatureForError (),
invoke_pd.Types [i].GetSignatureForError ());
if (src_block.HasCapturedThis) {
//
// Remove hoisted 'this' request when simple instance method is
- // enough (no hoisted variables only 'this')
+ // enough. No hoisted variables only 'this' and don't need to
+ // propagate this to value type state machine.
//
- if (src_block.ParametersBlock.StateMachine == null)
+ StateMachine sm_parent = null;
+ var pb = src_block.ParametersBlock;
+ do {
+ sm_parent = pb.StateMachine;
+ pb = pb.Parent == null ? null : pb.Parent.ParametersBlock;
+ } while (sm_parent == null && pb != null);
+
+ if (sm_parent == null) {
top_block.RemoveThisReferenceFromChildrenBlock (src_block);
-
- //
- // Special case where parent class is used to emit instance method
- // because currect storey is of value type (async host). We cannot
- // use ldftn on non-boxed instances either to share mutated state
- //
- if (sm != null && sm.Kind == MemberKind.Struct) {
- parent = sm.Parent.PartialContainer;
+ } else if (sm_parent.Kind == MemberKind.Struct) {
+ //
+ // Special case where parent class is used to emit instance method
+ // because currect storey is of value type (async host). We cannot
+ // use ldftn on non-boxed instances either to share mutated state
+ //
+ parent = sm_parent.Parent.PartialContainer;
}
}
// Otherwise, if the selected operator is a predefined operator
//
Binary b = source as Binary;
- if (b == null && source is ReducedExpression)
- b = ((ReducedExpression) source).OriginalExpression as Binary;
+ if (b == null) {
+ if (source is ReducedExpression)
+ b = ((ReducedExpression) source).OriginalExpression as Binary;
+ else if (source is Nullable.LiftedBinaryOperator) {
+ var po = ((Nullable.LiftedBinaryOperator) source);
+ if (po.UserOperator == null)
+ b = po.Binary;
+ } else if (source is TypeCast) {
+ b = ((TypeCast) source).Child as Binary;
+ }
+ }
if (b != null) {
//
return HasSecurityAttribute && IsSecurityActionValid ();
}
+ static bool IsValidMethodImplOption (int value)
+ {
+ //
+ // Allow to use AggressiveInlining on any runtime/corlib
+ //
+ MethodImplOptions all = (MethodImplOptions) 256;
+ foreach (MethodImplOptions v in System.Enum.GetValues (typeof (MethodImplOptions))) {
+ all |= v;
+ }
+
+ return ((MethodImplOptions) value | all) == all;
+ }
+
static bool IsValidArgumentType (TypeSpec t)
{
if (t.IsArray) {
if (string.IsNullOrEmpty (value))
Error_AttributeEmitError ("DllName cannot be empty or null");
}
- } else if (Type == predefined.MethodImpl && pt.BuiltinType == BuiltinTypeSpec.Type.Short &&
- !System.Enum.IsDefined (typeof (MethodImplOptions), ((Constant) arg_expr).GetValue ().ToString ())) {
- Error_AttributeEmitError ("Incorrect argument value.");
- return;
+ } else if (Type == predefined.MethodImpl) {
+ if (pos_args.Count == 1) {
+ var value = (int) ((Constant) arg_expr).GetValueAsLong ();
+
+ if (!IsValidMethodImplOption (value)) {
+ Error_AttributeEmitError ("Incorrect argument value");
+ }
+ }
}
}
if (ac != null) {
element = GetTransformationFlags (ac.Element);
if (element == null)
- return null;
+ return new bool[] { false, false };
bool[] res = new bool[element.Length + 1];
res[0] = false;
switch (oper){
case Binary.Operator.BitwiseOr:
//
- // bool? operator &(bool? x, bool? y);
+ // bool? operator |(bool? x, bool? y);
//
if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) ||
(rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) {
- var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ var b = new Binary (oper, left, right).ResolveOperator (ec);
// false | null => null
// null | false => null
//
if ((lt.BuiltinType == BuiltinTypeSpec.Type.Bool && right is NullLiteral) ||
(rt.BuiltinType == BuiltinTypeSpec.Type.Bool && left is NullLiteral)) {
- var b = new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ var b = new Binary (oper, left, right).ResolveOperator (ec);
// false & null => false
// null & false => false
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
if (!DoBinaryNumericPromotions (ec, ref left, ref right))
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
if (!DoBinaryNumericPromotions (ec, ref left, ref right))
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
if (!DoBinaryNumericPromotions (ec, ref left, ref right))
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
if (!DoBinaryNumericPromotions (ec, ref left, ref right))
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
IntConstant ic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant;
// null << value => null
if (left is NullLiteral)
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, left, right).ResolveOperator (ec);
left = left.ConvertImplicitly (ec.BuiltinTypes.Int);
if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int)
if (left is NullLiteral && right is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
IntConstant sic = right.ConvertImplicitly (ec.BuiltinTypes.Int) as IntConstant;
// null >> value => null
if (left is NullLiteral)
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, left, right).ResolveOperator (ec);
left = left.ConvertImplicitly (ec.BuiltinTypes.Int);
if (left.Type.BuiltinType == BuiltinTypeSpec.Type.Int)
if (left is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
- }
-
- if (left is Nullable.LiftedNull) {
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
}
if (left is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
- }
-
- if (left is Nullable.LiftedNull) {
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
}
if (left is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
- }
-
- if (left is Nullable.LiftedNull) {
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
}
if (left is NullLiteral) {
var lifted_int = new Nullable.NullableType (ec.BuiltinTypes.Int, loc);
lifted_int.ResolveAsType (ec);
- return (Constant) new Nullable.LiftedBinaryOperator (oper, lifted_int, right).Resolve (ec);
- }
-
- if (left is Nullable.LiftedNull) {
- return (Constant) new Nullable.LiftedBinaryOperator (oper, left, right).Resolve (ec);
+ return (Constant) new Binary (oper, lifted_int, right).ResolveOperator (ec);
}
}
}
bool pair_found = false;
- for (int ii = i + 1; ii < members.Count; ++ii) {
+ for (int ii = 0; ii < members.Count; ++ii) {
var o_b = members[ii] as Operator;
if (o_b == null || o_b.OperatorType != matching_type)
continue;
public void BeginCatchBlock (TypeSpec type)
{
+ if (IsAnonymousStoreyMutateRequired)
+ type = CurrentAnonymousMethod.Storey.Mutator.Mutate (type);
+
ig.BeginCatchBlock (type.GetMetaInfo ());
}
//
// Author:
// Miguel de Icaza (miguel@ximian.com)
-// Marek Safar (marek.safar@seznam.cz)
+// Marek Safar (marek.safar@gmail.com)
//
// Copyright 2001-2003 Ximian, Inc.
// Copyright 2003-2008 Novell, Inc.
-// Copyright 2011 Xamarin Inc
+// Copyright 2011-2013 Xamarin Inc
//
using System;
if (this.type == type)
return this;
- if (Convert.ImplicitNumericConversion (this, type) == null)
+ if (!Convert.ImplicitNumericConversionExists (this.type, type))
return null;
bool fail;
}
if (expr_type != expr.Type)
- return new Nullable.Lifted (conv, unwrap, target_type).Resolve (ec);
+ return new Nullable.LiftedConversion (conv, unwrap, target_type).Resolve (ec);
return Nullable.Wrap.Create (conv, target_type);
}
TypeSpec source_type = source.Type;
TypeSpec target_type = target;
Expression source_type_expr;
+ bool nullable_source = false;
if (source_type.IsNullableType) {
// No unwrapping conversion S? -> T for non-reference types
if (implicitOnly && !TypeSpec.IsReferenceType (target_type) && !target_type.IsNullableType) {
source_type_expr = source;
} else {
- source_type_expr = Nullable.Unwrap.Create (source);
+ source_type_expr = Nullable.Unwrap.CreateUnwrapped (source);
source_type = source_type_expr.Type;
+ nullable_source = true;
}
} else {
source_type_expr = source;
//
if (t_x != target_type) {
//
- // User operator is of T?, no need to lift it
+ // User operator is of T?
//
- if (t_x == target && t_x.IsNullableType)
- return source;
+ if (t_x.IsNullableType && target.IsNullableType) {
+ //
+ // User operator return type does not match target type we need
+ // yet another conversion. This should happen for promoted numeric
+ // types only
+ //
+ if (t_x != target) {
+ var unwrap = Nullable.Unwrap.CreateUnwrapped (source);
- source = implicitOnly ?
- ImplicitConversionStandard (ec, source, target_type, loc) :
- ExplicitConversionStandard (ec, source, target_type, loc);
+ source = implicitOnly ?
+ ImplicitConversionStandard (ec, unwrap, target_type, loc) :
+ ExplicitConversionStandard (ec, unwrap, target_type, loc);
- if (source == null)
- return null;
+ if (source == null)
+ return null;
+
+ source = new Nullable.LiftedConversion (source, unwrap, target).Resolve (ec);
+ }
+ } else {
+ source = implicitOnly ?
+ ImplicitConversionStandard (ec, source, target_type, loc) :
+ ExplicitConversionStandard (ec, source, target_type, loc);
+
+ if (source == null)
+ return null;
+ }
}
+
//
- // Source expression is of nullable type, lift the result in the case it's null and
- // not nullable/lifted user operator is used
+ // Source expression is of nullable type and underlying conversion returns
+ // only non-nullable type we need to lift it manually
//
- if (source_type_expr is Nullable.Unwrap && !s_x.IsNullableType && (TypeSpec.IsReferenceType (target) || target_type != target))
- source = new Nullable.Lifted (source, source_type_expr, target).Resolve (ec);
- else if (target_type != target)
+ if (nullable_source && !s_x.IsNullableType)
+ return new Nullable.LiftedConversion (source, source_type_expr, target).Resolve (ec);
+
+ //
+ // Target is of nullable type but source type is not, wrap the result expression
+ //
+ if (target.IsNullableType && !t_x.IsNullableType)
source = Nullable.Wrap.Create (source, target);
return source;
Expression am = ame.Compatible (ec, target_type);
if (am != null)
return am.Resolve (ec);
+
+ // Avoid CS1503 after CS1661
+ return ErrorExpression.Instance;
}
if (expr_type == InternalType.Arglist && target_type == ec.Module.PredefinedTypes.ArgIterator.TypeSpec)
if (e == null)
return null;
- return new Nullable.Lifted (e, unwrap, target_type).Resolve (ec);
+ return new Nullable.LiftedConversion (e, unwrap, target_type).Resolve (ec);
}
if (expr_type.BuiltinType == BuiltinTypeSpec.Type.Object) {
return new UnboxCast (expr, target_type);
var sect = (List<Attribute>) $2;
if (attrs == null)
attrs = new Attributes (sect);
- else
+ else if (sect != null)
attrs.AddAttributes (sect);
$$ = attrs;
}
}
| error
{
- $$ = CheckAttributeTarget (GetTokenName (yyToken), GetLocation ($1));
+ CheckAttributeTarget (GetTokenName (yyToken), GetLocation ($1));
$$ = null;
}
;
$$ = new Throw ((Expression) $2, GetLocation ($1));
lbag.AddStatement ($$, GetLocation ($3));
}
+ | THROW expression error
+ {
+ Error_SyntaxError (yyToken);
+ $$ = new Throw ((Expression) $2, GetLocation ($1));
+ }
| THROW error
{
Error_SyntaxError (yyToken);
public const int EvalCompilationUnitParserCharacter = 0x100001;
public const int EvalUsingDeclarationsParserCharacter = 0x100002;
public const int DocumentationXref = 0x100003;
+
+ const int UnicodeLS = 0x2028;
+ const int UnicodePS = 0x2029;
//
// XML documentation buffer. The save point is used to divide
x = '\n';
advance_line ();
- } else if (x == '\n') {
+ } else if (x == '\n' || x == UnicodeLS || x == UnicodePS) {
advance_line ();
} else {
col++;
throw new InternalErrorException (string.Format ("Secondary putback [{0}] putting back [{1}] is not allowed", (char)putback_char, (char) c), Location);
}
- if (c == '\n' || col == 0) {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS || col == 0) {
// It won't happen though.
line--;
ref_line--;
int has_identifier_argument = (int)(cmd & PreprocessorDirective.RequiresArgument);
int pos = 0;
- while (c != -1 && c != '\n') {
+ while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) {
if (c == '\\' && has_identifier_argument >= 0) {
if (has_identifier_argument != 0) {
has_identifier_argument = 1;
// Eat single-line comments
//
get_char ();
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
-
+ ReadToEndOfLine ();
break;
}
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
-
+ ReadToEndOfLine ();
return false;
}
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
-
+ ReadToEndOfLine ();
return new_line != 0;
}
c = 0;
}
- if (c != '\n' && c != '/' && c != '"') {
+ if (c != '\n' && c != '/' && c != '"' && c != UnicodeLS && c != UnicodePS) {
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
+ ReadToEndOfLine ();
Report.Error (1578, loc, "Filename, single-line comment or end-of-line expected");
return true;
}
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
+
} else if (c == '/') {
ReadSingleLineComment ();
} else {
//
// Eat any remaining characters to continue parsing on next line
//
- while (c != -1 && c != '\n') {
- c = get_char ();
- }
+ ReadToEndOfLine ();
Error_EndLineExpected ();
return true;
string TokenizeFileName (ref int c)
{
var string_builder = new StringBuilder ();
- while (c != -1 && c != '\n') {
+ while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS) {
c = get_char ();
if (c == '"') {
c = get_char ();
Report.Warning (1692, 1, Location, "Invalid number");
// Read everything till the end of the line or file
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
+ ReadToEndOfLine ();
}
}
return number;
}
+ void ReadToEndOfLine ()
+ {
+ int c;
+ do {
+ c = get_char ();
+ } while (c != -1 && c != '\n' && c != UnicodeLS && c != UnicodePS);
+ }
+
void ReadSingleLineComment ()
{
if (peek_char () != '/')
Report.Warning (1696, 1, Location, "Single-line comment or end-of-line expected");
// Read everything till the end of the line or file
- int c;
- do {
- c = get_char ();
- } while (c != -1 && c != '\n');
+ ReadToEndOfLine ();
}
/// <summary>
var loc = Location;
- if (c == '\n' || c == '/') {
+ if (c == '\n' || c == '/' || c == UnicodeLS || c == UnicodePS) {
if (c == '/')
ReadSingleLineComment ();
Report.RegisterWarningRegion (loc).WarningEnable (loc, code, context);
}
}
- } while (code >= 0 && c != '\n' && c != -1);
+ } while (code >= 0 && c != '\n' && c != -1 && c != UnicodeLS && c != UnicodePS);
}
return;
Report.Warning (1634, 1, Location, "Expected disable or restore");
// Eat any remaining characters on the line
- while (c != '\n' && c != -1)
- c = get_char ();
+ ReadToEndOfLine ();
return;
}
return Token.LITERAL;
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
if (!quoted) {
Report.Error (1010, Location, "Newline in constant");
case '\v':
case '\r':
case '\n':
+ case UnicodeLS:
+ case UnicodePS:
case '/':
next = peek_token ();
if (next == Token.COMMA || next == Token.CLOSE_BRACKET)
case Token.FOREACH:
case Token.TYPEOF:
case Token.WHILE:
+ case Token.SWITCH:
case Token.USING:
case Token.DEFAULT:
case Token.DELEGATE:
}
}
- while ((d = get_char ()) != -1 && d != '\n');
+ ReadToEndOfLine ();
any_token_seen |= tokens_seen;
tokens_seen = false;
if (docAppend)
xml_comment_buffer.Append ((char) d);
- if (d == '\n'){
+ if (d == '\n' || d == UnicodeLS || d == UnicodePS){
any_token_seen |= tokens_seen;
tokens_seen = false;
//
return is_number (c, false);
case '\n': // white space
+ case UnicodeLS:
+ case UnicodePS:
any_token_seen |= tokens_seen;
tokens_seen = false;
comments_seen = false;
continue;
}
- if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' )
+ if (c == ' ' || c == '\t' || c == '\n' || c == '\f' || c == '\v' || c == UnicodeLS || c == UnicodePS)
continue;
if (c == '#') {
return Token.LITERAL;
}
- if (c == '\n') {
+ if (c == '\n' || c == UnicodeLS || c == UnicodePS) {
Report.Error (1010, start_location, "Newline in constant");
return Token.ERROR;
}
// Try to recover, read until newline or next "'"
while ((c = get_char ()) != -1) {
- if (c == '\n' || c == '\'')
+ if (c == '\n' || c == '\'' || c == UnicodeLS || c == UnicodePS)
break;
}
}
//
// Returns true when type is MVAR or has MVAR reference
//
- static bool ContainsMethodTypeParameter (TypeSpec type)
+ public static bool ContainsMethodTypeParameter (TypeSpec type)
{
var tps = type as TypeParameterSpec;
if (tps != null)
return e;
}
+ public Constant ResolveLabelConstant (ResolveContext rc)
+ {
+ var expr = Resolve (rc);
+ if (expr == null)
+ return null;
+
+ Constant c = expr as Constant;
+ if (c == null) {
+ if (c.type != InternalType.ErrorType)
+ rc.Report.Error (150, StartLocation, "A constant value is expected");
+
+ return null;
+ }
+
+ return c;
+ }
+
public virtual void EncodeAttributeValue (IMemberContext rc, AttributeEncoder enc, TypeSpec targetType)
{
rc.Module.Compiler.Report.Error (182, loc,
public static Expression Create (Expression child, TypeSpec type)
{
Constant c = child as Constant;
- if (c != null)
- return new EmptyConstantCast (c, type);
+ if (c != null) {
+ var enum_constant = c as EnumConstant;
+ if (enum_constant != null)
+ c = enum_constant.Child;
+
+ if (!(c is ReducedExpression.ReducedConstantExpression)) {
+ if (c.Type == type)
+ return c;
+
+ var res = c.ConvertImplicitly (type);
+ if (res != null)
+ return res;
+ }
+ }
EmptyCast e = child as EmptyCast;
if (e != null)
public override void Emit (EmitContext ec)
{
base.Emit (ec);
+ Emit (ec, mode);
+ }
+ public static void Emit (EmitContext ec, Mode mode)
+ {
if (ec.HasSet (EmitContext.Options.CheckedScope)) {
switch (mode){
case Mode.I1_U1: ec.Emit (OpCodes.Conv_Ovf_U1); break;
//
public class ReducedExpression : Expression
{
- sealed class ReducedConstantExpression : EmptyConstantCast
+ public sealed class ReducedConstantExpression : EmptyConstantCast
{
readonly Expression orig_expr;
// is used as argument or delegate conversion
//
if (!Convert.ImplicitConversionExists (ec, argument.Expr, parameter)) {
- return 2;
+ return parameter.IsDelegate && argument.Expr is AnonymousMethodExpression ? 2 : 3;
}
}
{
protected readonly TypeSpec left;
protected readonly TypeSpec right;
+ protected readonly TypeSpec left_unwrap;
+ protected readonly TypeSpec right_unwrap;
public readonly Operator OperatorsMask;
public TypeSpec ReturnType;
if ((op_mask & Operator.ValuesOnlyMask) != 0)
throw new InternalErrorException ("Only masked values can be used");
+ if ((op_mask & Operator.NullableMask) != 0) {
+ left_unwrap = Nullable.NullableInfo.GetUnderlyingType (ltype);
+ right_unwrap = Nullable.NullableInfo.GetUnderlyingType (rtype);
+ } else {
+ left_unwrap = ltype;
+ right_unwrap = rtype;
+ }
+
this.left = ltype;
this.right = rtype;
this.OperatorsMask = op_mask;
this.ReturnType = return_type;
}
- public virtual Expression ConvertResult (ResolveContext ec, Binary b)
+ public bool IsLifted {
+ get {
+ return (OperatorsMask & Operator.NullableMask) != 0;
+ }
+ }
+
+ public virtual Expression ConvertResult (ResolveContext rc, Binary b)
{
+ Constant c;
+
+ var left_expr = b.left;
+ var right_expr = b.right;
+
b.type = ReturnType;
- b.left = Convert.ImplicitConversion (ec, b.left, left, b.left.Location);
- b.right = Convert.ImplicitConversion (ec, b.right, right, b.right.Location);
+ if (IsLifted) {
+ if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion)) {
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+ }
+
+ if (right_expr.IsNull) {
+ if ((b.oper & Operator.EqualityMask) != 0) {
+ if (!left_expr.Type.IsNullableType && left_expr.Type == left_unwrap)
+ return b.CreateLiftedValueTypeResult (rc, left_unwrap);
+ } else if ((b.oper & Operator.BitwiseMask) != 0) {
+ if (left_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
+ return Nullable.LiftedNull.CreateFromExpression (rc, b);
+ } else {
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+
+ if ((b.Oper & (Operator.ArithmeticMask | Operator.ShiftMask)) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, b);
+
+ return b.CreateLiftedValueTypeResult (rc, left);
+ }
+ } else if (left_expr.IsNull) {
+ if ((b.oper & Operator.EqualityMask) != 0) {
+ if (!right_expr.Type.IsNullableType && right_expr.Type == right_unwrap)
+ return b.CreateLiftedValueTypeResult (rc, right_unwrap);
+ } else if ((b.oper & Operator.BitwiseMask) != 0) {
+ if (right_unwrap.BuiltinType != BuiltinTypeSpec.Type.Bool)
+ return Nullable.LiftedNull.CreateFromExpression (rc, b);
+ } else {
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+
+ if ((b.Oper & (Operator.ArithmeticMask | Operator.ShiftMask)) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, b);
+
+ return b.CreateLiftedValueTypeResult (rc, right);
+ }
+ }
+ }
//
// A user operators does not support multiple user conversions, but decimal type
// is considered to be predefined type therefore we apply predefined operators rules
// and then look for decimal user-operator implementation
//
- if (left.BuiltinType == BuiltinTypeSpec.Type.Decimal)
- return b.ResolveUserOperator (ec, b.left, b.right);
+ if (left.BuiltinType == BuiltinTypeSpec.Type.Decimal) {
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+
+ return b.ResolveUserOperator (rc, b.left, b.right);
+ }
- var c = b.right as Constant;
+ c = right_expr as Constant;
if (c != null) {
- if (c.IsDefaultValue && (b.oper == Operator.Addition || b.oper == Operator.Subtraction || (b.oper == Operator.BitwiseOr && !(b is Nullable.LiftedBinaryOperator))))
- return ReducedExpression.Create (b.left, b).Resolve (ec);
+ if (c.IsDefaultValue) {
+ //
+ // Optimizes
+ //
+ // (expr + 0) to expr
+ // (expr - 0) to expr
+ // (bool? | false) to bool?
+ //
+ if (b.oper == Operator.Addition || b.oper == Operator.Subtraction ||
+ (b.oper == Operator.BitwiseOr && left_unwrap.BuiltinType == BuiltinTypeSpec.Type.Bool && c is BoolConstant)) {
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ return ReducedExpression.Create (b.left, b).Resolve (rc);
+ }
+ } else {
+ //
+ // Optimizes
+ //
+ // (bool? & true) to bool?
+ //
+ if (IsLifted && left_unwrap.BuiltinType == BuiltinTypeSpec.Type.Bool && b.oper == Operator.BitwiseAnd) {
+ return ReducedExpression.Create (b.left, b).Resolve (rc);
+ }
+ }
+
if ((b.oper == Operator.Multiply || b.oper == Operator.Division) && c.IsOneInteger)
- return ReducedExpression.Create (b.left, b).Resolve (ec);
- return b;
+ return ReducedExpression.Create (b.left, b).Resolve (rc);
+
+ if ((b.oper & Operator.ShiftMask) != 0 && c is IntConstant) {
+ b.right = new IntConstant (rc.BuiltinTypes, ((IntConstant) c).Value & GetShiftMask (left_unwrap), b.right.Location);
+ }
}
c = b.left as Constant;
if (c != null) {
- if (c.IsDefaultValue && (b.oper == Operator.Addition || (b.oper == Operator.BitwiseOr && !(b is Nullable.LiftedBinaryOperator))))
- return ReducedExpression.Create (b.right, b).Resolve (ec);
+ if (c.IsDefaultValue) {
+ //
+ // Optimizes
+ //
+ // (0 + expr) to expr
+ // (false | bool?) to bool?
+ //
+ if (b.oper == Operator.Addition ||
+ (b.oper == Operator.BitwiseOr && right_unwrap.BuiltinType == BuiltinTypeSpec.Type.Bool && c is BoolConstant)) {
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+ return ReducedExpression.Create (b.right, b).Resolve (rc);
+ }
+ } else {
+ //
+ // Optimizes
+ //
+ // (true & bool?) to bool?
+ //
+ if (IsLifted && left_unwrap.BuiltinType == BuiltinTypeSpec.Type.Bool && b.oper == Operator.BitwiseAnd) {
+ return ReducedExpression.Create (b.right, b).Resolve (rc);
+ }
+ }
+
if (b.oper == Operator.Multiply && c.IsOneInteger)
- return ReducedExpression.Create (b.right, b).Resolve (ec);
- return b;
+ return ReducedExpression.Create (b.right, b).Resolve (rc);
+ }
+
+ if (IsLifted) {
+ var lifted = new Nullable.LiftedBinaryOperator (b);
+
+ TypeSpec ltype, rtype;
+ if (b.left.Type.IsNullableType) {
+ lifted.UnwrapLeft = new Nullable.Unwrap (b.left);
+ ltype = left_unwrap;
+ } else {
+ ltype = left;
+ }
+
+ if (b.right.Type.IsNullableType) {
+ lifted.UnwrapRight = new Nullable.Unwrap (b.right);
+ rtype = right_unwrap;
+ } else {
+ rtype = right;
+ }
+
+ lifted.Left = b.left.IsNull ?
+ b.left :
+ Convert.ImplicitConversion (rc, lifted.UnwrapLeft ?? b.left, ltype, b.left.Location);
+
+ lifted.Right = b.right.IsNull ?
+ b.right :
+ Convert.ImplicitConversion (rc, lifted.UnwrapRight ?? b.right, rtype, b.right.Location);
+
+ return lifted.Resolve (rc);
}
+ b.left = Convert.ImplicitConversion (rc, b.left, left, b.left.Location);
+ b.right = Convert.ImplicitConversion (rc, b.right, right, b.right.Location);
+
return b;
}
public PredefinedOperator ResolveBetterOperator (ResolveContext ec, PredefinedOperator best_operator)
{
+ if ((OperatorsMask & Operator.DecomposedMask) != 0)
+ return best_operator;
+
+ if ((best_operator.OperatorsMask & Operator.DecomposedMask) != 0)
+ return this;
+
int result = 0;
if (left != null && best_operator.left != null) {
- result = OverloadResolver.BetterTypeConversion (ec, best_operator.left, left);
+ result = OverloadResolver.BetterTypeConversion (ec, best_operator.left_unwrap, left_unwrap);
}
//
// When second argument is same as the first one, the result is same
//
if (right != null && (left != right || best_operator.left != best_operator.right)) {
- result |= OverloadResolver.BetterTypeConversion (ec, best_operator.right, right);
+ result |= OverloadResolver.BetterTypeConversion (ec, best_operator.right_unwrap, right_unwrap);
}
if (result == 0 || result > 2)
}
}
- sealed class PredefinedShiftOperator : PredefinedOperator
- {
- public PredefinedShiftOperator (TypeSpec ltype, TypeSpec rtype, Operator op_mask)
- : base (ltype, rtype, op_mask)
- {
- }
-
- public override Expression ConvertResult (ResolveContext ec, Binary b)
- {
- b.left = Convert.ImplicitConversion (ec, b.left, left, b.left.Location);
-
- Expression expr_tree_expr = Convert.ImplicitConversion (ec, b.right, right, b.right.Location);
-
- int right_mask = left.BuiltinType == BuiltinTypeSpec.Type.Int || left.BuiltinType == BuiltinTypeSpec.Type.UInt ? 0x1f : 0x3f;
-
- //
- // b = b.left >> b.right & (0x1f|0x3f)
- //
- b.right = new Binary (Operator.BitwiseAnd,
- b.right, new IntConstant (ec.BuiltinTypes, right_mask, b.right.Location)).Resolve (ec);
-
- //
- // Expression tree representation does not use & mask
- //
- b.right = ReducedExpression.Create (b.right, expr_tree_expr).Resolve (ec);
- b.type = ReturnType;
-
- //
- // Optimize shift by 0
- //
- var c = b.right as Constant;
- if (c != null && c.IsDefaultValue)
- return ReducedExpression.Create (b.left, b).Resolve (ec);
-
- return b;
- }
- }
-
sealed class PredefinedEqualityOperator : PredefinedOperator
{
MethodSpec equal_method, inequal_method;
LogicalMask = 1 << 10,
AdditionMask = 1 << 11,
SubtractionMask = 1 << 12,
- RelationalMask = 1 << 13
+ RelationalMask = 1 << 13,
+
+ DecomposedMask = 1 << 19,
+ NullableMask = 1 << 20,
}
- protected enum State
+ enum State : byte
{
None = 0,
Compound = 1 << 1,
- LeftNullLifted = 1 << 2,
- RightNullLifted = 1 << 3
}
readonly Operator oper;
- protected Expression left, right;
- protected State state;
- Expression enum_conversion;
+ Expression left, right;
+ State state;
+ ConvCast.Mode enum_conversion;
public Binary (Operator oper, Expression left, Expression right, bool isCompound)
: this (oper, left, right)
oper, l, r);
}
- protected void Error_OperatorCannotBeApplied (ResolveContext ec, Expression left, Expression right)
+ void Error_OperatorCannotBeApplied (ResolveContext ec, Expression left, Expression right)
{
Error_OperatorCannotBeApplied (ec, left, right, OperName (oper), loc);
}
return left.ContainsEmitWithAwait () || right.ContainsEmitWithAwait ();
}
- public static void EmitOperatorOpcode (EmitContext ec, Operator oper, TypeSpec l)
+ public static void EmitOperatorOpcode (EmitContext ec, Operator oper, TypeSpec l, Expression right)
{
OpCode opcode;
break;
case Operator.RightShift:
+ if (!(right is IntConstant)) {
+ ec.EmitInt (GetShiftMask (l));
+ ec.Emit (OpCodes.And);
+ }
+
if (IsUnsigned (l))
opcode = OpCodes.Shr_Un;
else
break;
case Operator.LeftShift:
+ if (!(right is IntConstant)) {
+ ec.EmitInt (GetShiftMask (l));
+ ec.Emit (OpCodes.And);
+ }
+
opcode = OpCodes.Shl;
break;
ec.Emit (opcode);
}
+ static int GetShiftMask (TypeSpec type)
+ {
+ return type.BuiltinType == BuiltinTypeSpec.Type.Int || type.BuiltinType == BuiltinTypeSpec.Type.UInt ? 0x1f : 0x3f;
+ }
+
static bool IsUnsigned (TypeSpec t)
{
switch (t.BuiltinType) {
return t.BuiltinType == BuiltinTypeSpec.Type.Float || t.BuiltinType == BuiltinTypeSpec.Type.Double;
}
- Expression ResolveOperator (ResolveContext ec)
+ public Expression ResolveOperator (ResolveContext rc)
{
+ eclass = ExprClass.Value;
+
TypeSpec l = left.Type;
TypeSpec r = right.Type;
Expression expr;
//
// Handles predefined primitive types
//
- if (BuiltinTypeSpec.IsPrimitiveType (l) && BuiltinTypeSpec.IsPrimitiveType (r)) {
+ if ((BuiltinTypeSpec.IsPrimitiveType (l) || (l.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (Nullable.NullableInfo.GetUnderlyingType (l)))) &&
+ (BuiltinTypeSpec.IsPrimitiveType (r) || (r.IsNullableType && BuiltinTypeSpec.IsPrimitiveType (Nullable.NullableInfo.GetUnderlyingType (r))))) {
if ((oper & Operator.ShiftMask) == 0) {
- if (l.BuiltinType != BuiltinTypeSpec.Type.Bool && !DoBinaryOperatorPromotion (ec))
+ if (!DoBinaryOperatorPromotion (rc))
return null;
- primitives_only = true;
+ primitives_only = BuiltinTypeSpec.IsPrimitiveType (l) && BuiltinTypeSpec.IsPrimitiveType (r);
}
} else {
// Pointers
if (l.IsPointer || r.IsPointer)
- return ResolveOperatorPointer (ec, l, r);
+ return ResolveOperatorPointer (rc, l, r);
- // Enums
bool lenum = l.IsEnum;
bool renum = r.IsEnum;
- if (lenum || renum) {
- expr = ResolveOperatorEnum (ec, lenum, renum, l, r);
+ if ((oper & (Operator.ComparisonMask | Operator.BitwiseMask)) != 0) {
+ //
+ // Enumerations
+ //
+ if (IsEnumOrNullableEnum (l) || IsEnumOrNullableEnum (r)) {
+ expr = ResolveSingleEnumOperators (rc, lenum, renum, l, r);
- if (expr != null)
- return expr;
- }
+ if (expr == null)
+ return null;
- // Delegates
- if ((oper == Operator.Addition || oper == Operator.Subtraction) && (l.IsDelegate || r.IsDelegate)) {
-
- expr = ResolveOperatorDelegate (ec, l, r);
+ if ((oper & Operator.BitwiseMask) != 0) {
+ expr = EmptyCast.Create (expr, type);
+ AddEnumResultCast (type);
+
+ if (oper == Operator.BitwiseAnd && left.Type.IsEnum && right.Type.IsEnum) {
+ expr = OptimizeAndOperation (expr);
+ }
+ }
- // TODO: Can this be ambiguous
- if (expr != null)
+ left = ConvertEnumOperandToUnderlyingType (rc, left);
+ right = ConvertEnumOperandToUnderlyingType (rc, right);
return expr;
+ }
+ } else if ((oper == Operator.Addition || oper == Operator.Subtraction)) {
+ if (IsEnumOrNullableEnum (l) || IsEnumOrNullableEnum (r)) {
+ //
+ // Enumerations
+ //
+ expr = ResolveEnumOperators (rc, lenum, renum, l, r);
+
+ //
+ // We cannot break here there is also Enum + String possible match
+ // which is not ambiguous with predefined enum operators
+ //
+ if (expr != null) {
+ left = ConvertEnumOperandToUnderlyingType (rc, left);
+ right = ConvertEnumOperandToUnderlyingType (rc, right);
+
+ return expr;
+ }
+ } else if (l.IsDelegate || r.IsDelegate) {
+ //
+ // Delegates
+ //
+ expr = ResolveOperatorDelegate (rc, l, r);
+
+ // TODO: Can this be ambiguous
+ if (expr != null)
+ return expr;
+ }
}
// User operators
- expr = ResolveUserOperator (ec, left, right);
+ expr = ResolveUserOperator (rc, left, right);
if (expr != null)
return expr;
-
- // Predefined reference types equality
- if ((oper & Operator.EqualityMask) != 0) {
- expr = ResolveOperatorEquality (ec, l, r);
- if (expr != null)
- return expr;
- }
}
+
+ //
+ // Equality operators are more complicated
+ //
+ if ((oper & Operator.EqualityMask) != 0) {
+ return ResolveEquality (rc, l, r, primitives_only);
+ }
+
+ expr = ResolveOperatorPredefined (rc, rc.BuiltinTypes.OperatorsBinaryStandard, primitives_only);
+ if (expr != null)
+ return expr;
+
+ if (primitives_only)
+ return null;
+
+ //
+ // Lifted operators have lower priority
+ //
+ return ResolveOperatorPredefined (rc, rc.Module.OperatorsBinaryLifted, false);
+ }
- return ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryStandard, primitives_only, null);
+ static bool IsEnumOrNullableEnum (TypeSpec type)
+ {
+ return type.IsEnum || (type.IsNullableType && Nullable.NullableInfo.GetUnderlyingType (type).IsEnum);
}
+
// at least one of 'left' or 'right' is an enumeration constant (EnumConstant or SideEffectConstant or ...)
// if 'left' is not an enumeration constant, create one from the type of 'right'
Constant EnumLiftUp (ResolveContext ec, Constant left, Constant right, Location loc)
public static PredefinedOperator[] CreateStandardOperatorsTable (BuiltinTypes types)
{
TypeSpec bool_type = types.Bool;
- return new PredefinedOperator[] {
- new PredefinedOperator (types.Int, Operator.ArithmeticMask | Operator.BitwiseMask),
+
+ return new [] {
+ new PredefinedOperator (types.Int, Operator.ArithmeticMask | Operator.BitwiseMask | Operator.ShiftMask),
new PredefinedOperator (types.UInt, Operator.ArithmeticMask | Operator.BitwiseMask),
new PredefinedOperator (types.Long, Operator.ArithmeticMask | Operator.BitwiseMask),
new PredefinedOperator (types.ULong, Operator.ArithmeticMask | Operator.BitwiseMask),
new PredefinedOperator (types.Decimal, Operator.ComparisonMask, bool_type),
new PredefinedStringOperator (types.String, Operator.AdditionMask, types.String),
- new PredefinedStringOperator (types.String, types.Object, Operator.AdditionMask, types.String),
- new PredefinedStringOperator (types.Object, types.String, Operator.AdditionMask, types.String),
+ // Remaining string operators are in lifted tables
new PredefinedOperator (bool_type, Operator.BitwiseMask | Operator.LogicalMask | Operator.EqualityMask, bool_type),
- new PredefinedShiftOperator (types.Int, types.Int, Operator.ShiftMask),
- new PredefinedShiftOperator (types.UInt, types.Int, Operator.ShiftMask),
- new PredefinedShiftOperator (types.Long, types.Int, Operator.ShiftMask),
- new PredefinedShiftOperator (types.ULong, types.Int, Operator.ShiftMask)
+ new PredefinedOperator (types.UInt, types.Int, Operator.ShiftMask),
+ new PredefinedOperator (types.Long, types.Int, Operator.ShiftMask),
+ new PredefinedOperator (types.ULong, types.Int, Operator.ShiftMask)
+ };
+
+ }
+ public static PredefinedOperator[] CreateStandardLiftedOperatorsTable (ModuleContainer module)
+ {
+ var nullable = module.PredefinedTypes.Nullable.TypeSpec;
+ if (nullable == null)
+ return new PredefinedOperator [0];
+
+ var types = module.Compiler.BuiltinTypes;
+ var bool_type = types.Bool;
+
+ var nullable_bool = nullable.MakeGenericType (module, new[] { bool_type });
+ var nullable_int = nullable.MakeGenericType (module, new[] { types.Int });
+ var nullable_uint = nullable.MakeGenericType (module, new[] { types.UInt });
+ var nullable_long = nullable.MakeGenericType (module, new[] { types.Long });
+ var nullable_ulong = nullable.MakeGenericType (module, new[] { types.ULong });
+ var nullable_float = nullable.MakeGenericType (module, new[] { types.Float });
+ var nullable_double = nullable.MakeGenericType (module, new[] { types.Double });
+ var nullable_decimal = nullable.MakeGenericType (module, new[] { types.Decimal });
+
+ return new[] {
+ new PredefinedOperator (nullable_int, Operator.NullableMask | Operator.ArithmeticMask | Operator.BitwiseMask | Operator.ShiftMask),
+ new PredefinedOperator (nullable_uint, Operator.NullableMask | Operator.ArithmeticMask | Operator.BitwiseMask),
+ new PredefinedOperator (nullable_long, Operator.NullableMask | Operator.ArithmeticMask | Operator.BitwiseMask),
+ new PredefinedOperator (nullable_ulong, Operator.NullableMask | Operator.ArithmeticMask | Operator.BitwiseMask),
+ new PredefinedOperator (nullable_float, Operator.NullableMask | Operator.ArithmeticMask),
+ new PredefinedOperator (nullable_double, Operator.NullableMask | Operator.ArithmeticMask),
+ new PredefinedOperator (nullable_decimal, Operator.NullableMask | Operator.ArithmeticMask),
+
+ new PredefinedOperator (nullable_int, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_uint, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_long, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_ulong, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_float, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_double, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+ new PredefinedOperator (nullable_decimal, Operator.NullableMask | Operator.ComparisonMask, bool_type),
+
+ new PredefinedOperator (nullable_bool, Operator.NullableMask | Operator.BitwiseMask, nullable_bool),
+
+ new PredefinedOperator (nullable_uint, nullable_int, Operator.NullableMask | Operator.ShiftMask),
+ new PredefinedOperator (nullable_long, nullable_int, Operator.NullableMask | Operator.ShiftMask),
+ new PredefinedOperator (nullable_ulong, nullable_int, Operator.NullableMask | Operator.ShiftMask),
+
+ //
+ // Not strictly lifted but need to be in second group otherwise expressions like
+ // int + null would resolve to +(object, string) instead of +(int?, int?)
+ //
+ new PredefinedStringOperator (types.String, types.Object, Operator.AdditionMask, types.String),
+ new PredefinedStringOperator (types.Object, types.String, Operator.AdditionMask, types.String),
+
};
}
{
TypeSpec bool_type = types.Bool;
- return new PredefinedOperator[] {
+ return new[] {
new PredefinedEqualityOperator (types.String, bool_type),
new PredefinedEqualityOperator (types.Delegate, bool_type),
- new PredefinedOperator (bool_type, Operator.EqualityMask, bool_type)
+ new PredefinedOperator (bool_type, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.Int, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.UInt, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.Long, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.ULong, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.Float, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.Double, Operator.EqualityMask, bool_type),
+ new PredefinedOperator (types.Decimal, Operator.EqualityMask, bool_type),
+ };
+ }
+
+ public static PredefinedOperator[] CreateEqualityLiftedOperatorsTable (ModuleContainer module)
+ {
+ var nullable = module.PredefinedTypes.Nullable.TypeSpec;
+
+ if (nullable == null)
+ return new PredefinedOperator [0];
+
+ var types = module.Compiler.BuiltinTypes;
+ var bool_type = types.Bool;
+ var nullable_bool = nullable.MakeGenericType (module, new [] { bool_type });
+ var nullable_int = nullable.MakeGenericType (module, new[] { types.Int });
+ var nullable_uint = nullable.MakeGenericType (module, new[] { types.UInt });
+ var nullable_long = nullable.MakeGenericType (module, new[] { types.Long });
+ var nullable_ulong = nullable.MakeGenericType (module, new[] { types.ULong });
+ var nullable_float = nullable.MakeGenericType (module, new[] { types.Float });
+ var nullable_double = nullable.MakeGenericType (module, new[] { types.Double });
+ var nullable_decimal = nullable.MakeGenericType (module, new[] { types.Decimal });
+
+ return new [] {
+ new PredefinedOperator (nullable_bool, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_int, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_uint, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_long, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_ulong, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_float, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_double, Operator.NullableMask | Operator.EqualityMask, bool_type),
+ new PredefinedOperator (nullable_decimal, Operator.NullableMask | Operator.EqualityMask, bool_type)
};
}
//
- // Rules used during binary numeric promotion
+ // 7.2.6.2 Binary numeric promotions
//
- static bool DoNumericPromotion (ResolveContext rc, ref Expression prim_expr, ref Expression second_expr, TypeSpec type)
+ bool DoBinaryOperatorPromotion (ResolveContext rc)
{
- Expression temp;
+ TypeSpec ltype = left.Type;
+ if (ltype.IsNullableType) {
+ ltype = Nullable.NullableInfo.GetUnderlyingType (ltype);
+ }
- Constant c = prim_expr as Constant;
- if (c != null) {
- temp = c.ConvertImplicitly (type);
- if (temp != null) {
- prim_expr = temp;
- return true;
- }
+ //
+ // This is numeric promotion code only
+ //
+ if (ltype.BuiltinType == BuiltinTypeSpec.Type.Bool)
+ return true;
+
+ TypeSpec rtype = right.Type;
+ if (rtype.IsNullableType) {
+ rtype = Nullable.NullableInfo.GetUnderlyingType (rtype);
}
- if (type.BuiltinType == BuiltinTypeSpec.Type.UInt) {
- switch (prim_expr.Type.BuiltinType) {
- case BuiltinTypeSpec.Type.Int:
- case BuiltinTypeSpec.Type.Short:
- case BuiltinTypeSpec.Type.SByte:
- case BuiltinTypeSpec.Type.Long:
- type = rc.BuiltinTypes.Long;
+ var lb = ltype.BuiltinType;
+ var rb = rtype.BuiltinType;
+ TypeSpec type;
+ Expression expr;
- if (type != second_expr.Type) {
- c = second_expr as Constant;
- if (c != null)
- temp = c.ConvertImplicitly (type);
- else
- temp = Convert.ImplicitNumericConversion (second_expr, type);
- if (temp == null)
- return false;
- second_expr = temp;
- }
- break;
+ if (lb == BuiltinTypeSpec.Type.Decimal || rb == BuiltinTypeSpec.Type.Decimal) {
+ type = rc.BuiltinTypes.Decimal;
+ } else if (lb == BuiltinTypeSpec.Type.Double || rb == BuiltinTypeSpec.Type.Double) {
+ type = rc.BuiltinTypes.Double;
+ } else if (lb == BuiltinTypeSpec.Type.Float || rb == BuiltinTypeSpec.Type.Float) {
+ type = rc.BuiltinTypes.Float;
+ } else if (lb == BuiltinTypeSpec.Type.ULong || rb == BuiltinTypeSpec.Type.ULong) {
+ type = rc.BuiltinTypes.ULong;
+
+ if (IsSignedType (lb)) {
+ expr = ConvertSignedConstant (left, type);
+ if (expr == null)
+ return false;
+ left = expr;
+ } else if (IsSignedType (rb)) {
+ expr = ConvertSignedConstant (right, type);
+ if (expr == null)
+ return false;
+ right = expr;
}
- } else if (type.BuiltinType == BuiltinTypeSpec.Type.ULong) {
- //
- // A compile-time error occurs if the other operand is of type sbyte, short, int, or long
- //
- switch (type.BuiltinType) {
- case BuiltinTypeSpec.Type.Int:
- case BuiltinTypeSpec.Type.Long:
- case BuiltinTypeSpec.Type.Short:
- case BuiltinTypeSpec.Type.SByte:
- return false;
+
+ } else if (lb == BuiltinTypeSpec.Type.Long || rb == BuiltinTypeSpec.Type.Long) {
+ type = rc.BuiltinTypes.Long;
+ } else if (lb == BuiltinTypeSpec.Type.UInt || rb == BuiltinTypeSpec.Type.UInt) {
+ type = rc.BuiltinTypes.UInt;
+
+ if (IsSignedType (lb)) {
+ expr = ConvertSignedConstant (left, type);
+ if (expr == null)
+ type = rc.BuiltinTypes.Long;
+ } else if (IsSignedType (rb)) {
+ expr = ConvertSignedConstant (right, type);
+ if (expr == null)
+ type = rc.BuiltinTypes.Long;
}
+ } else {
+ type = rc.BuiltinTypes.Int;
}
- temp = Convert.ImplicitNumericConversion (prim_expr, type);
- if (temp == null)
- return false;
-
- prim_expr = temp;
- return true;
- }
+ if (ltype != type) {
+ expr = PromoteExpression (rc, left, type);
+ if (expr == null)
+ return false;
- //
- // 7.2.6.2 Binary numeric promotions
- //
- public bool DoBinaryOperatorPromotion (ResolveContext ec)
- {
- TypeSpec ltype = left.Type;
- TypeSpec rtype = right.Type;
- Expression temp;
+ left = expr;
+ }
- foreach (TypeSpec t in ec.BuiltinTypes.BinaryPromotionsTypes) {
- if (t == ltype)
- return t == rtype || DoNumericPromotion (ec, ref right, ref left, t);
+ if (rtype != type) {
+ expr = PromoteExpression (rc, right, type);
+ if (expr == null)
+ return false;
- if (t == rtype)
- return t == ltype || DoNumericPromotion (ec, ref left, ref right, t);
+ right = expr;
}
- TypeSpec int32 = ec.BuiltinTypes.Int;
- if (ltype != int32) {
- Constant c = left as Constant;
- if (c != null)
- temp = c.ConvertImplicitly (int32);
- else
- temp = Convert.ImplicitNumericConversion (left, int32);
+ return true;
+ }
- if (temp == null)
- return false;
- left = temp;
+ static bool IsSignedType (BuiltinTypeSpec.Type type)
+ {
+ switch (type) {
+ case BuiltinTypeSpec.Type.Int:
+ case BuiltinTypeSpec.Type.Short:
+ case BuiltinTypeSpec.Type.SByte:
+ case BuiltinTypeSpec.Type.Long:
+ return true;
+ default:
+ return false;
}
+ }
- if (rtype != int32) {
- Constant c = right as Constant;
- if (c != null)
- temp = c.ConvertImplicitly (int32);
- else
- temp = Convert.ImplicitNumericConversion (right, int32);
+ static Expression ConvertSignedConstant (Expression expr, TypeSpec type)
+ {
+ var c = expr as Constant;
+ if (c == null)
+ return null;
- if (temp == null)
- return false;
- right = temp;
+ return c.ConvertImplicitly (type);
+ }
+
+ static Expression PromoteExpression (ResolveContext rc, Expression expr, TypeSpec type)
+ {
+ if (expr.Type.IsNullableType) {
+ return Convert.ImplicitConversionStandard (rc, expr,
+ rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc, new[] { type }), expr.Location);
}
- return true;
+ var c = expr as Constant;
+ if (c != null)
+ return c.ConvertImplicitly (type);
+
+ return Convert.ImplicitNumericConversion (expr, type);
}
protected override Expression DoResolve (ResolveContext ec)
if (right == null)
return null;
- eclass = ExprClass.Value;
Constant rc = right as Constant;
// The conversion rules are ignored in enum context but why
return new DynamicExpressionStatement (this, args, loc).Resolve (ec);
}
- if (ec.Module.Compiler.Settings.Version >= LanguageVersion.ISO_2 &&
- ((left.Type.IsNullableType && (right is NullLiteral || right.Type.IsNullableType || TypeSpec.IsValueType (right.Type))) ||
- (TypeSpec.IsValueType (left.Type) && right is NullLiteral) ||
- (right.Type.IsNullableType && (left is NullLiteral || left.Type.IsNullableType || TypeSpec.IsValueType (left.Type))) ||
- (TypeSpec.IsValueType (right.Type) && left is NullLiteral))) {
- var lifted = new Nullable.LiftedBinaryOperator (oper, left, right);
- lifted.state = state;
- return lifted.Resolve (ec);
- }
-
return DoResolveCore (ec, left, right);
}
- protected Expression DoResolveCore (ResolveContext ec, Expression left_orig, Expression right_orig)
+ Expression DoResolveCore (ResolveContext ec, Expression left_orig, Expression right_orig)
{
Expression expr = ResolveOperator (ec);
if (expr == null)
public override SLE.Expression MakeExpression (BuilderContext ctx)
{
+ return MakeExpression (ctx, left, right);
+ }
+
+ public SLE.Expression MakeExpression (BuilderContext ctx, Expression left, Expression right)
+ {
+ Console.WriteLine ("{0} x {1}", left.Type.GetSignatureForError (), right.Type.GetSignatureForError ());
+
var le = left.MakeExpression (ctx);
var re = right.MakeExpression (ctx);
bool is_checked = ctx.HasSet (BuilderContext.Options.CheckedScope);
if (method == null)
return new EmptyExpression (ec.BuiltinTypes.Decimal);
- MethodGroupExpr mg = MethodGroupExpr.CreatePredefined (method, ec.BuiltinTypes.Delegate, loc);
- Expression expr = new UserOperatorCall (mg.BestCandidate, args, CreateExpressionTree, loc);
+ Expression expr = new UserOperatorCall (method, args, CreateExpressionTree, loc);
return new ClassCast (expr, l);
}
//
- // Enumeration operators
+ // Resolves enumeration operators where only single predefined overload exists, handles lifted versions too
//
- Expression ResolveOperatorEnum (ResolveContext ec, bool lenum, bool renum, TypeSpec ltype, TypeSpec rtype)
+ Expression ResolveSingleEnumOperators (ResolveContext rc, bool lenum, bool renum, TypeSpec ltype, TypeSpec rtype)
{
//
// bool operator == (E x, E y);
// E operator | (E x, E y);
// E operator ^ (E x, E y);
//
- // U operator - (E e, E f)
- // E operator - (E e, U x)
- // E operator - (U x, E e) // LAMESPEC: Not covered by the specification
- //
- // E operator + (E e, U x)
- // E operator + (U x, E e)
- //
- Expression ltemp = left;
- Expression rtemp = right;
- TypeSpec underlying_type;
- TypeSpec underlying_type_result;
- TypeSpec res_type;
Expression expr;
-
- //
- // LAMESPEC: There is never ambiguous conversion between enum operators
- // the one which contains more enum parameters always wins even if there
- // is an implicit conversion involved
- //
- if ((oper & (Operator.ComparisonMask | Operator.BitwiseMask)) != 0) {
- if (renum) {
- underlying_type = EnumSpec.GetUnderlyingType (rtype);
- expr = Convert.ImplicitConversion (ec, left, rtype, loc);
- if (expr == null)
- return null;
-
- left = expr;
- ltype = expr.Type;
- } else if (lenum) {
- underlying_type = EnumSpec.GetUnderlyingType (ltype);
- expr = Convert.ImplicitConversion (ec, right, ltype, loc);
- if (expr == null)
- return null;
+ if ((oper & Operator.ComparisonMask) != 0) {
+ type = rc.BuiltinTypes.Bool;
+ } else {
+ if (lenum)
+ type = ltype;
+ else if (renum)
+ type = rtype;
+ else if (ltype.IsNullableType && Nullable.NullableInfo.GetUnderlyingType (ltype).IsEnum)
+ type = ltype;
+ else
+ type = rtype;
+ }
+
+ if (ltype == rtype) {
+ if (lenum || renum)
+ return this;
+
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = left;
+ lifted.Right = right;
+ return lifted.Resolve (rc);
+ }
+ if (renum && !ltype.IsNullableType) {
+ expr = Convert.ImplicitConversion (rc, left, rtype, loc);
+ if (expr != null) {
+ left = expr;
+ return this;
+ }
+ } else if (lenum && !rtype.IsNullableType) {
+ expr = Convert.ImplicitConversion (rc, right, ltype, loc);
+ if (expr != null) {
right = expr;
- rtype = expr.Type;
- } else {
- return null;
+ return this;
}
+ }
- if ((oper & Operator.BitwiseMask) != 0) {
- res_type = ltype;
- underlying_type_result = underlying_type;
- } else {
- res_type = null;
- underlying_type_result = null;
- }
- } else if (oper == Operator.Subtraction) {
- if (renum) {
- underlying_type = EnumSpec.GetUnderlyingType (rtype);
- if (ltype != rtype) {
- expr = Convert.ImplicitConversion (ec, left, rtype, left.Location);
- if (expr == null) {
- expr = Convert.ImplicitConversion (ec, left, underlying_type, left.Location);
- if (expr == null)
- return null;
-
- res_type = rtype;
- } else {
- res_type = underlying_type;
- }
+ //
+ // Now try lifted version of predefined operator
+ //
+ var nullable_type = rc.Module.PredefinedTypes.Nullable.TypeSpec;
+ if (nullable_type != null) {
+ if (renum && !ltype.IsNullableType) {
+ var lifted_type = nullable_type.MakeGenericType (rc.Module, new[] { rtype });
+ expr = Convert.ImplicitConversion (rc, left, lifted_type, loc);
+ if (expr != null) {
left = expr;
- } else {
- res_type = underlying_type;
+ right = Convert.ImplicitConversion (rc, right, lifted_type, loc);
}
- underlying_type_result = underlying_type;
- } else if (lenum) {
- underlying_type = EnumSpec.GetUnderlyingType (ltype);
- expr = Convert.ImplicitConversion (ec, right, ltype, right.Location);
- if (expr == null || expr is EnumConstant) {
- expr = Convert.ImplicitConversion (ec, right, underlying_type, right.Location);
- if (expr == null)
- return null;
+ if ((oper & Operator.BitwiseMask) != 0)
+ type = lifted_type;
- res_type = ltype;
- } else {
- res_type = underlying_type;
+ if (left.IsNull) {
+ if ((oper & Operator.BitwiseMask) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, this);
+
+ return CreateLiftedValueTypeResult (rc, rtype);
}
- right = expr;
- underlying_type_result = underlying_type;
- } else {
- return null;
- }
- } else if (oper == Operator.Addition) {
- if (lenum) {
- underlying_type = EnumSpec.GetUnderlyingType (ltype);
- res_type = ltype;
+ if (expr != null) {
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = expr;
+ lifted.Right = right;
+ return lifted.Resolve (rc);
+ }
+ } else if (lenum && !rtype.IsNullableType) {
+ var lifted_type = nullable_type.MakeGenericType (rc.Module, new[] { ltype });
+
+ expr = Convert.ImplicitConversion (rc, right, lifted_type, loc);
+ if (expr != null) {
+ right = expr;
+ left = Convert.ImplicitConversion (rc, left, lifted_type, loc);
+ }
+
+ if ((oper & Operator.BitwiseMask) != 0)
+ type = lifted_type;
+
+ if (right.IsNull) {
+ if ((oper & Operator.BitwiseMask) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, this);
- if (rtype != underlying_type && (state & (State.RightNullLifted | State.LeftNullLifted)) == 0) {
- expr = Convert.ImplicitConversion (ec, right, underlying_type, right.Location);
+ return CreateLiftedValueTypeResult (rc, ltype);
+ }
+
+ if (expr != null) {
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = left;
+ lifted.Right = expr;
+ return lifted.Resolve (rc);
+ }
+ } else if (rtype.IsNullableType && Nullable.NullableInfo.GetUnderlyingType (rtype).IsEnum) {
+ if (left.IsNull) {
+ if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion))
+ left = Convert.ImplicitConversion (rc, left, rtype, left.Location);
+
+ if ((oper & Operator.RelationalMask) != 0)
+ return CreateLiftedValueTypeResult (rc, rtype);
+
+ if ((oper & Operator.BitwiseMask) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, this);
+
+ // Equality operators are valid between E? and null
+ expr = left;
+ } else {
+ expr = Convert.ImplicitConversion (rc, left, Nullable.NullableInfo.GetUnderlyingType (rtype), loc);
if (expr == null)
return null;
+ }
- right = expr;
+ if (expr != null) {
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = expr;
+ lifted.Right = right;
+ return lifted.Resolve (rc);
}
- } else {
- underlying_type = EnumSpec.GetUnderlyingType (rtype);
- res_type = rtype;
- if (ltype != underlying_type) {
- expr = Convert.ImplicitConversion (ec, left, underlying_type, left.Location);
+ } else if (ltype.IsNullableType && Nullable.NullableInfo.GetUnderlyingType (ltype).IsEnum) {
+ if (right.IsNull) {
+ if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion))
+ right = Convert.ImplicitConversion (rc, right, ltype, right.Location);
+
+ if ((oper & Operator.RelationalMask) != 0)
+ return CreateLiftedValueTypeResult (rc, ltype);
+
+ if ((oper & Operator.BitwiseMask) != 0)
+ return Nullable.LiftedNull.CreateFromExpression (rc, this);
+
+ // Equality operators are valid between E? and null
+ expr = right;
+ } else {
+ expr = Convert.ImplicitConversion (rc, right, Nullable.NullableInfo.GetUnderlyingType (ltype), loc);
if (expr == null)
return null;
+ }
- left = expr;
+ if (expr != null) {
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = left;
+ lifted.Right = expr;
+ return lifted.Resolve (rc);
}
}
-
- underlying_type_result = underlying_type;
- } else {
- return null;
}
- // Unwrap the constant correctly, so DoBinaryOperatorPromotion can do the magic
- // with constants and expressions
- if (left.Type != underlying_type) {
- if (left is Constant)
- left = ((Constant) left).ConvertExplicitly (false, underlying_type);
+ return null;
+ }
+
+ static Expression ConvertEnumOperandToUnderlyingType (ResolveContext rc, Expression expr)
+ {
+ TypeSpec underlying_type;
+ if (expr.Type.IsNullableType) {
+ var nt = Nullable.NullableInfo.GetUnderlyingType (expr.Type);
+ if (nt.IsEnum)
+ underlying_type = EnumSpec.GetUnderlyingType (nt);
else
- left = EmptyCast.Create (left, underlying_type);
+ underlying_type = nt;
+ } else if (expr.Type.IsEnum) {
+ underlying_type = EnumSpec.GetUnderlyingType (expr.Type);
+ } else {
+ underlying_type = expr.Type;
}
- if (right.Type != underlying_type) {
- if (right is Constant)
- right = ((Constant) right).ConvertExplicitly (false, underlying_type);
- else
- right = EmptyCast.Create (right, underlying_type);
+ switch (underlying_type.BuiltinType) {
+ case BuiltinTypeSpec.Type.SByte:
+ case BuiltinTypeSpec.Type.Byte:
+ case BuiltinTypeSpec.Type.Short:
+ case BuiltinTypeSpec.Type.UShort:
+ underlying_type = rc.BuiltinTypes.Int;
+ break;
}
+ if (expr.Type.IsNullableType)
+ underlying_type = rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { underlying_type });
+
+ if (expr.Type == underlying_type)
+ return expr;
+
+ return EmptyCast.Create (expr, underlying_type);
+ }
+
+ Expression ResolveEnumOperators (ResolveContext rc, bool lenum, bool renum, TypeSpec ltype, TypeSpec rtype)
+ {
+ //
+ // U operator - (E e, E f)
+ // E operator - (E e, U x) // Internal decomposition operator
+ // E operator - (U x, E e) // Internal decomposition operator
//
- // C# specification uses explicit cast syntax which means binary promotion
- // should happen, however it seems that csc does not do that
+ // E operator + (E e, U x)
+ // E operator + (U x, E e)
//
- if (!DoBinaryOperatorPromotion (ec)) {
- left = ltemp;
- right = rtemp;
- return null;
+
+ TypeSpec enum_type;
+
+ if (lenum)
+ enum_type = ltype;
+ else if (renum)
+ enum_type = rtype;
+ else if (ltype.IsNullableType && Nullable.NullableInfo.GetUnderlyingType (ltype).IsEnum)
+ enum_type = ltype;
+ else
+ enum_type = rtype;
+
+ Expression expr;
+ if (!enum_type.IsNullableType) {
+ expr = ResolveOperatorPredefined (rc, rc.Module.GetPredefinedEnumAritmeticOperators (enum_type, false), false);
+ if (expr != null) {
+ if (oper == Operator.Subtraction)
+ expr = ConvertEnumSubtractionResult (rc, expr);
+ else
+ expr = ConvertEnumAdditionalResult (expr, enum_type);
+
+ AddEnumResultCast (expr.Type);
+
+ return expr;
+ }
+
+ enum_type = rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { enum_type });
}
- if (underlying_type_result != null && left.Type != underlying_type_result) {
- enum_conversion = Convert.ExplicitNumericConversion (ec, new EmptyExpression (left.Type), underlying_type_result);
+ expr = ResolveOperatorPredefined (rc, rc.Module.GetPredefinedEnumAritmeticOperators (enum_type, true), false);
+ if (expr != null) {
+ if (oper == Operator.Subtraction)
+ expr = ConvertEnumSubtractionResult (rc, expr);
+ else
+ expr = ConvertEnumAdditionalResult (expr, enum_type);
+
+ AddEnumResultCast (expr.Type);
}
- expr = ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryStandard, true, res_type);
- if (expr == null)
- return null;
+ return expr;
+ }
- if (!IsCompound)
- return expr;
+ static Expression ConvertEnumAdditionalResult (Expression expr, TypeSpec enumType)
+ {
+ return EmptyCast.Create (expr, enumType);
+ }
+ Expression ConvertEnumSubtractionResult (ResolveContext rc, Expression expr)
+ {
//
- // Section: 7.16.2
+ // Enumeration subtraction has different result type based on
+ // best overload
//
+ TypeSpec result_type;
+ if (left.Type == right.Type) {
+ var c = right as EnumConstant;
+ if (c != null && c.IsZeroInteger) {
+ //
+ // LAMESPEC: This is quite unexpected for expression E - 0 the return type is
+ // E which is not what expressions E - 1 or 0 - E return
+ //
+ result_type = left.Type;
+ } else {
+ result_type = left.Type.IsNullableType ?
+ Nullable.NullableInfo.GetEnumUnderlyingType (rc.Module, left.Type) :
+ EnumSpec.GetUnderlyingType (left.Type);
+ }
+ } else if (IsEnumOrNullableEnum (left.Type)) {
+ result_type = left.Type;
+ } else {
+ result_type = right.Type;
+ }
- //
- // If the return type of the selected operator is implicitly convertible to the type of x
- //
- if (Convert.ImplicitConversionExists (ec, expr, ltype))
- return expr;
+ return EmptyCast.Create (expr, result_type);
+ }
- //
- // Otherwise, if the selected operator is a predefined operator, if the return type of the
- // selected operator is explicitly convertible to the type of x, and if y is implicitly
- // convertible to the type of x or the operator is a shift operator, then the operation
- // is evaluated as x = (T)(x op y), where T is the type of x
- //
- expr = Convert.ExplicitConversion (ec, expr, ltype, loc);
- if (expr == null)
- return null;
+ void AddEnumResultCast (TypeSpec type)
+ {
+ if (type.IsNullableType)
+ type = Nullable.NullableInfo.GetUnderlyingType (type);
- if (Convert.ImplicitConversionExists (ec, ltemp, ltype))
- return expr;
+ if (type.IsEnum)
+ type = EnumSpec.GetUnderlyingType (type);
- return null;
+ switch (type.BuiltinType) {
+ case BuiltinTypeSpec.Type.SByte:
+ enum_conversion = ConvCast.Mode.I4_I1;
+ break;
+ case BuiltinTypeSpec.Type.Byte:
+ enum_conversion = ConvCast.Mode.I4_U1;
+ break;
+ case BuiltinTypeSpec.Type.Short:
+ enum_conversion = ConvCast.Mode.I4_I2;
+ break;
+ case BuiltinTypeSpec.Type.UShort:
+ enum_conversion = ConvCast.Mode.I4_U2;
+ break;
+ }
}
//
- // 7.9.6 Reference type equality operators
+ // Equality operators rules
//
- Expression ResolveOperatorEquality (ResolveContext ec, TypeSpec l, TypeSpec r)
+ Expression ResolveEquality (ResolveContext ec, TypeSpec l, TypeSpec r, bool primitives_only)
{
Expression result;
type = ec.BuiltinTypes.Bool;
+ bool no_arg_conv = false;
- //
- // a, Both operands are reference-type values or the value null
- // b, One operand is a value of type T where T is a type-parameter and
- // the other operand is the value null. Furthermore T does not have the
- // value type constraint
- //
- // LAMESPEC: Very confusing details in the specification, basically any
- // reference like type-parameter is allowed
- //
- var tparam_l = l as TypeParameterSpec;
- var tparam_r = r as TypeParameterSpec;
- if (tparam_l != null) {
- if (right is NullLiteral && !tparam_l.HasSpecialStruct) {
- left = new BoxedCast (left, ec.BuiltinTypes.Object);
- return this;
- }
+ if (!primitives_only) {
- if (!tparam_l.IsReferenceType)
- return null;
+ //
+ // a, Both operands are reference-type values or the value null
+ // b, One operand is a value of type T where T is a type-parameter and
+ // the other operand is the value null. Furthermore T does not have the
+ // value type constraint
+ //
+ // LAMESPEC: Very confusing details in the specification, basically any
+ // reference like type-parameter is allowed
+ //
+ var tparam_l = l as TypeParameterSpec;
+ var tparam_r = r as TypeParameterSpec;
+ if (tparam_l != null) {
+ if (right is NullLiteral) {
+ if (tparam_l.GetEffectiveBase ().BuiltinType == BuiltinTypeSpec.Type.ValueType)
+ return null;
- l = tparam_l.GetEffectiveBase ();
- left = new BoxedCast (left, l);
- } else if (left is NullLiteral && tparam_r == null) {
- if (!TypeSpec.IsReferenceType (r) || r.Kind == MemberKind.InternalCompilerType)
- return null;
+ left = new BoxedCast (left, ec.BuiltinTypes.Object);
+ return this;
+ }
- return this;
- }
+ if (!tparam_l.IsReferenceType)
+ return null;
- if (tparam_r != null) {
- if (left is NullLiteral && !tparam_r.HasSpecialStruct) {
- right = new BoxedCast (right, ec.BuiltinTypes.Object);
- return this;
+ l = tparam_l.GetEffectiveBase ();
+ left = new BoxedCast (left, l);
+ } else if (left is NullLiteral && tparam_r == null) {
+ if (TypeSpec.IsReferenceType (r))
+ return this;
+
+ if (r.Kind == MemberKind.InternalCompilerType)
+ return null;
}
- if (!tparam_r.IsReferenceType)
- return null;
+ if (tparam_r != null) {
+ if (left is NullLiteral) {
+ if (tparam_r.GetEffectiveBase ().BuiltinType == BuiltinTypeSpec.Type.ValueType)
+ return null;
- r = tparam_r.GetEffectiveBase ();
- right = new BoxedCast (right, r);
- } else if (right is NullLiteral) {
- if (!TypeSpec.IsReferenceType (l) || l.Kind == MemberKind.InternalCompilerType)
- return null;
+ right = new BoxedCast (right, ec.BuiltinTypes.Object);
+ return this;
+ }
- return this;
- }
+ if (!tparam_r.IsReferenceType)
+ return null;
- bool no_arg_conv = false;
+ r = tparam_r.GetEffectiveBase ();
+ right = new BoxedCast (right, r);
+ } else if (right is NullLiteral) {
+ if (TypeSpec.IsReferenceType (l))
+ return this;
- //
- // LAMESPEC: method groups can be compared when they convert to other side delegate
- //
- if (l.IsDelegate) {
- if (right.eclass == ExprClass.MethodGroup) {
- result = Convert.ImplicitConversion (ec, right, l, loc);
+ if (l.Kind == MemberKind.InternalCompilerType)
+ return null;
+ }
+
+ //
+ // LAMESPEC: method groups can be compared when they convert to other side delegate
+ //
+ if (l.IsDelegate) {
+ if (right.eclass == ExprClass.MethodGroup) {
+ result = Convert.ImplicitConversion (ec, right, l, loc);
+ if (result == null)
+ return null;
+
+ right = result;
+ r = l;
+ } else if (r.IsDelegate && l != r) {
+ return null;
+ }
+ } else if (left.eclass == ExprClass.MethodGroup && r.IsDelegate) {
+ result = Convert.ImplicitConversionRequired (ec, left, r, loc);
if (result == null)
return null;
- right = result;
- r = l;
- } else if (r.IsDelegate && l != r) {
- return null;
+ left = result;
+ l = r;
+ } else {
+ no_arg_conv = l == r && !l.IsStruct;
}
- } else if (left.eclass == ExprClass.MethodGroup && r.IsDelegate) {
- result = Convert.ImplicitConversionRequired (ec, left, r, loc);
- if (result == null)
- return null;
-
- left = result;
- l = r;
- } else {
- no_arg_conv = l == r && !l.IsStruct;
}
//
// not apply when both operands are of same reference type
//
if (r.BuiltinType != BuiltinTypeSpec.Type.Object && l.BuiltinType != BuiltinTypeSpec.Type.Object) {
- result = ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryEquality, no_arg_conv, null);
+ result = ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryEquality, no_arg_conv);
+ if (result != null)
+ return result;
+
+ //
+ // Now try lifted version of predefined operators
+ //
+ result = ResolveOperatorPredefined (ec, ec.Module.OperatorsBinaryEqualityLifted, no_arg_conv);
if (result != null)
return result;
+
+ //
+ // The == and != operators permit one operand to be a value of a nullable
+ // type and the other to be the null literal, even if no predefined or user-defined
+ // operator (in unlifted or lifted form) exists for the operation.
+ //
+ if ((l.IsNullableType && right.IsNull) || (r.IsNullableType && left.IsNull)) {
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.Left = left;
+ lifted.Right = right;
+ return lifted.Resolve (ec);
+ }
}
//
return this;
}
- return ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryUnsafe, false, null);
+ return ResolveOperatorPredefined (ec, ec.BuiltinTypes.OperatorsBinaryUnsafe, false);
}
//
// Build-in operators method overloading
//
- protected virtual Expression ResolveOperatorPredefined (ResolveContext ec, PredefinedOperator [] operators, bool primitives_only, TypeSpec enum_type)
+ Expression ResolveOperatorPredefined (ResolveContext ec, PredefinedOperator [] operators, bool primitives_only)
{
PredefinedOperator best_operator = null;
TypeSpec l = left.Type;
if (best_operator == null)
return null;
- Expression expr = best_operator.ConvertResult (ec, this);
+ var expr = best_operator.ConvertResult (ec, this);
- //
- // Optimize &/&& constant expressions with 0 value
- //
- if (oper == Operator.BitwiseAnd || oper == Operator.LogicalAnd) {
- Constant rc = right as Constant;
- Constant lc = left as Constant;
- if (((lc != null && lc.IsDefaultValue) || (rc != null && rc.IsDefaultValue)) && !(this is Nullable.LiftedBinaryOperator)) {
- //
- // The result is a constant with side-effect
- //
- Constant side_effect = rc == null ?
- new SideEffectConstant (lc, right, loc) :
- new SideEffectConstant (rc, left, loc);
+ if ((oper == Operator.BitwiseAnd || oper == Operator.LogicalAnd) && !best_operator.IsLifted) {
+ expr = OptimizeAndOperation (expr);
+ }
- return ReducedExpression.Create (side_effect, expr);
- }
+ return expr;
+ }
+
+ //
+ // Optimize &/&& constant expressions with 0 value
+ //
+ Expression OptimizeAndOperation (Expression expr)
+ {
+ Constant rc = right as Constant;
+ Constant lc = left as Constant;
+ if ((lc != null && lc.IsDefaultValue) || (rc != null && rc.IsDefaultValue)) {
+ //
+ // The result is a constant with side-effect
+ //
+ Constant side_effect = rc == null ?
+ new SideEffectConstant (lc, right, loc) :
+ new SideEffectConstant (rc, left, loc);
+
+ return ReducedExpression.Create (side_effect, expr);
}
- if (enum_type == null)
- return expr;
+ return expr;
+ }
- //
- // HACK: required by enum_conversion
- //
- expr.Type = enum_type;
- return EmptyCast.Create (expr, enum_type);
+ //
+ // Value types can be compared with the null literal because of the lifting
+ // language rules. However the result is always true or false.
+ //
+ public Expression CreateLiftedValueTypeResult (ResolveContext rc, TypeSpec valueType)
+ {
+ if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion)) {
+ type = rc.BuiltinTypes.Bool;
+ return this;
+ }
+
+ // FIXME: Handle side effect constants
+ Constant c = new BoolConstant (rc.BuiltinTypes, Oper == Operator.Inequality, loc);
+
+ if ((Oper & Operator.EqualityMask) != 0) {
+ rc.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is always `{1}'",
+ valueType.GetSignatureForError (), c.GetValueAsLiteral ());
+ } else {
+ rc.Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'",
+ valueType.GetSignatureForError (), c.GetValueAsLiteral ());
+ }
+
+ return c;
}
//
// Performs user-operator overloading
//
- protected virtual Expression ResolveUserOperator (ResolveContext ec, Expression left, Expression right)
+ Expression ResolveUserOperator (ResolveContext rc, Expression left, Expression right)
{
+ Expression oper_expr;
+
var op = ConvertBinaryToUserOperator (oper);
var l = left.Type;
if (l.IsNullableType)
Arguments args = new Arguments (2);
Argument larg = new Argument (left);
- args.Add (larg);
+ args.Add (larg);
Argument rarg = new Argument (right);
args.Add (rarg);
left_operators = right_operators;
}
- var res = new OverloadResolver (left_operators, OverloadResolver.Restrictions.ProbingOnly |
- OverloadResolver.Restrictions.NoBaseMembers | OverloadResolver.Restrictions.BaseMembersIncluded, loc);
+ const OverloadResolver.Restrictions restr = OverloadResolver.Restrictions.ProbingOnly |
+ OverloadResolver.Restrictions.NoBaseMembers | OverloadResolver.Restrictions.BaseMembersIncluded;
- var oper_method = res.ResolveOperator (ec, ref args);
- if (oper_method == null)
- return null;
+ var res = new OverloadResolver (left_operators, restr, loc);
- var llifted = (state & State.LeftNullLifted) != 0;
- var rlifted = (state & State.RightNullLifted) != 0;
- if ((Oper & Operator.EqualityMask) != 0) {
- var parameters = oper_method.Parameters;
- // LAMESPEC: No idea why this is not allowed
- if ((left is Nullable.Unwrap || right is Nullable.Unwrap) && parameters.Types [0] != parameters.Types [1])
+ var oper_method = res.ResolveOperator (rc, ref args);
+ if (oper_method == null) {
+ //
+ // Logical && and || cannot be lifted
+ //
+ if ((oper & Operator.LogicalMask) != 0)
return null;
- // Binary operation was lifted but we have found a user operator
- // which requires value-type argument, we downgrade ourself back to
- // binary operation
- // LAMESPEC: The user operator is not called (it cannot be we are passing null to struct)
- // but compilation succeeds
- if ((llifted && !parameters.Types[0].IsStruct) || (rlifted && !parameters.Types[1].IsStruct)) {
- state &= ~(State.LeftNullLifted | State.RightNullLifted);
+ //
+ // Apply lifted user operators only for liftable types. Implicit conversion
+ // to nullable types is not allowed
+ //
+ if (!IsLiftedOperatorApplicable ())
+ return null;
+
+ // TODO: Cache the result in module container
+ var lifted_methods = CreateLiftedOperators (rc, left_operators);
+ if (lifted_methods == null)
+ return null;
+
+ res = new OverloadResolver (lifted_methods, restr | OverloadResolver.Restrictions.ProbingOnly, loc);
+
+ oper_method = res.ResolveOperator (rc, ref args);
+ if (oper_method == null)
+ return null;
+
+ MethodSpec best_original = null;
+ foreach (MethodSpec ms in left_operators) {
+ if (ms.MemberDefinition == oper_method.MemberDefinition) {
+ best_original = ms;
+ break;
+ }
+ }
+
+ if (rc.HasSet (ResolveContext.Options.ExpressionTreeConversion)) {
+ //
+ // Expression trees use lifted notation in this case
+ //
+ this.left = Convert.ImplicitConversion (rc, left, oper_method.Parameters.Types[0], left.Location);
+ this.right = Convert.ImplicitConversion (rc, right, oper_method.Parameters.Types[1], left.Location);
}
- }
- Expression oper_expr;
+ var ptypes = best_original.Parameters.Types;
+
+ if (left.IsNull || right.IsNull) {
+ //
+ // The lifted operator produces the value false if one or both operands are null for
+ // relational operators.
+ //
+ if ((oper & Operator.ComparisonMask) != 0) {
+ //
+ // CSC BUG: This should be different warning, csc reports CS0458 with bool? which is wrong
+ // because return type is actually bool
+ //
+ // For some reason CSC does not report this warning for equality operators
+ //
+ return CreateLiftedValueTypeResult (rc, left.IsNull ? ptypes [1] : ptypes [0]);
+ }
+
+ // The lifted operator produces a null value if one or both operands are null
+ //
+ if ((oper & (Operator.ArithmeticMask | Operator.ShiftMask | Operator.BitwiseMask)) != 0) {
+ type = oper_method.ReturnType;
+ return Nullable.LiftedNull.CreateFromExpression (rc, this);
+ }
+ }
+
+ type = oper_method.ReturnType;
+ var lifted = new Nullable.LiftedBinaryOperator (this);
+ lifted.UserOperator = best_original;
+
+ if (left.Type.IsNullableType && !ptypes[0].IsNullableType) {
+ lifted.UnwrapLeft = new Nullable.Unwrap (left);
+ }
+
+ if (right.Type.IsNullableType && !ptypes[1].IsNullableType) {
+ lifted.UnwrapRight = new Nullable.Unwrap (right);
+ }
- // TODO: CreateExpressionTree is allocated every time
+ lifted.Left = Convert.ImplicitConversion (rc, lifted.UnwrapLeft ?? left, ptypes[0], left.Location);
+ lifted.Right = Convert.ImplicitConversion (rc, lifted.UnwrapRight ?? right, ptypes[1], right.Location);
+
+ return lifted.Resolve (rc);
+ }
+
if ((oper & Operator.LogicalMask) != 0) {
+ // TODO: CreateExpressionTree is allocated every time
oper_expr = new ConditionalLogicalOperator (oper_method, args, CreateExpressionTree,
- oper == Operator.LogicalAnd, loc).Resolve (ec);
+ oper == Operator.LogicalAnd, loc).Resolve (rc);
} else {
oper_expr = new UserOperatorCall (oper_method, args, CreateExpressionTree, loc);
}
- if (!llifted)
- this.left = larg.Expr;
-
- if (!rlifted)
- this.right = rarg.Expr;
+ this.left = larg.Expr;
+ this.right = rarg.Expr;
return oper_expr;
}
+ bool IsLiftedOperatorApplicable ()
+ {
+ if (left.Type.IsNullableType) {
+ if ((oper & Operator.EqualityMask) != 0)
+ return !right.IsNull;
+
+ return true;
+ }
+
+ if (right.Type.IsNullableType) {
+ if ((oper & Operator.EqualityMask) != 0)
+ return !left.IsNull;
+
+ return true;
+ }
+
+ if (TypeSpec.IsValueType (left.Type))
+ return right.IsNull;
+
+ if (TypeSpec.IsValueType (right.Type))
+ return left.IsNull;
+
+ return false;
+ }
+
+ List<MemberSpec> CreateLiftedOperators (ResolveContext rc, IList<MemberSpec> operators)
+ {
+ var nullable_type = rc.Module.PredefinedTypes.Nullable.TypeSpec;
+ if (nullable_type == null)
+ return null;
+
+ //
+ // Lifted operators permit predefined and user-defined operators that operate
+ // on non-nullable value types to also be used with nullable forms of those types.
+ // Lifted operators are constructed from predefined and user-defined operators
+ // that meet certain requirements
+ //
+ List<MemberSpec> lifted = null;
+ foreach (MethodSpec oper in operators) {
+ TypeSpec rt;
+ if ((Oper & Operator.ComparisonMask) != 0) {
+ //
+ // Result type must be of type bool for lifted comparison operators
+ //
+ rt = oper.ReturnType;
+ if (rt.BuiltinType != BuiltinTypeSpec.Type.Bool)
+ continue;
+ } else {
+ if (!TypeSpec.IsNonNullableValueType (oper.ReturnType))
+ continue;
+
+ rt = null;
+ }
+
+ var ptypes = oper.Parameters.Types;
+ if (!TypeSpec.IsNonNullableValueType (ptypes [0]) || !TypeSpec.IsNonNullableValueType (ptypes [1]))
+ continue;
+
+ //
+ // LAMESPEC: I am not sure why but for equality operators to be lifted
+ // both types have to match
+ //
+ if ((Oper & Operator.EqualityMask) != 0 && ptypes [0] != ptypes [1])
+ continue;
+
+ if (lifted == null)
+ lifted = new List<MemberSpec> ();
+
+ //
+ // The lifted form is constructed by adding a single ? modifier to each operand and
+ // result type except for comparison operators where return type is bool
+ //
+ if (rt == null)
+ rt = nullable_type.MakeGenericType (rc.Module, new[] { oper.ReturnType });
+
+ var parameters = ParametersCompiled.CreateFullyResolved (
+ nullable_type.MakeGenericType (rc.Module, new [] { ptypes[0] }),
+ nullable_type.MakeGenericType (rc.Module, new [] { ptypes[1] }));
+
+ var lifted_op = new MethodSpec (oper.Kind, oper.DeclaringType, oper.MemberDefinition,
+ rt, parameters, oper.Modifiers);
+
+ lifted.Add (lifted_op);
+ }
+
+ return lifted;
+ }
+
//
// Merge two sets of user operators into one, they are mostly distinguish
// except when they share base type and it contains an operator
}
public override void Emit (EmitContext ec)
- {
- EmitOperator (ec, left.Type);
- }
-
- protected virtual void EmitOperator (EmitContext ec, TypeSpec l)
{
if (ec.HasSet (BuilderContext.Options.AsyncBody) && right.ContainsEmitWithAwait ()) {
left = left.EmitToField (ec);
}
}
+ EmitOperator (ec, left, right);
+ }
+
+ public void EmitOperator (EmitContext ec, Expression left, Expression right)
+ {
left.Emit (ec);
right.Emit (ec);
- EmitOperatorOpcode (ec, oper, l);
+
+ EmitOperatorOpcode (ec, oper, left.Type, right);
//
- // Nullable enum could require underlying type cast and we cannot simply wrap binary
- // expression because that would wrap lifted binary operation
+ // Emit result enumerable conversion this way because it's quite complicated get it
+ // to resolved tree because expression tree cannot see it.
//
- if (enum_conversion != null)
- enum_conversion.Emit (ec);
+ if (enum_conversion != 0)
+ ConvCast.Emit (ec, enum_conversion);
}
public override void EmitSideEffect (EmitContext ec)
return CreateExpressionTree (ec, null);
}
- Expression CreateExpressionTree (ResolveContext ec, Expression method)
+ public Expression CreateExpressionTree (ResolveContext ec, Expression method)
{
string method_name;
bool lift_arg = false;
if (rtype.BuiltinType == BuiltinTypeSpec.Type.Long || rtype.BuiltinType == BuiltinTypeSpec.Type.ULong)
ec.Emit (OpCodes.Conv_I8);
- Binary.EmitOperatorOpcode (ec, Binary.Operator.Multiply, rtype);
+ Binary.EmitOperatorOpcode (ec, Binary.Operator.Multiply, rtype, right);
}
if (left_const == null) {
else if (rtype.BuiltinType == BuiltinTypeSpec.Type.ULong)
ec.Emit (OpCodes.Conv_U);
- Binary.EmitOperatorOpcode (ec, op, op_type);
+ Binary.EmitOperatorOpcode (ec, op, op_type, right);
}
}
}
// TODO: Should be just Add
GetAssemblyDefinition (assembly);
- var all_types = assembly.GetTypes ();
- ImportTypes (all_types, targetNamespace, true);
-
- all_types = assembly.ManifestModule.__GetExportedTypes ();
- if (all_types.Length != 0)
- ImportForwardedTypes (all_types, targetNamespace);
+ try {
+ var all_types = assembly.GetTypes ();
+ ImportTypes (all_types, targetNamespace, true);
+
+ all_types = assembly.ManifestModule.__GetExportedTypes ();
+ if (all_types.Length != 0)
+ ImportForwardedTypes (all_types, targetNamespace);
+ } catch (Exception e) {
+ throw new InternalErrorException (e, "Failed to import assembly `{0}'", assembly.FullName);
+ }
}
public ImportedModuleDefinition ImportModule (Module module, RootNamespace targetNamespace)
<ItemGroup>\r
<Compile Include="..\build\common\Consts.cs">\r
</Compile>\r
- <Compile Include="..\class\corlib\Mono.Security.Cryptography\CryptoConvert.cs">\r
+ <Compile Include="..\class\Mono.Security\Mono.Security.Cryptography\CryptoConvert.cs">\r
<Link>CryptoConvert.cs</Link>\r
</Compile>\r
<Compile Include="..\class\Mono.CompilerServices.SymbolWriter\MonoSymbolFile.cs">\r
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolFile.cs
../class/Mono.CompilerServices.SymbolWriter/MonoSymbolTable.cs
../class/Mono.CompilerServices.SymbolWriter/SourceMethodBuilder.cs
-../class/corlib/Mono.Security.Cryptography/CryptoConvert.cs
+../class/Mono.Security/Mono.Security.Cryptography/CryptoConvert.cs
../build/common/Consts.cs
../tools/monop/outline.cs
PredefinedTypes predefined_types;
PredefinedMembers predefined_members;
+ public Binary.PredefinedOperator[] OperatorsBinaryEqualityLifted;
+ public Binary.PredefinedOperator[] OperatorsBinaryLifted;
+
static readonly string[] attribute_targets = new string[] { "assembly", "module" };
public ModuleContainer (CompilerContext context)
return "<module>";
}
+ public Binary.PredefinedOperator[] GetPredefinedEnumAritmeticOperators (TypeSpec enumType, bool nullable)
+ {
+ TypeSpec underlying;
+ Binary.Operator mask = 0;
+
+ if (nullable) {
+ underlying = Nullable.NullableInfo.GetEnumUnderlyingType (this, enumType);
+ mask = Binary.Operator.NullableMask;
+ } else {
+ underlying = EnumSpec.GetUnderlyingType (enumType);
+ }
+
+ var operators = new[] {
+ new Binary.PredefinedOperator (enumType, underlying,
+ mask | Binary.Operator.AdditionMask | Binary.Operator.SubtractionMask | Binary.Operator.DecomposedMask, enumType),
+ new Binary.PredefinedOperator (underlying, enumType,
+ mask | Binary.Operator.AdditionMask | Binary.Operator.SubtractionMask | Binary.Operator.DecomposedMask, enumType),
+ new Binary.PredefinedOperator (enumType, mask | Binary.Operator.SubtractionMask, underlying)
+ };
+
+ return operators;
+ }
+
public void InitializePredefinedTypes ()
{
predefined_attributes = new PredefinedAttributes (this);
predefined_types = new PredefinedTypes (this);
predefined_members = new PredefinedMembers (this);
+
+ OperatorsBinaryEqualityLifted = Binary.CreateEqualityLiftedOperatorsTable (this);
+ OperatorsBinaryLifted = Binary.CreateStandardLiftedOperatorsTable (this);
}
public override bool IsClsComplianceRequired ()
//
using System;
+using SLE = System.Linq.Expressions;
#if STATIC
using IKVM.Reflection.Emit;
{
return ((InflatedTypeSpec) nullableType).TypeArguments[0];
}
+
+ public static TypeSpec GetEnumUnderlyingType (ModuleContainer module, TypeSpec nullableEnum)
+ {
+ return module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (module,
+ new[] { EnumSpec.GetUnderlyingType (GetUnderlyingType (nullableEnum)) });
+ }
}
public class Unwrap : Expression, IMemoryLocation
Expression expr;
LocalTemporary temp;
+ Expression temp_field;
readonly bool useDefaultValue;
- Unwrap (Expression expr, bool useDefaultValue)
+ public Unwrap (Expression expr, bool useDefaultValue = true)
{
this.expr = expr;
this.loc = expr.Location;
return expr.ContainsEmitWithAwait ();
}
+ // TODO: REMOVE
public static Expression Create (Expression expr)
{
//
return Create (expr, false);
}
+ public static Expression CreateUnwrapped (Expression expr)
+ {
+ //
+ // Avoid unwraping and wraping of same type
+ //
+ Wrap wrap = expr as Wrap;
+ if (wrap != null)
+ return wrap.Child;
+
+ return Create (expr, true);
+ }
+
public static Unwrap Create (Expression expr, bool useDefaultValue)
{
return new Unwrap (expr, useDefaultValue);
call.EmitPredefined (ec, NullableInfo.GetHasValue (expr.Type), null);
}
+ public override Expression EmitToField (EmitContext ec)
+ {
+ if (temp_field == null)
+ temp_field = this.expr.EmitToField (ec);
+
+ return this;
+ }
+
public override bool Equals (object obj)
{
Unwrap uw = obj as Unwrap;
}
}
- void Store (EmitContext ec)
+ public void Store (EmitContext ec)
{
- if (temp != null)
+ if (temp != null || temp_field != null)
return;
if (expr is VariableReference)
public void Load (EmitContext ec)
{
- if (expr is VariableReference)
+ if (temp_field != null)
+ temp_field.Emit (ec);
+ else if (expr is VariableReference)
expr.Emit (ec);
else
LocalVariable.Emit (ec);
}
- public override System.Linq.Expressions.Expression MakeExpression (BuilderContext ctx)
+ public override SLE.Expression MakeExpression (BuilderContext ctx)
{
return expr.MakeExpression (ctx);
}
public void AddressOf (EmitContext ec, AddressOp mode)
{
- IMemoryLocation ml = expr as VariableReference;
+ IMemoryLocation ml;
+
+ if (temp_field != null) {
+ ml = temp_field as IMemoryLocation;
+ if (ml == null) {
+ var lt = new LocalTemporary (temp_field.Type);
+ temp_field.Emit (ec);
+ lt.Store (ec);
+ ml = lt;
+ }
+ } else {
+ ml = expr as VariableReference;
+ }
+
if (ml != null)
ml.AddressOf (ec, mode);
else
//
LocalTemporary LocalVariable {
get {
- if (temp == null)
+ if (temp == null && temp_field == null)
temp = new LocalTemporary (expr.Type);
return temp;
}
return child_cast.CreateExpressionTree (ec);
}
+ var user_cast = child as UserCast;
+ if (user_cast != null) {
+ child.Type = type;
+ return user_cast.CreateExpressionTree (ec);
+ }
+
return base.CreateExpressionTree (ec);
}
return new LiftedNull (nullable, loc);
}
- public static Constant CreateFromExpression (ResolveContext ec, Expression e)
+ public static Constant CreateFromExpression (ResolveContext rc, Expression e)
{
- ec.Report.Warning (458, 2, e.Location, "The result of the expression is always `null' of type `{0}'",
- e.Type.GetSignatureForError ());
+ if (!rc.HasSet (ResolveContext.Options.ExpressionTreeConversion)) {
+ rc.Report.Warning (458, 2, e.Location, "The result of the expression is always `null' of type `{0}'",
+ e.Type.GetSignatureForError ());
+ }
return ReducedExpression.Create (Create (e.Type, e.Location), e);
}
//
// Generic lifting expression, supports all S/S? -> T/T? cases
//
- public class Lifted : Expression, IMemoryLocation
+ public class LiftedConversion : Expression, IMemoryLocation
{
Expression expr, null_value;
Unwrap unwrap;
- public Lifted (Expression expr, Unwrap unwrap, TypeSpec type)
+ public LiftedConversion (Expression expr, Unwrap unwrap, TypeSpec type)
{
this.expr = expr;
this.unwrap = unwrap;
this.type = type;
}
- public Lifted (Expression expr, Expression unwrap, TypeSpec type)
+ public LiftedConversion (Expression expr, Expression unwrap, TypeSpec type)
: this (expr, unwrap as Unwrap, type)
{
}
// Wrap target for T?
if (type.IsNullableType) {
- expr = Wrap.Create (expr, type);
- if (expr == null)
- return null;
+ if (!expr.Type.IsNullableType) {
+ expr = Wrap.Create (expr, type);
+ if (expr == null)
+ return null;
+ }
null_value = LiftedNull.Create (type, loc);
} else if (TypeSpec.IsValueType (type)) {
ec.MarkLabel (is_null_label);
null_value.Emit (ec);
+
ec.MarkLabel (end_label);
}
}
}
- public class LiftedBinaryOperator : Binary
+ //
+ // Lifted version of binary operators
+ //
+ class LiftedBinaryOperator : Expression
{
- Unwrap left_unwrap, right_unwrap;
- Expression left_orig, right_orig;
- Expression user_operator;
- MethodSpec wrap_ctor;
-
- public LiftedBinaryOperator (Binary.Operator op, Expression left, Expression right)
- : base (op, left, right)
+ public LiftedBinaryOperator (Binary b)
{
+ this.Binary = b;
+ this.loc = b.Location;
}
- bool IsBitwiseBoolean {
- get {
- return (Oper == Operator.BitwiseAnd || Oper == Operator.BitwiseOr) &&
- ((left_unwrap != null && left_unwrap.Type.BuiltinType == BuiltinTypeSpec.Type.Bool) ||
- (right_unwrap != null && right_unwrap.Type.BuiltinType == BuiltinTypeSpec.Type.Bool));
- }
- }
+ public Binary Binary { get; private set; }
- bool IsLeftNullLifted {
- get {
- return (state & State.LeftNullLifted) != 0;
- }
- }
+ public Expression Left { get; set; }
- bool IsRightNullLifted {
- get {
- return (state & State.RightNullLifted) != 0;
- }
- }
+ public Expression Right { get; set; }
- public override Expression CreateExpressionTree (ResolveContext ec)
- {
- if (user_operator != null)
- return user_operator.CreateExpressionTree (ec);
+ public Unwrap UnwrapLeft { get; set; }
- return base.CreateExpressionTree (ec);
- }
+ public Unwrap UnwrapRight { get; set; }
- //
- // CSC 2 has this behavior, it allows structs to be compared
- // with the null literal *outside* of a generics context and
- // inlines that as true or false.
- //
- Constant CreateNullConstant (ResolveContext ec, Expression expr)
- {
- // FIXME: Handle side effect constants
- Constant c = new BoolConstant (ec.BuiltinTypes, Oper == Operator.Inequality, loc);
+ public MethodSpec UserOperator { get; set; }
- if ((Oper & Operator.EqualityMask) != 0) {
- ec.Report.Warning (472, 2, loc, "The result of comparing value type `{0}' with null is always `{1}'",
- expr.Type.GetSignatureForError (), c.GetValueAsLiteral ());
- } else {
- ec.Report.Warning (464, 2, loc, "The result of comparing type `{0}' with null is always `{1}'",
- expr.Type.GetSignatureForError (), c.GetValueAsLiteral ());
+ bool IsBitwiseBoolean {
+ get {
+ return (Binary.Oper == Binary.Operator.BitwiseAnd || Binary.Oper == Binary.Operator.BitwiseOr) &&
+ ((UnwrapLeft != null && UnwrapLeft.Type.BuiltinType == BuiltinTypeSpec.Type.Bool) ||
+ (UnwrapRight != null && UnwrapRight.Type.BuiltinType == BuiltinTypeSpec.Type.Bool));
}
-
- return ReducedExpression.Create (c, this);
}
- protected override Expression DoResolve (ResolveContext ec)
+ public override bool ContainsEmitWithAwait ()
{
- if ((Oper & Operator.LogicalMask) != 0) {
- Error_OperatorCannotBeApplied (ec, left, right);
- return null;
- }
-
- bool use_default_call = (Oper & (Operator.BitwiseMask | Operator.EqualityMask)) != 0;
- left_orig = left;
- if (left.Type.IsNullableType) {
- left = left_unwrap = Unwrap.Create (left, use_default_call);
- if (left == null)
- return null;
- }
-
- right_orig = right;
- if (right.Type.IsNullableType) {
- right = right_unwrap = Unwrap.Create (right, use_default_call);
- if (right == null)
- return null;
- }
-
- //
- // Some details are in 6.4.2, 7.2.7
- // Arguments can be lifted for equal operators when the return type is bool and both
- // arguments are of same type
- //
- if (left_orig is NullLiteral) {
- left = right;
- state |= State.LeftNullLifted;
- type = ec.BuiltinTypes.Bool;
- }
-
- if (right_orig.IsNull) {
- if ((Oper & Operator.ShiftMask) != 0)
- right = new EmptyExpression (ec.BuiltinTypes.Int);
- else
- right = left;
-
- state |= State.RightNullLifted;
- type = ec.BuiltinTypes.Bool;
- }
-
- eclass = ExprClass.Value;
- return DoResolveCore (ec, left_orig, right_orig);
+ return Left.ContainsEmitWithAwait () || Right.ContainsEmitWithAwait ();
}
- void EmitBitwiseBoolean (EmitContext ec)
+ public override Expression CreateExpressionTree (ResolveContext rc)
{
- Label load_left = ec.DefineLabel ();
- Label load_right = ec.DefineLabel ();
- Label end_label = ec.DefineLabel ();
-
- // null & value, null | value
- if (left_unwrap == null) {
- left_unwrap = right_unwrap;
- right_unwrap = null;
- right = left;
- }
-
- left_unwrap.Emit (ec);
- ec.Emit (OpCodes.Brtrue, load_right);
-
- // value & null, value | null
- if (right_unwrap != null) {
- right_unwrap.Emit (ec);
- ec.Emit (OpCodes.Brtrue_S, load_left);
- }
-
- left_unwrap.EmitCheck (ec);
- ec.Emit (OpCodes.Brfalse_S, load_right);
-
- // load left
- ec.MarkLabel (load_left);
+ if (UserOperator != null) {
+ Arguments args = new Arguments (2);
+ args.Add (new Argument (Binary.Left));
+ args.Add (new Argument (Binary.Right));
- if (Oper == Operator.BitwiseAnd) {
- left_unwrap.Load (ec);
- } else {
- if (right_unwrap == null) {
- right.Emit (ec);
- if (right is EmptyConstantCast || right is EmptyCast)
- ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
- } else {
- right_unwrap.Load (ec);
- right_unwrap = left_unwrap;
- }
- }
- ec.Emit (OpCodes.Br_S, end_label);
-
- // load right
- ec.MarkLabel (load_right);
- if (right_unwrap == null) {
- if (Oper == Operator.BitwiseAnd) {
- right.Emit (ec);
- if (right is EmptyConstantCast || right is EmptyCast)
- ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
- } else {
- left_unwrap.Load (ec);
- }
- } else {
- right_unwrap.Load (ec);
+ var method = new UserOperatorCall (UserOperator, args, Binary.CreateExpressionTree, loc);
+ return method.CreateExpressionTree (rc);
}
- ec.MarkLabel (end_label);
+ return Binary.CreateExpressionTree (rc);
}
- //
- // Emits optimized equality or inequality operator when possible
- //
- void EmitEquality (EmitContext ec)
+ protected override Expression DoResolve (ResolveContext rc)
{
- //
- // Either left or right is null
- //
- if (left_unwrap != null && (IsRightNullLifted || right.IsNull)) {
- left_unwrap.EmitCheck (ec);
- if (Oper == Binary.Operator.Equality) {
- ec.EmitInt (0);
- ec.Emit (OpCodes.Ceq);
- }
- return;
- }
-
- if (right_unwrap != null && (IsLeftNullLifted || left.IsNull)) {
- right_unwrap.EmitCheck (ec);
- if (Oper == Binary.Operator.Equality) {
- ec.EmitInt (0);
- ec.Emit (OpCodes.Ceq);
- }
- return;
- }
-
- Label dissimilar_label = ec.DefineLabel ();
- Label end_label = ec.DefineLabel ();
+ if (rc.IsRuntimeBinder) {
+ if (UnwrapLeft == null && !Left.Type.IsNullableType)
+ Left = Wrap.Create (Left, rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { Left.Type }));
- if (user_operator != null) {
- user_operator.Emit (ec);
- ec.Emit (Oper == Operator.Equality ? OpCodes.Brfalse_S : OpCodes.Brtrue_S, dissimilar_label);
+ if (UnwrapRight == null && !Right.Type.IsNullableType)
+ Right = Wrap.Create (Right, rc.Module.PredefinedTypes.Nullable.TypeSpec.MakeGenericType (rc.Module, new[] { Right.Type }));
} else {
- if (ec.HasSet (BuilderContext.Options.AsyncBody) && right.ContainsEmitWithAwait ()) {
- left = left.EmitToField (ec);
- right = right.EmitToField (ec);
+ if (UnwrapLeft == null && Left != null && Left.Type.IsNullableType) {
+ Left = Unwrap.CreateUnwrapped (Left);
+ UnwrapLeft = Left as Unwrap;
}
- left.Emit (ec);
- right.Emit (ec);
-
- ec.Emit (OpCodes.Bne_Un_S, dissimilar_label);
- }
-
- if (left_unwrap != null)
- left_unwrap.EmitCheck (ec);
-
- if (right_unwrap != null)
- right_unwrap.EmitCheck (ec);
-
- if (left_unwrap != null && right_unwrap != null) {
- if (Oper == Operator.Inequality)
- ec.Emit (OpCodes.Xor);
- else
- ec.Emit (OpCodes.Ceq);
- } else {
- if (Oper == Operator.Inequality) {
- ec.EmitInt (0);
- ec.Emit (OpCodes.Ceq);
+ if (UnwrapRight == null && Right != null && Right.Type.IsNullableType) {
+ Right = Unwrap.CreateUnwrapped (Right);
+ UnwrapRight = Right as Unwrap;
}
}
- ec.Emit (OpCodes.Br_S, end_label);
-
- ec.MarkLabel (dissimilar_label);
- if (Oper == Operator.Inequality)
- ec.EmitInt (1);
- else
- ec.EmitInt (0);
+ type = Binary.Type;
+ eclass = Binary.eclass;
- ec.MarkLabel (end_label);
+ return this;
}
-
- public override void EmitBranchable (EmitContext ec, Label target, bool onTrue)
- {
- Emit (ec);
- ec.Emit (onTrue ? OpCodes.Brtrue : OpCodes.Brfalse, target);
- }
public override void Emit (EmitContext ec)
{
- //
- // Optimize same expression operation
- //
- if (right_unwrap != null && right.Equals (left))
- right_unwrap = left_unwrap;
-
- if (user_operator == null && IsBitwiseBoolean) {
+ if (IsBitwiseBoolean && UserOperator == null) {
EmitBitwiseBoolean (ec);
return;
}
- if ((Oper & Operator.EqualityMask) != 0) {
+ if ((Binary.Oper & Binary.Operator.EqualityMask) != 0) {
EmitEquality (ec);
return;
}
Label is_null_label = ec.DefineLabel ();
Label end_label = ec.DefineLabel ();
- if (left_unwrap != null) {
- left_unwrap.EmitCheck (ec);
- ec.Emit (OpCodes.Brfalse, is_null_label);
+ if (ec.HasSet (BuilderContext.Options.AsyncBody) && Right.ContainsEmitWithAwait ()) {
+ Left = Left.EmitToField (ec);
+ Right = Right.EmitToField (ec);
+ }
+
+ if (UnwrapLeft != null) {
+ UnwrapLeft.EmitCheck (ec);
}
//
// Don't emit HasValue check when left and right expressions are same
//
- if (right_unwrap != null && !left.Equals (right)) {
- right_unwrap.EmitCheck (ec);
- ec.Emit (OpCodes.Brfalse, is_null_label);
+ if (UnwrapRight != null && !Binary.Left.Equals (Binary.Right)) {
+ UnwrapRight.EmitCheck (ec);
+ if (UnwrapLeft != null) {
+ ec.Emit (OpCodes.And);
+ }
}
- EmitOperator (ec, left.Type);
+ ec.Emit (OpCodes.Brfalse, is_null_label);
+
+ if (UserOperator != null) {
+ var args = new Arguments (2);
+ args.Add (new Argument (Left));
+ args.Add (new Argument (Right));
+
+ var call = new CallEmitter ();
+ call.EmitPredefined (ec, UserOperator, args);
+ } else {
+ Binary.EmitOperator (ec, Left, Right);
+ }
- if (wrap_ctor != null)
- ec.Emit (OpCodes.Newobj, wrap_ctor);
+ //
+ // Wrap the result when the operator return type is nullable type
+ //
+ if (type.IsNullableType)
+ ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
ec.Emit (OpCodes.Br_S, end_label);
ec.MarkLabel (is_null_label);
- if ((Oper & Operator.ComparisonMask) != 0) {
+ if ((Binary.Oper & Binary.Operator.ComparisonMask) != 0) {
ec.EmitInt (0);
} else {
LiftedNull.Create (type, loc).Emit (ec);
ec.MarkLabel (end_label);
}
- protected override void EmitOperator (EmitContext ec, TypeSpec l)
+ void EmitBitwiseBoolean (EmitContext ec)
{
- if (user_operator != null) {
- user_operator.Emit (ec);
- return;
- }
+ Label load_left = ec.DefineLabel ();
+ Label load_right = ec.DefineLabel ();
+ Label end_label = ec.DefineLabel ();
+ Label is_null_label = ec.DefineLabel ();
- if (left.Type.IsNullableType) {
- l = NullableInfo.GetUnderlyingType (left.Type);
- left = EmptyCast.Create (left, l);
- }
+ bool or = Binary.Oper == Binary.Operator.BitwiseOr;
- if (right.Type.IsNullableType) {
- right = EmptyCast.Create (right, NullableInfo.GetUnderlyingType (right.Type));
- }
+ //
+ // Both operands are bool? types
+ //
+ if (UnwrapLeft != null && UnwrapRight != null) {
+ if (ec.HasSet (BuilderContext.Options.AsyncBody) && Binary.Right.ContainsEmitWithAwait ()) {
+ Left = Left.EmitToField (ec);
+ Right = Right.EmitToField (ec);
+ }
- base.EmitOperator (ec, l);
- }
+ Left.Emit (ec);
+ ec.Emit (OpCodes.Brtrue_S, load_right);
- Expression LiftResult (ResolveContext ec, Expression res_expr)
- {
- TypeSpec lifted_type;
+ Right.Emit (ec);
+ ec.Emit (OpCodes.Brtrue_S, load_left);
- //
- // Avoid double conversion
- //
- if (left_unwrap == null || IsLeftNullLifted || left_unwrap.Type != left.Type || (left_unwrap != null && IsRightNullLifted)) {
- lifted_type = new NullableType (left.Type, loc).ResolveAsType (ec);
- if (lifted_type == null)
- return null;
+ UnwrapLeft.EmitCheck (ec);
+ ec.Emit (OpCodes.Brfalse_S, load_right);
- if (left is UserCast || left is EmptyCast || left is OpcodeCast)
- left.Type = lifted_type;
+ // load left
+ ec.MarkLabel (load_left);
+ if (or)
+ UnwrapRight.Load (ec);
else
- left = EmptyCast.Create (left, lifted_type);
- }
+ UnwrapLeft.Load (ec);
- if (left != right && (right_unwrap == null || IsRightNullLifted || right_unwrap.Type != right.Type || (right_unwrap != null && IsLeftNullLifted))) {
- lifted_type = new NullableType (right.Type, loc).ResolveAsType (ec);
- if (lifted_type == null)
- return null;
-
- var r = right;
- if (r is ReducedExpression)
- r = ((ReducedExpression) r).OriginalExpression;
+ ec.Emit (OpCodes.Br_S, end_label);
- if (r is UserCast || r is EmptyCast || r is OpcodeCast)
- r.Type = lifted_type;
+ // load right
+ ec.MarkLabel (load_right);
+ if (or)
+ UnwrapLeft.Load (ec);
else
- right = EmptyCast.Create (right, lifted_type);
+ UnwrapRight.Load (ec);
+
+ ec.MarkLabel (end_label);
+ return;
}
- if ((Oper & Operator.ComparisonMask) == 0) {
- lifted_type = new NullableType (res_expr.Type, loc).ResolveAsType (ec);
- if (lifted_type == null)
- return null;
+ //
+ // Faster version when one operand is bool
+ //
+ if (UnwrapLeft == null) {
+ //
+ // (bool, bool?)
+ //
+ // Optimizes remaining (false & bool?), (true | bool?) which are not easy to handle
+ // in binary expression reduction
+ //
+ var c = Left as BoolConstant;
+ if (c != null) {
+ // Keep evaluation order
+ UnwrapRight.Store (ec);
+
+ ec.EmitInt (or ? 1 : 0);
+ ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
+ } else if (Left.IsNull) {
+ UnwrapRight.Emit (ec);
+ ec.Emit (or ? OpCodes.Brfalse_S : OpCodes.Brtrue_S, is_null_label);
+
+ UnwrapRight.Load (ec);
+ ec.Emit (OpCodes.Br_S, end_label);
+
+ ec.MarkLabel (is_null_label);
+ LiftedNull.Create (type, loc).Emit (ec);
+ } else {
+ Left.Emit (ec);
+ ec.Emit (or ? OpCodes.Brfalse_S : OpCodes.Brtrue_S, load_right);
- wrap_ctor = NullableInfo.GetConstructor (lifted_type);
- type = res_expr.Type = lifted_type;
- }
+ ec.EmitInt (or ? 1 : 0);
+ ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
- if (IsLeftNullLifted) {
- left = LiftedNull.Create (right.Type, left.Location);
+ ec.Emit (OpCodes.Br_S, end_label);
+ ec.MarkLabel (load_right);
+ UnwrapRight.Original.Emit (ec);
+ }
+ } else {
//
- // Special case for bool?, the result depends on both null right side and left side value
+ // (bool?, bool)
//
- if ((Oper == Operator.BitwiseAnd || Oper == Operator.BitwiseOr) && NullableInfo.GetUnderlyingType (type).BuiltinType == BuiltinTypeSpec.Type.Bool) {
- return res_expr;
- }
-
- if ((Oper & (Operator.ArithmeticMask | Operator.ShiftMask | Operator.BitwiseMask)) != 0)
- return LiftedNull.CreateFromExpression (ec, res_expr);
+ // Keep left-right evaluation order
+ UnwrapLeft.Store (ec);
//
- // Value types and null comparison
+ // Optimizes remaining (bool? & false), (bool? | true) which are not easy to handle
+ // in binary expression reduction
//
- if (right_unwrap == null || (Oper & Operator.RelationalMask) != 0)
- return CreateNullConstant (ec, right_orig);
+ var c = Right as BoolConstant;
+ if (c != null) {
+ ec.EmitInt (or ? 1 : 0);
+ ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
+ } else if (Right.IsNull) {
+ UnwrapLeft.Emit (ec);
+ ec.Emit (or ? OpCodes.Brfalse_S : OpCodes.Brtrue_S, is_null_label);
+
+ UnwrapLeft.Load (ec);
+ ec.Emit (OpCodes.Br_S, end_label);
+
+ ec.MarkLabel (is_null_label);
+ LiftedNull.Create (type, loc).Emit (ec);
+ } else {
+ Right.Emit (ec);
+ ec.Emit (or ? OpCodes.Brfalse_S : OpCodes.Brtrue_S, load_right);
+
+ ec.EmitInt (or ? 1 : 0);
+ ec.Emit (OpCodes.Newobj, NullableInfo.GetConstructor (type));
+
+ ec.Emit (OpCodes.Br_S, end_label);
+
+ ec.MarkLabel (load_right);
+
+ UnwrapLeft.Load (ec);
+ }
}
- if (IsRightNullLifted) {
- right = LiftedNull.Create (left.Type, right.Location);
+ ec.MarkLabel (end_label);
+ }
+ //
+ // Emits optimized equality or inequality operator when possible
+ //
+ void EmitEquality (EmitContext ec)
+ {
+ //
+ // Either left or right is null
+ //
+ if (UnwrapLeft != null && Binary.Right.IsNull) { // TODO: Optimize for EmitBranchable
//
- // Special case for bool?, the result depends on both null right side and left side value
+ // left.HasValue == false
//
- if ((Oper == Operator.BitwiseAnd || Oper == Operator.BitwiseOr) && NullableInfo.GetUnderlyingType (type).BuiltinType == BuiltinTypeSpec.Type.Bool) {
- return res_expr;
+ UnwrapLeft.EmitCheck (ec);
+ if (Binary.Oper == Binary.Operator.Equality) {
+ ec.EmitInt (0);
+ ec.Emit (OpCodes.Ceq);
}
+ return;
+ }
- if ((Oper & (Operator.ArithmeticMask | Operator.ShiftMask | Operator.BitwiseMask)) != 0)
- return LiftedNull.CreateFromExpression (ec, res_expr);
-
+ if (UnwrapRight != null && Binary.Left.IsNull) {
//
- // Value types and null comparison
+ // right.HasValue == false
//
- if (left_unwrap == null || (Oper & Operator.RelationalMask) != 0)
- return CreateNullConstant (ec, left_orig);
+ UnwrapRight.EmitCheck (ec);
+ if (Binary.Oper == Binary.Operator.Equality) {
+ ec.EmitInt (0);
+ ec.Emit (OpCodes.Ceq);
+ }
+ return;
}
- return res_expr;
- }
+ Label dissimilar_label = ec.DefineLabel ();
+ Label end_label = ec.DefineLabel ();
- protected override Expression ResolveOperatorPredefined (ResolveContext ec, Binary.PredefinedOperator [] operators, bool primitives_only, TypeSpec enum_type)
- {
- Expression e = base.ResolveOperatorPredefined (ec, operators, primitives_only, enum_type);
+ if (UserOperator != null) {
+ var left = Left;
- if (e == this || enum_type != null)
- return LiftResult (ec, e);
+ if (UnwrapLeft != null) {
+ UnwrapLeft.EmitCheck (ec);
+ } else {
+ // Keep evaluation order same
+ if (!(Left is VariableReference)) {
+ Left.Emit (ec);
+ var lt = new LocalTemporary (Left.Type);
+ lt.Store (ec);
+ left = lt;
+ }
+ }
- //
- // 7.9.9 Equality operators and null
- //
- // The == and != operators permit one operand to be a value of a nullable type and
- // the other to be the null literal, even if no predefined or user-defined operator
- // (in unlifted or lifted form) exists for the operation.
- //
- if (e == null && (Oper & Operator.EqualityMask) != 0) {
- if ((IsLeftNullLifted && right_unwrap != null) || (IsRightNullLifted && left_unwrap != null))
- return LiftResult (ec, this);
- }
+ if (UnwrapRight != null) {
+ UnwrapRight.EmitCheck (ec);
- return e;
- }
+ if (UnwrapLeft != null) {
+ ec.Emit (OpCodes.Bne_Un, dissimilar_label);
- protected override Expression ResolveUserOperator (ResolveContext ec, Expression left, Expression right)
- {
- //
- // Try original types first for exact match without unwrapping
- //
- Expression expr = base.ResolveUserOperator (ec, left_orig, right_orig);
- if (expr != null)
- return expr;
+ Label compare_label = ec.DefineLabel ();
+ UnwrapLeft.EmitCheck (ec);
+ ec.Emit (OpCodes.Brtrue, compare_label);
- State orig_state = state;
+ if (Binary.Oper == Binary.Operator.Equality)
+ ec.EmitInt (1);
+ else
+ ec.EmitInt (0);
- //
- // One side is a nullable type, try to match underlying types
- //
- if (left_unwrap != null || right_unwrap != null || (state & (State.RightNullLifted | State.LeftNullLifted)) != 0) {
- expr = base.ResolveUserOperator (ec, left, right);
+ ec.Emit (OpCodes.Br, end_label);
+
+ ec.MarkLabel (compare_label);
+ } else {
+ ec.Emit (OpCodes.Brfalse, dissimilar_label);
+ }
+ } else {
+ ec.Emit (OpCodes.Brfalse, dissimilar_label);
+ }
+
+ var args = new Arguments (2);
+ args.Add (new Argument (left));
+ args.Add (new Argument (Right));
+
+ var call = new CallEmitter ();
+ call.EmitPredefined (ec, UserOperator, args);
+ } else {
+ if (ec.HasSet (BuilderContext.Options.AsyncBody) && Binary.Right.ContainsEmitWithAwait ()) {
+ Left = Left.EmitToField (ec);
+ Right = Right.EmitToField (ec);
+ }
+
+ //
+ // Emit underlying value comparison first.
+ //
+ // For this code: int? a = 1; bool b = a == 1;
+ //
+ // We emit something similar to this. Expressions with side effects have local
+ // variable created by Unwrap expression
+ //
+ // left.GetValueOrDefault ()
+ // right
+ // bne.un.s dissimilar_label
+ // left.HasValue
+ // br.s end_label
+ // dissimilar_label:
+ // ldc.i4.0
+ // end_label:
+ //
+
+ Left.Emit (ec);
+ Right.Emit (ec);
+
+ ec.Emit (OpCodes.Bne_Un_S, dissimilar_label);
+
+ //
+ // Check both left and right expressions for Unwrap call in which
+ // case we need to run get_HasValue() check because the type is
+ // nullable and could have null value
+ //
+ if (UnwrapLeft != null)
+ UnwrapLeft.EmitCheck (ec);
+
+ if (UnwrapRight != null)
+ UnwrapRight.EmitCheck (ec);
+
+ if (UnwrapLeft != null && UnwrapRight != null) {
+ if (Binary.Oper == Binary.Operator.Inequality)
+ ec.Emit (OpCodes.Xor);
+ else
+ ec.Emit (OpCodes.Ceq);
+ } else {
+ if (Binary.Oper == Binary.Operator.Inequality) {
+ ec.EmitInt (0);
+ ec.Emit (OpCodes.Ceq);
+ }
+ }
}
- if (expr == null)
- return null;
+ ec.Emit (OpCodes.Br_S, end_label);
- //
- // Lift the result in the case it can be null and predefined or user operator
- // result type is of a value type
- //
- if (!TypeSpec.IsValueType (expr.Type))
- return null;
+ ec.MarkLabel (dissimilar_label);
+ if (Binary.Oper == Binary.Operator.Inequality)
+ ec.EmitInt (1);
+ else
+ ec.EmitInt (0);
- if (state != orig_state)
- return expr;
+ ec.MarkLabel (end_label);
+ }
- expr = LiftResult (ec, expr);
- if (expr is Constant)
- return expr;
+ public override SLE.Expression MakeExpression (BuilderContext ctx)
+ {
+ Console.WriteLine (":{0} x {1}", Left.GetType (), Right.GetType ());
- type = expr.Type;
- user_operator = expr;
- return this;
+ return Binary.MakeExpression (ctx, Left, Right);
}
}
}
ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
+ ec.CurrentBranching.CurrentUsageVector.Goto ();
bool ok = Resolve (ec);
ec.KillFlowBranching ();
return false;
}
- if (ec.Switch.DefaultLabel == null) {
- FlowBranchingBlock.Error_UnknownLabel (loc, "default", ec.Report);
- return false;
- }
+ ec.Switch.RegisterGotoCase (null, null);
return true;
}
/// </summary>
public class GotoCase : Statement {
Expression expr;
- SwitchLabel sl;
public GotoCase (Expression e, Location l)
{
return this.expr;
}
}
+
+ public SwitchLabel Label { get; set; }
public override bool Resolve (BlockContext ec)
{
ec.CurrentBranching.CurrentUsageVector.Goto ();
- expr = expr.Resolve (ec);
- if (expr == null)
- return false;
-
- Constant c = expr as Constant;
+ Constant c = expr.ResolveLabelConstant (ec);
if (c == null) {
- ec.Report.Error (150, expr.Location, "A constant value is expected");
return false;
}
}
- sl = ec.Switch.ResolveGotoCase (ec, res);
+ ec.Switch.RegisterGotoCase (this, res);
return true;
}
protected override void DoEmit (EmitContext ec)
{
- ec.Emit (OpCodes.Br, sl.GetILLabel (ec));
+ ec.Emit (OpCodes.Br, Label.GetILLabel (ec));
}
protected override void CloneTo (CloneContext clonectx, Statement t)
scope_initializers.Add (s);
}
}
+
+ public void InsertStatement (int index, Statement s)
+ {
+ statements.Insert (index, s);
+ }
public void AddStatement (Statement s)
{
public override bool Resolve (BlockContext bc)
{
+ if (ResolveAndReduce (bc))
+ bc.Switch.RegisterLabel (bc, this);
+
bc.CurrentBranching.CurrentUsageVector.ResetBarrier ();
return base.Resolve (bc);
// Resolves the expression, reduces it to a literal if possible
// and then converts it to the requested type.
//
- public bool ResolveAndReduce (ResolveContext ec, TypeSpec required_type, bool allow_nullable)
- {
- Expression e = label.Resolve (ec);
-
- if (e == null)
- return false;
+ bool ResolveAndReduce (ResolveContext rc)
+ {
+ if (IsDefault)
+ return true;
- Constant c = e as Constant;
- if (c == null){
- ec.Report.Error (150, loc, "A constant value is expected");
+ var c = label.ResolveLabelConstant (rc);
+ if (c == null)
return false;
- }
- if (allow_nullable && c is NullLiteral) {
+ if (rc.Switch.IsNullable && c is NullLiteral) {
converted = c;
return true;
}
- converted = c.ImplicitConversionRequired (ec, required_type, loc);
+ converted = c.ImplicitConversionRequired (rc, rc.Switch.SwitchType, loc);
return converted != null;
}
- public void Error_AlreadyOccurs (ResolveContext ec, TypeSpec switch_type, SwitchLabel collision_with)
+ public void Error_AlreadyOccurs (ResolveContext ec, SwitchLabel collision_with)
{
string label;
if (converted == null)
Dictionary<string, SwitchLabel> string_labels;
List<SwitchLabel> case_labels;
+ List<Tuple<GotoCase, Constant>> goto_cases;
+
/// <summary>
/// The governing switch type
/// </summary>
};
}
- //
- // Performs the basic sanity checks on the switch statement
- // (looks for duplicate keys and non-constant expressions).
- //
- // It also returns a hashtable with the keys that we will later
- // use to compute the switch tables
- //
- bool ResolveLabels (ResolveContext ec, Constant value)
+ public void RegisterLabel (ResolveContext rc, SwitchLabel sl)
{
- bool error = false;
- if (SwitchType.BuiltinType == BuiltinTypeSpec.Type.String) {
- string_labels = new Dictionary<string, SwitchLabel> ();
- } else {
- labels = new Dictionary<long, SwitchLabel> ();
- }
-
- case_labels = new List<SwitchLabel> ();
- int default_label_index = -1;
- bool constant_label_found = false;
-
- for (int i = 0; i < block.Statements.Count; ++i) {
- var s = block.Statements[i];
-
- var sl = s as SwitchLabel;
- if (sl == null) {
- continue;
- }
-
- case_labels.Add (sl);
-
- if (sl.IsDefault) {
- if (case_default != null) {
- sl.Error_AlreadyOccurs (ec, SwitchType, case_default);
- error = true;
- }
+ case_labels.Add (sl);
- default_label_index = i;
+ if (sl.IsDefault) {
+ if (case_default != null) {
+ sl.Error_AlreadyOccurs (rc, case_default);
+ } else {
case_default = sl;
- continue;
}
- if (!sl.ResolveAndReduce (ec, SwitchType, IsNullable)) {
- error = true;
- continue;
- }
+ return;
+ }
- try {
- if (string_labels != null) {
- string string_value = sl.Converted.GetValue () as string;
- if (string_value == null)
- case_null = sl;
- else
- string_labels.Add (string_value, sl);
+ try {
+ if (string_labels != null) {
+ string string_value = sl.Converted.GetValue () as string;
+ if (string_value == null)
+ case_null = sl;
+ else
+ string_labels.Add (string_value, sl);
+ } else {
+ if (sl.Converted is NullLiteral) {
+ case_null = sl;
} else {
- if (sl.Converted is NullLiteral) {
- case_null = sl;
- } else {
- labels.Add (sl.Converted.GetValueAsLong (), sl);
- }
+ labels.Add (sl.Converted.GetValueAsLong (), sl);
}
- } catch (ArgumentException) {
- if (string_labels != null)
- sl.Error_AlreadyOccurs (ec, SwitchType, string_labels[(string) sl.Converted.GetValue ()]);
- else
- sl.Error_AlreadyOccurs (ec, SwitchType, labels[sl.Converted.GetValueAsLong ()]);
-
- error = true;
- }
-
- if (value != null) {
- var constant_label = constant_label_found ? null : FindLabel (value);
- if (constant_label == null || constant_label != sl)
- block.Statements[i] = new EmptyStatement (s.loc);
- else
- constant_label_found = true;
}
+ } catch (ArgumentException) {
+ if (string_labels != null)
+ sl.Error_AlreadyOccurs (rc, string_labels[(string) sl.Converted.GetValue ()]);
+ else
+ sl.Error_AlreadyOccurs (rc, labels[sl.Converted.GetValueAsLong ()]);
}
-
- if (value != null && constant_label_found && default_label_index >= 0)
- block.Statements[default_label_index] = new EmptyStatement (case_default.loc);
-
- return !error;
}
//
if (block.Statements.Count == 0)
return true;
- var constant = new_expr as Constant;
+ if (SwitchType.BuiltinType == BuiltinTypeSpec.Type.String) {
+ string_labels = new Dictionary<string, SwitchLabel> ();
+ } else {
+ labels = new Dictionary<long, SwitchLabel> ();
+ }
- if (!ResolveLabels (ec, constant))
- return false;
+ case_labels = new List<SwitchLabel> ();
+
+ var constant = new_expr as Constant;
//
// Don't need extra variable for constant switch or switch with
// only default case
//
- if (constant == null && (case_labels.Count - (case_default != null ? 1 : 0)) != 0) {
+ if (constant == null) {
//
// Store switch expression for comparison purposes
//
value = new_expr as VariableReference;
- if (value == null) {
- // Create temporary variable inside switch scope
+ if (value == null && !HasOnlyDefaultSection ()) {
var current_block = ec.CurrentBlock;
ec.CurrentBlock = Block;
+ // Create temporary variable inside switch scope
value = TemporaryVariableReference.Create (SwitchType, ec.CurrentBlock, loc);
value.Resolve (ec);
ec.CurrentBlock = current_block;
ec.EndFlowBranching ();
ec.Switch = old_switch;
+ //
+ // Check if all goto cases are valid. Needs to be done after switch
+ // is resolved becuase goto can jump forward in the scope.
+ //
+ if (goto_cases != null) {
+ foreach (var gc in goto_cases) {
+ if (gc.Item1 == null) {
+ if (DefaultLabel == null) {
+ FlowBranchingBlock.Error_UnknownLabel (loc, "default", ec.Report);
+ }
+
+ continue;
+ }
+
+ var sl = FindLabel (gc.Item2);
+ if (sl == null) {
+ FlowBranchingBlock.Error_UnknownLabel (loc, "case " + gc.Item2.GetValueAsLiteral (), ec.Report);
+ } else {
+ gc.Item1.Label = sl;
+ }
+ }
+ }
+
+ if (constant != null) {
+ ResolveUnreachableSections (ec, constant);
+ }
+
if (!ok)
return false;
}
//
- // Needed to emit anonymous storey initialization before
+ // Anonymous storey initialization has to happen before
// any generated switch dispatch
//
- block.AddScopeStatement (new DispatchStatement (this));
+ block.InsertStatement (0, new DispatchStatement (this));
return true;
}
- public SwitchLabel ResolveGotoCase (ResolveContext rc, Constant value)
+ bool HasOnlyDefaultSection ()
{
- var sl = FindLabel (value);
+ for (int i = 0; i < block.Statements.Count; ++i) {
+ var s = block.Statements[i] as SwitchLabel;
+
+ if (s == null || s.IsDefault)
+ continue;
- if (sl == null) {
- FlowBranchingBlock.Error_UnknownLabel (loc, "case " + value.GetValueAsLiteral (), rc.Report);
+ return false;
}
- return sl;
+ return true;
+ }
+
+ public void RegisterGotoCase (GotoCase gotoCase, Constant value)
+ {
+ if (goto_cases == null)
+ goto_cases = new List<Tuple<GotoCase, Constant>> ();
+
+ goto_cases.Add (Tuple.Create (gotoCase, value));
}
//
string_dictionary = new SimpleAssign (switch_cache_field, initializer.Resolve (ec));
}
+ void ResolveUnreachableSections (BlockContext bc, Constant value)
+ {
+ var constant_label = FindLabel (value) ?? case_default;
+
+ bool found = false;
+ bool unreachable_reported = false;
+ for (int i = 0; i < block.Statements.Count; ++i) {
+ var s = block.Statements[i];
+
+ if (s is SwitchLabel) {
+ if (unreachable_reported) {
+ found = unreachable_reported = false;
+ }
+
+ found |= s == constant_label;
+ continue;
+ }
+
+ if (found) {
+ unreachable_reported = true;
+ continue;
+ }
+
+ if (!unreachable_reported) {
+ unreachable_reported = true;
+ bc.Report.Warning (162, 2, s.loc, "Unreachable code detected");
+ }
+
+ block.Statements[i] = new EmptyStatement (s.loc);
+ }
+ }
+
void DoEmitStringSwitch (EmitContext ec)
{
Label l_initialized = ec.DefineLabel ();
return;
}
- //
- // Mark sequence point explicitly to switch
- //
- ec.Mark (block.StartLocation);
- block.IsCompilerGenerated = true;
-
if (string_dictionary != null) {
DoEmitStringSwitch (ec);
} else if (case_labels.Count < 4 || string_labels != null) {
} else if (new_expr != value) {
value.EmitAssign (ec, new_expr, false, false);
}
+
+
+ //
+ // Next statement is compiler generated we don't need extra
+ // nop when we can use the statement for sequence point
+ //
+ ec.Mark (block.StartLocation);
+ block.IsCompilerGenerated = true;
}
block.Emit (ec);
}
}
+ public static bool IsNonNullableValueType (TypeSpec t)
+ {
+ switch (t.Kind) {
+ case MemberKind.TypeParameter:
+ return ((TypeParameterSpec) t).IsValueType;
+ case MemberKind.Struct:
+ return !t.IsNullableType;
+ case MemberKind.Enum:
+ return true;
+ default:
+ return false;
+ }
+ }
+
public static bool IsValueType (TypeSpec t)
{
switch (t.Kind) {
public dynamic[,] t2;
public Func<dynamic, int, dynamic[]> v;
public I<dynamic>[] iface;
+ public Action<int[], object, dynamic> d2;
}
delegate dynamic Del (dynamic d);
if (!da.TransformFlags.SequenceEqual (new bool[] { false, false, true }))
return 47;
+ da = t.GetMember ("d2")[0].GetCustomAttributes (ca, false)[0] as DynamicAttribute;
+ if (da == null)
+ return 48;
+ if (!da.TransformFlags.SequenceEqual (new bool[] { false, false, false, false, true }))
+ return 49;
+
t = typeof (Del);
if (t.GetMember ("Invoke")[0].GetCustomAttributes (ca, false).Length != 0)
}
}
+struct S
+{
+ public static implicit operator bool?(S arg)
+ {
+ throw new ApplicationException ("should not be called");
+ }
+}
+
class X
{
- public static void Main ()
+ public static int Main ()
{
int a = 3;
int? b = a;
Baz? z2 = (Baz?) f2;
Baz? z3 = (Baz?) f3;
Baz z4 = (Baz) f2;
+
+ S? s = null;
+ bool? g = s;
+ if (g != null)
+ return 1;
+
+ return 0;
}
}
if (res)
return 2;
+ int? re = 3 + (short?) 7;
+ if (re != 10)
+ return 3;
+
+ int a = 2;
+ int b = 2;
+ int? c = (byte?)a + b;
+ if (c != 4)
+ return 4;
+
+ c = a + (ushort?)b;
+ if (c != 4)
+ return 5;
+
return 0;
}
}
--- /dev/null
+using System;
+
+enum E : sbyte
+{
+ V = 1
+}
+
+struct S
+{
+ public static bool operator == (S s, S i)
+ {
+ throw new ApplicationException ();
+ }
+
+ public static bool operator != (S s, S i)
+ {
+ throw new ApplicationException ();
+ }
+
+ public static implicit operator int? (S s)
+ {
+ throw new ApplicationException ();
+ }
+
+ public static implicit operator E? (S s)
+ {
+ return null;
+ }
+}
+
+class C
+{
+ public static int Main ()
+ {
+ E? a = E.V;
+ E? a_n = null;
+ E? b = E.V;
+ E? b_n = null;
+
+ if (a != b)
+ return 1;
+
+ if (a == a_n)
+ return 2;
+
+ if (a_n != b_n)
+ return 3;
+
+ E e = (E) 4;
+ S s;
+ if (e == s)
+ return 10;
+
+ if (s == e)
+ return 11;
+
+ if (e > s)
+ return 12;
+
+ if (s > e)
+ return 13;
+
+ if ((s & e) != null)
+ return 14;
+
+ if ((s & e) != null)
+ return 15;
+
+ Console.WriteLine ("ok");
+
+ return 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+struct S
+{
+ public static implicit operator int (S arg)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+struct S2
+{
+ public static implicit operator int?(S2 arg)
+ {
+ return 10000;
+ }
+
+ public static implicit operator uint?(S2 arg)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+public struct S3
+{
+ public static int counter;
+
+ public static implicit operator string (S3 s3)
+ {
+ counter++;
+ return "";
+ }
+}
+
+class C
+{
+ public static int Main ()
+ {
+ S? s = null;
+ bool res = s > 1;
+ if (res)
+ return 1;
+
+ S2 s2 = new S2 ();
+
+ var b = s2 >> 3;
+ if (b != 1250)
+ return 2;
+
+ var b2 = s2 >> s2;
+ if (b2 != 0)
+ return 3;
+
+ var b3 = s2 + 1;
+ if (b3 != 10001)
+ return 4;
+
+ var s3 = new S3 ();
+ if ((s3 == null) != false)
+ return 5;
+
+ if ((s3 != null) != true)
+ return 6;
+
+ if (S3.counter != 2)
+ return 7;
+
+ Console.WriteLine ("ok");
+ return 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+struct S
+{
+ public static bool operator == (S s, S i)
+ {
+ throw new ApplicationException ();
+ }
+
+ public static bool operator != (S s, S i)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+struct S2
+{
+ public static int counter;
+
+ public static bool operator == (S2 s, S2 i)
+ {
+ counter++;
+ return true;
+ }
+
+ public static bool operator != (S2 s, S2 i)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+
+struct S3
+{
+ public static int counter;
+
+ public static implicit operator int?(S3 arg)
+ {
+ counter++;
+ return null;
+ }
+}
+
+class C
+{
+ public static int Main ()
+ {
+ S? s = new S ();
+ S? s2 = null;
+ S? s4 = null;
+
+ if ((s == s2) != false)
+ return 1;
+
+ if ((s2 == s) != false)
+ return 2;
+
+ if ((s2 == s4) != true)
+ return 3;
+
+ S x = new S ();
+
+ if ((s2 == x) != false)
+ return 5;
+
+ if ((x == s2) != false)
+ return 6;
+
+ S2? s2_1 = new S2 ();
+ S2? s2_3 = new S2 ();
+ S2 x2 = new S2 ();
+
+ if ((s2_1 == s2_3) != true)
+ return 7;
+
+ if ((s2_1 == x2) != true)
+ return 8;
+
+ if ((x2 == s2_1) != true)
+ return 9;
+
+ if (S2.counter != 3)
+ return 10;
+
+ S3 s3;
+
+ if ((s3 == null) != true)
+ return 20;
+
+ if ((null == s3) != true)
+ return 21;
+
+ if (S3.counter != 2)
+ return 22;
+
+ return 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+struct S
+{
+ public static implicit operator string (S s)
+ {
+ return "1";
+ }
+
+ public static implicit operator short? (S s)
+ {
+ return 1;
+ }
+
+ public static implicit operator E (S s)
+ {
+ return 0;
+ }
+}
+
+public enum E
+{
+}
+
+class C
+{
+ public static int Main ()
+ {
+ E? e = 0;
+ const E e1 = (E)44;
+ var res = e == e1;
+ if (res != false)
+ return 1;
+
+ res = e1 == e;
+ if (res != false)
+ return 2;
+
+ E e2 = 0;
+ S s;
+ var res2 = e2 & s;
+ if (res2 != 0)
+ return 3;
+
+ res2 = s & e2;
+ if (res2 != 0)
+ return 4;
+
+ return 0;
+ }
+}
\ No newline at end of file
--- /dev/null
+using System;
+
+struct S
+{
+ public static implicit operator short? (S s)
+ {
+ return 0;
+ }
+
+ public static implicit operator short (S s)
+ {
+ throw new ApplicationException ();
+ }
+}
+
+class Program
+{
+ public static int Main ()
+ {
+ S? s = null;
+ S? s2 = new S ();
+
+ long? i = s;
+ if (i != null)
+ return 1;
+
+ double? ui = s2;
+ if (ui == null)
+ return 2;
+
+ return 0;
+ }
+}
\ No newline at end of file
{
throw new ApplicationException ();
}
+
+ public static Foo operator + (Foo d1, Foo d2)
+ {
+ throw new ApplicationException ();
+ }
}
class C
if (!e.Compile ().Invoke ())
return 4;
+ Expression<Func<Foo?>> e2 = () => f + null;
+ if (e2.Compile ().Invoke () != null)
+ return 5;
+
Console.WriteLine ("OK");
return 0;
}
--- /dev/null
+using System;
+using System.Linq;
+using System.Collections.Generic;
+
+public class Test
+{
+ public static int Main ()
+ {
+ var x = Test2 ();
+ if (x.Count () != 0)
+ return 1;
+
+ Console.WriteLine ("ok");
+ return 0;
+ }
+
+ public static IEnumerable<int> Test2 ()
+ {
+ while (false)
+ yield return 5;
+ }
+}
\ No newline at end of file
{
}
+ [MethodImplAttribute((short)MethodImplOptions.Synchronized)]
+ public void test2 ()
+ {
+ }
+
+ [MethodImplAttribute((byte)32)]
+ public void test3 ()
+ {
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
+ public void test4 ()
+ {
+ }
+
public static int Main ()
{
- MethodImplAttributes iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
- return ((iflags & MethodImplAttributes.Synchronized) != 0 ? 0 : 1);
+ MethodImplAttributes iflags;
+ iflags = typeof (Test).GetMethod ("test").GetMethodImplementationFlags ();
+ if ((iflags & MethodImplAttributes.Synchronized) == 0)
+ return 1;
+
+ iflags = typeof (Test).GetMethod ("test2").GetMethodImplementationFlags ();
+ if ((iflags & MethodImplAttributes.Synchronized) == 0)
+ return 2;
+
+ iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
+ if ((iflags & MethodImplAttributes.Synchronized) == 0)
+ return 3;
+
+ iflags = typeof (Test).GetMethod ("test3").GetMethodImplementationFlags ();
+ if ((iflags & MethodImplAttributes.Synchronized) == 0)
+ return 4;
+
+ return 0;
}
}
-class T {
- public static int Main ()
+class Test
+{
+ static int test1 ()
{
- switch (1) {
- case 1:
- return 0;
- default:
- break;
+ var s = "Nice";
+ switch (s) {
+ case "HI":
+ const string x = "Nice";
+ return 1;
+ case x:
+ return 2;
}
+
+ return 3;
}
-}
+
+ public const string xx = "Not";
+ static int test2 ()
+ {
+ var s = "Nice";
+ switch (s) {
+ case "HI":
+ const string xx = "Nice";
+ return 1;
+ case xx:
+ return 2;
+ }
+
+ return 3;
+ }
+
+ static int Main ()
+ {
+ if (test1 () != 2)
+ return 1;
+
+ if (test2 () != 2)
+ return 2;
+
+ return 0;
+ }
+}
\ No newline at end of file
};
}
+ static Func<T> Catch_2<T> (T t) where T : Exception
+ {
+ T l = t;
+ return () => {
+ try {
+ throw new NotSupportedException ();
+ } catch (T e) {
+ return l;
+ } catch {
+ throw new ApplicationException ("Should not be reached");
+ }
+ };
+ }
+
static Func<T> Finally<T> (T t)
{
T l = t;
if (t5 () != 3)
return 5;
+ var ex = new NotSupportedException ();
+ var t5_2 = Catch_2 (ex);
+ if (t5_2 () != ex)
+ return 52;
+
var t6 = Finally (5);
if (t6 () != 0)
return 6;
--- /dev/null
+using System;
+
+namespace TestAnonSwitch
+{
+ public class MyClass
+ {
+ public event EventHandler<EventArgs> FirstEvent;
+ public event EventHandler<EventArgs> SecondEvent;
+
+ public void Trigger ()
+ {
+ if (FirstEvent != null)
+ FirstEvent (this, EventArgs.Empty);
+ }
+ }
+
+ public class Tester
+ {
+ MyClass myobj;
+
+ public void Test ()
+ {
+ myobj = new MyClass ();
+ var something = "key";
+
+ switch (something) {
+ case "key":
+ myobj.FirstEvent += (sender, e) => {
+ Console.WriteLine ("FirstEvent: {0}", myobj);
+ };
+ break;
+ case "somethingelse":
+ bool? woot = null;
+ myobj.SecondEvent += (sender, e) => {
+ Console.WriteLine ("woot {0}", woot);
+ };
+ break;
+ }
+
+ myobj.Trigger ();
+ }
+ }
+
+ class MainClass
+ {
+ public static void Main ()
+ {
+ var tester = new Tester ();
+ tester.Test ();
+ }
+ }
+}
--- /dev/null
+using System;
+
+class C
+{
+ public static void Main ()
+ {
+ new C ().Test ();
+ }
+
+ void Test ()
+ {
+ var v = new View ();
+ v.Click += async (o, e) => {
+ var b = new Builder ();
+ b.SetButton (() => {
+ Console.WriteLine (this);
+ });
+ };
+ v.Run ();
+ }
+}
+
+class View
+{
+ public event EventHandler Click;
+
+ public void Run ()
+ {
+ Click (null, null);
+ }
+}
+
+class Builder
+{
+ public void SetButton (Action h)
+ {
+ h ();
+ }
+}
</sequencepoints>
<locals />
<scopes>
- <entry index="0" start="0x22" end="0x3c" />
+ <entry index="0" start="0x1" end="0x3c" />
<entry index="1" start="0x28" end="0x2d" />
</scopes>
</method>
</sequencepoints>
<locals />
<scopes>
- <entry index="0" start="0x28" end="0x38" />
+ <entry index="0" start="0x15" end="0x38" />
<entry index="1" start="0x2e" end="0x33" />
</scopes>
</method>
</sequencepoints>
<locals />
<scopes>
- <entry index="0" start="0xb3" end="0xd2" />
+ <entry index="0" start="0x1" end="0xd2" />
<entry index="1" start="0xb9" end="0xbe" />
</scopes>
</method>
</sequencepoints>
<locals />
<scopes>
- <entry index="0" start="0x2c" end="0x3b" />
+ <entry index="0" start="0x1" end="0x3b" />
</scopes>
</method>
<method token="0x600000f">
</type>\r
<type name="Test">\r
<method name="Int32 Main()" attrs="150">\r
- <size>1216</size>\r
+ <size>1292</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<method name="Void Assert[T](T, T, System.String)" attrs="145">\r
<size>99</size>\r
</method>\r
- <method name="Void Assert[T](IList`1, IList`1, System.String)" attrs="145">\r
- <size>257</size>\r
- </method>\r
<method name="Void AssertArgument(System.Runtime.CompilerServices.CallSiteBinder, Microsoft.CSharp.RuntimeBinder.CSharpArgumentInfo[], System.String)" attrs="145">\r
<size>172</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Tester">\r
+ <method name="Void Assert[T](System.Collections.Generic.IList`1[T], System.Collections.Generic.IList`1[T], System.String)" attrs="145">\r
+ <size>257</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="dtest-004.cs">\r
<type name="G`1[T]">\r
<method name="Int32 ConvertImplicitReturnTest()" attrs="129">\r
<size>83</size>\r
</method>\r
- <method name="IEnumerable`1 ConvertImplicitReturnTest_2()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="Void ConvertExplicitTest()" attrs="129">\r
<size>503</size>\r
</method>\r
<method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
- <size>14</size>\r
- </method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>154</size>\r
</method>\r
<method name="Void Reset()" attrs="486">\r
<size>6</size>\r
</method>\r
+ <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
+ <size>14</size>\r
+ </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="Int32 <>m__3()" attrs="131">\r
<size>81</size>\r
</method>\r
- <method name="Nullable`1 <>m__4()" attrs="131">\r
- <size>81</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Tester">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] ConvertImplicitReturnTest_2()" attrs="129">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<ConvertImplicitReturnTest_2>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<ConvertExplicitCheckedTest>c__AnonStorey3">\r
+ <method name="System.Nullable`1[System.UInt32] <>m__4()" attrs="131">\r
+ <size>81</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="dtest-007.cs">\r
<type name="D">\r
</method>\r
</type>\r
<type name="DynamicAssignments">\r
- <method name="Void Foo(IA`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>192</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Foo(IA`1[System.Object])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="dtest-018.cs">\r
</method>\r
</type>\r
<type name="C+<Main>c__DynamicSite1+Container0">\r
- <method name="System.Object Invoke(System.Runtime.CompilerServices.CallSite, Nullable`1 ByRef, System.Object)" attrs="454">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
<size>0</size>\r
</method>\r
</type>\r
+ <type name="C+<Main>c__DynamicSite1+Container0">\r
+ <method name="System.Object Invoke(System.Runtime.CompilerServices.CallSite, System.Nullable`1[System.Int32] ByRef, System.Object)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="dtest-026.cs">\r
<type name="C">\r
<method name="Void M3[T,U](T, A`1[U])" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void M4[T,U](T, IEquatable`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>577</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void M4[T,U](T, System.IEquatable`1[U])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="dtest-031.cs">\r
</test>\r
<test name="dtest-040.cs">\r
<type name="A">\r
- <method name="S`2 Foo[U](U)" attrs="454">\r
- <size>18</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="B">\r
- <method name="S`2 Foo[T](T)" attrs="198">\r
- <size>38</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="A">\r
+ <method name="S`2[U,System.Object] Foo[U](U)" attrs="454">\r
+ <size>18</size>\r
+ </method>\r
+ </type>\r
+ <type name="B">\r
+ <method name="S`2[T,System.Object] Foo[T](T)" attrs="198">\r
+ <size>38</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="dtest-041.cs">\r
<type name="A`1[AA]">\r
</test>\r
<test name="dtest-044.cs">\r
<type name="C">\r
- <method name="Int32 Test[T,U](T, IComparable`1)" attrs="150">\r
- <size>10</size>\r
- </method>\r
- <method name="Int32 Test_2[T](IList`1, T)" attrs="150">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>868</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Int32 Test[T,U](T, System.IComparable`1[U])" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 Test_2[T](System.Collections.Generic.IList`1[T], T)" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="dtest-045.cs">\r
<method name="Void CLSCompliantMethod(System.Object[])" attrs="134">\r
<size>2</size>\r
</method>\r
- <method name="Void CLSCompliantMethod(IEnumerable`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void CLSCompliantMethod(System.Collections.Generic.IEnumerable`1[System.Object])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="dtest-collectioninit-01.cs">\r
</test>\r
<test name="dtest-iter-01.cs">\r
<type name="Program">\r
- <method name="IEnumerable`1 D1()" attrs="150">\r
- <size>23</size>\r
- </method>\r
- <method name="IEnumerable`1 D2()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<dynamic>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<System.Func<dynamic>>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Program">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] D1()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Func`1[System.Object]] D2()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Program+<D1>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<dynamic>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Program+<D2>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Func`1[System.Object]] System.Collections.Generic.IEnumerable<System.Func<dynamic>>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="dtest-named-01.cs">\r
<type name="Test">\r
</test>\r
<test name="gtest-032.cs">\r
<type name="X">\r
- <method name="Void Test(Bar`2)" attrs="145">\r
- <size>25</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Test(Bar`2[System.Int32,System.String])" attrs="145">\r
+ <size>25</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-033.cs">\r
<type name="X">\r
- <method name="Void Test(Bar`3)" attrs="145">\r
- <size>36</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Test(Bar`3[System.Int64,System.Int32,System.String])" attrs="145">\r
+ <size>36</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-034.cs">\r
<method name="T get_Name()" attrs="2182">\r
<size>15</size>\r
</method>\r
- <method name="IMonkey`1 GetTheMonkey[U](U)" attrs="134">\r
- <size>16</size>\r
- </method>\r
<method name="Void .ctor(T)" attrs="6278">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Zoo`1[T]">\r
+ <method name="IMonkey`1[U] GetTheMonkey[U](U)" attrs="134">\r
+ <size>16</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-040.cs">\r
<type name="Stack`1[T]">\r
- <method name="INode`1 GetNode()" attrs="134">\r
- <size>15</size>\r
- </method>\r
<method name="Stack`1+Foo`1[T,T] GetFoo(T)" attrs="134">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Stack`1[T]">\r
+ <method name="INode`1[T] GetNode()" attrs="134">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-041.cs">\r
<type name="Stack`1[T]">\r
<method name="Void Print(T)" attrs="486">\r
<size>18</size>\r
</method>\r
- <method name="IHello`1 Test[U]()" attrs="486">\r
- <size>14</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Hello`1[T]">\r
+ <method name="IHello`1[U] Test[U]()" attrs="486">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-058.cs">\r
<type name="Foo">\r
</test>\r
<test name="gtest-062.cs">\r
<type name="X">\r
- <method name="IEnumerable`1 Test(Int32, Int64)" attrs="134">\r
- <size>44</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>95</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>116</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="X">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Int32, Int64)" attrs="134">\r
+ <size>44</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-063.cs">\r
<type name="Test">\r
</test>\r
<test name="gtest-064.cs">\r
<type name="Foo`1[T]">\r
- <method name="IHello`1 IFoo<T>.GetHello()" attrs="481">\r
- <size>15</size>\r
- </method>\r
<method name="Foo`1+Hello[T] GetHello()" attrs="134">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo`1[T]">\r
+ <method name="IHello`1[T] IFoo<T>.GetHello()" attrs="481">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-065.cs">\r
<type name="ComparablePair`2[T,U]">\r
- <method name="Int32 CompareTo(ComparablePair`2)" attrs="486">\r
- <size>76</size>\r
- </method>\r
- <method name="Boolean Equals(ComparablePair`2)" attrs="134">\r
- <size>81</size>\r
- </method>\r
<method name="System.String ToString()" attrs="198">\r
<size>72</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="ComparablePair`2[T,U]">\r
+ <method name="Int32 CompareTo(ComparablePair`2[T,U])" attrs="486">\r
+ <size>76</size>\r
+ </method>\r
+ <method name="Boolean Equals(ComparablePair`2[T,U])" attrs="134">\r
+ <size>81</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-066.cs">\r
<type name="Foo`1[T]">\r
</test>\r
<test name="gtest-069.cs">\r
<type name="Test`1[T]">\r
- <method name="Int32 Foo(IFoo`1)" attrs="134">\r
- <size>15</size>\r
- </method>\r
<method name="Int32 Foo(IFoo)" attrs="134">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test`1[T]">\r
+ <method name="Int32 Foo(IFoo`1[T])" attrs="134">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-070.cs">\r
<type name="Martin.Test`1[T]">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="MyList`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="486">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-074.cs">\r
<type name="Foo`1[T]">\r
</method>\r
</type>\r
<type name="Test`1[T]">\r
- <method name="Foo`1 GetFoo(T)" attrs="134">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test`1[T]">\r
+ <method name="Foo`1[T] GetFoo(T)" attrs="134">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-078.cs">\r
<type name="S">\r
</test>\r
<test name="gtest-080.cs">\r
<type name="Test">\r
- <method name="Void Hello[T](IFoo`1)" attrs="134">\r
- <size>9</size>\r
- </method>\r
- <method name="Void InsertAll[U](IFoo`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Void Hello[T](IFoo`1[T])" attrs="134">\r
+ <size>9</size>\r
+ </method>\r
+ <method name="Void InsertAll[U](IFoo`1[U])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-081.cs">\r
<type name="ArrayList`1[T]">\r
</test>\r
<test name="gtest-084.cs">\r
<type name="HasherBuilder.ByPrototype`1[S]">\r
- <method name="IHasher`1 Examine()" attrs="150">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="ArrayList`1[U]">\r
- <method name="IHasher`1 GetHasher()" attrs="134">\r
- <size>14</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-085.cs">\r
- <type name="ArrayList`1[T]">\r
- <method name="Int32 InsertAll(IFoo`1)" attrs="454">\r
- <size>10</size>\r
- </method>\r
- <method name="Int32 InsertAll[U](IFoo`1)" attrs="454">\r
+ <type name="HasherBuilder.ByPrototype`1[S]">\r
+ <method name="IHasher`1[S] Examine()" attrs="150">\r
<size>10</size>\r
</method>\r
- <method name="Int32 AddAll(IFoo`1)" attrs="454">\r
- <size>16</size>\r
+ </type>\r
+ <type name="ArrayList`1[U]">\r
+ <method name="IHasher`1[U] GetHasher()" attrs="134">\r
+ <size>14</size>\r
</method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-085.cs">\r
+ <type name="ArrayList`1[T]">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-086.cs">\r
<type name="ArrayList`1[T]">\r
- <method name="Int32 InsertAll(IFoo`1)" attrs="454">\r
+ <method name="Int32 InsertAll(IFoo`1[T])" attrs="454">\r
<size>10</size>\r
</method>\r
- <method name="Int32 InsertAll[U](IFoo`1)" attrs="454">\r
+ <method name="Int32 InsertAll[U](IFoo`1[U])" attrs="454">\r
<size>10</size>\r
</method>\r
- <method name="Int32 AddAll(IFoo`1)" attrs="454">\r
+ <method name="Int32 AddAll(IFoo`1[T])" attrs="454">\r
<size>16</size>\r
</method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-086.cs">\r
+ <type name="ArrayList`1[T]">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="ArrayList`1[T]">\r
+ <method name="Int32 InsertAll(IFoo`1[T])" attrs="454">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 InsertAll[U](IFoo`1[U])" attrs="454">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 AddAll(IFoo`1[T])" attrs="454">\r
+ <size>16</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-087.cs">\r
<type name="C5.HashedArrayList`1[T]">\r
</test>\r
<test name="gtest-095.cs">\r
<type name="GuardedCollectionValue`1[T]">\r
- <method name="IDirectedEnumerable`1 IDirectedEnumerable<T>.Backwards()" attrs="481">\r
- <size>10</size>\r
- </method>\r
- <method name="IDirectedCollectionValue`1 Backwards()" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="GuardedSequenced`1[T]">\r
- <method name="IDirectedCollectionValue`1 Test()" attrs="134">\r
- <size>20</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="GuardedCollectionValue`1[T]">\r
+ <method name="IDirectedEnumerable`1[T] IDirectedEnumerable<T>.Backwards()" attrs="481">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="IDirectedCollectionValue`1[T] Backwards()" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="GuardedSequenced`1[T]">\r
+ <method name="IDirectedCollectionValue`1[T] Test()" attrs="134">\r
+ <size>20</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-096.cs">\r
<type name="Foo`1[T]">\r
</method>\r
</type>\r
<type name="Hello">\r
- <method name="Void World[U](U, IFoo`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
- <method name="Void World[V](IFoo`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Void Test(Foo)" attrs="134">\r
<size>21</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Hello">\r
+ <method name="Void World[U](U, IFoo`1[U])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void World[V](IFoo`1[V])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-104.cs">\r
<type name="MainClass">\r
</method>\r
</type>\r
<type name="A.KeyValuePairComparer`2[K,V]">\r
- <method name="Int32 Compare(KeyValuePair`2)" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="A.KeyValuePairComparer`2[K,V]">\r
+ <method name="Int32 Compare(A.KeyValuePair`2[K,V])" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-106.cs">\r
<type name="KeyValuePair`2[X,Y]">\r
</method>\r
</type>\r
<type name="KeyValuePairComparer`2[K,V]">\r
- <method name="Int32 Compare(KeyValuePair`2)" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="KeyValuePairComparer`2[K,V]">\r
+ <method name="Int32 Compare(KeyValuePair`2[K,V])" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-107.cs">\r
<type name="Mapper`2[T,V]">\r
</test>\r
<test name="gtest-108.cs">\r
<type name="Test`1[T]">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor(T)" attrs="6278">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-109.cs">\r
<type name="X">\r
</test>\r
<test name="gtest-112.cs">\r
<type name="IC">\r
- <method name="Void Compare(Foo`1)" attrs="486">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</method>\r
</type>\r
<type name="List`1[T]">\r
- <method name="Void Sort(IComparer`1, T)" attrs="454">\r
- <size>9</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Sorting">\r
- <method name="Void IntroSort[T](IComparer`1, T)" attrs="150">\r
- <size>16</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="IC">\r
+ <method name="Void Compare(Foo`1[System.Int32])" attrs="486">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
+ <type name="List`1[T]">\r
+ <method name="Void Sort(IComparer`1[T], T)" attrs="454">\r
+ <size>9</size>\r
+ </method>\r
+ </type>\r
+ <type name="Sorting">\r
+ <method name="Void IntroSort[T](IComparer`1[T], T)" attrs="150">\r
+ <size>16</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-113.cs">\r
<type name="Mapper`2[T,V]">\r
<method name="LinkedList`1[T] op_Addition(LinkedList`1[T], LinkedList`1[T])" attrs="2198">\r
<size>135</size>\r
</method>\r
- <method name="IMyList`1 Map[U](Mapper`2[T,U])" attrs="486">\r
- <size>78</size>\r
- </method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>31</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="LinkedList`1[T]">\r
+ <method name="IMyList`1[U] Map[U](Mapper`2[T,U])" attrs="486">\r
+ <size>78</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="486">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-116.cs">\r
<type name="Slow.Test">\r
<method name="Int32 TestC()" attrs="150">\r
<size>46</size>\r
</method>\r
- <method name="Boolean Check1(Nullable`1)" attrs="145">\r
- <size>16</size>\r
- </method>\r
<method name="Boolean Check2[T](E)" attrs="145">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Boolean Check1(System.Nullable`1[E])" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-118.cs">\r
</method>\r
</type>\r
<type name="Sequenced`1[T]">\r
- <method name="Boolean Equals(ISequenced`1)" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Sequenced`1[T]">\r
+ <method name="Boolean Equals(ISequenced`1[T])" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-121.cs">\r
<type name="B`1[T]">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="System.Collections.Generic.List`1[T] foo1[T](Filter`1)" attrs="145">\r
- <size>46</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>46</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.List`1[T] foo1[T](Filter`1[T])" attrs="145">\r
+ <size>46</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-127.cs">\r
<test name="gtest-130.cs">\r
<type name="MyTest">\r
<method name="Void Main(System.String[])" attrs="150">\r
- <size>938</size>\r
+ <size>908</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<test name="gtest-131.cs">\r
<type name="MyTest">\r
<method name="Void Main(System.String[])" attrs="150">\r
- <size>1332</size>\r
+ <size>1300</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</test>\r
<test name="gtest-132.cs">\r
<type name="MyTest">\r
- <method name="Nullable`1 Sqrt(Nullable`1)" attrs="150">\r
- <size>68</size>\r
- </method>\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>64</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Nullable`1[System.Int32] Sqrt(System.Nullable`1[System.Int32])" attrs="150">\r
+ <size>68</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-133.cs">\r
<test name="gtest-137.cs">\r
<type name="X">\r
<method name="Int32 Main()" attrs="150">\r
- <size>158</size>\r
+ <size>240</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<test name="gtest-138.cs">\r
<type name="X">\r
<method name="Void Main()" attrs="150">\r
- <size>62</size>\r
+ <size>102</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</type>\r
</test>\r
<test name="gtest-139.cs">\r
+ <type name="Test">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>78</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
<type name="MyStruct">\r
- <method name="Int32 op_Inequality(Nullable`1, System.String)" attrs="2198">\r
+ <method name="Int32 op_Inequality(System.Nullable`1[MyStruct], System.String)" attrs="2198">\r
<size>10</size>\r
</method>\r
- <method name="Int32 op_Equality(Nullable`1, System.String)" attrs="2198">\r
+ <method name="Int32 op_Equality(System.Nullable`1[MyStruct], System.String)" attrs="2198">\r
<size>10</size>\r
</method>\r
- <method name="Int32 op_Inequality(System.String, Nullable`1)" attrs="2198">\r
+ <method name="Int32 op_Inequality(System.String, System.Nullable`1[MyStruct])" attrs="2198">\r
<size>11</size>\r
</method>\r
- <method name="Int32 op_Equality(System.String, Nullable`1)" attrs="2198">\r
+ <method name="Int32 op_Equality(System.String, System.Nullable`1[MyStruct])" attrs="2198">\r
<size>10</size>\r
</method>\r
</type>\r
- <type name="Test">\r
- <method name="Int32 Main()" attrs="150">\r
- <size>78</size>\r
- </method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
- </type>\r
</test>\r
<test name="gtest-140.cs">\r
<type name="X">\r
<method name="Void IsFalse(System.String, Boolean)" attrs="150">\r
<size>19</size>\r
</method>\r
- <method name="Void IsNull[T](System.String, Nullable`1)" attrs="150">\r
- <size>25</size>\r
- </method>\r
- <method name="Void IsNotNull[T](System.String, Nullable`1)" attrs="150">\r
- <size>25</size>\r
- </method>\r
- <method name="Void IsTrue(System.String, Nullable`1)" attrs="150">\r
- <size>37</size>\r
- </method>\r
- <method name="Void IsFalse(System.String, Nullable`1)" attrs="150">\r
- <size>37</size>\r
- </method>\r
<method name="Void .cctor()" attrs="6289">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="X">\r
<method name="Int32 Main()" attrs="150">\r
- <size>2253</size>\r
+ <size>2163</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Assert">\r
+ <method name="Void IsNull[T](System.String, System.Nullable`1[T])" attrs="150">\r
+ <size>25</size>\r
+ </method>\r
+ <method name="Void IsNotNull[T](System.String, System.Nullable`1[T])" attrs="150">\r
+ <size>25</size>\r
+ </method>\r
+ <method name="Void IsTrue(System.String, System.Nullable`1[System.Boolean])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ <method name="Void IsFalse(System.String, System.Nullable`1[System.Boolean])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-143.cs">\r
<type name="X">\r
<method name="Int32 Index()" attrs="145">\r
<size>34</size>\r
</method>\r
- <method name="Nullable`1 get_Item(Int32)" attrs="2177">\r
- <size>15</size>\r
- </method>\r
- <method name="Void set_Item(Int32, Nullable`1)" attrs="2177">\r
- <size>9</size>\r
- </method>\r
<method name="Int32 Test()" attrs="145">\r
- <size>1157</size>\r
+ <size>1276</size>\r
</method>\r
<method name="Int32 Main()" attrs="150">\r
<size>38</size>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Nullable`1[System.Int32] get_Item(Int32)" attrs="2177">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="Void set_Item(Int32, System.Nullable`1[System.Int32])" attrs="2177">\r
+ <size>9</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-144.cs">\r
<method name="IFoo IFoo.Hello()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IFoo`1 Hello()" attrs="1478">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</method>\r
</type>\r
<type name="HashBag`1[T]">\r
- <method name="IFoo`1 Hello()" attrs="198">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="EnumerableBase`1[T]">\r
+ <method name="IFoo`1[T] Hello()" attrs="1478">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="HashBag`1[T]">\r
+ <method name="IFoo`1[T] Hello()" attrs="198">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-153.cs">\r
<type name="MyClass`1[T]">\r
</test>\r
<test name="gtest-163.cs">\r
<type name="Foo`1[T]">\r
- <method name="IEnumerator`1 getEnumerator(Int32)" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] getEnumerator(Int32)" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-164.cs">\r
<type name="Int2Int">\r
</method>\r
</type>\r
<type name="FunEnumerable">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor(Int32, Int2Int)" attrs="6278">\r
<size>22</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="FunEnumerable">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] GetEnumerator()" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-165.cs">\r
<type name="C">\r
</method>\r
</type>\r
<type name="X`1[T]">\r
- <method name="IEnumerator`1 Y(IEnumerable`1)" attrs="150">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] Y(System.Collections.Generic.IEnumerable`1[T])" attrs="150">\r
<size>15</size>\r
</method>\r
- <method name="T Z(IList`1, Int32)" attrs="150">\r
+ <method name="T Z(System.Collections.Generic.IList`1[T], Int32)" attrs="150">\r
<size>16</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-178.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>168</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-182.cs">\r
</test>\r
<test name="gtest-183.cs">\r
<type name="test.Test`1[T]">\r
- <method name="IEnumerable`1 Lookup(T)" attrs="134">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>91</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="test.Test`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Lookup(T)" attrs="134">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="test.Test`1+<Lookup>c__Iterator0[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-184.cs">\r
<type name="X">\r
</type>\r
</test>\r
<test name="gtest-191.cs">\r
- <type name="Test1.Test">\r
- <method name="IEnumerable`1 Replace[T]()" attrs="150">\r
- <size>23</size>\r
- </method>\r
- </type>\r
<type name="Test2.Test`1[S]">\r
- <method name="IEnumerable`1 Replace[T]()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test3.Test`1[S]">\r
- <method name="IEnumerable`1 Replace[T](IEnumerable`1, IEnumerable`1)" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test4.Test">\r
- <method name="IEnumerable`1 Replace[T]()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test5.Test">\r
- <method name="IEnumerable`1 Replace[T](T)" attrs="150">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test6.Test">\r
- <method name="IEnumerable`1 Replace[T](T)" attrs="150">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test7.Test">\r
- <method name="IEnumerable`1 Replace[T](T[])" attrs="150">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
</method>\r
</type>\r
<type name="Test3.Test`1+<Replace>c__Iterator2`1[S,T]">\r
- <method name="KeyValuePair`2 System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<S,T>>.get_Current()" attrs="2529">\r
- <size>14</size>\r
- </method>\r
<method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">\r
<size>19</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<S,T>>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>77</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>89</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T[]>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>89</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test1.Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Replace[T]()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test2.Test`1[S]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Replace[T]()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test3.Test`1[S]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Collections.Generic.KeyValuePair`2[S,T]] Replace[T](System.Collections.Generic.IEnumerable`1[T], System.Collections.Generic.IEnumerable`1[S])" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test4.Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Replace[T]()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test5.Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Replace[T](T)" attrs="150">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test6.Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Replace[T](T)" attrs="150">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test7.Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T[]] Replace[T](T[])" attrs="150">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test1.Test+<Replace>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test2.Test`1+<Replace>c__Iterator1`1[S,T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test3.Test`1+<Replace>c__Iterator2`1[S,T]">\r
+ <method name="System.Collections.Generic.KeyValuePair`2[S,T] System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<S,T>>.get_Current()" attrs="2529">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[S,T]] System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<S,T>>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test4.Test+<Replace>c__Iterator3`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test5.Test+<Replace>c__Iterator4`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test6.Test+<Replace>c__Iterator5`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test7.Test+<Replace>c__Iterator6`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T[]] System.Collections.Generic.IEnumerable<T[]>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-192.cs">\r
<type name="xX">\r
</test>\r
<test name="gtest-193.cs">\r
<type name="OrderedMultiDictionary`2[T,U]">\r
- <method name="IEnumerator`1 EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
- <size>29</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="RedBlackTree`1[S]">\r
- <method name="IEnumerable`1 EnumerateRange(RedBlackTree`1+RangeTester[S])" attrs="134">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<S>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-194.cs">\r
+ <type name="OrderedMultiDictionary`2[T,U]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
+ <size>29</size>\r
+ </method>\r
+ </type>\r
<type name="RedBlackTree`1[S]">\r
- <method name="IEnumerable`1 EnumerateRange(RedBlackTree`1+RangeTester[S])" attrs="134">\r
+ <method name="System.Collections.Generic.IEnumerable`1[S] EnumerateRange(RedBlackTree`1+RangeTester[S])" attrs="134">\r
<size>23</size>\r
</method>\r
+ </type>\r
+ <type name="RedBlackTree`1+<EnumerateRange>c__Iterator1[S]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[S] System.Collections.Generic.IEnumerable<S>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-194.cs">\r
+ <type name="RedBlackTree`1[S]">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</method>\r
</type>\r
<type name="OrderedMultiDictionary`2[T,U]">\r
- <method name="IEnumerator`1 EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
- <size>29</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<S>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="RedBlackTree`1[S]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[S] EnumerateRange(RedBlackTree`1+RangeTester[S])" attrs="134">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="OrderedMultiDictionary`2[T,U]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] EnumerateKeys(RedBlackTree`1+RangeTester[System.Collections.Generic.KeyValuePair`2[T,U]])" attrs="129">\r
+ <size>29</size>\r
+ </method>\r
+ </type>\r
+ <type name="RedBlackTree`1+<EnumerateRange>c__Iterator0[S]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[S] System.Collections.Generic.IEnumerable<S>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-195.cs">\r
<type name="OrderedMultiDictionary`2[T,U]">\r
<method name="Int64 Test()" attrs="134">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor(Int64)" attrs="6278">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="HashSet`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int64] GetEnumerator()" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-202.cs">\r
<type name="Generic`1[T]">\r
<method name="Ret Foo()" attrs="454">\r
<size>10</size>\r
</method>\r
- <method name="Ret`1 Foo[T]()" attrs="454">\r
- <size>10</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Ret Foo()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Ret`1 Foo[T]()" attrs="198">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="BaseClass">\r
+ <method name="Ret`1[T] Foo[T]()" attrs="454">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="DerivedClass">\r
+ <method name="Ret`1[T] Foo[T]()" attrs="198">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-217.cs">\r
<type name="Fun`2[A1,R]">\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>99</size>\r
</method>\r
- <method name="IEnumerable`1 Map[Aa,Af,Rf,Rr](Fun`2[Af,Rf], IEnumerable`1)" attrs="150">\r
- <size>37</size>\r
- </method>\r
- <method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="150">\r
- <size>37</size>\r
- </method>\r
<method name="System.String <Main>m__0(Int32)" attrs="145">\r
<size>22</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Rr>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>215</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>125</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="MyTest">\r
+ <method name="System.Collections.Generic.IEnumerable`1[Rr] Map[Aa,Af,Rf,Rr](Fun`2[Af,Rf], System.Collections.Generic.IEnumerable`1[Aa])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] FromTo(Int32, Int32)" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="MyTest+<Map>c__Iterator0`4[Aa,Af,Rf,Rr]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Rr] System.Collections.Generic.IEnumerable<Rr>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
+ <type name="MyTest+<FromTo>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-218.cs">\r
<type name="Foo">\r
</test>\r
<test name="gtest-225.cs">\r
<type name="Set`1[Element]">\r
- <method name="Locator locate(Element)" attrs="132">\r
- <size>39</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>8</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Set`1[Element]">\r
+ <method name="Set`1+Locator[Element] locate(Element)" attrs="132">\r
+ <size>39</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-226.cs">\r
<type name="Container`1[T]">\r
<method name="IFoo GetFoo()" attrs="134">\r
<size>15</size>\r
</method>\r
- <method name="IFoo`1 GetFooGeneric[T]()" attrs="134">\r
- <size>10</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="IFoo`1[T] GetFooGeneric[T]()" attrs="134">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-235.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="1478">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
<method name="Void raiseItemsAdded(T, Int32)" attrs="452">\r
<size>2</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="1222">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</method>\r
</type>\r
<type name="CircularQueue`1[T]">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void Enqueue(T)" attrs="454">\r
<size>2</size>\r
</method>\r
<method name="Boolean searchoradd(T ByRef, Boolean, Boolean, Boolean)" attrs="129">\r
<size>10</size>\r
</method>\r
- <method name="Void RemoveAll[U](IEnumerable`1)" attrs="454">\r
- <size>8</size>\r
- </method>\r
- <method name="Void AddAll[U](IEnumerable`1)" attrs="454">\r
- <size>65</size>\r
- </method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="EnumerableBase`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="1478">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="CollectionValueBase`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="1222">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="CircularQueue`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="HashSet`1[T]">\r
+ <method name="Void RemoveAll[U](System.Collections.Generic.IEnumerable`1[U])" attrs="454">\r
+ <size>8</size>\r
+ </method>\r
+ <method name="Void AddAll[U](System.Collections.Generic.IEnumerable`1[U])" attrs="454">\r
+ <size>65</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-248.cs">\r
<type name="Foo`1[T]">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="1478">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="ArrayBase`1[T]">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="HashedArrayList`1[T]">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="EnumerableBase`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="1478">\r
+ <size>0</size>\r
+ </method>\r
+ </type>\r
+ <type name="ArrayBase`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="HashedArrayList`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-250.cs">\r
<type name="Fun`2[R,S]">\r
</method>\r
</type>\r
<type name="GuardedIndexedSorted`1[T]">\r
- <method name="IIndexedSorted`1 Map[V](Fun`2[T,V])" attrs="486">\r
- <size>21</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="GuardedIndexedSorted`1[T]">\r
+ <method name="IIndexedSorted`1[V] Map[V](Fun`2[T,V])" attrs="486">\r
+ <size>21</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-251.cs">\r
<type name="SortedIndexedTester`1[T]">\r
- <method name="Void Test(ISorted`1)" attrs="134">\r
- <size>25</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="SortedIndexedTester`1[T]">\r
+ <method name="Void Test(ISorted`1[System.Int32])" attrs="134">\r
+ <size>25</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-252.cs">\r
<type name="EqualityComparer`1[T]">\r
</method>\r
</type>\r
<type name="Extensible`1[V]">\r
- <method name="Void AddAll[W](IEnumerable`1)" attrs="486">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Extensible`1[V]">\r
+ <method name="Void AddAll[W](System.Collections.Generic.IEnumerable`1[W])" attrs="486">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-254.cs">\r
<type name="HashedLinkedList`1[T]">\r
</test>\r
<test name="gtest-256.cs">\r
<type name="Test">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>12</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] GetEnumerator()" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-257.cs">\r
<type name="Tests">\r
</method>\r
</type>\r
<type name="ConvertHelper">\r
- <method name="IEnumerator`1 Test[S,T](S)" attrs="150">\r
- <size>22</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="ConvertHelper">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] Test[S,T](S)" attrs="150">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-264.cs">\r
<type name="BaseList`1[SubType]">\r
</test>\r
<test name="gtest-269.cs">\r
<type name="IrishPub">\r
- <method name="Int64 op_Implicit(Nullable`1)" attrs="2198">\r
- <size>44</size>\r
- </method>\r
- <method name="Nullable`1 op_Implicit(Int64)" attrs="2198">\r
- <size>21</size>\r
- </method>\r
<method name="Void .ctor(IrishBeer)" attrs="6278">\r
<size>9</size>\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Int32 Beer(Nullable`1)" attrs="145">\r
- <size>72</size>\r
- </method>\r
<method name="Int64 PubToLong(IrishPub)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Test(Nullable`1)" attrs="145">\r
- <size>62</size>\r
- </method>\r
- <method name="Int32 TestWithNull(Nullable`1)" attrs="145">\r
- <size>78</size>\r
- </method>\r
- <method name="Nullable`1 Foo(Boolean)" attrs="145">\r
- <size>37</size>\r
- </method>\r
<method name="Int32 Test(Boolean)" attrs="145">\r
<size>72</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-270.cs">\r
+ <type name="IrishPub">\r
+ <method name="Int64 op_Implicit(System.Nullable`1[IrishPub])" attrs="2198">\r
+ <size>44</size>\r
+ </method>\r
+ <method name="System.Nullable`1[IrishPub] op_Implicit(Int64)" attrs="2198">\r
+ <size>21</size>\r
+ </method>\r
+ </type>\r
<type name="X">\r
- <method name="Int32 Test(Nullable`1)" attrs="145">\r
+ <method name="Int32 Beer(System.Nullable`1[IrishPub])" attrs="145">\r
+ <size>72</size>\r
+ </method>\r
+ <method name="Int32 Test(System.Nullable`1[System.Int32])" attrs="145">\r
<size>62</size>\r
</method>\r
+ <method name="Int32 TestWithNull(System.Nullable`1[System.Int32])" attrs="145">\r
+ <size>78</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Int64] Foo(Boolean)" attrs="145">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-270.cs">\r
+ <type name="X">\r
<method name="Int32 Main()" attrs="150">\r
<size>60</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Int32 Test(System.Nullable`1[System.Int32])" attrs="145">\r
+ <size>62</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-271.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Qux`2[X,V]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[V] GetEnumerator()" attrs="486">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-272.cs">\r
<type name="Handler`1[T]">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="Void Main()" attrs="150">\r
- <size>448</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S">\r
+ <method name="System.Nullable`1[System.Boolean] op_Implicit(S)" attrs="2198">\r
+ <size>12</size>\r
+ </method>\r
+ </type>\r
+ <type name="X">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>612</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-275.cs">\r
<type name="Test">\r
</method>\r
</type>\r
<type name="Tests+GenericClass`1[T]">\r
- <method name="T Z(IList`1, Int32)" attrs="150">\r
- <size>16</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="T Z(System.Collections.Generic.IList`1[T], Int32)" attrs="150">\r
+ <size>16</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-277.cs">\r
<method name="Void Bar()" attrs="486">\r
<size>12</size>\r
</method>\r
- <method name="IList`1 Bar[T]()" attrs="486">\r
- <size>20</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo">\r
+ <method name="System.Collections.Generic.IList`1[T] Bar[T]()" attrs="486">\r
+ <size>20</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-280.cs">\r
<type name="Test">\r
</test>\r
<test name="gtest-281.cs">\r
<type name="List">\r
- <method name="Void AddRange[T](ICollection`1)" attrs="131">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="List">\r
+ <method name="Void AddRange[T](System.Collections.Generic.ICollection`1[T])" attrs="131">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-282.cs">\r
<type name="Foo">\r
</method>\r
</type>\r
<type name="CollectionTester">\r
- <method name="Int32 Test[T](IList`1)" attrs="145">\r
- <size>95</size>\r
- </method>\r
<method name="Int32 Test()" attrs="150">\r
<size>628</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="CollectionTester">\r
+ <method name="Int32 Test[T](System.Collections.Generic.IList`1[T])" attrs="145">\r
+ <size>95</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-285.cs">\r
<type name="A">\r
<method name="Void Main()" attrs="150">\r
<size>23</size>\r
</method>\r
- <method name="System.String Test2(Nullable`1)" attrs="145">\r
- <size>14</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.String Test2(System.Nullable`1[System.Decimal])" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-292.cs">\r
<method name="Void Invalid(T)" attrs="134">\r
<size>22</size>\r
</method>\r
- <method name="Void Other(IEnumerable`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test`1[T]">\r
+ <method name="Void Other(System.Collections.Generic.IEnumerable`1[T])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-294.cs">\r
<type name="A">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-303.cs">\r
<type name="test.BaseClass">\r
</test>\r
<test name="gtest-310.cs">\r
<type name="MonoBugs.IncompleteGenericInference">\r
- <method name="Void DoSomethingGeneric[T1,T2](IEnumerable`1, IDictionary`2)" attrs="150">\r
- <size>2</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>21</size>\r
</method>\r
+ <method name="Void DoSomethingGeneric[T1,T2](System.Collections.Generic.IEnumerable`1[T1], System.Collections.Generic.IDictionary`2[T1,T2])" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-312.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Temp`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Temp`1+Foo[T]] GetEnumerator()" attrs="486">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-320.cs">\r
<type name="Foo`1[K]">\r
</test>\r
<test name="gtest-330.cs">\r
<type name="BaseCollection`1[T]">\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>25</size>\r
- </method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>25</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="BaseCollection`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>25</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-331.cs">\r
<type name="Foo`1[T]">\r
<method name="Void Main()" attrs="150">\r
<size>14</size>\r
</method>\r
- <method name="Void Foo[T](IList`1)" attrs="145">\r
- <size>26</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="FooList`1[T]">\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>7</size>\r
- </method>\r
<method name="Int32 IndexOf(T)" attrs="486">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Void Foo[T](System.Collections.Generic.IList`1[T])" attrs="145">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="FooList`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-339.cs">\r
<type name="Program">\r
<method name="Void SerializeDictionary(IDictionary)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void SerializeDictionary(IDictionary`2)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="SerializerLazyDictionary">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="196">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="Boolean System.Collections.Generic.IDictionary<string,object>.ContainsKey(System.String)" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="ICollection`1 System.Collections.Generic.IDictionary<string,object>.get_Keys()" attrs="2529">\r
- <size>7</size>\r
- </method>\r
<method name="Boolean System.Collections.Generic.IDictionary<string,object>.Remove(System.String)" attrs="481">\r
<size>7</size>\r
</method>\r
<method name="Boolean System.Collections.Generic.IDictionary<string,object>.TryGetValue(System.String, System.Object ByRef)" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="ICollection`1 System.Collections.Generic.IDictionary<string,object>.get_Values()" attrs="2529">\r
- <size>7</size>\r
- </method>\r
<method name="System.Object System.Collections.Generic.IDictionary<string,object>.get_Item(System.String)" attrs="2529">\r
<size>7</size>\r
</method>\r
<method name="Void System.Collections.Generic.IDictionary<string,object>.set_Item(System.String, System.Object)" attrs="2529">\r
<size>7</size>\r
</method>\r
- <method name="Void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Add(KeyValuePair`2)" attrs="481">\r
- <size>7</size>\r
- </method>\r
<method name="Void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Clear()" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="Boolean System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Contains(KeyValuePair`2)" attrs="481">\r
- <size>7</size>\r
- </method>\r
<method name="Void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.CopyTo(System.Collections.Generic.KeyValuePair`2[System.String,System.Object][], Int32)" attrs="481">\r
<size>7</size>\r
</method>\r
<method name="Boolean System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.get_IsReadOnly()" attrs="2529">\r
<size>7</size>\r
</method>\r
- <method name="Boolean System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Remove(KeyValuePair`2)" attrs="481">\r
+ <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>.GetEnumerator()" attrs="481">\r
- <size>15</size>\r
+ </type>\r
+ <type name="Program">\r
+ <method name="Void SerializeDictionary(System.Collections.Generic.IDictionary`2[System.String,System.Object])" attrs="145">\r
+ <size>2</size>\r
</method>\r
- <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
- <size>15</size>\r
+ </type>\r
+ <type name="SerializerLazyDictionary">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]] GetEnumerator()" attrs="196">\r
+ <size>10</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="1476">\r
- <size>0</size>\r
+ </type>\r
+ <type name="LazyDictionary">\r
+ <method name="System.Collections.Generic.ICollection`1[System.String] System.Collections.Generic.IDictionary<string,object>.get_Keys()" attrs="2529">\r
+ <size>7</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6276">\r
+ <method name="System.Collections.Generic.ICollection`1[System.Object] System.Collections.Generic.IDictionary<string,object>.get_Values()" attrs="2529">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Void System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Add(System.Collections.Generic.KeyValuePair`2[System.String,System.Object])" attrs="481">\r
<size>7</size>\r
</method>\r
+ <method name="Boolean System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Contains(System.Collections.Generic.KeyValuePair`2[System.String,System.Object])" attrs="481">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Boolean System.Collections.Generic.ICollection<System.Collections.Generic.KeyValuePair<string,object>>.Remove(System.Collections.Generic.KeyValuePair`2[System.String,System.Object])" attrs="481">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]] System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<string,object>>.GetEnumerator()" attrs="481">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]] GetEnumerator()" attrs="1476">\r
+ <size>0</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-340.cs">\r
<method name="IEnumerable Enumerable(Int32)" attrs="134">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerable`1 Enumerable[T](System.String)" attrs="134">\r
- <size>7</size>\r
- </method>\r
<method name="IEnumerable Enumerable(System.String)" attrs="134">\r
<size>7</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Enumerable[T](System.String)" attrs="134">\r
+ <size>7</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-348.cs">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="S2">\r
- <method name="Boolean op_Equality(S2, Nullable`1)" attrs="2198">\r
- <size>7</size>\r
- </method>\r
- <method name="Boolean op_Inequality(S2, Nullable`1)" attrs="2198">\r
- <size>7</size>\r
- </method>\r
- </type>\r
<type name="S3">\r
<method name="Decimal op_Inequality(S3, System.Object)" attrs="2198">\r
<size>15</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S2">\r
+ <method name="Boolean op_Equality(S2, System.Nullable`1[S2])" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Boolean op_Inequality(S2, System.Nullable`1[S2])" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-359.cs">\r
<type name="BaseGeneric`1[T]">\r
</method>\r
</type>\r
<type name="BugReport.A">\r
- <method name="Nullable`1 get_Counter()" attrs="2182">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Int32] get_Counter()" attrs="2182">\r
<size>15</size>\r
</method>\r
- <method name="Void set_Counter(Nullable`1)" attrs="2182">\r
+ <method name="Void set_Counter(System.Nullable`1[System.Int32])" attrs="2182">\r
<size>9</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-365.cs">\r
<method name="IList Query()" attrs="486">\r
<size>10</size>\r
</method>\r
- <method name="IList`1 Query[Extent](IList`1, IList`1)" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Db4objects.Db4o.Internal.ObjectContainerBase">\r
+ <method name="System.Collections.Generic.IList`1[Extent] Query[Extent](System.Collections.Generic.IList`1[Extent], System.Collections.Generic.IList`1[Extent])" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-370.cs">\r
<type name="N2.X`1[T]">\r
</type>\r
</test>\r
<test name="gtest-376.cs">\r
- <type name="S`1[T]">\r
- <method name="System.Object Box(Nullable`1)" attrs="145">\r
- <size>43</size>\r
- </method>\r
- </type>\r
<type name="C">\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S`1[T]">\r
+ <method name="System.Object Box(System.Nullable`1[T])" attrs="145">\r
+ <size>43</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-377.cs">\r
<type name="D">\r
<method name="Void Main()" attrs="150">\r
- <size>92</size>\r
+ <size>68</size>\r
</method>\r
<method name="Void .cctor()" attrs="6289">\r
<size>26</size>\r
</test>\r
<test name="gtest-378.cs">\r
<type name="Test">\r
- <method name="System.Object Foo(Nullable`1)" attrs="145">\r
- <size>15</size>\r
- </method>\r
- <method name="System.Object FooG[T](Nullable`1)" attrs="145">\r
- <size>15</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>76</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Object Foo(System.Nullable`1[System.Int32])" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Object FooG[T](System.Nullable`1[T])" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-379.cs">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="Int32 Print(Nullable`1)" attrs="145">\r
- <size>29</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>23</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Int32 Print(System.Nullable`1[S])" attrs="145">\r
+ <size>29</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-380.cs">\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>71</size>\r
</method>\r
- <method name="IEnumerable`1 setX()" attrs="145">\r
- <size>23</size>\r
- </method>\r
- <method name="IEnumerable`1 test()" attrs="145">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<bool>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>115</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<bool>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>189</size>\r
</method>\r
<size>9</size>\r
</method>\r
</type>\r
+ <type name="TestGoto">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] setX()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] test()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestGoto+<setX>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable<bool>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestGoto+<test>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Boolean] System.Collections.Generic.IEnumerable<bool>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-382.cs">\r
<type name="C">\r
</type>\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
- <size>279</size>\r
+ <size>298</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<test name="gtest-389.cs">\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
- <size>261</size>\r
+ <size>253</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</test>\r
<test name="gtest-392.cs">\r
<type name="DieSubrangeType">\r
- <method name="Nullable`1 get_UpperBound()" attrs="2182">\r
- <size>14</size>\r
- </method>\r
- <method name="Void set_UpperBound(Nullable`1)" attrs="2177">\r
- <size>8</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>20</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="DieSubrangeType">\r
+ <method name="System.Nullable`1[System.Int32] get_UpperBound()" attrs="2182">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="Void set_UpperBound(System.Nullable`1[System.Int32])" attrs="2177">\r
+ <size>8</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-393.cs">\r
<type name="B`1[T]">\r
</test>\r
<test name="gtest-397.cs">\r
<type name="Foo">\r
- <method name="Foo op_UnaryNegation(Nullable`1)" attrs="2198">\r
- <size>55</size>\r
- </method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
<size>9</size>\r
</method>\r
</type>\r
<type name="Bar">\r
- <method name="Nullable`1 op_UnaryNegation(Nullable`1)" attrs="2198">\r
- <size>54</size>\r
- </method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
<size>9</size>\r
</method>\r
<method name="Foo NegateFoo(Foo)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="Foo NegateFooNullable(Nullable`1)" attrs="145">\r
- <size>15</size>\r
- </method>\r
- <method name="Nullable`1 NegateBarNullable(Nullable`1)" attrs="145">\r
- <size>15</size>\r
- </method>\r
- <method name="Nullable`1 NegateBar(Bar)" attrs="145">\r
- <size>20</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>168</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo">\r
+ <method name="Foo op_UnaryNegation(System.Nullable`1[Foo])" attrs="2198">\r
+ <size>55</size>\r
+ </method>\r
+ </type>\r
+ <type name="Bar">\r
+ <method name="System.Nullable`1[Bar] op_UnaryNegation(System.Nullable`1[Bar])" attrs="2198">\r
+ <size>54</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test">\r
+ <method name="Foo NegateFooNullable(System.Nullable`1[Foo])" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Nullable`1[Bar] NegateBarNullable(System.Nullable`1[Bar])" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Nullable`1[Bar] NegateBar(Bar)" attrs="145">\r
+ <size>20</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-398.cs">\r
<type name="ToStr">\r
</type>\r
<type name="NullableColorTests">\r
<method name="Int32 Main()" attrs="150">\r
- <size>117</size>\r
+ <size>120</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<method name="Void Test_2()" attrs="129">\r
<size>32</size>\r
</method>\r
- <method name="Nullable`1 Test_3[T](System.Func`3[T,T,T], T)" attrs="129">\r
- <size>22</size>\r
- </method>\r
<method name="Void Test_4(Boolean, Boolean)" attrs="129">\r
<size>40</size>\r
</method>\r
<method name="Void Test_13(System.Object)" attrs="129">\r
<size>53</size>\r
</method>\r
- <method name="Nullable`1 Test_14()" attrs="129">\r
- <size>68</size>\r
- </method>\r
<method name="System.Action`1[System.Int32] Test_15(System.Action`1[System.Int32])" attrs="129">\r
<size>46</size>\r
</method>\r
<method name="Void Helper[T](T)" attrs="145">\r
<size>2</size>\r
</method>\r
+ <method name="System.Nullable`1[T] Test_3[T](System.Func`3[T,T,T], T)" attrs="129">\r
+ <size>22</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Int32] Test_14()" attrs="129">\r
+ <size>68</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-410.cs">\r
<method name="Int32 Main()" attrs="150">\r
<size>31</size>\r
</method>\r
- <method name="Nullable`1 get_Id()" attrs="2177">\r
- <size>15</size>\r
- </method>\r
<method name="Boolean Test()" attrs="129">\r
<size>59</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Nullable`1[System.Int32] get_Id()" attrs="2177">\r
+ <size>15</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-423.cs">\r
<method name="Void Block(A[])" attrs="150">\r
<size>7</size>\r
</method>\r
- <method name="Void Block(IEnumerable`1, A[])" attrs="150">\r
- <size>2</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>37</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Block(System.Collections.Generic.IEnumerable`1[B], A[])" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-425.cs">\r
</test>\r
<test name="gtest-426.cs">\r
<type name="OverloadTest.MyClass`1[T]">\r
- <method name="Boolean Method(MyInterface`1)" attrs="134">\r
- <size>28</size>\r
- </method>\r
<method name="Boolean Method(System.Action`1[T])" attrs="134">\r
<size>10</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="OverloadTest.MyClass`1[T]">\r
+ <method name="Boolean Method(OverloadTest.MyInterface`1[T])" attrs="134">\r
+ <size>28</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-427.cs">\r
<type name="EventHandler">\r
</method>\r
</type>\r
<type name="Klass">\r
- <method name="Nullable`1 get_Value()" attrs="2182">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor(Nullable`1)" attrs="6278">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Klass">\r
+ <method name="System.Nullable`1[CInt] get_Value()" attrs="2182">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-429.cs">\r
<type name="CInt">\r
</method>\r
</type>\r
<type name="Driver">\r
- <method name="Nullable`1 get_Prop()" attrs="2182">\r
- <size>50</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>50</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Nullable`1[System.Int32] get_Prop()" attrs="2182">\r
+ <size>50</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-431.cs">\r
<test name="gtest-435.cs">\r
<type name="testcase.Program">\r
<method name="Int32 Main()" attrs="150">\r
- <size>293</size>\r
+ <size>371</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
- <method name="Void Foo[U](IEnumerable`1)" attrs="486">\r
- <size>2</size>\r
- </method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Impl`1[T]">\r
+ <method name="Void Foo[U](System.Collections.Generic.IEnumerable`1[U])" attrs="486">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-449.cs">\r
<type name="Program">\r
<method name="Single op_Implicit(S)" attrs="2198">\r
<size>12</size>\r
</method>\r
- <method name="Nullable`1 op_Implicit(S)" attrs="2198">\r
+ <method name="System.Nullable`1[System.Single] op_Implicit(S)" attrs="2198">\r
<size>19</size>\r
</method>\r
</type>\r
</test>\r
<test name="gtest-468.cs">\r
<type name="TS">\r
- <method name="Nullable`1 get_v()" attrs="2182">\r
- <size>15</size>\r
- </method>\r
- <method name="Nullable`1 op_Implicit(TS)" attrs="2198">\r
- <size>15</size>\r
- </method>\r
- <method name="TS op_Implicit(Nullable`1)" attrs="2198">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>56</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Nullable`1[System.Int32] get_v()" attrs="2182">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Int32] op_Implicit(TS)" attrs="2198">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="TS op_Implicit(System.Nullable`1[System.Int32])" attrs="2198">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-469.cs">\r
</test>\r
<test name="gtest-476.cs">\r
<type name="Test`1[T]">\r
- <method name="B First()" attrs="134">\r
- <size>18</size>\r
- </method>\r
<method name="IFoo Second()" attrs="134">\r
<size>23</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test`1[T]">\r
+ <method name="Test`1+B[T] First()" attrs="134">\r
+ <size>18</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-477.cs">\r
<type name="B`1[T]">\r
</method>\r
</type>\r
<type name="M">\r
- <method name="Void Test[T](I`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>22</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Test[T](I`1[T])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-480.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
- <method name="Void AddRange(IMyCollection`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
- <method name="Void AddRange(IEnumerable`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Int32 get_Count()" attrs="2534">\r
<size>10</size>\r
</method>\r
<method name="Boolean Remove(T)" attrs="486">\r
<size>10</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>21</size>\r
</method>\r
</type>\r
+ <type name="MyCollection`1[T]">\r
+ <method name="Void AddRange(IMyCollection`1[T])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void AddRange(System.Collections.Generic.IEnumerable`1[T])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-487.cs">\r
<type name="Limada.MonoTests.Generics.MultiDictionary`3[K,V,TDictionary]">\r
</test>\r
<test name="gtest-490.cs">\r
<type name="Foo">\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Foo>.GetEnumerator()" attrs="481">\r
- <size>25</size>\r
- </method>\r
<method name="IEnumerator GetEnumerator()" attrs="486">\r
<size>25</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>18</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[Foo] System.Collections.Generic.IEnumerable<Foo>.GetEnumerator()" attrs="481">\r
+ <size>25</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-491.cs">\r
<method name="Int32 Test(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="R Method[T,R](IEnumerable`1, System.Func`2[T,R])" attrs="145">\r
- <size>24</size>\r
- </method>\r
- <method name="R Method2[T,R](IEnumerable`1, System.Func`2[System.Collections.Generic.List`1[T],R])" attrs="145">\r
- <size>16</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>125</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="R Method[T,R](System.Collections.Generic.IEnumerable`1[T], System.Func`2[T,R])" attrs="145">\r
+ <size>24</size>\r
+ </method>\r
+ <method name="R Method2[T,R](System.Collections.Generic.IEnumerable`1[T], System.Func`2[System.Collections.Generic.List`1[T],R])" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-506.cs">\r
</test>\r
<test name="gtest-515.cs">\r
<type name="A">\r
- <method name="I`1 Foo[T]()" attrs="454">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="AA">\r
- <method name="I`1 Foo[V]()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="Void Dispose()" attrs="486">\r
<size>2</size>\r
</method>\r
- <method name="I`1 Foo[R]()" attrs="198">\r
- <size>15</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>13</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="A">\r
+ <method name="I`1[T] Foo[T]()" attrs="454">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="AA">\r
+ <method name="I`1[V] Foo[V]()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="B">\r
+ <method name="I`1[R] Foo[R]()" attrs="198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-516.cs">\r
<type name="B">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<A>.GetEnumerator()" attrs="481">\r
- <size>24</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerator`1[A] System.Collections.Generic.IEnumerable<A>.GetEnumerator()" attrs="481">\r
+ <size>24</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-521.cs">\r
<type name="D">\r
<method name="Boolean Equals(T)" attrs="486">\r
<size>10</size>\r
</method>\r
- <method name="Boolean Equals(TestClass4`1)" attrs="486">\r
+ <method name="Int32 GetHashCode()" attrs="198">\r
<size>10</size>\r
</method>\r
- <method name="Boolean Equals(TestClass4`1, TestClass4`1)" attrs="486">\r
- <size>17</size>\r
- </method>\r
- <method name="Int32 GetHashCode(TestClass4`1)" attrs="486">\r
- <size>22</size>\r
+ <method name="Boolean Equals(System.Object)" attrs="198">\r
+ <size>10</size>\r
</method>\r
- <method name="Int32 GetHashCode()" attrs="198">\r
+ </type>\r
+ <type name="Test.C">\r
+ <method name="Void Main()" attrs="150">\r
<size>10</size>\r
</method>\r
- <method name="Boolean Equals(System.Object)" attrs="198">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.TestClass4`1[T]">\r
+ <method name="Boolean Equals(Test.TestClass4`1[T])" attrs="486">\r
<size>10</size>\r
</method>\r
- <method name="Boolean op_Equality(TestClass4`1, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean Equals(Test.TestClass4`1[T], Test.TestClass4`1[T])" attrs="486">\r
+ <size>17</size>\r
+ </method>\r
+ <method name="Int32 GetHashCode(Test.TestClass4`1[T])" attrs="486">\r
+ <size>22</size>\r
+ </method>\r
+ <method name="Boolean op_Equality(Test.TestClass4`1[T], Test.TestClass4`1[T])" attrs="2198">\r
<size>17</size>\r
</method>\r
- <method name="Boolean op_Equality(T, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean op_Equality(T, Test.TestClass4`1[T])" attrs="2198">\r
<size>17</size>\r
</method>\r
- <method name="Boolean op_Equality(TestClass4`1, T)" attrs="2198">\r
+ <method name="Boolean op_Equality(Test.TestClass4`1[T], T)" attrs="2198">\r
<size>17</size>\r
</method>\r
- <method name="Boolean op_Equality(System.Object, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean op_Equality(System.Object, Test.TestClass4`1[T])" attrs="2198">\r
<size>23</size>\r
</method>\r
- <method name="Boolean op_Equality(TestClass4`1, System.Object)" attrs="2198">\r
+ <method name="Boolean op_Equality(Test.TestClass4`1[T], System.Object)" attrs="2198">\r
<size>23</size>\r
</method>\r
- <method name="Boolean op_Inequality(TestClass4`1, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean op_Inequality(Test.TestClass4`1[T], Test.TestClass4`1[T])" attrs="2198">\r
<size>19</size>\r
</method>\r
- <method name="Boolean op_Inequality(T, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean op_Inequality(T, Test.TestClass4`1[T])" attrs="2198">\r
<size>19</size>\r
</method>\r
- <method name="Boolean op_Inequality(TestClass4`1, T)" attrs="2198">\r
+ <method name="Boolean op_Inequality(Test.TestClass4`1[T], T)" attrs="2198">\r
<size>19</size>\r
</method>\r
- <method name="Boolean op_Inequality(System.Object, TestClass4`1)" attrs="2198">\r
+ <method name="Boolean op_Inequality(System.Object, Test.TestClass4`1[T])" attrs="2198">\r
<size>19</size>\r
</method>\r
- <method name="Boolean op_Inequality(TestClass4`1, System.Object)" attrs="2198">\r
+ <method name="Boolean op_Inequality(Test.TestClass4`1[T], System.Object)" attrs="2198">\r
<size>19</size>\r
</method>\r
</type>\r
- <type name="Test.C">\r
- <method name="Void Main()" attrs="150">\r
- <size>10</size>\r
- </method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
- </type>\r
</test>\r
<test name="gtest-524.cs">\r
<type name="C">\r
</test>\r
<test name="gtest-534.cs">\r
<type name="A">\r
- <method name="Void Method(IG`1)" attrs="486">\r
- <size>2</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>21</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Method(IG`1[System.Double[][]])" attrs="486">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-535.cs">\r
</method>\r
</type>\r
<type name="S">\r
- <method name="System.String op_BitwiseOr(S, Nullable`1)" attrs="2198">\r
+ <method name="System.String op_BitwiseOr(S, System.Nullable`1[S])" attrs="2198">\r
<size>14</size>\r
</method>\r
- <method name="Nullable`1 op_Addition(S, Nullable`1)" attrs="2198">\r
+ <method name="System.Nullable`1[System.Int32] op_Addition(S, System.Nullable`1[S])" attrs="2198">\r
<size>16</size>\r
</method>\r
</type>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor(Int32)" attrs="6278">\r
<size>2</size>\r
</method>\r
</type>\r
- <type name="S2">\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>23</size>\r
- </method>\r
- </type>\r
<type name="Enumerator`1[T]">\r
<method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">\r
<size>7</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] GetEnumerator()" attrs="486">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="S2">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] GetEnumerator()" attrs="134">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-539.cs">\r
<type name="S">\r
<method name="C op_Explicit(S)" attrs="2198">\r
<size>12</size>\r
</method>\r
- <method name="C op_Explicit(Nullable`1)" attrs="2198">\r
- <size>47</size>\r
- </method>\r
<method name="Void .ctor(Int32)" attrs="6273">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="C op_Explicit(System.Nullable`1[S])" attrs="2198">\r
+ <size>47</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-540.cs">\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
- <size>964</size>\r
+ <size>762</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<size>10</size>\r
</method>\r
<method name="Int32 Main()" attrs="150">\r
- <size>128</size>\r
+ <size>353</size>\r
</method>\r
</type>\r
</test>\r
<size>20</size>\r
</method>\r
</type>\r
- <type name="Foo.Magic`1[T]">\r
- <method name="Void Upsample(IUpDown)" attrs="150">\r
- <size>9</size>\r
- </method>\r
- </type>\r
<type name="Foo.Instance">\r
<method name="Int32 get_DestinationDimension()" attrs="2534">\r
<size>10</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo.Magic`1[T]">\r
+ <method name="Void Upsample(Foo.Magic`1+IUpDown[T])" attrs="150">\r
+ <size>9</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-551.cs">\r
<type name="Base`1[T]">\r
<method name="Void Foo[T](T)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void Test(Nullable`1)" attrs="150">\r
- <size>20</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C`1[U]">\r
+ <method name="Void Test(System.Nullable`1[S])" attrs="150">\r
+ <size>20</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-564.cs">\r
<type name="B1`2[T1,T2]">\r
</method>\r
</type>\r
<type name="C`1[T]">\r
- <method name="C`1 op_Implicit(T)" attrs="2198">\r
+ <method name="C`1[T] op_Implicit(T)" attrs="2198">\r
<size>18</size>\r
</method>\r
</type>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>7</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int16] GetEnumerator()" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-573.cs">\r
</method>\r
</type>\r
<type name="CA`1[T]">\r
- <method name="IB`1 IB<T>.Backwards()" attrs="481">\r
- <size>10</size>\r
- </method>\r
- <method name="IA`1 Backwards()" attrs="1478">\r
- <size>0</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="CA`1[T]">\r
+ <method name="IA`1[T] Backwards()" attrs="1478">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="IB`1[T] IB<T>.Backwards()" attrs="481">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-574.cs">\r
<type name="TestClass`1[T1]">\r
<method name="Void Test()" attrs="129">\r
<size>11</size>\r
</method>\r
- <method name="Void Foo[U](IEnumerable`1)" attrs="134">\r
- <size>2</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</method>\r
</type>\r
<type name="DirectedCollectionBase`1[T3]">\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T3>.GetEnumerator()" attrs="481">\r
- <size>10</size>\r
- </method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
</method>\r
</type>\r
<type name="EnumerableBase`1[T6]">\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T6>.GetEnumerator()" attrs="481">\r
- <size>10</size>\r
- </method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>10</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="TestClass`1[T1]">\r
+ <method name="Void Foo[U](System.Collections.Generic.IEnumerable`1[U])" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
+ <type name="DirectedCollectionBase`1[T3]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T3] System.Collections.Generic.IEnumerable<T3>.GetEnumerator()" attrs="481">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="EnumerableBase`1[T6]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T6] System.Collections.Generic.IEnumerable<T6>.GetEnumerator()" attrs="481">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-575.cs">\r
<type name="C`1[T1]">\r
</test>\r
<test name="gtest-576.cs">\r
<type name="A">\r
- <method name="Void IA.f[T1](IParam`1)" attrs="481">\r
- <size>2</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>8</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void IA.f[T1](IParam`1[T1])" attrs="481">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-577.cs">\r
</test>\r
<test name="gtest-578.cs">\r
<type name="X">\r
- <method name="I`1 Test[T,TR](I`1, System.Func`2[I`1[T],TR])" attrs="150">\r
- <size>10</size>\r
- </method>\r
- <method name="U First[U](I`1)" attrs="150">\r
- <size>18</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>44</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="I`1[TR] Test[T,TR](I`1[T], System.Func`2[I`1[T],TR])" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="U First[U](I`1[U])" attrs="150">\r
+ <size>18</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-579.cs">\r
</method>\r
</type>\r
</test>\r
+ <test name="gtest-584.cs">\r
+ <type name="S">\r
+ <method name="Boolean op_Equality(S, S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Boolean op_Inequality(S, S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>531</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S">\r
+ <method name="System.Nullable`1[System.Int32] op_Implicit(S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="System.Nullable`1[E] op_Implicit(S)" attrs="2198">\r
+ <size>18</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-585.cs">\r
+ <type name="S">\r
+ <method name="Int32 op_Implicit(S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S3">\r
+ <method name="System.String op_Implicit(S3)" attrs="2198">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>436</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S2">\r
+ <method name="System.Nullable`1[System.Int32] op_Implicit(S2)" attrs="2198">\r
+ <size>19</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.UInt32] op_Implicit(S2)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-586.cs">\r
+ <type name="S">\r
+ <method name="Boolean op_Equality(S, S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Boolean op_Inequality(S, S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S2">\r
+ <method name="Boolean op_Equality(S2, S2)" attrs="2198">\r
+ <size>22</size>\r
+ </method>\r
+ <method name="Boolean op_Inequality(S2, S2)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>661</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S3">\r
+ <method name="System.Nullable`1[System.Int32] op_Implicit(S3)" attrs="2198">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-587.cs">\r
+ <type name="S">\r
+ <method name="System.String op_Implicit(S)" attrs="2198">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="E op_Implicit(S)" attrs="2198">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>139</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="S">\r
+ <method name="System.Nullable`1[System.Int16] op_Implicit(S)" attrs="2198">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-588.cs">\r
+ <type name="S">\r
+ <method name="System.Nullable`1[System.Int16] op_Implicit(S)" attrs="2198">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="Int16 op_Implicit(S)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Program">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>246</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="gtest-anontype-01.cs">\r
<type name="Test">\r
<method name="Int32 Main()" attrs="150">\r
</test>\r
<test name="gtest-anontype-13.cs">\r
<type name="Test">\r
- <method name="IEnumerable`1 Select[T](System.Array, System.Func`2[System.Object,T])" attrs="150">\r
- <size>37</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>182</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>211</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Select[T](System.Array, System.Func`2[System.Object,T])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Select>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-autoproperty-01.cs">\r
<type name="Test">\r
<size>239</size>\r
</method>\r
<method name="Void ConvertTest_7()" attrs="129">\r
- <size>123</size>\r
+ <size>108</size>\r
</method>\r
<method name="Void ConvertTest_8()" attrs="129">\r
<size>119</size>\r
<size>170</size>\r
</method>\r
<method name="Void EqualTest_11()" attrs="129">\r
- <size>133</size>\r
+ <size>148</size>\r
</method>\r
<method name="Void EqualTest_12()" attrs="129">\r
<size>128</size>\r
<size>125</size>\r
</method>\r
<method name="Void EqualTest_14()" attrs="129">\r
- <size>102</size>\r
+ <size>132</size>\r
</method>\r
<method name="Void EqualTest_15()" attrs="129">\r
<size>160</size>\r
<size>198</size>\r
</method>\r
<method name="Void ExclusiveOrTest_8()" attrs="129">\r
- <size>164</size>\r
+ <size>179</size>\r
</method>\r
<method name="Void GreaterThanTest()" attrs="129">\r
<size>100</size>\r
<size>170</size>\r
</method>\r
<method name="Void NotEqualTest_11()" attrs="129">\r
- <size>133</size>\r
+ <size>148</size>\r
</method>\r
<method name="Void OrTest()" attrs="129">\r
<size>142</size>\r
</type>\r
<type name="Tester">\r
<method name="Void LessThanTest_9()" attrs="129">\r
- <size>199</size>\r
+ <size>184</size>\r
</method>\r
</type>\r
</test>\r
<test name="gtest-etree-03.cs">\r
<type name="S`1[T]">\r
<method name="Int32 Test()" attrs="150">\r
- <size>164</size>\r
+ <size>139</size>\r
</method>\r
</type>\r
<type name="C">\r
</type>\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
- <size>394</size>\r
+ <size>495</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo">\r
+ <method name="Foo op_Addition(Foo, Foo)" attrs="2198">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-etree-05.cs">\r
<type name="C">\r
</test>\r
<test name="gtest-etree-10.cs">\r
<type name="Foo`1[T]">\r
- <method name="Boolean ContainsAll[U](IEnumerable`1)" attrs="134">\r
- <size>200</size>\r
- </method>\r
<method name="Boolean Contains(T)" attrs="134">\r
<size>10</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo`1[T]">\r
+ <method name="Boolean ContainsAll[U](System.Collections.Generic.IEnumerable`1[U])" attrs="134">\r
+ <size>200</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-etree-11.cs">\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
<size>66</size>\r
</method>\r
- <method name="IEnumerable`1 Test[T](Int32)" attrs="145">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>148</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Program">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test[T](Int32)" attrs="145">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Program+<Test>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-etree-14.cs">\r
<type name="Person">\r
<method name="Int32 Main()" attrs="150">\r
<size>67</size>\r
</method>\r
- <method name="IEnumerable`1 GetPersons[T](IEnumerable`1, Int32)" attrs="145">\r
- <size>37</size>\r
- </method>\r
<method name="Boolean Test[T](T, System.Linq.Expressions.Expression`1[System.Func`2[T,System.Boolean]])" attrs="145">\r
<size>21</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>336</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Repro">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] GetPersons[T](System.Collections.Generic.IEnumerable`1[T], Int32)" attrs="145">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="Repro+<GetPersons>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-etree-15.cs">\r
<type name="Foo">\r
</test>\r
<test name="gtest-exmethod-07.cs">\r
<type name="E">\r
- <method name="Void ToReadOnly[T](IEnumerable`1)" attrs="147">\r
- <size>2</size>\r
- </method>\r
<method name="Void To(IA)" attrs="147">\r
<size>2</size>\r
</method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
- <method name="Void Test(IEnumerable`1)" attrs="150">\r
- <size>16</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="E">\r
+ <method name="Void ToReadOnly[T](System.Collections.Generic.IEnumerable`1[T])" attrs="147">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
+ <type name="C">\r
+ <method name="Void Test(System.Collections.Generic.IEnumerable`1[System.Boolean])" attrs="150">\r
+ <size>16</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-exmethod-08.cs">\r
<type name="C">\r
</test>\r
<test name="gtest-exmethod-13.cs">\r
<type name="Foo">\r
- <method name="IEnumerable`1 Reverse[T](IEnumerable`1)" attrs="150">\r
- <size>10</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>24</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Reverse[T](System.Collections.Generic.IEnumerable`1[T])" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-exmethod-14.cs">\r
<method name="System.String Test_1(System.String)" attrs="150">\r
<size>20</size>\r
</method>\r
- <method name="Int32 Test_2[T](IEnumerable`1)" attrs="150">\r
- <size>11</size>\r
- </method>\r
</type>\r
<type name="Test">\r
<method name="Int32 Main()" attrs="150">\r
<size>0</size>\r
</method>\r
</type>\r
+ <type name="Rocks">\r
+ <method name="Int32 Test_2[T](System.Collections.Generic.IEnumerable`1[T])" attrs="150">\r
+ <size>11</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-exmethod-20.cs">\r
<type name="Outer.Inner.Test">\r
</method>\r
</type>\r
<type name="Outer.ExtensionMethods">\r
- <method name="Void AddRange[T](I, IEnumerable`1)" attrs="150">\r
+ <method name="Void AddRange[T](I, System.Collections.Generic.IEnumerable`1[T])" attrs="150">\r
<size>2</size>\r
</method>\r
</type>\r
</type>\r
</test>\r
<test name="gtest-exmethod-27.cs">\r
- <type name="Foo.Extensions">\r
- <method name="System.String AsString(IList`1)" attrs="150">\r
- <size>14</size>\r
- </method>\r
- </type>\r
<type name="Bar.Program">\r
<method name="Void Main()" attrs="150">\r
<size>18</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo.Extensions">\r
+ <method name="System.String AsString(System.Collections.Generic.IList`1[System.Byte])" attrs="150">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-exmethod-28.cs">\r
<type name="Foo">\r
<method name="Int32 get_First()" attrs="2182">\r
<size>10</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] GetEnumerator()" attrs="486">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-exmethod-31.cs">\r
<type name="N.S">\r
</test>\r
<test name="gtest-exmethod-41.cs">\r
<type name="TT">\r
- <method name="Void Method[T](IEnumerable`1, System.Func`2[T,System.Boolean])" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Void Test[U](U)" attrs="150">\r
<size>25</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="TT">\r
+ <method name="Void Method[T](System.Collections.Generic.IEnumerable`1[T], System.Func`2[T,System.Boolean])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-exmethod-42.cs">\r
<type name="C">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="ExtensionTest.Two.Extensions">\r
- <method name="Boolean Contains[T](IEnumerable`1, T)" attrs="150">\r
- <size>10</size>\r
- </method>\r
- <method name="Boolean All[T](IEnumerable`1, ExtensionTest.Two.AxFunc`2[T,System.Boolean])" attrs="150">\r
- <size>10</size>\r
- </method>\r
- </type>\r
<type name="ExtensionTest.MyClass">\r
<method name="Boolean IsCharacters(System.String, System.Char[])" attrs="150">\r
<size>27</size>\r
<size>2</size>\r
</method>\r
</type>\r
+ <type name="ExtensionTest.Two.Extensions">\r
+ <method name="Boolean Contains[T](System.Collections.Generic.IEnumerable`1[T], T)" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Boolean All[T](System.Collections.Generic.IEnumerable`1[T], ExtensionTest.Two.AxFunc`2[T,System.Boolean])" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-fixedbuffer-01.cs">\r
<type name="TestNew">\r
<method name="T get_Item(Int32)" attrs="2182">\r
<size>21</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="134">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>8</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C+ArrayReadOnlyList`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="134">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-02.cs">\r
<type name="C">\r
- <method name="IEnumerator`1 Test()" attrs="129">\r
- <size>15</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
</method>\r
</type>\r
<type name="C+<Test>c__Iterator0">\r
- <method name="KeyValuePair`2 System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,object>>.get_Current()" attrs="2529">\r
- <size>14</size>\r
- </method>\r
<method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">\r
<size>19</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Collections.Generic.KeyValuePair`2[System.String,System.Object]] Test()" attrs="129">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.KeyValuePair`2[System.String,System.Object] System.Collections.Generic.IEnumerator<System.Collections.Generic.KeyValuePair<string,object>>.get_Current()" attrs="2529">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-03.cs">\r
<type name="Test">\r
- <method name="IEnumerable`1 Annotations[T]()" attrs="134">\r
- <size>30</size>\r
- </method>\r
- <method name="IEnumerable`1 Annotations(System.Type)" attrs="134">\r
- <size>37</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>15</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>204</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>232</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Annotations[T]()" attrs="134">\r
+ <size>30</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] Annotations(System.Type)" attrs="134">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Annotations>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Annotations>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-04.cs">\r
<type name="TestClass">\r
<method name="Void ToString(System.Object)" attrs="1478">\r
<size>0</size>\r
</method>\r
- <method name="IEnumerable`1 TestEnumerator()" attrs="134">\r
- <size>30</size>\r
- </method>\r
<method name="Void Test()" attrs="134">\r
<size>9</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>38</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="TestClass">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] TestEnumerator()" attrs="134">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestClass+<TestEnumerator>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-05.cs">\r
<type name="Test">\r
<method name="Void Main()" attrs="150">\r
<size>32</size>\r
</method>\r
- <method name="IEnumerable`1 TestRoutine[T](IEnumerable`1, Foo`1[T])" attrs="150">\r
- <size>37</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>197</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-iter-06.cs">\r
- <type name="Mono.Rocks.KeyValuePair">\r
- <method name="Nullable`1 Just[TKey,TValue](TKey, TValue)" attrs="150">\r
- <size>21</size>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] TestRoutine[T](System.Collections.Generic.IEnumerable`1[T], Foo`1[T])" attrs="150">\r
+ <size>37</size>\r
</method>\r
</type>\r
- <type name="Mono.Rocks.Sequence">\r
- <method name="IEnumerable`1 Unfoldr[TSource,TResult](TSource, System.Func`2[TSource,System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TResult,TSource]]])" attrs="150">\r
- <size>16</size>\r
- </method>\r
- <method name="IEnumerable`1 CreateUnfoldrIterator[TSource,TResult](TSource, System.Func`2[TSource,System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TResult,TSource]]])" attrs="145">\r
- <size>44</size>\r
+ <type name="Test+<TestRoutine>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
</method>\r
</type>\r
+ </test>\r
+ <test name="gtest-iter-06.cs">\r
<type name="Mono.Rocks.Test">\r
<method name="Int32 Main()" attrs="150">\r
<size>128</size>\r
</method>\r
- <method name="Nullable`1 <Main>m__0(Int32)" attrs="145">\r
- <size>37</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>192</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Mono.Rocks.KeyValuePair">\r
+ <method name="System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TKey,TValue]] Just[TKey,TValue](TKey, TValue)" attrs="150">\r
+ <size>21</size>\r
+ </method>\r
+ </type>\r
+ <type name="Mono.Rocks.Sequence">\r
+ <method name="System.Collections.Generic.IEnumerable`1[TResult] Unfoldr[TSource,TResult](TSource, System.Func`2[TSource,System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TResult,TSource]]])" attrs="150">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[TResult] CreateUnfoldrIterator[TSource,TResult](TSource, System.Func`2[TSource,System.Nullable`1[System.Collections.Generic.KeyValuePair`2[TResult,TSource]]])" attrs="145">\r
+ <size>44</size>\r
+ </method>\r
+ </type>\r
+ <type name="Mono.Rocks.Test">\r
+ <method name="System.Nullable`1[System.Collections.Generic.KeyValuePair`2[System.Int32,System.Int32]] <Main>m__0(Int32)" attrs="145">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="Mono.Rocks.Sequence+<CreateUnfoldrIterator>c__Iterator0`2[TSource,TResult]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[TResult] System.Collections.Generic.IEnumerable<TResult>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-07.cs">\r
<type name="Test">\r
<method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
- <method name="Void TestFunction(IEnumerable`1)" attrs="150">\r
- <size>36</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="MySystem">\r
- <method name="IEnumerable`1 get_Items()" attrs="2182">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>35</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>197</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Void TestFunction(System.Collections.Generic.IEnumerable`1[System.String])" attrs="150">\r
+ <size>36</size>\r
+ </method>\r
+ </type>\r
+ <type name="MySystem">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] get_Items()" attrs="2182">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="MySystem+<>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-08.cs">\r
<type name="App">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>91</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-iter-09.cs">\r
<type name="Test">\r
- <method name="IEnumerable`1 Create[T](T[,])" attrs="145">\r
- <size>30</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>89</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>137</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Create[T](T[,])" attrs="145">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Create>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-10.cs">\r
<type name="Test">\r
- <method name="IEnumerable`1 FromTo(Int32, Int32)" attrs="145">\r
- <size>44</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>185</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>110</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] FromTo(Int32, Int32)" attrs="145">\r
+ <size>44</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<FromTo>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-11.cs">\r
<type name="Foo">\r
<method name="Void Add(T)" attrs="134">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 GetEnumerator()" attrs="486">\r
- <size>22</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>18</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Collection`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] GetEnumerator()" attrs="486">\r
+ <size>22</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-12.cs">\r
<type name="H">\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>2</size>\r
</method>\r
- <method name="IEnumerable`1 Merge[T](IEnumerator`1)" attrs="150">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>124</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="H">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Merge[T](System.Collections.Generic.IEnumerator`1[T])" attrs="150">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="H+<Merge>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-13.cs">\r
<type name="C`1[T]">\r
<method name="IEnumerator GetEnumerator()" attrs="134">\r
<size>20</size>\r
</method>\r
- <method name="IEnumerable`1 Filter(System.Func`2[T,System.Boolean])" attrs="134">\r
- <size>37</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>225</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Filter(System.Func`2[T,System.Boolean])" attrs="134">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="C`1+<Filter>c__Iterator0[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-14.cs">\r
<type name="A">\r
</method>\r
</type>\r
<type name="S">\r
- <method name="IEnumerable`1 GetIt()" attrs="134">\r
- <size>35</size>\r
- </method>\r
<method name="Int32 <GetHashCode>__BaseCallProxy0()" attrs="129">\r
<size>24</size>\r
</method>\r
<method name="Void set_BaseM(Int32)" attrs="2244">\r
<size>12</size>\r
</method>\r
- <method name="IEnumerable`1 GetIt()" attrs="129">\r
- <size>30</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>145</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>82</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>93</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] GetIt()" attrs="134">\r
+ <size>35</size>\r
+ </method>\r
+ </type>\r
+ <type name="X">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] GetIt()" attrs="129">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="S+<GetIt>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<GetIt>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-15.cs">\r
<type name="C`1[TFirst]">\r
- <method name="IEnumerable`1 GetEnumerable[V](IEnumerable`1)" attrs="131">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<V>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>189</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C`1[TFirst]">\r
+ <method name="System.Collections.Generic.IEnumerable`1[V] GetEnumerable[V](System.Collections.Generic.IEnumerable`1[C`1+VSlot`1[TFirst,V]])" attrs="131">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="C`1+<GetEnumerable>c__Iterator0`1[TFirst,V]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[V] System.Collections.Generic.IEnumerable<V>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-16.cs">\r
<type name="Test.Base">\r
- <method name="IEnumerable`1 GetStuff(Int32)" attrs="454">\r
- <size>30</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test.Derived">\r
- <method name="IEnumerable`1 GetStuff(Int32)" attrs="198">\r
- <size>37</size>\r
- </method>\r
- <method name="IEnumerable`1 <GetStuff>__BaseCallProxy0(Int32)" attrs="129">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6276">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test.SpecialDerived">\r
- <method name="IEnumerable`1 GetStuff(Int32)" attrs="198">\r
- <size>37</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>65</size>\r
</method>\r
- <method name="IEnumerable`1 <GetStuff>__BaseCallProxy0(Int32)" attrs="129">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>77</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>195</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>195</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test.Base">\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test.Base] GetStuff(Int32)" attrs="454">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Derived">\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test.Base] GetStuff(Int32)" attrs="198">\r
+ <size>37</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test.Base] <GetStuff>__BaseCallProxy0(Int32)" attrs="129">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.SpecialDerived">\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test.Base] GetStuff(Int32)" attrs="198">\r
+ <size>37</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test.Base] <GetStuff>__BaseCallProxy0(Int32)" attrs="129">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Base+<GetStuff>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Test.Base] System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Derived+<GetStuff>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Test.Base] System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.SpecialDerived+<GetStuff>c__Iterator2">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Test.Base] System.Collections.Generic.IEnumerable<Test.Base>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-17.cs">\r
<type name="Test">\r
- <method name="IEnumerable`1 TestMethod()" attrs="134">\r
- <size>23</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>37</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] TestMethod()" attrs="134">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<TestMethod>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-18.cs">\r
<type name="c">\r
- <method name="IEnumerable`1 func()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>57</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<char>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>78</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="c">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Char] func()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="c+<func>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Char] System.Collections.Generic.IEnumerable<char>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-19.cs">\r
<type name="IEnumerableTransform">\r
- <method name="IEnumerable`1 Transform[TOut](IEnumerable`1, IEnumerableTransform+EmitterFunc`1[TOut])" attrs="150">\r
- <size>37</size>\r
- </method>\r
<method name="IEnumerableTransform+EmitterFunc`1[TOut] Emit[TOut](TOut)" attrs="150">\r
<size>34</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<TOut>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>203</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="IEnumerableTransform">\r
+ <method name="System.Collections.Generic.IEnumerable`1[TOut] Transform[TOut](System.Collections.Generic.IEnumerable`1[System.Int32], IEnumerableTransform+EmitterFunc`1[TOut])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="IEnumerableTransform+<Transform>c__Iterator0`1[TOut]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[TOut] System.Collections.Generic.IEnumerable<TOut>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-20.cs">\r
<type name="X">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>77</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-iter-21.cs">\r
<type name="C">\r
- <method name="IEnumerable`1 Test()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>72</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Void <>__Finally0()" attrs="129">\r
<size>29</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test()" attrs="129">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-22.cs">\r
<type name="D">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="IEnumerable`1 Test()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>78</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>74</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="gtest-iter-23.cs">\r
<type name="C">\r
- <method name="IEnumerable`1 Test()" attrs="145">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test()" attrs="129">\r
<size>23</size>\r
</method>\r
- <method name="IEnumerable`1 Test_2()" attrs="145">\r
- <size>23</size>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
</method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-iter-23.cs">\r
+ <type name="C">\r
<method name="Int32 Main()" attrs="150">\r
<size>180</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>271</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>200</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test_2()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test_2>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-24.cs">\r
<type name="B">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="IEnumerable`1 Test()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>71</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>170</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-25.cs">\r
<type name="Test.Program">\r
<method name="Void Main()" attrs="150">\r
<size>61</size>\r
</method>\r
- <method name="IEnumerable`1 Test()" attrs="150">\r
- <size>23</size>\r
- </method>\r
</type>\r
<type name="Test.Program+<Test>c__Iterator0">\r
<method name="System.Object System.Collections.Generic.IEnumerator<object>.get_Current()" attrs="2529">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>143</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test.Program">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] Test()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Program+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-26.cs">\r
<type name="Test.Program">\r
<method name="Int32 Main()" attrs="150">\r
<size>51</size>\r
</method>\r
- <method name="IEnumerable`1 Test()" attrs="150">\r
- <size>23</size>\r
- </method>\r
</type>\r
<type name="Test.Program+<Test>c__Iterator0">\r
<method name="System.Object System.Collections.Generic.IEnumerator<object>.get_Current()" attrs="2529">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>72</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test.Program">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] Test()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test.Program+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-27.cs">\r
<type name="CompilerBug">\r
<method name="Void Main()" attrs="150">\r
<size>61</size>\r
</method>\r
- <method name="IEnumerable`1 Foo()" attrs="145">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>161</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="CompilerBug">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Foo()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="CompilerBug+<Foo>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-iter-28.cs">\r
<type name="A">\r
- <method name="IEnumerable`1 Test(B)" attrs="134">\r
- <size>37</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>18</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>178</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="A">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Test(B)" attrs="134">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="A+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
+ <test name="gtest-iter-29.cs">\r
+ <type name="Test">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>44</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Test2>c__Iterator0">\r
+ <method name="Int32 System.Collections.Generic.IEnumerator<int>.get_Current()" attrs="2529">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="System.Object System.Collections.IEnumerator.get_Current()" attrs="2529">\r
+ <size>19</size>\r
+ </method>\r
+ <method name="Boolean MoveNext()" attrs="486">\r
+ <size>21</size>\r
+ </method>\r
+ <method name="Void Dispose()" attrs="486">\r
+ <size>1</size>\r
+ </method>\r
+ <method name="Void Reset()" attrs="486">\r
+ <size>6</size>\r
+ </method>\r
+ <method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test2()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Test2>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-lambda-01.cs">\r
<type name="IntFunc">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="IEnumerable`1 Test[T](T)" attrs="145">\r
- <size>10</size>\r
- </method>\r
- <method name="IEnumerable`1 Test[T](Func`1[T])" attrs="145">\r
- <size>10</size>\r
- </method>\r
- <method name="IEnumerable`1 Test2[T](Func`2[T,T])" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>114</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Test[T](T)" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Test[T](Func`1[T])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Test2[T](Func`2[T,T])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-lambda-10.cs">\r
<type name="C">\r
- <method name="Void Foo[TSource](IEnumerable`1)" attrs="150">\r
- <size>2</size>\r
- </method>\r
- <method name="Void Foo[TCollection,TSource](IEnumerable`1, System.Func`2[TSource,System.Collections.Generic.IEnumerable`1[TCollection]])" attrs="150">\r
- <size>2</size>\r
- </method>\r
- <method name="Void Foo[TCollection,TSource](IEnumerable`1, System.Func`3[TSource,TCollection[],System.Collections.Generic.IEnumerable`1[TCollection]])" attrs="150">\r
- <size>2</size>\r
- </method>\r
<method name="Void Foo[TCollection,TSource](System.Func`2[TCollection[],System.Collections.Generic.IEnumerable`1[TSource]])" attrs="150">\r
<size>2</size>\r
</method>\r
</method>\r
</type>\r
<type name="C+<Main>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__0(Int32)" attrs="131">\r
- <size>15</size>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
</method>\r
- <method name="IEnumerable`1 <>m__1(Int32, System.Int32[])" attrs="131">\r
+ </type>\r
+ <type name="C">\r
+ <method name="Void Foo[TSource](System.Collections.Generic.IEnumerable`1[TSource])" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void Foo[TCollection,TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Collections.Generic.IEnumerable`1[TCollection]])" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void Foo[TCollection,TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`3[TSource,TCollection[],System.Collections.Generic.IEnumerable`1[TCollection]])" attrs="150">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Main>c__AnonStorey0">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__0(Int32)" attrs="131">\r
<size>15</size>\r
</method>\r
- <method name="IEnumerable`1 <>m__2(System.Int32[])" attrs="131">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__1(Int32, System.Int32[])" attrs="131">\r
<size>15</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__2(System.Int32[])" attrs="131">\r
+ <size>15</size>\r
</method>\r
</type>\r
</test>\r
</type>\r
</test>\r
<test name="gtest-lambda-15.cs">\r
- <type name="Enumerable">\r
- <method name="Int32 Sum[TSource](IEnumerable`1, System.Func`2[TSource,System.Int32])" attrs="150">\r
- <size>40</size>\r
- </method>\r
- <method name="TR Sum[TA,TR](IEnumerable`1, System.Func`3[TR,TA,TR])" attrs="145">\r
- <size>139</size>\r
- </method>\r
- </type>\r
<type name="Repro">\r
<method name="Int32 Main()" attrs="150">\r
<size>128</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Enumerable">\r
+ <method name="Int32 Sum[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Int32])" attrs="150">\r
+ <size>40</size>\r
+ </method>\r
+ <method name="TR Sum[TA,TR](System.Collections.Generic.IEnumerable`1[TA], System.Func`3[TR,TA,TR])" attrs="145">\r
+ <size>139</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-lambda-16.cs">\r
<type name="Repro">\r
- <method name="Void AssertFoo[T](IList`1)" attrs="145">\r
- <size>35</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Repro">\r
+ <method name="Void AssertFoo[T](System.Collections.Generic.IList`1[T])" attrs="145">\r
+ <size>35</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-lambda-17.cs">\r
<type name="TestCase">\r
<method name="Product <Main>m__1(Product)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="<>__AnonType0`2[System.Linq.IGrouping`2[System.Int32,Product],System.Collections.Generic.IEnumerable`1[Product]] <Main>m__2(IGrouping`2)" attrs="145">\r
- <size>56</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="MainClass">\r
+ <method name="<>__AnonType0`2[System.Linq.IGrouping`2[System.Int32,Product],System.Collections.Generic.IEnumerable`1[Product]] <Main>m__2(System.Linq.IGrouping`2[System.Int32,Product])" attrs="145">\r
+ <size>56</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-lambda-23.cs">\r
<type name="C">\r
<method name="Void DoStuff[T](T, System.Action`1[T])" attrs="150">\r
<size>12</size>\r
</method>\r
- <method name="Void DoStuff[T](Nullable`1, System.Action`1[T])" attrs="150">\r
- <size>15</size>\r
- </method>\r
</type>\r
<type name="MonoBugs.Program">\r
<method name="Void Main()" attrs="150">\r
<size>60</size>\r
</method>\r
- <method name="Void <Main>m__0(Foo`1)" attrs="145">\r
+ </type>\r
+ <type name="MonoBugs.Bar">\r
+ <method name="Void DoStuff[T](System.Nullable`1[T], System.Action`1[T])" attrs="150">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
+ <type name="MonoBugs.Program">\r
+ <method name="Void <Main>m__0(MonoBugs.Foo`1[System.Int32])" attrs="145">\r
<size>13</size>\r
</method>\r
</type>\r
<method name="Int32 Main()" attrs="150">\r
<size>294</size>\r
</method>\r
- <method name="IEnumerable`1 <Main>m__0(IEnumerable)" attrs="145">\r
+ <method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <Main>m__0(IEnumerable)" attrs="145">\r
<size>7</size>\r
</method>\r
</type>\r
<method name="Int32 <Main>m__1(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Nullable`1 <Main>m__2(Nullable`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 <Main>m__3(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__1B(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 <Main>m__1C(Int32, IEnumerable`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 <Main>m__1D(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__1E(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="Int32 <Main>m__1F(Int32, IEnumerable`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 <Main>m__20(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__23(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="IGrouping`2 <Main>m__24(IGrouping`2)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="<>__AnonType1`2[System.Int32,System.Int32] <Main>m__25(Int32)" attrs="145">\r
<size>18</size>\r
</method>\r
<method name="Int32 <Main>m__2B(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
- <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__2D(IGrouping`2, Int32)" attrs="145">\r
- <size>16</size>\r
- </method>\r
<method name="Int32 <Main>m__2E(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__2F(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__31(IGrouping`2, Int32)" attrs="145">\r
- <size>16</size>\r
- </method>\r
<method name="Int32 <Main>m__32(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__33(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__35(IGrouping`2, Int32)" attrs="145">\r
- <size>16</size>\r
- </method>\r
<method name="Int32 <Main>m__36(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>10</size>\r
</method>\r
<method name="Int32 <Main>m__37(<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32])" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="IGrouping`2 <Main>m__38(IGrouping`2)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 <Main>m__39(Int32)" attrs="145">\r
<size>10</size>\r
</method>\r
</method>\r
</type>\r
<type name="from.C+<Main>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__4(Int32)" attrs="131">\r
- <size>15</size>\r
- </method>\r
- <method name="IEnumerable`1 <>m__2C(IGrouping`2)" attrs="131">\r
- <size>15</size>\r
- </method>\r
- <method name="IEnumerable`1 <>m__30(IGrouping`2)" attrs="131">\r
- <size>15</size>\r
- </method>\r
- <method name="IEnumerable`1 <>m__34(IGrouping`2)" attrs="131">\r
- <size>15</size>\r
- </method>\r
<method name="<>__AnonType1`2[System.Int32,System.Collections.Generic.IEnumerable`1[System.Int32]] <>m__3C(Int32)" attrs="131">\r
<size>55</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="from.C">\r
+ <method name="System.Nullable`1[System.Boolean] <Main>m__2(System.Nullable`1[System.Boolean])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 <Main>m__1C(Int32, System.Collections.Generic.IEnumerable`1[System.Int32])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="Int32 <Main>m__1F(Int32, System.Collections.Generic.IEnumerable`1[System.Int32])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="System.Linq.IGrouping`2[System.Int32,System.Int32] <Main>m__24(System.Linq.IGrouping`2[System.Int32,System.Int32])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__2D(System.Linq.IGrouping`2[System.Int32,System.Int32], Int32)" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__31(System.Linq.IGrouping`2[System.Int32,System.Int32], Int32)" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="<>__AnonType3`2[System.Linq.IGrouping`2[System.Int32,System.Int32],System.Int32] <Main>m__35(System.Linq.IGrouping`2[System.Int32,System.Int32], Int32)" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="System.Linq.IGrouping`2[System.Int32,System.Int32] <Main>m__38(System.Linq.IGrouping`2[System.Int32,System.Int32])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
+ <type name="from.C+<Main>c__AnonStorey0">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__4(Int32)" attrs="131">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__2C(System.Linq.IGrouping`2[System.Int32,System.Int32])" attrs="131">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__30(System.Linq.IGrouping`2[System.Int32,System.Int32])" attrs="131">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__34(System.Linq.IGrouping`2[System.Int32,System.Int32])" attrs="131">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-02.cs">\r
<type name="Test">\r
</method>\r
</type>\r
<type name="SelectMany+<Main>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__0(Int32)" attrs="131">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] <>m__0(Int32)" attrs="131">\r
<size>20</size>\r
</method>\r
- <method name="IEnumerable`1 <>m__3(Int32)" attrs="131">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] <>m__3(Int32)" attrs="131">\r
<size>20</size>\r
</method>\r
- <method name="IEnumerable`1 <>m__5(<>__AnonType0`2[System.Int32,System.String])" attrs="131">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__5(<>__AnonType0`2[System.Int32,System.String])" attrs="131">\r
<size>20</size>\r
</method>\r
- <method name="IEnumerable`1 <>m__9(Int32)" attrs="131">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] <>m__9(Int32)" attrs="131">\r
<size>15</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-linq-08.cs">\r
<method name="Int32 <Main>m__1(DataB)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]] <Main>m__2(DataA, IEnumerable`1)" attrs="145">\r
- <size>16</size>\r
- </method>\r
- <method name="IEnumerable`1 <Main>m__3(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]])" attrs="145">\r
- <size>20</size>\r
- </method>\r
<method name="<>__AnonType1`2[System.String,System.String] <Main>m__4(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]], DataB)" attrs="145">\r
<size>47</size>\r
</method>\r
<method name="Int32 <Main>m__6(DataB)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]] <Main>m__7(DataA, IEnumerable`1)" attrs="145">\r
- <size>16</size>\r
- </method>\r
- <method name="IEnumerable`1 <Main>m__8(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]])" attrs="145">\r
- <size>20</size>\r
- </method>\r
<method name="<>__AnonType1`2[System.String,System.String] <Main>m__9(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]], DataB)" attrs="145">\r
<size>47</size>\r
</method>\r
<method name="Int32 <Main>m__B(DataB)" attrs="145">\r
<size>15</size>\r
</method>\r
- <method name="DataA <Main>m__C(DataA, IEnumerable`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>21</size>\r
</method>\r
</type>\r
+ <type name="GroupJoin">\r
+ <method name="<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]] <Main>m__2(DataA, System.Collections.Generic.IEnumerable`1[DataB])" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[DataB] <Main>m__3(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]])" attrs="145">\r
+ <size>20</size>\r
+ </method>\r
+ <method name="<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]] <Main>m__7(DataA, System.Collections.Generic.IEnumerable`1[DataB])" attrs="145">\r
+ <size>16</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[DataB] <Main>m__8(<>__AnonType0`2[DataA,System.Collections.Generic.IEnumerable`1[DataB]])" attrs="145">\r
+ <size>20</size>\r
+ </method>\r
+ <method name="DataA <Main>m__C(DataA, System.Collections.Generic.IEnumerable`1[DataB])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-11.cs">\r
<type name="IntoTest">\r
<method name="<>__AnonType0`2[System.String,System.Int32] <XX>m__0(System.String)" attrs="145">\r
<size>20</size>\r
</method>\r
- <method name="IEnumerable`1 <XX>m__1(<>__AnonType0`2[System.String,System.Int32])" attrs="145">\r
- <size>117</size>\r
- </method>\r
<method name="Boolean <Main>m__2(System.String)" attrs="145">\r
<size>18</size>\r
</method>\r
- <method name="IEnumerable`1 <Main>m__3(System.String)" attrs="145">\r
- <size>44</size>\r
- </method>\r
<method name="<>__AnonType0`2[System.String,System.Int32] <Main>m__4(System.String)" attrs="145">\r
<size>21</size>\r
</method>\r
- <method name="IEnumerable`1 <Main>m__5(<>__AnonType0`2[System.String,System.Int32])" attrs="145">\r
- <size>118</size>\r
- </method>\r
<method name="<>__AnonType1`2[System.Char,System.Int32] <XX>m__6(Char)" attrs="145">\r
<size>16</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="NestedQuery">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Char] <XX>m__1(<>__AnonType0`2[System.String,System.Int32])" attrs="145">\r
+ <size>117</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Char] <Main>m__3(System.String)" attrs="145">\r
+ <size>44</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Char] <Main>m__5(<>__AnonType0`2[System.String,System.Int32])" attrs="145">\r
+ <size>118</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-13.cs">\r
<type name="Program">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Extension">\r
- <method name="IEnumerable`1 Cast[T](IFoo)" attrs="150">\r
- <size>10</size>\r
- </method>\r
- </type>\r
<type name="MethodDefinition">\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Extension">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Cast[T](IFoo)" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-14.cs">\r
<type name="Person">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Extensions">\r
- <method name="IMarker`1 Cast[T](IObjectContainer)" attrs="150">\r
- <size>10</size>\r
- </method>\r
- <method name="IMarker`1 Where[T](IMarker`1, System.Linq.Expressions.Expression`1[System.Func`2[T,System.Boolean]])" attrs="150">\r
- <size>10</size>\r
- </method>\r
- </type>\r
<type name="Program">\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Extensions">\r
+ <method name="IMarker`1[T] Cast[T](IObjectContainer)" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ <method name="IMarker`1[T] Where[T](IMarker`1[T], System.Linq.Expressions.Expression`1[System.Func`2[T,System.Boolean]])" attrs="150">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-15.cs">\r
<type name="NameCollisionTest.Data">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="NameCollisionTest.Ex">\r
- <method name="IEnumerable`1 Foo[T,TR](IEnumerable`1, System.Func`2[T,TR])" attrs="150">\r
- <size>37</size>\r
- </method>\r
- </type>\r
<type name="NameCollisionTest.C">\r
<method name="Void Main()" attrs="150">\r
<size>79</size>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<TR>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>93</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="NameCollisionTest.Ex">\r
+ <method name="System.Collections.Generic.IEnumerable`1[TR] Foo[T,TR](System.Collections.Generic.IEnumerable`1[T], System.Func`2[T,TR])" attrs="150">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="NameCollisionTest.Ex+<Foo>c__Iterator0`2[T,TR]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[TR] System.Collections.Generic.IEnumerable<TR>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-16.cs">\r
<type name="C">\r
</method>\r
</type>\r
<type name="C+<Test_1>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__0()" attrs="131">\r
- <size>74</size>\r
- </method>\r
<method name="<>__AnonType0`2[System.Int32,System.Int32] <>m__2(Int32)" attrs="145">\r
<size>16</size>\r
</method>\r
</method>\r
</type>\r
<type name="C+<Test_2>c__AnonStorey1">\r
- <method name="IEnumerable`1 <>m__4()" attrs="131">\r
- <size>74</size>\r
- </method>\r
<method name="<>__AnonType0`2[System.Int32,System.Int32] <>m__5(Int32)" attrs="145">\r
<size>16</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C+<Test_1>c__AnonStorey0">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__0()" attrs="131">\r
+ <size>74</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test_2>c__AnonStorey1">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__4()" attrs="131">\r
+ <size>74</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-17.cs">\r
<type name="TestGroupBy">\r
<method name="Boolean <Main>m__10(Int32)" attrs="145">\r
<size>39</size>\r
</method>\r
- <method name="Int32 <Main>m__11(Int32, IEnumerable`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="Int32 <Main>m__11(Int32, System.Collections.Generic.IEnumerable`1[System.Int32])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-19.cs">\r
<type name="Test">\r
</method>\r
</type>\r
<type name="Program+<Main>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__0(Int32)" attrs="131">\r
- <size>15</size>\r
- </method>\r
<method name="System.Action <>m__1(Int32, Int32)" attrs="131">\r
<size>48</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Program+<Main>c__AnonStorey0">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] <>m__0(Int32)" attrs="131">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-22.cs">\r
<type name="Test.MainClass">\r
<method name="Void <Main>m__0()" attrs="145">\r
<size>162</size>\r
</method>\r
- <method name="IEnumerable`1 <Main>m__1(A)" attrs="145">\r
- <size>15</size>\r
- </method>\r
<method name="<>__AnonType0`2[A,B] <Main>m__2(A, B)" attrs="145">\r
<size>16</size>\r
</method>\r
<size>21</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[B] <Main>m__1(A)" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-26.cs">\r
<type name="Test.S`1[T]">\r
</method>\r
</type>\r
<type name="C+<Main>c__AnonStorey0">\r
- <method name="IEnumerable`1 <>m__1(System.String)" attrs="131">\r
- <size>82</size>\r
- </method>\r
<method name="<>__AnonType0`2[System.String,System.Boolean] <>m__2(System.String)" attrs="145">\r
<size>55</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C+<Main>c__AnonStorey0">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Boolean] <>m__1(System.String)" attrs="131">\r
+ <size>82</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-linq-28.cs">\r
<type name="C">\r
<method name="<>__AnonType0`2[System.Char,System.Collections.Generic.IEnumerable`1[System.Char]] <Main>m__0(Char)" attrs="145">\r
<size>54</size>\r
</method>\r
- <method name="IEnumerable`1 <Main>m__1(<>__AnonType0`2[System.Char,System.Collections.Generic.IEnumerable`1[System.Char]])" attrs="145">\r
- <size>15</size>\r
- </method>\r
<method name="Char <Main>m__2(Char)" attrs="145">\r
<size>10</size>\r
</method>\r
<size>21</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Char] <Main>m__1(<>__AnonType0`2[System.Char,System.Collections.Generic.IEnumerable`1[System.Char]])" attrs="145">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-named-01.cs">\r
<type name="C">\r
</test>\r
<test name="gtest-optional-02.cs">\r
<type name="C">\r
- <method name="Boolean Test3(Nullable`1)" attrs="150">\r
+ <method name="Int32 Main()" attrs="150">\r
+ <size>160</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ <method name="Boolean Test3(System.Nullable`1[System.Int32])" attrs="150">\r
<size>29</size>\r
</method>\r
- <method name="Boolean Test2(Nullable`1)" attrs="150">\r
+ <method name="Boolean Test2(System.Nullable`1[System.Int32])" attrs="150">\r
<size>19</size>\r
</method>\r
- <method name="Int32 Test(Nullable`1)" attrs="150">\r
+ <method name="Int32 Test(System.Nullable`1[System.Int32])" attrs="150">\r
<size>35</size>\r
</method>\r
- <method name="Int64 Test4(Nullable`1)" attrs="150">\r
+ <method name="Int64 Test4(System.Nullable`1[System.Int64])" attrs="150">\r
<size>16</size>\r
</method>\r
- <method name="Int32 Main()" attrs="150">\r
- <size>160</size>\r
- </method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
- </method>\r
</type>\r
</test>\r
<test name="gtest-optional-03.cs">\r
<method name="Void TestParams(Int32)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="Void TestStruct(Nullable`1)" attrs="145">\r
- <size>25</size>\r
- </method>\r
- <method name="Void TestStruct2(Nullable`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="System.String get_Item(Int32, System.String)" attrs="2182">\r
<size>10</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void TestStruct(System.Nullable`1[System.Int32])" attrs="145">\r
+ <size>25</size>\r
+ </method>\r
+ <method name="Void TestStruct2(System.Nullable`1[S])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-optional-05.cs">\r
<method name="Void I.Explicit()" attrs="481">\r
<size>18</size>\r
</method>\r
- <method name="IEnumerable`1 Enumerator()" attrs="145">\r
- <size>23</size>\r
- </method>\r
<method name="Void GenericMethod[T]()" attrs="134">\r
<size>18</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>88</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="CallerMemberTest">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Enumerator()" attrs="145">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="CallerMemberTest+<Enumerator>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-optional-23.cs">\r
<type name="CallerLineNumberTest">\r
</test>\r
<test name="gtest-optional-27.cs">\r
<type name="EnumWrapperCtor`1[T]">\r
- <method name="Test getValue()" attrs="134">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor(Test)" attrs="6278">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="EnumWrapperCtor`1[T]">\r
+ <method name="EnumWrapperCtor`1+Test[T] getValue()" attrs="134">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-partial-01.cs">\r
<type name="B`1[U]">\r
</test>\r
<test name="gtest-variance-11.cs">\r
<type name="D">\r
- <method name="Boolean Contra[T](IContravariant`1, IContravariant`1)" attrs="150">\r
- <size>49</size>\r
- </method>\r
- <method name="Boolean Covariant[T](ICovariant`1, ICovariant`1)" attrs="150">\r
- <size>49</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>58</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Boolean Contra[T](IContravariant`1[T], IContravariant`1[T])" attrs="150">\r
+ <size>49</size>\r
+ </method>\r
+ <method name="Boolean Covariant[T](ICovariant`1[T], ICovariant`1[T])" attrs="150">\r
+ <size>49</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-variance-12.cs">\r
</test>\r
<test name="gtest-variance-13.cs">\r
<type name="A">\r
- <method name="Void Foo[T](T, IList`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Void Test()" attrs="150">\r
<size>18</size>\r
</method>\r
</method>\r
</type>\r
<type name="B">\r
- <method name="Void Foo[T](T, I`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
- <method name="Void Test[U](U, I`1)" attrs="145">\r
- <size>9</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="A">\r
+ <method name="Void Foo[T](T, System.Collections.Generic.IList`1[T])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
+ </type>\r
+ <type name="B">\r
+ <method name="Void Foo[T](T, I`1[T])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void Test[U](U, I`1[U])" attrs="145">\r
+ <size>9</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="gtest-variance-14.cs">\r
<type name="A">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="T Foo[T](T, I`1)" attrs="145">\r
- <size>10</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>58</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="T Foo[T](T, I`1[T])" attrs="145">\r
+ <size>10</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="gtest-variance-17.cs">\r
</test>\r
<test name="gtest-variance-6.cs">\r
<type name="Cov1`1[U]">\r
- <method name="ICovariant`1 Invoke(IContravariant`1)" attrs="454">\r
- <size>0</size>\r
- </method>\r
- <method name="IAsyncResult BeginInvoke(IContravariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
- <method name="ICovariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ </type>\r
+ <type name="Cov2`1[U]">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
+ </type>\r
+ <type name="Cov3`1[U]">\r
<method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Cov2`1[U]">\r
- <method name="ICovariant`1 Invoke(IContravariant`1)" attrs="454">\r
+ <type name="Cov4`1[U]">\r
+ <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(IContravariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
- <method name="ICovariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ </type>\r
+ <type name="Cov5`1[U]">\r
+ <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
<method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Cov3`1[U]">\r
- <method name="ICovariant`1 Invoke(IContravariant`1)" attrs="454">\r
+ <type name="Contra5`1[U]">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(IContravariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ </type>\r
+ <type name="Contra6`1[U]">\r
+ <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="ICovariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
+ </type>\r
+ <type name="Contra7`1[U]">\r
<method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Cov4`1[U]">\r
- <method name="ICovariant`1 Invoke()" attrs="454">\r
+ <type name="Contra8`1[U]">\r
+ <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
- <size>0</size>\r
+ </type>\r
+ <type name="Program">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>2</size>\r
</method>\r
- <method name="ICovariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
- <size>0</size>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ </type>\r
+ <type name="Cov1`1[U]">\r
+ <method name="ICovariant`1[U] Invoke(IContravariant`1[U])" attrs="454">\r
<size>0</size>\r
</method>\r
- </type>\r
- <type name="Cov5`1[U]">\r
- <method name="IContravariant`1 Invoke()" attrs="454">\r
+ <method name="IAsyncResult BeginInvoke(IContravariant`1[U], System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
+ <method name="ICovariant`1[U] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IContravariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ </type>\r
+ <type name="Cov2`1[U]">\r
+ <method name="ICovariant`1[U] Invoke(IContravariant`1[ICovariant`1[U]])" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <method name="IAsyncResult BeginInvoke(IContravariant`1[ICovariant`1[U]], System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- </type>\r
- <type name="Contra5`1[U]">\r
- <method name="IContravariant`1 Invoke(U, ICovariant`1)" attrs="454">\r
+ <method name="ICovariant`1[U] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(U, ICovariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ </type>\r
+ <type name="Cov3`1[U]">\r
+ <method name="ICovariant`1[IContravariant`1[IContravariant`1[U]]] Invoke(IContravariant`1[IContravariant`1[IContravariant`1[ICovariant`1[U]]]])" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IContravariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ <method name="IAsyncResult BeginInvoke(IContravariant`1[IContravariant`1[IContravariant`1[ICovariant`1[U]]]], System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <method name="ICovariant`1[IContravariant`1[IContravariant`1[U]]] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Contra6`1[U]">\r
- <method name="IContravariant`1 Invoke()" attrs="454">\r
+ <type name="Cov4`1[U]">\r
+ <method name="ICovariant`1[System.Int32] Invoke()" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(System.AsyncCallback, System.Object)" attrs="454">\r
+ <method name="ICovariant`1[System.Int32] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IContravariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ </type>\r
+ <type name="Cov5`1[U]">\r
+ <method name="IContravariant`1[System.Int32] Invoke()" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <method name="IContravariant`1[System.Int32] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Contra7`1[U]">\r
- <method name="IContravariant`1 Invoke(U, ICovariant`1)" attrs="454">\r
+ <type name="Contra5`1[U]">\r
+ <method name="IContravariant`1[U[]] Invoke(U, ICovariant`1[U])" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(U, ICovariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ <method name="IAsyncResult BeginInvoke(U, ICovariant`1[U], System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IContravariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ <method name="IContravariant`1[U[]] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ </type>\r
+ <type name="Contra6`1[U]">\r
+ <method name="IContravariant`1[U[]] Invoke()" attrs="454">\r
<size>0</size>\r
</method>\r
- </type>\r
- <type name="Contra8`1[U]">\r
- <method name="IContravariant`1 Invoke(U, ICovariant`1)" attrs="454">\r
+ <method name="IContravariant`1[U[]] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IAsyncResult BeginInvoke(U, ICovariant`1, System.AsyncCallback, System.Object)" attrs="454">\r
+ </type>\r
+ <type name="Contra7`1[U]">\r
+ <method name="IContravariant`1[U] Invoke(U, ICovariant`1[U])" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="IContravariant`1 EndInvoke(IAsyncResult)" attrs="454">\r
+ <method name="IAsyncResult BeginInvoke(U, ICovariant`1[U], System.AsyncCallback, System.Object)" attrs="454">\r
<size>0</size>\r
</method>\r
- <method name="Void .ctor(Object, IntPtr)" attrs="6278">\r
+ <method name="IContravariant`1[U] EndInvoke(IAsyncResult)" attrs="454">\r
<size>0</size>\r
</method>\r
</type>\r
- <type name="Program">\r
- <method name="Void Main()" attrs="150">\r
- <size>2</size>\r
+ <type name="Contra8`1[U]">\r
+ <method name="IContravariant`1[ICovariant`1[U]] Invoke(U, ICovariant`1[U])" attrs="454">\r
+ <size>0</size>\r
</method>\r
- <method name="Void .ctor()" attrs="6278">\r
- <size>7</size>\r
+ <method name="IAsyncResult BeginInvoke(U, ICovariant`1[U], System.AsyncCallback, System.Object)" attrs="454">\r
+ <size>0</size>\r
+ </method>\r
+ <method name="IContravariant`1[ICovariant`1[U]] EndInvoke(IAsyncResult)" attrs="454">\r
+ <size>0</size>\r
</method>\r
</type>\r
</test>\r
</test>\r
<test name="gtest-variance-9.cs">\r
<type name="Test">\r
- <method name="Void Foo(IIn`1)" attrs="145">\r
- <size>2</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>18</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void Foo(IIn`1[System.String])" attrs="145">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-1.cs">\r
<size>2</size>\r
</method>\r
<method name="Int32 Main()" attrs="150">\r
- <size>51</size>\r
+ <size>178</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="Void test2()" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void test3()" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
+ <method name="Void test4()" attrs="134">\r
+ <size>2</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-182.cs">\r
</type>\r
</test>\r
<test name="test-285.cs">\r
- <type name="T">\r
- <method name="Int32 Main()" attrs="150">\r
- <size>11</size>\r
+ <type name="Test">\r
+ <method name="Int32 test1()" attrs="145">\r
+ <size>73</size>\r
+ </method>\r
+ <method name="Int32 test2()" attrs="145">\r
+ <size>73</size>\r
+ </method>\r
+ <method name="Int32 Main()" attrs="145">\r
+ <size>46</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<test name="test-510.cs">\r
<type name="Foo">\r
<method name="Void test39(Int32 ByRef)" attrs="145">\r
- <size>37</size>\r
+ <size>41</size>\r
</method>\r
<method name="Void Main()" attrs="150">\r
<size>29</size>\r
<test name="test-618.cs">\r
<type name="C">\r
<method name="Void ZeroBasedReductions()" attrs="150">\r
- <size>16</size>\r
+ <size>22</size>\r
</method>\r
<method name="Void ZeroBasedReductionsWithConversion()" attrs="150">\r
- <size>16</size>\r
+ <size>18</size>\r
</method>\r
<method name="Int32 Main()" attrs="150">\r
<size>41</size>\r
<test name="test-640.cs">\r
<type name="C">\r
<method name="Int32 Main()" attrs="150">\r
- <size>128</size>\r
+ <size>125</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</type>\r
<type name="Program">\r
<method name="Int32 Main()" attrs="150">\r
- <size>438</size>\r
+ <size>410</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<method name="Int32 GetItem()" attrs="150">\r
<size>59</size>\r
</method>\r
- <method name="IEnumerable`1 GetItems()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>76</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] GetItems()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<GetItems>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-105.cs">\r
<type name="Hello">\r
</method>\r
</type>\r
<type name="Foo">\r
- <method name="IEnumerable`1 Test(Foo)" attrs="134">\r
- <size>42</size>\r
- </method>\r
<method name="Void Hello(Int32)" attrs="134">\r
<size>20</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Foo>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>113</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo">\r
+ <method name="System.Collections.Generic.IEnumerable`1[Foo] Test(Foo)" attrs="134">\r
+ <size>42</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Foo] System.Collections.Generic.IEnumerable<Foo>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-106.cs">\r
<type name="Foo`2[R,S]">\r
</method>\r
</type>\r
<type name="X">\r
- <method name="IEnumerable`1 Test(Int32)" attrs="150">\r
- <size>30</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>62</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>181</size>\r
</method>\r
<size>23</size>\r
</method>\r
</type>\r
+ <type name="X">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test(Int32)" attrs="150">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-108.cs">\r
<type name="Foo">\r
<method name="Foo op_Implicit(Test)" attrs="2198">\r
<size>38</size>\r
</method>\r
- <method name="IEnumerable`1 op_Addition(Test, Test)" attrs="2198">\r
- <size>37</size>\r
- </method>\r
- <method name="IEnumerable`1 get_Foo()" attrs="2182">\r
- <size>23</size>\r
- </method>\r
- <method name="Void set_Foo(IEnumerable`1)" attrs="2182">\r
- <size>12</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>82</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<Test>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>113</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>72</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] get_Foo()" attrs="2182">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="Void set_Foo(System.Collections.Generic.IEnumerable`1[System.Int32])" attrs="2182">\r
+ <size>12</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[Test] op_Addition(Test, Test)" attrs="2198">\r
+ <size>37</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<op_Addition>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[Test] System.Collections.Generic.IEnumerable<Test>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-11.cs">\r
<type name="D">\r
</test>\r
<test name="test-anon-110.cs">\r
<type name="X">\r
- <method name="IEnumerable`1 Test[T](T, T)" attrs="134">\r
- <size>44</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>110</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>125</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="X">\r
+ <method name="System.Collections.Generic.IEnumerable`1[T] Test[T](T, T)" attrs="134">\r
+ <size>44</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<Test>c__Iterator0`1[T]">\r
+ <method name="System.Collections.Generic.IEnumerator`1[T] System.Collections.Generic.IEnumerable<T>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-111.cs">\r
<type name="Foo">\r
<method name="Void Closure(EmptyDelegate)" attrs="145">\r
<size>2</size>\r
</method>\r
- <method name="System.Collections.Generic.List`1[T] Query[T](Nullable`1 ByRef)" attrs="145">\r
- <size>61</size>\r
- </method>\r
<method name="T MakeSomething[T]()" attrs="145">\r
<size>15</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="BaseObject">\r
+ <method name="System.Collections.Generic.List`1[T] Query[T](System.Nullable`1[System.Int32] ByRef)" attrs="145">\r
+ <size>61</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-122.cs">\r
<type name="D1">\r
</test>\r
<test name="test-anon-123.cs">\r
<type name="MemberAccessData">\r
- <method name="Void set_MyTypeProperty(Nullable`1)" attrs="2182">\r
- <size>9</size>\r
- </method>\r
- <method name="Nullable`1 get_MyTypeProperty()" attrs="2182">\r
- <size>15</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="MemberAccessData">\r
+ <method name="Void set_MyTypeProperty(System.Nullable`1[System.Int32])" attrs="2182">\r
+ <size>9</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Int32] get_MyTypeProperty()" attrs="2182">\r
+ <size>15</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-124.cs">\r
<type name="Disposable`1[T]">\r
<size>42</size>\r
</method>\r
<method name="Int32 Main()" attrs="150">\r
- <size>645</size>\r
+ <size>683</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<Finally>c__AnonStorey6`1[T]">\r
+ <type name="Test+<ArrayMultiMutate>c__AnonStoreyC`1[T]">\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test">\r
+ <method name="System.Func`1[T] Catch_2[T](T)" attrs="145">\r
+ <size>34</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<Catch_2>c__AnonStorey6`1[T]">\r
<method name="T <>m__6()" attrs="131">\r
- <size>62</size>\r
+ <size>42</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<Using>c__AnonStorey7`1[T]">\r
+ <type name="Test+<Finally>c__AnonStorey7`1[T]">\r
<method name="T <>m__7()" attrs="131">\r
- <size>15</size>\r
+ <size>62</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<Switch>c__AnonStorey8`1[T]">\r
+ <type name="Test+<Using>c__AnonStorey8`1[T]">\r
<method name="T <>m__8()" attrs="131">\r
- <size>16</size>\r
+ <size>15</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<ForForeach>c__AnonStorey9`1[T]">\r
- <method name="System.Collections.Generic.List`1[T] <>m__9()" attrs="131">\r
- <size>67</size>\r
+ <type name="Test+<Switch>c__AnonStorey9`1[T]">\r
+ <method name="T <>m__9()" attrs="131">\r
+ <size>16</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<ArrayMutate>c__AnonStoreyA`1[T]">\r
- <method name="Void <>m__A(Int32)" attrs="131">\r
- <size>39</size>\r
+ <type name="Test+<ForForeach>c__AnonStoreyA`1[T]">\r
+ <method name="System.Collections.Generic.List`1[T] <>m__A()" attrs="131">\r
+ <size>67</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<ArrayMultiMutate>c__AnonStoreyB`1[T]">\r
- <method name="T[][] <>m__B()" attrs="131">\r
- <size>58</size>\r
+ <type name="Test+<ArrayMutate>c__AnonStoreyB`1[T]">\r
+ <method name="Void <>m__B(Int32)" attrs="131">\r
+ <size>39</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
<type name="Test+<ArrayMultiMutate>c__AnonStoreyC`1[T]">\r
- <method name="Int32 <>m__C()" attrs="131">\r
+ <method name="T[][] <>m__C()" attrs="131">\r
+ <size>58</size>\r
+ </method>\r
+ </type>\r
+ <type name="Test+<ArrayMultiMutate>c__AnonStoreyD`1[T]">\r
+ <method name="Int32 <>m__D()" attrs="131">\r
<size>35</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
- <type name="Test+<NestedTypeMutate>c__AnonStoreyD`1[T]">\r
- <method name="T[] <>m__D()" attrs="131">\r
+ <type name="Test+<NestedTypeMutate>c__AnonStoreyE`1[T]">\r
+ <method name="T[] <>m__E()" attrs="131">\r
<size>45</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
</method>\r
</type>\r
<type name="Test">\r
- <method name="Void Foo[T](IEqualityComparer`1)" attrs="145">\r
- <size>28</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Void Foo[T](System.Collections.Generic.IEqualityComparer`1[T])" attrs="145">\r
+ <size>28</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-126.cs">\r
<type name="MonoBugs.BrokenGenericCast">\r
<method name="Boolean TryAction[T](Test+Creator`1[T], T ByRef)" attrs="145">\r
<size>25</size>\r
</method>\r
- <method name="Boolean Func1[T](IList`1, Boolean, T ByRef)" attrs="145">\r
- <size>40</size>\r
- </method>\r
- <method name="T Item[T](IList`1)" attrs="150">\r
- <size>15</size>\r
- </method>\r
- <method name="T GetSingleItem[T](IList`1)" attrs="150">\r
- <size>18</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>16</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Boolean Func1[T](System.Collections.Generic.IList`1[T], Boolean, T ByRef)" attrs="145">\r
+ <size>40</size>\r
+ </method>\r
+ <method name="T Item[T](System.Collections.Generic.IList`1[T])" attrs="150">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="T GetSingleItem[T](System.Collections.Generic.IList`1[T])" attrs="150">\r
+ <size>18</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-13.cs">\r
<type name="D">\r
<method name="Void Assert(System.Action`1[System.Int32])" attrs="150">\r
<size>10</size>\r
</method>\r
- <method name="Void Foo[T](IList`1)" attrs="150">\r
- <size>32</size>\r
- </method>\r
<method name="Void Main(System.String[])" attrs="150">\r
<size>8</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
- </test>\r
- <test name="test-anon-133.cs">\r
- <type name="IEnumerableRocks">\r
- <method name="System.String Implode[TSource,TResult](IEnumerable`1, System.String, System.Func`2[TSource,TResult])" attrs="150">\r
- <size>41</size>\r
- </method>\r
- <method name="System.String Implode[TSource](IEnumerable`1, System.String, System.Action`2[System.Text.StringBuilder,TSource])" attrs="150">\r
- <size>146</size>\r
+ <type name="Program">\r
+ <method name="Void Foo[T](System.Collections.Generic.IList`1[T])" attrs="150">\r
+ <size>32</size>\r
</method>\r
</type>\r
+ </test>\r
+ <test name="test-anon-133.cs">\r
<type name="Test">\r
<method name="Void Main()" attrs="150">\r
<size>68</size>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="IEnumerableRocks">\r
+ <method name="System.String Implode[TSource,TResult](System.Collections.Generic.IEnumerable`1[TSource], System.String, System.Func`2[TSource,TResult])" attrs="150">\r
+ <size>41</size>\r
+ </method>\r
+ <method name="System.String Implode[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.String, System.Action`2[System.Text.StringBuilder,TSource])" attrs="150">\r
+ <size>146</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-134.cs">\r
<type name="MyClass">\r
</test>\r
<test name="test-anon-138.cs">\r
<type name="Foo`1[T]">\r
- <method name="Boolean ContainsAll[U](IEnumerable`1)" attrs="134">\r
- <size>48</size>\r
- </method>\r
<method name="Boolean Contains(T)" attrs="134">\r
<size>10</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo`1[T]">\r
+ <method name="Boolean ContainsAll[U](System.Collections.Generic.IEnumerable`1[U])" attrs="134">\r
+ <size>48</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-139.cs">\r
<type name="Test">\r
<method name="Void Test_1[T](T)" attrs="134">\r
<size>34</size>\r
</method>\r
- <method name="Void Test_2[T](Nullable`1)" attrs="134">\r
- <size>34</size>\r
- </method>\r
<method name="T Test_3[T](System.Object)" attrs="134">\r
<size>59</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Test">\r
+ <method name="Void Test_2[T](System.Nullable`1[T])" attrs="134">\r
+ <size>34</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-14.cs">\r
<type name="X">\r
</test>\r
<test name="test-anon-141.cs">\r
<type name="C">\r
- <method name="Decimal Average[TSource](IEnumerable`1, System.Func`2[TSource,System.Decimal])" attrs="150">\r
- <size>45</size>\r
- </method>\r
- <method name="TResult Average[TElement,TAggregate,TResult](IEnumerable`1, System.Func`3[TAggregate,TElement,TAggregate], System.Func`3[TAggregate,TElement,TResult])" attrs="145">\r
- <size>7</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="Decimal <Average`1>m__1[TSource](Decimal, Decimal)" attrs="145">\r
<size>15</size>\r
</method>\r
+ <method name="Decimal Average[TSource](System.Collections.Generic.IEnumerable`1[TSource], System.Func`2[TSource,System.Decimal])" attrs="150">\r
+ <size>45</size>\r
+ </method>\r
+ <method name="TResult Average[TElement,TAggregate,TResult](System.Collections.Generic.IEnumerable`1[TElement], System.Func`3[TAggregate,TElement,TAggregate], System.Func`3[TAggregate,TElement,TResult])" attrs="145">\r
+ <size>7</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-anon-142.cs">\r
<method name="Void Main()" attrs="150">\r
<size>33</size>\r
</method>\r
- <method name="Void Test[T](IList`1)" attrs="150">\r
- <size>34</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
<method name="Void <>m__0()" attrs="131">\r
<size>47</size>\r
</method>\r
- <method name="Int32 <>m__1(IList`1)" attrs="145">\r
- <size>9</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="TestCase">\r
+ <method name="Void Test[T](System.Collections.Generic.IList`1[System.Collections.Generic.IList`1[T]])" attrs="150">\r
+ <size>34</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestCase+<Test>c__AnonStorey0`1[T]">\r
+ <method name="Int32 <>m__1(System.Collections.Generic.IList`1[System.Collections.Generic.IList`1[T]])" attrs="145">\r
+ <size>9</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-anon-162.cs">\r
<type name="D">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-anon-171.cs">\r
+ <type name="TestAnonSwitch.MyClass">\r
+ <method name="Void add_FirstEvent(System.EventHandler`1[System.EventArgs])" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void remove_FirstEvent(System.EventHandler`1[System.EventArgs])" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void add_SecondEvent(System.EventHandler`1[System.EventArgs])" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void remove_SecondEvent(System.EventHandler`1[System.EventArgs])" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void Trigger()" attrs="134">\r
+ <size>30</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestAnonSwitch.Tester">\r
+ <method name="Void Test()" attrs="134">\r
+ <size>157</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestAnonSwitch.MainClass">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="TestAnonSwitch.Tester+<Test>c__AnonStorey0">\r
+ <method name="Void <>m__0(System.Object, System.EventArgs)" attrs="131">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="Void <>m__1(System.Object, System.EventArgs)" attrs="131">\r
+ <size>23</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-anon-18.cs">\r
<type name="A">\r
<method name="Void Invoke()" attrs="454">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>135</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-anon-51.cs">\r
</type>\r
<type name="Tester+<ArrayAccessTest_7>c__async6">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>385</size>\r
+ <size>426</size>\r
</method>\r
<method name="Int32 <>m__14()" attrs="145">\r
<size>9</size>\r
</type>\r
<type name="Tester+<ArrayAccessTest_8>c__async7">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>670</size>\r
+ <size>792</size>\r
</method>\r
<method name="Int32 <>m__15()" attrs="145">\r
<size>9</size>\r
<method name="Void MoveNext()" attrs="486">\r
<size>273</size>\r
</method>\r
- <method name="Nullable`1 <>m__1F()" attrs="145">\r
- <size>17</size>\r
- </method>\r
</type>\r
<type name="Tester+<AssignTest_3>c__asyncB">\r
<method name="Void MoveNext()" attrs="486">\r
</type>\r
<type name="Tester+<BinaryTest_3>c__asyncE">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>1082</size>\r
- </method>\r
- <method name="Nullable`1 <>m__28()" attrs="145">\r
- <size>14</size>\r
- </method>\r
- <method name="Nullable`1 <>m__29()" attrs="145">\r
- <size>17</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2A()" attrs="145">\r
- <size>17</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2B()" attrs="145">\r
- <size>14</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2C()" attrs="145">\r
- <size>17</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2D()" attrs="145">\r
- <size>14</size>\r
+ <size>1137</size>\r
</method>\r
</type>\r
<type name="Tester+<BinaryTest_4>c__asyncF">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>809</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2E()" attrs="145">\r
- <size>14</size>\r
- </method>\r
- <method name="Nullable`1 <>m__2F()" attrs="145">\r
- <size>17</size>\r
- </method>\r
- <method name="Nullable`1 <>m__30()" attrs="145">\r
- <size>20</size>\r
- </method>\r
- <method name="Nullable`1 <>m__31()" attrs="145">\r
- <size>17</size>\r
+ <size>872</size>\r
</method>\r
</type>\r
<type name="Tester+<ArrayAccessTest_1>c__async0">\r
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</method>\r
- <method name="Nullable`1 <>m__3D()" attrs="145">\r
- <size>17</size>\r
- </method>\r
<method name="Byte <>m__3E()" attrs="145">\r
<size>9</size>\r
</method>\r
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</method>\r
- <method name="Nullable`1 <>m__59()" attrs="145">\r
- <size>14</size>\r
- </method>\r
</type>\r
<type name="Tester+<LogicalUserOperator_1>c__async2A">\r
<method name="Void MoveNext()" attrs="486">\r
</type>\r
<type name="Tester+<UnaryTest_2>c__async3C">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>354</size>\r
+ <size>339</size>\r
</method>\r
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</type>\r
<type name="Tester+<UnaryTest_3>c__async3D">\r
<method name="Void MoveNext()" attrs="486">\r
- <size>369</size>\r
+ <size>372</size>\r
</method>\r
<method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
<size>13</size>\r
</method>\r
</type>\r
<type name="Tester+<UnaryTest_2>c__async3C+<UnaryTest_2>c__AnonStorey47">\r
- <method name="Nullable`1 <>m__7D()" attrs="131">\r
- <size>14</size>\r
- </method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Tester+<AssignTest_2>c__asyncA">\r
+ <method name="System.Nullable`1[System.SByte] <>m__1F()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<BinaryTest_3>c__asyncE">\r
+ <method name="System.Nullable`1[System.Boolean] <>m__28()" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Boolean] <>m__29()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Boolean] <>m__2A()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Boolean] <>m__2B()" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Boolean] <>m__2C()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Boolean] <>m__2D()" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<BinaryTest_4>c__asyncF">\r
+ <method name="System.Nullable`1[System.Int16] <>m__2E()" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Byte] <>m__2F()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Decimal] <>m__30()" attrs="145">\r
+ <size>20</size>\r
+ </method>\r
+ <method name="System.Nullable`1[System.Decimal] <>m__31()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<CoalescingTest_2>c__async19">\r
+ <method name="System.Nullable`1[System.Int16] <>m__3D()" attrs="145">\r
+ <size>17</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<IsTest_2>c__async29">\r
+ <method name="System.Nullable`1[System.UInt32] <>m__59()" attrs="145">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
+ <type name="Tester+<UnaryTest_2>c__async3C+<UnaryTest_2>c__AnonStorey47">\r
+ <method name="System.Nullable`1[System.Int16] <>m__7D()" attrs="131">\r
+ <size>14</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-async-14.cs">\r
<type name="C">\r
</test>\r
<test name="test-async-30.cs">\r
<type name="C">\r
- <method name="IEnumerable`1 Test(System.String)" attrs="129">\r
- <size>30</size>\r
- </method>\r
- <method name="IEnumerable`1 Test2()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="Int32 Main()" attrs="150">\r
<size>214</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>138</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>137</size>\r
</method>\r
<size>13</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Test(System.String)" attrs="129">\r
+ <size>30</size>\r
+ </method>\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.String] Test2()" attrs="129">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test2>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.String] System.Collections.Generic.IEnumerable<string>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-async-31.cs">\r
<type name="C">\r
</method>\r
</type>\r
</test>\r
+ <test name="test-async-47.cs">\r
+ <type name="C">\r
+ <method name="Void Main()" attrs="150">\r
+ <size>12</size>\r
+ </method>\r
+ <method name="Void Test()" attrs="129">\r
+ <size>32</size>\r
+ </method>\r
+ <method name="Void <Test>m__0(System.Object, System.EventArgs)" attrs="129">\r
+ <size>35</size>\r
+ </method>\r
+ <method name="Void <Test>m__1()" attrs="129">\r
+ <size>8</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="View">\r
+ <method name="Void add_Click(System.EventHandler)" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void remove_Click(System.EventHandler)" attrs="2182">\r
+ <size>42</size>\r
+ </method>\r
+ <method name="Void Run()" attrs="134">\r
+ <size>15</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="Builder">\r
+ <method name="Void SetButton(System.Action)" attrs="134">\r
+ <size>8</size>\r
+ </method>\r
+ <method name="Void .ctor()" attrs="6278">\r
+ <size>7</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__async0">\r
+ <method name="Void MoveNext()" attrs="486">\r
+ <size>61</size>\r
+ </method>\r
+ <method name="Void SetStateMachine(IAsyncStateMachine)" attrs="486">\r
+ <size>13</size>\r
+ </method>\r
+ </type>\r
+ </test>\r
<test name="test-cls-00.cs">\r
<type name="CLSCLass_6">\r
<method name="Void add_Disposed(Delegate)" attrs="2182">\r
<method name="Void Switch_1(Int32)" attrs="129">\r
<size>61</size>\r
</method>\r
- <method name="Void Switch_2(Nullable`1)" attrs="129">\r
- <size>57</size>\r
- </method>\r
<method name="Void Switch_3(System.String)" attrs="129">\r
<size>211</size>\r
</method>\r
<method name="Void ForEach_4(System.Int32[,])" attrs="129">\r
<size>78</size>\r
</method>\r
+ <method name="Void Switch_2(System.Nullable`1[System.Int32])" attrs="129">\r
+ <size>57</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-debug-12.cs">\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
- <method name="IEnumerable`1 Iter_1()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="IEnumerable Iter_2()" attrs="129">\r
<size>23</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>72</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>26</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Iter_1()" attrs="129">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Iter_1>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Iter_2>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-debug-14.cs">\r
<type name="C">\r
</test>\r
<test name="test-debug-21.cs">\r
<type name="C">\r
- <method name="IEnumerable`1 Test()" attrs="129">\r
- <size>23</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>2</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Void <>__Finally0()" attrs="129">\r
<size>13</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] Test()" attrs="129">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<Test>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-debug-22.cs">\r
<type name="A">\r
</method>\r
</type>\r
<type name="C">\r
- <method name="IEnumerable`1 GetIter()" attrs="134">\r
- <size>30</size>\r
- </method>\r
<method name="Int32 Foo()" attrs="198">\r
<size>7</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>82</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="C">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Int32] GetIter()" attrs="134">\r
+ <size>30</size>\r
+ </method>\r
+ </type>\r
+ <type name="C+<GetIter>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Int32] System.Collections.Generic.IEnumerable<int>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-debug-23.cs">\r
<type name="Program">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>149</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-02.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>159</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>246</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="X+<GetIt>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<GetMulti>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-iter-04.cs">\r
<type name="X">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>130</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-05.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>191</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-06.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>198</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>159</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>154</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>159</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="S+<Get>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
+ </type>\r
+ <type name="S+<GetS>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<Get>c__Iterator2">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
+ <type name="X+<GetS>c__Iterator3">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-iter-07.cs">\r
<type name="Test">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>264</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-08.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>377</size>\r
</method>\r
<method name="Void <>__Finally0()" attrs="129">\r
<size>23</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-09.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>168</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-11.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>190</size>\r
</method>\r
<method name="Void <>__Finally0()" attrs="129">\r
<size>20</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-13.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>27</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-14.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>98</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-15.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>38</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-17.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>168</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-18.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>214</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-iter-19.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>40</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>242</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="X+<GetIt>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>40</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-iter-22.cs">\r
<type name="Test">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>117</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="X+<GetIt2>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-iter-25.cs">\r
<type name="D">\r
<method name="Void RunOnThread(System.Action)" attrs="150">\r
<size>8</size>\r
</method>\r
- <method name="IEnumerable`1 TagsError()" attrs="150">\r
- <size>23</size>\r
- </method>\r
<method name="Void Main()" attrs="150">\r
<size>68</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>60</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="UploadAction">\r
+ <method name="System.Collections.Generic.IEnumerable`1[System.Object] TagsError()" attrs="150">\r
+ <size>23</size>\r
+ </method>\r
+ </type>\r
+ <type name="UploadAction+<TagsError>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-iter-26.cs">\r
<type name="C">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>52</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>101</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>52</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-named-01.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>76</size>\r
</method>\r
<method name="Void .ctor()" attrs="6278">\r
<size>7</size>\r
</method>\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
</type>\r
</test>\r
<test name="test-partial-13.cs">\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>32</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>32</size>\r
</method>\r
<method name="IEnumerator System.Collections.IEnumerable.GetEnumerator()" attrs="481">\r
<size>14</size>\r
</method>\r
- <method name="IEnumerator`1 System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
- <size>26</size>\r
- </method>\r
<method name="Boolean MoveNext()" attrs="486">\r
<size>32</size>\r
</method>\r
<size>7</size>\r
</method>\r
</type>\r
+ <type name="Foo.X+<Attempts2>c__Iterator0">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo.X+<>c__Iterator1">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
+ <type name="Foo.X+<>c__Iterator2">\r
+ <method name="System.Collections.Generic.IEnumerator`1[System.Object] System.Collections.Generic.IEnumerable<object>.GetEnumerator()" attrs="481">\r
+ <size>26</size>\r
+ </method>\r
+ </type>\r
</test>\r
<test name="test-partial-16.cs">\r
<type name="A.C">\r
+++ /dev/null
-//
-// Authors:
-// Miguel de Icaza (miguel@novell.com)
-//
-// See the following url for documentation:
-// http://www.mono-project.com/Mono_DataConvert
-//
-// Compilation Options:
-// MONO_DATACONVERTER_PUBLIC:
-// Makes the class public instead of the default internal.
-//
-// MONO_DATACONVERTER_STATIC_METHODS:
-// Exposes the public static methods.
-//
-// TODO:
-// Support for "DoubleWordsAreSwapped" for ARM devices
-//
-// Copyright (C) 2006 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-using System;
-using System.Collections;
-using System.Text;
-
-#pragma warning disable 3021
-
-namespace Mono {
-
-#if MONO_DATACONVERTER_PUBLIC
- unsafe public abstract class DataConverter {
-#else
- unsafe internal abstract class DataConverter {
-
-// Disables the warning: CLS compliance checking will not be performed on
-// `XXXX' because it is not visible from outside this assembly
-#pragma warning disable 3019
-#endif
- static DataConverter SwapConv = new SwapConverter ();
- static DataConverter CopyConv = new CopyConverter ();
-
- public static readonly bool IsLittleEndian = BitConverter.IsLittleEndian;
-
- public abstract double GetDouble (byte [] data, int index);
- public abstract float GetFloat (byte [] data, int index);
- public abstract long GetInt64 (byte [] data, int index);
- public abstract int GetInt32 (byte [] data, int index);
-
- public abstract short GetInt16 (byte [] data, int index);
-
- [CLSCompliant (false)]
- public abstract uint GetUInt32 (byte [] data, int index);
- [CLSCompliant (false)]
- public abstract ushort GetUInt16 (byte [] data, int index);
- [CLSCompliant (false)]
- public abstract ulong GetUInt64 (byte [] data, int index);
-
- public abstract void PutBytes (byte [] dest, int destIdx, double value);
- public abstract void PutBytes (byte [] dest, int destIdx, float value);
- public abstract void PutBytes (byte [] dest, int destIdx, int value);
- public abstract void PutBytes (byte [] dest, int destIdx, long value);
- public abstract void PutBytes (byte [] dest, int destIdx, short value);
-
- [CLSCompliant (false)]
- public abstract void PutBytes (byte [] dest, int destIdx, ushort value);
- [CLSCompliant (false)]
- public abstract void PutBytes (byte [] dest, int destIdx, uint value);
- [CLSCompliant (false)]
- public abstract void PutBytes (byte [] dest, int destIdx, ulong value);
-
- public byte[] GetBytes (double value)
- {
- byte [] ret = new byte [8];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- public byte[] GetBytes (float value)
- {
- byte [] ret = new byte [4];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- public byte[] GetBytes (int value)
- {
- byte [] ret = new byte [4];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- public byte[] GetBytes (long value)
- {
- byte [] ret = new byte [8];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- public byte[] GetBytes (short value)
- {
- byte [] ret = new byte [2];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- [CLSCompliant (false)]
- public byte[] GetBytes (ushort value)
- {
- byte [] ret = new byte [2];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- [CLSCompliant (false)]
- public byte[] GetBytes (uint value)
- {
- byte [] ret = new byte [4];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- [CLSCompliant (false)]
- public byte[] GetBytes (ulong value)
- {
- byte [] ret = new byte [8];
- PutBytes (ret, 0, value);
- return ret;
- }
-
- static public DataConverter LittleEndian {
- get {
- return BitConverter.IsLittleEndian ? CopyConv : SwapConv;
- }
- }
-
- static public DataConverter BigEndian {
- get {
- return BitConverter.IsLittleEndian ? SwapConv : CopyConv;
- }
- }
-
- static public DataConverter Native {
- get {
- return CopyConv;
- }
- }
-
- static int Align (int current, int align)
- {
- return ((current + align - 1) / align) * align;
- }
-
- class PackContext {
- // Buffer
- public byte [] buffer;
- int next;
-
- public string description;
- public int i; // position in the description
- public DataConverter conv;
- public int repeat;
-
- //
- // if align == -1, auto align to the size of the byte array
- // if align == 0, do not do alignment
- // Any other values aligns to that particular size
- //
- public int align;
-
- public void Add (byte [] group)
- {
- //Console.WriteLine ("Adding {0} bytes to {1} (next={2}", group.Length,
- // buffer == null ? "null" : buffer.Length.ToString (), next);
-
- if (buffer == null){
- buffer = group;
- next = group.Length;
- return;
- }
- if (align != 0){
- if (align == -1)
- next = Align (next, group.Length);
- else
- next = Align (next, align);
- align = 0;
- }
-
- if (next + group.Length > buffer.Length){
- byte [] nb = new byte [System.Math.Max (next, 16) * 2 + group.Length];
- Array.Copy (buffer, nb, buffer.Length);
- Array.Copy (group, 0, nb, next, group.Length);
- next = next + group.Length;
- buffer = nb;
- } else {
- Array.Copy (group, 0, buffer, next, group.Length);
- next += group.Length;
- }
- }
-
- public byte [] Get ()
- {
- if (buffer == null)
- return new byte [0];
-
- if (buffer.Length != next){
- byte [] b = new byte [next];
- Array.Copy (buffer, b, next);
- return b;
- }
- return buffer;
- }
- }
-
- //
- // Format includes:
- // Control:
- // ^ Switch to big endian encoding
- // _ Switch to little endian encoding
- // % Switch to host (native) encoding
- // ! aligns the next data type to its natural boundary (for strings this is 4).
- //
- // Types:
- // s Int16
- // S UInt16
- // i Int32
- // I UInt32
- // l Int64
- // L UInt64
- // f float
- // d double
- // b byte
- // c 1-byte signed character
- // C 1-byte unsigned character
- // z8 string encoded as UTF8 with 1-byte null terminator
- // z6 string encoded as UTF16 with 2-byte null terminator
- // z7 string encoded as UTF7 with 1-byte null terminator
- // zb string encoded as BigEndianUnicode with 2-byte null terminator
- // z3 string encoded as UTF32 with 4-byte null terminator
- // z4 string encoded as UTF32 big endian with 4-byte null terminator
- // $8 string encoded as UTF8
- // $6 string encoded as UTF16
- // $7 string encoded as UTF7
- // $b string encoded as BigEndianUnicode
- // $3 string encoded as UTF32
- // $4 string encoded as UTF-32 big endian encoding
- // x null byte
- //
- // Repeats, these are prefixes:
- // N a number between 1 and 9, indicates a repeat count (process N items
- // with the following datatype
- // [N] For numbers larger than 9, use brackets, for example [20]
- // * Repeat the next data type until the arguments are exhausted
- //
- static public byte [] Pack (string description, params object [] args)
- {
- int argn = 0;
- PackContext b = new PackContext ();
- b.conv = CopyConv;
- b.description = description;
-
- for (b.i = 0; b.i < description.Length; ){
- object oarg;
-
- if (argn < args.Length)
- oarg = args [argn];
- else {
- if (b.repeat != 0)
- break;
-
- oarg = null;
- }
-
- int save = b.i;
-
- if (PackOne (b, oarg)){
- argn++;
- if (b.repeat > 0){
- if (--b.repeat > 0)
- b.i = save;
- else
- b.i++;
- } else
- b.i++;
- } else
- b.i++;
- }
- return b.Get ();
- }
-
- static public byte [] PackEnumerable (string description, IEnumerable args)
- {
- PackContext b = new PackContext ();
- b.conv = CopyConv;
- b.description = description;
-
- IEnumerator enumerator = args.GetEnumerator ();
- bool ok = enumerator.MoveNext ();
-
- for (b.i = 0; b.i < description.Length; ){
- object oarg;
-
- if (ok)
- oarg = enumerator.Current;
- else {
- if (b.repeat != 0)
- break;
- oarg = null;
- }
-
- int save = b.i;
-
- if (PackOne (b, oarg)){
- ok = enumerator.MoveNext ();
- if (b.repeat > 0){
- if (--b.repeat > 0)
- b.i = save;
- else
- b.i++;
- } else
- b.i++;
- } else
- b.i++;
- }
- return b.Get ();
- }
-
- //
- // Packs one datum `oarg' into the buffer `b', using the string format
- // in `description' at position `i'
- //
- // Returns: true if we must pick the next object from the list
- //
- static bool PackOne (PackContext b, object oarg)
- {
- int n;
-
- switch (b.description [b.i]){
- case '^':
- b.conv = BigEndian;
- return false;
- case '_':
- b.conv = LittleEndian;
- return false;
- case '%':
- b.conv = Native;
- return false;
-
- case '!':
- b.align = -1;
- return false;
-
- case 'x':
- b.Add (new byte [] { 0 });
- return false;
-
- // Type Conversions
- case 'i':
- b.Add (b.conv.GetBytes (Convert.ToInt32 (oarg)));
- break;
-
- case 'I':
- b.Add (b.conv.GetBytes (Convert.ToUInt32 (oarg)));
- break;
-
- case 's':
- b.Add (b.conv.GetBytes (Convert.ToInt16 (oarg)));
- break;
-
- case 'S':
- b.Add (b.conv.GetBytes (Convert.ToUInt16 (oarg)));
- break;
-
- case 'l':
- b.Add (b.conv.GetBytes (Convert.ToInt64 (oarg)));
- break;
-
- case 'L':
- b.Add (b.conv.GetBytes (Convert.ToUInt64 (oarg)));
- break;
-
- case 'f':
- b.Add (b.conv.GetBytes (Convert.ToSingle (oarg)));
- break;
-
- case 'd':
- b.Add (b.conv.GetBytes (Convert.ToDouble (oarg)));
- break;
-
- case 'b':
- b.Add (new byte [] { Convert.ToByte (oarg) });
- break;
-
- case 'c':
- b.Add (new byte [] { (byte) (Convert.ToSByte (oarg)) });
- break;
-
- case 'C':
- b.Add (new byte [] { Convert.ToByte (oarg) });
- break;
-
- // Repeat acount;
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- b.repeat = ((short) b.description [b.i]) - ((short) '0');
- return false;
-
- case '*':
- b.repeat = Int32.MaxValue;
- return false;
-
- case '[':
- int count = -1, j;
-
- for (j = b.i+1; j < b.description.Length; j++){
- if (b.description [j] == ']')
- break;
- n = ((short) b.description [j]) - ((short) '0');
- if (n >= 0 && n <= 9){
- if (count == -1)
- count = n;
- else
- count = count * 10 + n;
- }
- }
- if (count == -1)
- throw new ArgumentException ("invalid size specification");
- b.i = j;
- b.repeat = count;
- return false;
-
- case '$': case 'z':
- bool add_null = b.description [b.i] == 'z';
- b.i++;
- if (b.i >= b.description.Length)
- throw new ArgumentException ("$ description needs a type specified", "description");
- char d = b.description [b.i];
- Encoding e;
-
- switch (d){
- case '8':
- e = Encoding.UTF8;
- n = 1;
- break;
- case '6':
- e = Encoding.Unicode;
- n = 2;
- break;
- case '7':
- e = Encoding.UTF7;
- n = 1;
- break;
- case 'b':
- e = Encoding.BigEndianUnicode;
- n = 2;
- break;
- case '3':
- e = Encoding.GetEncoding (12000);
- n = 4;
- break;
- case '4':
- e = Encoding.GetEncoding (12001);
- n = 4;
- break;
-
- default:
- throw new ArgumentException ("Invalid format for $ specifier", "description");
- }
- if (b.align == -1)
- b.align = 4;
- b.Add (e.GetBytes (Convert.ToString (oarg)));
- if (add_null)
- b.Add (new byte [n]);
- break;
- default:
- throw new ArgumentException (String.Format ("invalid format specified `{0}'",
- b.description [b.i]));
- }
- return true;
- }
-
- static bool Prepare (byte [] buffer, ref int idx, int size, ref bool align)
- {
- if (align){
- idx = Align (idx, size);
- align = false;
- }
- if (idx + size > buffer.Length){
- idx = buffer.Length;
- return false;
- }
- return true;
- }
-
- static public IList Unpack (string description, byte [] buffer, int startIndex)
- {
- DataConverter conv = CopyConv;
- ArrayList result = new ArrayList ();
- int idx = startIndex;
- bool align = false;
- int repeat = 0, n;
-
- for (int i = 0; i < description.Length && idx < buffer.Length; ){
- int save = i;
-
- switch (description [i]){
- case '^':
- conv = BigEndian;
- break;
- case '_':
- conv = LittleEndian;
- break;
- case '%':
- conv = Native;
- break;
- case 'x':
- idx++;
- break;
-
- case '!':
- align = true;
- break;
-
- // Type Conversions
- case 'i':
- if (Prepare (buffer, ref idx, 4, ref align)){
- result.Add (conv.GetInt32 (buffer, idx));
- idx += 4;
- }
- break;
-
- case 'I':
- if (Prepare (buffer, ref idx, 4, ref align)){
- result.Add (conv.GetUInt32 (buffer, idx));
- idx += 4;
- }
- break;
-
- case 's':
- if (Prepare (buffer, ref idx, 2, ref align)){
- result.Add (conv.GetInt16 (buffer, idx));
- idx += 2;
- }
- break;
-
- case 'S':
- if (Prepare (buffer, ref idx, 2, ref align)){
- result.Add (conv.GetUInt16 (buffer, idx));
- idx += 2;
- }
- break;
-
- case 'l':
- if (Prepare (buffer, ref idx, 8, ref align)){
- result.Add (conv.GetInt64 (buffer, idx));
- idx += 8;
- }
- break;
-
- case 'L':
- if (Prepare (buffer, ref idx, 8, ref align)){
- result.Add (conv.GetUInt64 (buffer, idx));
- idx += 8;
- }
- break;
-
- case 'f':
- if (Prepare (buffer, ref idx, 4, ref align)){
- result.Add (conv.GetDouble (buffer, idx));
- idx += 4;
- }
- break;
-
- case 'd':
- if (Prepare (buffer, ref idx, 8, ref align)){
- result.Add (conv.GetDouble (buffer, idx));
- idx += 8;
- }
- break;
-
- case 'b':
- if (Prepare (buffer, ref idx, 1, ref align)){
- result.Add (buffer [idx]);
- idx++;
- }
- break;
-
- case 'c': case 'C':
- if (Prepare (buffer, ref idx, 1, ref align)){
- char c;
-
- if (description [i] == 'c')
- c = ((char) ((sbyte)buffer [idx]));
- else
- c = ((char) ((byte)buffer [idx]));
-
- result.Add (c);
- idx++;
- }
- break;
-
- // Repeat acount;
- case '1': case '2': case '3': case '4': case '5':
- case '6': case '7': case '8': case '9':
- repeat = ((short) description [i]) - ((short) '0');
- save = i + 1;
- break;
-
- case '*':
- repeat = Int32.MaxValue;
- break;
-
- case '[':
- int count = -1, j;
-
- for (j = i+1; j < description.Length; j++){
- if (description [j] == ']')
- break;
- n = ((short) description [j]) - ((short) '0');
- if (n >= 0 && n <= 9){
- if (count == -1)
- count = n;
- else
- count = count * 10 + n;
- }
- }
- if (count == -1)
- throw new ArgumentException ("invalid size specification");
- i = j;
- repeat = count;
- break;
-
- case '$': case 'z':
- // bool with_null = description [i] == 'z';
- i++;
- if (i >= description.Length)
- throw new ArgumentException ("$ description needs a type specified", "description");
- char d = description [i];
- Encoding e;
- if (align){
- idx = Align (idx, 4);
- align = false;
- }
- if (idx >= buffer.Length)
- break;
-
- switch (d){
- case '8':
- e = Encoding.UTF8;
- n = 1;
- break;
- case '6':
- e = Encoding.Unicode;
- n = 2;
- break;
- case '7':
- e = Encoding.UTF7;
- n = 1;
- break;
- case 'b':
- e = Encoding.BigEndianUnicode;
- n = 2;
- break;
- case '3':
- e = Encoding.GetEncoding (12000);
- n = 4;
- break;
- case '4':
- e = Encoding.GetEncoding (12001);
- n = 4;
- break;
-
- default:
- throw new ArgumentException ("Invalid format for $ specifier", "description");
- }
- int k = idx;
- switch (n){
- case 1:
- for (; k < buffer.Length && buffer [k] != 0; k++)
- ;
- result.Add (e.GetChars (buffer, idx, k-idx));
- if (k == buffer.Length)
- idx = k;
- else
- idx = k+1;
- break;
-
- case 2:
- for (; k < buffer.Length; k++){
- if (k+1 == buffer.Length){
- k++;
- break;
- }
- if (buffer [k] == 0 && buffer [k+1] == 0)
- break;
- }
- result.Add (e.GetChars (buffer, idx, k-idx));
- if (k == buffer.Length)
- idx = k;
- else
- idx = k+2;
- break;
-
- case 4:
- for (; k < buffer.Length; k++){
- if (k+3 >= buffer.Length){
- k = buffer.Length;
- break;
- }
- if (buffer[k]==0 && buffer[k+1] == 0 && buffer[k+2] == 0 && buffer[k+3]== 0)
- break;
- }
- result.Add (e.GetChars (buffer, idx, k-idx));
- if (k == buffer.Length)
- idx = k;
- else
- idx = k+4;
- break;
- }
- break;
- default:
- throw new ArgumentException (String.Format ("invalid format specified `{0}'",
- description [i]));
- }
-
- if (repeat > 0){
- if (--repeat > 0)
- i = save;
- } else
- i++;
- }
- return result;
- }
-
- internal void Check (byte [] dest, int destIdx, int size)
- {
- if (dest == null)
- throw new ArgumentNullException ("dest");
- if (destIdx < 0 || destIdx > dest.Length - size)
- throw new ArgumentException ("destIdx");
- }
-
- class CopyConverter : DataConverter {
- public override double GetDouble (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
- double ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override ulong GetUInt64 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ulong ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override long GetInt64 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- long ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override float GetFloat (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- float ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override int GetInt32 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- int ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override uint GetUInt32 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- uint ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override short GetInt16 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- short ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 2; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override ushort GetUInt16 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ushort ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 2; i++)
- b [i] = data [index+i];
-
- return ret;
- }
-
- public override void PutBytes (byte [] dest, int destIdx, double value)
- {
- Check (dest, destIdx, 8);
- fixed (byte *target = &dest [destIdx]){
- long *source = (long *) &value;
-
- *((long *)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, float value)
- {
- Check (dest, destIdx, 4);
- fixed (byte *target = &dest [destIdx]){
- uint *source = (uint *) &value;
-
- *((uint *)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, int value)
- {
- Check (dest, destIdx, 4);
- fixed (byte *target = &dest [destIdx]){
- uint *source = (uint *) &value;
-
- *((uint *)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, uint value)
- {
- Check (dest, destIdx, 4);
- fixed (byte *target = &dest [destIdx]){
- uint *source = (uint *) &value;
-
- *((uint *)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, long value)
- {
- Check (dest, destIdx, 8);
- fixed (byte *target = &dest [destIdx]){
- long *source = (long *) &value;
-
- *((long*)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, ulong value)
- {
- Check (dest, destIdx, 8);
- fixed (byte *target = &dest [destIdx]){
- ulong *source = (ulong *) &value;
-
- *((ulong *) target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, short value)
- {
- Check (dest, destIdx, 2);
- fixed (byte *target = &dest [destIdx]){
- ushort *source = (ushort *) &value;
-
- *((ushort *)target) = *source;
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, ushort value)
- {
- Check (dest, destIdx, 2);
- fixed (byte *target = &dest [destIdx]){
- ushort *source = (ushort *) &value;
-
- *((ushort *)target) = *source;
- }
- }
- }
-
- class SwapConverter : DataConverter {
- public override double GetDouble (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- double ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [7-i] = data [index+i];
-
- return ret;
- }
-
- public override ulong GetUInt64 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ulong ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [7-i] = data [index+i];
-
- return ret;
- }
-
- public override long GetInt64 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- long ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 8; i++)
- b [7-i] = data [index+i];
-
- return ret;
- }
-
- public override float GetFloat (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- float ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [3-i] = data [index+i];
-
- return ret;
- }
-
- public override int GetInt32 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- int ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [3-i] = data [index+i];
-
- return ret;
- }
-
- public override uint GetUInt32 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- uint ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 4; i++)
- b [3-i] = data [index+i];
-
- return ret;
- }
-
- public override short GetInt16 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- short ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 2; i++)
- b [1-i] = data [index+i];
-
- return ret;
- }
-
- public override ushort GetUInt16 (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ushort ret;
- byte *b = (byte *)&ret;
-
- for (int i = 0; i < 2; i++)
- b [1-i] = data [index+i];
-
- return ret;
- }
-
- public override void PutBytes (byte [] dest, int destIdx, double value)
- {
- Check (dest, destIdx, 8);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 8; i++)
- target [i] = source [7-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, float value)
- {
- Check (dest, destIdx, 4);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 4; i++)
- target [i] = source [3-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, int value)
- {
- Check (dest, destIdx, 4);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 4; i++)
- target [i] = source [3-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, uint value)
- {
- Check (dest, destIdx, 4);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 4; i++)
- target [i] = source [3-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, long value)
- {
- Check (dest, destIdx, 8);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 8; i++)
- target [i] = source [7-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, ulong value)
- {
- Check (dest, destIdx, 8);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 4; i++)
- target [i] = source [7-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, short value)
- {
- Check (dest, destIdx, 2);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 2; i++)
- target [i] = source [1-i];
- }
- }
-
- public override void PutBytes (byte [] dest, int destIdx, ushort value)
- {
- Check (dest, destIdx, 2);
-
- fixed (byte *target = &dest [destIdx]){
- byte *source = (byte *) &value;
-
- for (int i = 0; i < 2; i++)
- target [i] = source [1-i];
- }
- }
- }
-
-#if MONO_DATACONVERTER_STATIC_METHODS
- static unsafe void PutBytesLE (byte *dest, byte *src, int count)
- {
- int i = 0;
-
- if (BitConverter.IsLittleEndian){
- for (; i < count; i++)
- *dest++ = *src++;
- } else {
- dest += count;
- for (; i < count; i++)
- *(--dest) = *src++;
- }
- }
-
- static unsafe void PutBytesBE (byte *dest, byte *src, int count)
- {
- int i = 0;
-
- if (BitConverter.IsLittleEndian){
- dest += count;
- for (; i < count; i++)
- *(--dest) = *src++;
- } else {
- for (; i < count; i++)
- *dest++ = *src++;
- }
- }
-
- static unsafe void PutBytesNative (byte *dest, byte *src, int count)
- {
- int i = 0;
-
- for (; i < count; i++)
- dest [i-count] = *src++;
- }
-
- static public unsafe double DoubleFromLE (byte[] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- double ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe float FloatFromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- float ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe long Int64FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- long ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe ulong UInt64FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ulong ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe int Int32FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- int ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe uint UInt32FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- uint ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe short Int16FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- short ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- static public unsafe ushort UInt16FromLE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ushort ret;
- fixed (byte *src = &data[index]){
- PutBytesLE ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- static public unsafe double DoubleFromBE (byte[] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- double ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe float FloatFromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- float ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe long Int64FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- long ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe ulong UInt64FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ulong ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe int Int32FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- int ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe uint UInt32FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- uint ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe short Int16FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- short ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- static public unsafe ushort UInt16FromBE (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ushort ret;
- fixed (byte *src = &data[index]){
- PutBytesBE ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- static public unsafe double DoubleFromNative (byte[] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- double ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe float FloatFromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- float ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe long Int64FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- long ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe ulong UInt64FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 8)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ulong ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 8);
- }
- return ret;
- }
-
- static public unsafe int Int32FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- int ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe uint UInt32FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 4)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- uint ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 4);
- }
- return ret;
- }
-
- static public unsafe short Int16FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- short ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- static public unsafe ushort UInt16FromNative (byte [] data, int index)
- {
- if (data == null)
- throw new ArgumentNullException ("data");
- if (data.Length - index < 2)
- throw new ArgumentException ("index");
- if (index < 0)
- throw new ArgumentException ("index");
-
- ushort ret;
- fixed (byte *src = &data[index]){
- PutBytesNative ((byte *) &ret, src, 2);
- }
- return ret;
- }
-
- unsafe static byte[] GetBytesPtr (byte *ptr, int count)
- {
- byte [] ret = new byte [count];
-
- for (int i = 0; i < count; i++) {
- ret [i] = ptr [i];
- }
-
- return ret;
- }
-
- unsafe static byte[] GetBytesSwap (bool swap, byte *ptr, int count)
- {
- byte [] ret = new byte [count];
-
- if (swap){
- int t = count-1;
- for (int i = 0; i < count; i++) {
- ret [t-i] = ptr [i];
- }
- } else {
- for (int i = 0; i < count; i++) {
- ret [i] = ptr [i];
- }
- }
- return ret;
- }
-
- unsafe public static byte[] GetBytesNative (bool value)
- {
- return GetBytesPtr ((byte *) &value, 1);
- }
-
- unsafe public static byte[] GetBytesNative (char value)
- {
- return GetBytesPtr ((byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesNative (short value)
- {
- return GetBytesPtr ((byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesNative (int value)
- {
- return GetBytesPtr ((byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesNative (long value)
- {
- return GetBytesPtr ((byte *) &value, 8);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesNative (ushort value)
- {
- return GetBytesPtr ((byte *) &value, 2);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesNative (uint value)
- {
- return GetBytesPtr ((byte *) &value, 4);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesNative (ulong value)
- {
- return GetBytesPtr ((byte *) &value, 8);
- }
-
- unsafe public static byte[] GetBytesNative (float value)
- {
- return GetBytesPtr ((byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesNative (double value)
- {
- return GetBytesPtr ((byte *) &value, 8);
- }
-
- unsafe public static byte[] GetBytesLE (bool value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 1);
- }
-
- unsafe public static byte[] GetBytesLE (char value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesLE (short value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesLE (int value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesLE (long value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesLE (ushort value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesLE (uint value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesLE (ulong value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-
- unsafe public static byte[] GetBytesLE (float value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesLE (double value)
- {
- return GetBytesSwap (!BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-
- unsafe public static byte[] GetBytesBE (bool value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 1);
- }
-
- unsafe public static byte[] GetBytesBE (char value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesBE (short value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- unsafe public static byte[] GetBytesBE (int value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesBE (long value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesBE (ushort value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 2);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesBE (uint value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- [CLSCompliant (false)]
- unsafe public static byte[] GetBytesBE (ulong value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-
- unsafe public static byte[] GetBytesBE (float value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 4);
- }
-
- unsafe public static byte[] GetBytesBE (double value)
- {
- return GetBytesSwap (BitConverter.IsLittleEndian, (byte *) &value, 8);
- }
-#endif
-
- }
-}
+++ /dev/null
-thisdir = tools/ildasm
-SUBDIRS =
-include ../../build/rules.make
-
-LOCAL_MCS_FLAGS = -r:Mono.Cecil.dll -D:MONO_DATACONVERTER_STATIC_METHODS -unsafe
-PROGRAM = $(topdir)/class/lib/$(PROFILE)/ildasm.exe
-
-include ../../build/executable.make
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-using System.Linq;
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-using Mono;
-
-public partial class ILDAsm
-{
- public static int Main (String[] args) {
- if (args.Length != 1) {
- Console.Error.WriteLine ("Usage: ildasm <assembly file>");
- return 1;
- }
-
- var inst = new ILDAsm ();
- return inst.Run (args);
- }
-
- public AssemblyDefinition ad;
- public ModuleDefinition main;
- public TextWriter os;
- public int indent;
- public List<FieldDefinition> fields_with_rva = new List<FieldDefinition> ();
-
- public void WriteLine () {
- os.WriteLine ();
- }
-
- public void WriteLine (String s) {
- for (int i = 0; i < indent; ++i)
- os.Write (" ");
- os.WriteLine (s);
- }
-
- public int Run (String[] args) {
- ad = AssemblyDefinition.ReadAssembly (args [0]);
-
- main = ad.MainModule;
-
- os = Console.Out;
-
- // Emit assembly references
- EmitAssemblyReferences ();
- EmitAssembly ();
- EmitModule ();
- foreach (var typedef in main.Types) {
- // FIXME:
- if (typedef.Name == "<Module>")
- EmitGlobals (typedef);
- else
- EmitType (typedef);
- }
- EmitData ();
-
- return 0;
- }
-
- string EscapeName (string s) {
- bool escape = false;
-
- if (s.Contains ("/")) {
- string[] parts = s.Split ('/');
- var sb = new StringBuilder ();
- for (int i = 0; i < parts.Length; ++i) {
- if (i > 0)
- sb.Append ("/");
- sb.Append (EscapeName (parts [i]));
- }
- return sb.ToString ();
- }
-
- foreach (char c in s) {
- if (!((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') || (c == '_') || (c == '.') || (c == '`')))
- escape = true;
- }
- if (!escape && keyword_table.ContainsKey (s))
- escape = true;
- if (escape)
- return "'" + s + "'";
- else
- return s;
- }
-
- string EscapeString (string s) {
- return s.Replace ("\\", "\\\\").Replace ("\"", "\\\"");
- }
-
- void EmitScope (IMetadataScope s, StringBuilder sb) {
- if (s is AssemblyNameReference) {
- AssemblyNameReference aname = (s as AssemblyNameReference);
- sb.Append ("[" + EscapeName (aname.Name) + "]");
- } else if (s is ModuleDefinition) {
- if (s != main)
- throw new NotImplementedException ();
- } else {
- throw new NotImplementedException (s.GetType ().ToString ());
- }
- }
-
- string StringifyTypeRef (TypeReference t) {
- switch (t.MetadataType) {
- case MetadataType.Void:
- return "void";
- case MetadataType.Boolean:
- return "bool";
- case MetadataType.Char:
- return "char";
- case MetadataType.SByte:
- return "int8";
- case MetadataType.Byte:
- return "unsigned int8";
- case MetadataType.Int16:
- return "int16";
- case MetadataType.UInt16:
- return "unsigned int16";
- case MetadataType.Int32:
- return "int32";
- case MetadataType.UInt32:
- return "unsigned int32";
- case MetadataType.Int64:
- return "int64";
- case MetadataType.UInt64:
- return "unsigned int64";
- case MetadataType.Single:
- return "float32";
- case MetadataType.Double:
- return "float64";
- case MetadataType.String:
- return "string";
- case MetadataType.IntPtr:
- return "native int";
- case MetadataType.UIntPtr:
- //return "unsigned native int";
- return "[mscorlib]System.UIntPtr";
- case MetadataType.TypedByReference:
- return "typedref";
- case MetadataType.Class:
- case MetadataType.Object:
- case MetadataType.ValueType: {
- var sb = new StringBuilder ();
- IMetadataScope s = t.Scope;
- if (t.MetadataType == MetadataType.ValueType)
- sb.Append ("valuetype ");
- else
- sb.Append ("class ");
- EmitScope (s, sb);
- sb.Append (EscapeName (t.FullName));
- return sb.ToString ();
- }
- case MetadataType.Array: {
- ArrayType at = (t as ArrayType);
-
- if (at.IsVector)
- return StringifyTypeRef (at.ElementType) + "[]";
-
- var suffix = new StringBuilder ();
- suffix.Append ("[");
- for (int i = 0; i < at.Dimensions.Count; i++) {
- if (i > 0)
- suffix.Append (",");
-
- suffix.Append (at.Dimensions [i].ToString ());
- }
- suffix.Append ("]");
-
- return StringifyTypeRef (at.ElementType) + suffix;
- }
- case MetadataType.Pointer:
- return StringifyTypeRef ((t as TypeSpecification).ElementType) + "*";
- case MetadataType.ByReference:
- return StringifyTypeRef ((t as TypeSpecification).ElementType) + "&";
- case MetadataType.Pinned:
- return StringifyTypeRef ((t as TypeSpecification).ElementType) + " pinned";
- case MetadataType.GenericInstance: {
- var sb = new StringBuilder ();
- var inst = (t as GenericInstanceType);
- sb.Append (StringifyTypeRef (inst.ElementType));
- sb.Append ("<");
- int aindex = 0;
- foreach (TypeReference arg in inst.GenericArguments) {
- if (aindex > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (arg));
- aindex ++;
- }
- sb.Append (">");
- return sb.ToString ();
- }
- case MetadataType.Var:
- return "!" + (t as GenericParameter).Position;
- case MetadataType.MVar:
- return "!!" + (t as GenericParameter).Position;
- case MetadataType.Sentinel:
- return "..., " + StringifyTypeRef ((t as SentinelType).ElementType);
- case MetadataType.RequiredModifier: {
- var mod = (t as RequiredModifierType);
- if (mod.ModifierType.MetadataType != MetadataType.Class)
- throw new NotImplementedException ();
- var sb = new StringBuilder ();
- sb.Append (StringifyTypeRef (mod.ElementType));
- sb.Append (" modreq (");
- EmitScope (mod.ModifierType.Scope, sb);
- sb.Append (EscapeName (mod.ModifierType.FullName));
- sb.Append (")");
- return sb.ToString ();
- }
- default:
- throw new NotImplementedException ("" + t.MetadataType + " " + t.ToString ());
- }
- }
-
- // Same as StringifyTypeRef, but emit primitive types as [mscorlib]...
- string StringifyTypeRefNoPrim (TypeReference t) {
- switch (t.MetadataType) {
- case MetadataType.Void:
- case MetadataType.Boolean:
- case MetadataType.Char:
- case MetadataType.SByte:
- case MetadataType.Byte:
- case MetadataType.Int16:
- case MetadataType.UInt16:
- case MetadataType.Int32:
- case MetadataType.UInt32:
- case MetadataType.Int64:
- case MetadataType.UInt64:
- case MetadataType.Single:
- case MetadataType.Double:
- case MetadataType.String:
- case MetadataType.IntPtr:
- case MetadataType.UIntPtr:
- case MetadataType.TypedByReference:
- return "[mscorlib]" + t.FullName;
- default:
- return StringifyTypeRef (t);
- }
- }
-
- string StringifyMethodRef (MethodReference method) {
- var sb = new StringBuilder ();
- if (method.CallingConvention == MethodCallingConvention.VarArg)
- sb.Append ("vararg ");
- if (method.HasThis)
- sb.Append ("instance ");
- sb.Append (StringifyTypeRef (method.ReturnType));
- sb.Append (' ');
- sb.Append (StringifyTypeRefNoPrim (method.DeclaringType));
- sb.Append ("::");
- sb.Append (EscapeName (method.Name));
- if (method is GenericInstanceMethod) {
- sb.Append ("<");
- int idx = 0;
- foreach (var gpar in (method as GenericInstanceMethod).GenericArguments) {
- if (idx > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (gpar));
- idx ++;
- }
- sb.Append (">");
- }
- sb.Append ('(');
- int par_index = 0;
- foreach (ParameterReference par in method.Parameters) {
- if (par_index > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (par.ParameterType));
- par_index ++;
- }
- sb.Append (")");
- return sb.ToString ();
- }
-
- string StringifyFieldRef (FieldReference field) {
- var sb = new StringBuilder ();
- sb.Append (StringifyTypeRef (field.FieldType));
- sb.Append (' ');
- sb.Append (StringifyTypeRefNoPrim (field.DeclaringType));
- sb.Append ("::");
- sb.Append (EscapeName (field.Name));
- return sb.ToString ();
- }
-
- void WriteBlob (byte[] blob) {
- int idx = 0;
- while (idx < blob.Length) {
- int len = idx + 16 < blob.Length ? 16 : blob.Length - idx;
- var sb = new StringBuilder ();
- var sb2 = new StringBuilder ();
- for (int i = idx; i < idx + len; ++i) {
- sb.Append (String.Format ("{0:X2} ", blob [i]));
- if (Char.IsLetterOrDigit ((char)blob [i]))
- sb2.Append ((char)blob [i]);
- else
- sb2.Append ('.');
- }
- for (int i = 0; i < 16 - len; ++i)
- sb.Append (" ");
- if (len < 16 || idx + 16 == blob.Length)
- sb.Append (')');
- else
- sb.Append (' ');
- WriteLine (String.Format ("{0} // {1}", sb.ToString (), sb2.ToString ()));
- idx += 16;
- }
- }
-
- string Map (Dictionary <uint, string> map, uint val) {
- string s;
-
- if (map.TryGetValue (val, out s))
- return s;
- else
- throw new NotImplementedException ("Value '" + val + "' not supported.");
- }
-
- string MapFlags (Dictionary <uint, string> map, uint val) {
- var sb = new StringBuilder ();
- foreach (var flag in map.Keys)
- if ((val & flag) != 0)
- sb.Append (map [flag]);
- return sb.ToString ();
- }
-
- void EmitAssemblyReferences () {
- foreach (var aname in main.AssemblyReferences) {
- os.WriteLine (".assembly extern " + EscapeName (aname.Name));
- os.WriteLine ("{");
- indent ++;
- Version v = aname.Version;
- WriteLine (String.Format (".ver {0}:{1}:{2}:{3}", v.Major, v.Minor, v.Build, v.Revision));
- byte [] token = aname.PublicKeyToken;
- if (token.Length > 0) {
- StringBuilder sb = new StringBuilder ();
- StringBuilder sb2 = new StringBuilder ();
- for (int i = 0; i < token.Length; ++i) {
- if (i > 0)
- sb.Append (" ");
- sb.Append (String.Format ("{0:X2}", token [i]));
- if (Char.IsLetterOrDigit ((char)token [i]))
- sb2.Append ((char)token [i]);
- else
- sb2.Append ('.');
- }
- WriteLine (String.Format (".publickeytoken = ({0}) // {1}", sb, sb2));
- }
- indent --;
- WriteLine ("}");
- }
- }
-
- void EmitCattrs (ICustomAttributeProvider prov) {
- foreach (var cattr in prov.CustomAttributes) {
- WriteLine (String.Format (".custom {0} = (", StringifyMethodRef (cattr.Constructor)));
- indent += 3;
- byte[] blob = cattr.GetBlob ();
- WriteBlob (blob);
- indent -= 3;
- }
- }
-
- void EmitSecDeclarations (ISecurityDeclarationProvider prov) {
- foreach (var sec in prov.SecurityDeclarations) {
- string act_str = null;
- if (!sec_action_to_string.TryGetValue (sec.Action, out act_str))
- throw new NotImplementedException (sec.Action.ToString ());
- WriteLine (".permissionset " + act_str + " = (");
- WriteBlob (sec.GetBlob ());
- }
- }
-
- void EmitAssembly () {
- AssemblyNameDefinition aname = ad.Name;
-
- WriteLine (".assembly " + EscapeName (aname.Name));
- WriteLine ("{");
- indent ++;
- EmitCattrs (ad);
- EmitSecDeclarations (ad);
- WriteLine (String.Format (".hash algorithm 0x{0:X8}", (int)aname.HashAlgorithm));
- Version v = aname.Version;
- WriteLine (String.Format (".ver {0}:{1}:{2}:{3}", v.Major, v.Minor, v.Build, v.Revision));
- byte[] token = aname.PublicKey;
- if (token != null && token.Length > 0) {
- StringBuilder sb = new StringBuilder ();
- StringBuilder sb2 = new StringBuilder ();
- for (int i = 0; i < token.Length; ++i) {
- if (i > 0)
- sb.Append (" ");
- sb.Append (String.Format ("{0:X2}", token [i]));
- if (Char.IsLetterOrDigit ((char)token [i]))
- sb2.Append ((char)token [i]);
- else
- sb2.Append ('.');
- }
- WriteLine (String.Format (".publickey = ({0}) // {1}", sb, sb2));
- }
- indent --;
- WriteLine ("}");
- }
-
- void EmitModule () {
- WriteLine (".module " + EscapeName (main.Name) + " // GUID = " + "{" + main.Mvid.ToString ().ToUpper () + "}");
- EmitCattrs (main);
- }
-
- string StringifyTypeAttrs (TypeAttributes attrs) {
- var sb = new StringBuilder ();
-
- sb.Append (Map (type_sem_map, (uint)(attrs & TypeAttributes.ClassSemanticMask)));
- sb.Append (Map (type_access_map, (uint)(attrs & TypeAttributes.VisibilityMask)));
- sb.Append (Map (type_layout_map, (uint)(attrs & TypeAttributes.LayoutMask)));
- sb.Append (Map (type_string_format_map, (uint)(attrs & TypeAttributes.StringFormatMask)));
- sb.Append (MapFlags (type_flag_map, (uint)(attrs)));
-
- return sb.ToString ();
- }
-
- void EmitGenParams (IGenericParameterProvider prov, StringBuilder sb) {
- sb.Append ("<");
- int idx = 0;
- foreach (var gpar in prov.GenericParameters) {
- if (idx > 0)
- sb.Append (", ");
- if (gpar.HasDefaultConstructorConstraint)
- sb.Append (".ctor ");
- if (gpar.HasNotNullableValueTypeConstraint)
- sb.Append ("valuetype ");
- if (gpar.HasReferenceTypeConstraint)
- sb.Append ("class ");
- if (gpar.HasConstraints) {
- int idx2 = 0;
- sb.Append ("(");
- foreach (var c in gpar.Constraints) {
- if (idx2 > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (c));
- idx2 ++;
- }
- sb.Append (")");
- }
- sb.Append (EscapeName (gpar.Name));
- idx ++;
- }
- sb.Append (">");
- }
-
- void EmitGenParamCattrs (IGenericParameterProvider prov) {
- foreach (var gpar in prov.GenericParameters) {
- if (gpar.HasCustomAttributes) {
- WriteLine (".param type " + gpar.Name);
- EmitCattrs (gpar);
- }
- }
- }
-
- void EmitGlobals (TypeDefinition td) {
- foreach (var md in td.Methods)
- EmitMethod (md);
- }
-
- void EmitType (TypeDefinition td) {
- WriteLine ("");
-
- if (td.MetadataType != MetadataType.Class && td.MetadataType != MetadataType.ValueType)
- throw new NotImplementedException (td.MetadataType.ToString ());
-
- // FIXME: Group types by namespaces
- if (!td.IsNested && td.Namespace != null && td.Namespace != String.Empty) {
- WriteLine (".namespace " + EscapeName (td.Namespace));
- WriteLine ("{");
- indent ++;
- }
-
- var sb = new StringBuilder ();
- sb.Append (".class ");
- sb.Append (StringifyTypeAttrs (td.Attributes));
- sb.Append (EscapeName (td.Name));
- if (td.HasGenericParameters)
- EmitGenParams (td, sb);
- WriteLine (sb.ToString ());
- indent ++;
- if (td.BaseType != null)
- WriteLine ("extends " + StringifyTypeRef (td.BaseType));
- if (td.HasInterfaces) {
- int idx = 0;
- sb = new StringBuilder ();
- foreach (TypeReference t in td.Interfaces) {
- if (idx > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (t));
- idx ++;
- }
- WriteLine (String.Format ("implements {0}", sb.ToString ()));
- }
- indent --;
- WriteLine ("{");
- indent ++;
- if (td.PackingSize != -1)
- WriteLine (".pack " + td.PackingSize);
- if (td.ClassSize != -1)
- WriteLine (".size " + td.ClassSize);
- EmitCattrs (td);
- EmitGenParamCattrs (td);
- EmitSecDeclarations (td);
- foreach (var fd in td.Fields)
- EmitField (fd);
- foreach (var md in td.Methods)
- EmitMethod (md);
- foreach (var p in td.Properties)
- EmitProperty (p);
- foreach (var e in td.Events)
- EmitEvent (e);
- foreach (var t in td.NestedTypes)
- EmitType (t);
- indent --;
- WriteLine ("}");
-
- if (!td.IsNested && td.Namespace != null && td.Namespace != String.Empty) {
- WriteLine ("}");
- indent --;
- }
- }
-
- string StringifyFieldAttributes (FieldAttributes attrs) {
- var sb = new StringBuilder ();
- sb.Append (Map (field_access_map, (uint)(attrs & FieldAttributes.FieldAccessMask)));
- sb.Append (MapFlags (field_flag_map, (uint)(attrs)));
- return sb.ToString ();
- }
-
- void EmitField (FieldDefinition fd) {
- var sb = new StringBuilder ();
- sb.Append (".field ");
- if (fd.Offset != -1)
- sb.Append ("[" + fd.Offset + "] ");
- sb.Append (StringifyFieldAttributes (fd.Attributes));
- if (fd.HasMarshalInfo) {
- sb.Append (" ");
- sb.Append (StringifyMarshalInfo (fd.MarshalInfo));
- }
- sb.Append (" ");
- sb.Append (StringifyTypeRef (fd.FieldType));
- sb.Append (" ");
- sb.Append (EscapeName (fd.Name));
- if (fd.HasConstant)
- EmitConstant (fd.Constant, sb);
- if (fd.RVA != 0) {
- sb.Append (String.Format (" at D_{0:x8}", fd.RVA));
- fields_with_rva.Add (fd);
- }
- WriteLine (sb.ToString ());
- EmitCattrs (fd);
- }
-
- string StringifyMethodAttributes (MethodAttributes attrs) {
- var sb = new StringBuilder ();
- sb.Append (Map (method_access_map, (uint)(attrs & MethodAttributes.MemberAccessMask)));
- sb.Append (MapFlags (method_flag_map, (uint)(attrs)));
- return sb.ToString ();
- }
-
- string StringifyMethodImplAttributes (MethodImplAttributes attrs) {
- var sb = new StringBuilder ();
- sb.Append (Map (method_impl_map, (uint)(attrs & MethodImplAttributes.CodeTypeMask)));
- sb.Append (Map (method_managed_map, (uint)(attrs & MethodImplAttributes.ManagedMask)));
- sb.Append (MapFlags (method_impl_flag_map, (uint)(attrs)));
-
- return sb.ToString ();
- }
-
- string StringifyTypeNameReflection (TypeReference t) {
- if (t.MetadataType != MetadataType.Class)
- throw new NotImplementedException ();
- IMetadataScope s = t.Scope;
- if (!(s is ModuleDefinition))
- throw new NotImplementedException ();
- return t.FullName.Replace ("/", "+");
- }
-
- string StringifyMarshalInfo (MarshalInfo mi) {
- var sb = new StringBuilder ();
-
- sb.Append ("marshal (");
-
- string s = null;
- switch (mi.NativeType) {
- case NativeType.Array: {
- var ami = (mi as ArrayMarshalInfo);
- if (native_type_to_str.TryGetValue (ami.ElementType, out s)) {
- sb.Append (s);
- }
- sb.Append ("[");
- //Console.WriteLine ("// XXX: " + ami.Size + " " + ami.SizeParameterIndex + " " + ami.SizeParameterMultiplier);
-
- /*
- * Comments in metadata.c:
- * So if (param_num == 0) && (num_elem > 0), then
- * elem_mult == 0 -> the array size is num_elem
- * elem_mult == 1 -> the array size is @param_num + num_elem
- */
- if (ami.Size != -1 && ami.Size != 0)
- sb.Append (ami.Size.ToString ());
- if (ami.SizeParameterMultiplier != 0 && ami.SizeParameterIndex != -1)
- sb.Append ("+" + ami.SizeParameterIndex.ToString ());
- sb.Append ("]");
- break;
- }
- case NativeType.FixedArray: {
- var ami = (mi as FixedArrayMarshalInfo);
- /*
- if (native_type_to_str.TryGetValue (ami.ElementType, out s)) {
- sb.Append (s);
- }
- */
- sb.Append ("fixed array [" + ami.Size + "]");
- break;
- }
- case NativeType.FixedSysString: {
- var ami = (mi as FixedSysStringMarshalInfo);
- sb.Append ("fixed sysstring [" + ami.Size + "]");
- break;
- }
- case NativeType.SafeArray: {
- var sami = (mi as SafeArrayMarshalInfo);
- sb.Append ("safearray ");
- switch (sami.ElementType) {
- case VariantType.Variant:
- sb.Append ("variant");
- break;
- default:
- throw new NotImplementedException ();
- }
- break;
- }
- case NativeType.CustomMarshaler: {
- var cmi = (mi as CustomMarshalInfo);
-
- if (cmi.Guid != Guid.Empty || cmi.UnmanagedType != String.Empty)
- throw new NotImplementedException ();
- sb.Append ("custom (\"" + StringifyTypeNameReflection (cmi.ManagedType) + "\", \"" + EscapeString (cmi.Cookie) + "\")");
- break;
- }
- default:
- if (native_type_to_str.TryGetValue (mi.NativeType, out s))
- sb.Append (s);
- else
- throw new NotImplementedException (mi.NativeType.ToString ());
- break;
- }
- sb.Append (")");
- return sb.ToString ();
- }
-
- string StringifySignature (MethodDefinition md) {
- var sb = new StringBuilder ();
- int pindex = 0;
- foreach (var par in md.Parameters) {
- if (pindex > 0)
- sb.Append (", ");
- if (par.IsIn)
- sb.Append ("[in] ");
- if (par.IsOut)
- sb.Append ("[out] ");
- if (par.IsOptional)
- sb.Append ("[opt] ");
- sb.Append (StringifyTypeRef (par.ParameterType));
- if (par.HasMarshalInfo) {
- sb.Append (" ");
- sb.Append (StringifyMarshalInfo (par.MarshalInfo));
- }
- sb.Append (" ");
- sb.Append (EscapeName (par.Name));
- pindex ++;
- }
-
- return sb.ToString ();
- }
-
- string StringifyPInvokeAttrs (PInvokeAttributes attrs) {
- var sb = new StringBuilder ();
- sb.Append (Map (pinvoke_char_set_map, (uint)(attrs & PInvokeAttributes.CharSetMask)));
- sb.Append (Map (pinvoke_cconv_map, (uint)(attrs & PInvokeAttributes.CallConvMask)));
- sb.Append (MapFlags (pinvoke_flags_map, (uint)(attrs)));
- return sb.ToString ();
- }
-
- string StringifyCallingConvention (MethodCallingConvention cconv) {
- switch (cconv) {
- case MethodCallingConvention.Default:
- return "default";
- case MethodCallingConvention.VarArg:
- return "vararg";
- default:
- throw new NotImplementedException (cconv.ToString ());
- }
- }
-
- void EmitMethod (MethodDefinition md) {
- int idx;
-
- WriteLine ();
- var pinvoke_sb = new StringBuilder ();
- if ((uint)(md.Attributes & MethodAttributes.PInvokeImpl) != 0) {
- var pinvoke = md.PInvokeInfo;
- pinvoke_sb.Append ("pinvokeimpl (\"" + pinvoke.Module.Name + "\" as \"" + pinvoke.EntryPoint + "\" " + StringifyPInvokeAttrs (pinvoke.Attributes) + " )");
- }
- WriteLine (String.Format (".method {0}{1}", StringifyMethodAttributes (md.Attributes), pinvoke_sb));
-
- var sb = new StringBuilder ();
- sb.Append (" ");
- if (!md.IsStatic)
- sb.Append ("instance ");
- // CallingConvention seems to be 32
- sb.Append (StringifyCallingConvention ((MethodCallingConvention)((uint)md.CallingConvention & 0xf)));
- sb.Append (" ");
- sb.Append (StringifyTypeRef (md.ReturnType));
- sb.Append (" ");
- if (md.MethodReturnType.HasMarshalInfo) {
- sb.Append (StringifyMarshalInfo (md.MethodReturnType.MarshalInfo));
- sb.Append (" ");
- }
- sb.Append (EscapeName (md.Name));
- if (md.HasGenericParameters)
- EmitGenParams (md, sb);
- WriteLine (String.Format ("{0} ({1}) {2}", sb, StringifySignature (md), StringifyMethodImplAttributes (md.ImplAttributes)));
- WriteLine ("{");
- indent ++;
- foreach (var ov in md.Overrides)
- WriteLine (".override method " + StringifyMethodRef (ov));
- EmitCattrs (md);
- EmitGenParamCattrs (md);
- EmitSecDeclarations (md);
- idx = 0;
- foreach (var par in md.Parameters) {
- if (par.HasCustomAttributes) {
- WriteLine (".param [" + (idx + 1) + "]");
- EmitCattrs (par);
- }
- if (par.HasConstant) {
- sb = new StringBuilder ();
- EmitConstant (par.Constant, sb);
- WriteLine (".param [" + (idx + 1) + "]" + sb);
- }
- idx ++;
- }
- // FIXME: Print RVA, code size
- if (md == main.EntryPoint)
- WriteLine (".entrypoint");
- if (md.HasBody) {
- MethodBody body = md.Body;
- WriteLine (".maxstack " + body.MaxStackSize);
- if (body.InitLocals)
- WriteLine (".locals init (");
- else
- WriteLine (".locals (");
- indent ++;
- int vindex = 0;
- foreach (var v in body.Variables) {
- WriteLine (StringifyTypeRef (v.VariableType) + " " + (v.Name == "" ? "V_" + v.Index : v.Name) + (vindex + 1 < body.Variables.Count ? ", " : ""));
- vindex ++;
- }
- indent --;
- WriteLine (")");
-
- List<ExceptionHandler> handlers = body.ExceptionHandlers.ToList ();
- List<ExceptionHandler> reverse_handlers = body.ExceptionHandlers.Reverse ().ToList ();
-
- var trys = new Dictionary<ExceptionHandler, bool> ();
- if (handlers.Count > 0)
- trys [handlers [0]] = true;
- for (int i = 1; i < handlers.Count; ++i) {
- trys [handlers [i]] = true;
- for (int j = 0; j < i; ++j) {
- if (handlers [i].TryStart == handlers [j].TryStart && handlers [i].TryEnd == handlers [j].TryEnd) {
- trys [handlers [i]] = false;
- break;
- }
- }
- }
-
- idx = 0;
- var handler_to_idx = new Dictionary<ExceptionHandler, int> ();
- foreach (ExceptionHandler eh in body.ExceptionHandlers) {
- handler_to_idx [eh] = idx;
- idx ++;
- }
-
- foreach (var ins in body.Instructions) {
- foreach (var eh in handlers) {
- if (eh.TryEnd == ins && trys [eh]) {
- indent --;
- WriteLine ("} // end try " + handler_to_idx [eh]);
- }
-
- if (eh.HandlerEnd == ins) {
- indent --;
- WriteLine ("} // end handler " + handler_to_idx [eh]);
- }
- }
-
- foreach (var eh in reverse_handlers) {
- if (eh.TryStart == ins && trys [eh]) {
- WriteLine (".try { // " + handler_to_idx [eh]);
- indent ++;
- }
- if (eh.HandlerStart == ins) {
- string type_str = null;
- switch (eh.HandlerType) {
- case ExceptionHandlerType.Catch:
- type_str = "catch";
- break;
- case ExceptionHandlerType.Finally:
- type_str = "finally";
- break;
- default:
- throw new NotImplementedException (eh.HandlerType.ToString ());
- }
- if (eh.CatchType == null)
- WriteLine (type_str + " { // " + handler_to_idx [eh]);
- else
- WriteLine (type_str + " " + StringifyTypeRef (eh.CatchType) + " { // " + handler_to_idx [eh]);
- indent ++;
- }
- }
-
- WriteLine (StringifyIns (ins));
- }
- }
- indent --;
- WriteLine ("}");
- }
-
- // Based on Instruction:ToString ()
- public string StringifyIns (Instruction ins) {
- var sb = new StringBuilder ();
-
- AppendLabel (sb, ins);
- sb.Append (':');
- sb.Append (" ");
- sb.Append (ins.OpCode.Name);
-
- if (ins.Operand == null)
- return sb.ToString ();
-
- sb.Append (' ');
-
- object operand = ins.Operand;
- switch (ins.OpCode.OperandType) {
- case OperandType.ShortInlineBrTarget:
- case OperandType.InlineBrTarget:
- AppendLabel (sb, (Instruction) operand);
- break;
- case OperandType.InlineSwitch:
- var labels = (Instruction []) operand;
- sb.Append ("(");
- for (int i = 0; i < labels.Length; i++) {
- if (i > 0)
- sb.Append (',');
-
- AppendLabel (sb, labels [i]);
- }
- sb.Append (")");
- break;
- case OperandType.InlineString:
- sb.Append ('\"');
- sb.Append (EscapeString ((string)operand));
- sb.Append ('\"');
- break;
- default:
- if (operand is MethodReference) {
- if (ins.OpCode == OpCodes.Ldtoken)
- sb.Append ("method ");
- sb.Append (StringifyMethodRef ((MethodReference)operand));
- } else if (operand is TypeReference)
- sb.Append (StringifyTypeRef ((TypeReference)operand));
- else if (operand is VariableDefinition)
- sb.Append (operand.ToString ());
- else if (operand is FieldReference) {
- if (ins.OpCode == OpCodes.Ldtoken)
- sb.Append ("field ");
- sb.Append (StringifyFieldRef ((FieldReference)operand));
- } else if (operand is ParameterDefinition) {
- var pd = (operand as ParameterDefinition);
- sb.Append (pd.Index + (pd.Method.HasThis ? 1 : 0));
- }
- else {
- EmitConstantOperand (operand, sb);
- }
- break;
- }
-
- return sb.ToString ();
- }
-
- static void AppendLabel (StringBuilder builder, Instruction instruction) {
- builder.Append ("IL_");
- builder.Append (instruction.Offset.ToString ("x4"));
- }
-
- void EmitProperty (PropertyDefinition p) {
- // FIXME: attributes
-
- var sb = new StringBuilder ();
- sb.Append (".property ");
- if (p.HasThis)
- sb.Append ("instance ");
- sb.Append (StringifyTypeRef (p.PropertyType));
- sb.Append (" ");
- sb.Append (EscapeName (p.Name));
- sb.Append ("(");
- int idx = 0;
- foreach (var par in p.Parameters) {
- if (idx > 0)
- sb.Append (", ");
- sb.Append (StringifyTypeRef (par.ParameterType));
- idx ++;
- }
- sb.Append (")");
- WriteLine (sb.ToString ());
- WriteLine ("{");
- indent ++;
- EmitCattrs (p);
- if (p.SetMethod != null)
- WriteLine (".set " + StringifyMethodRef (p.SetMethod));
- if (p.GetMethod != null)
- WriteLine (".get " + StringifyMethodRef (p.GetMethod));
- if (p.HasOtherMethods)
- throw new NotImplementedException ();
- indent --;
- WriteLine ("}");
- }
-
- void EmitEvent (EventDefinition e) {
- WriteLine (".event " + StringifyTypeRef (e.EventType) + " " + EscapeName (e.Name));
- WriteLine ("{");
- indent ++;
- if (e.AddMethod != null)
- WriteLine (".addon " + StringifyMethodRef (e.AddMethod));
- if (e.RemoveMethod != null)
- WriteLine (".removeon " + StringifyMethodRef (e.RemoveMethod));
- foreach (var m in e.OtherMethods)
- WriteLine (".other " + StringifyMethodRef (m));
- indent --;
- WriteLine ("}");
- }
-
- void EmitData () {
- foreach (var fd in fields_with_rva) {
- WriteLine (String.Format (".data D_{0:x8} = bytearray (", fd.RVA));
- WriteBlob (fd.InitialValue);
- }
- }
-
- void EmitConstantOperand (object operand, StringBuilder sb) {
- if (operand is double) {
- double d = (double)operand;
- // FIXME:
- //if (Double.IsNaN (d) || Double.IsInfinity (d)) {
- {
- byte[] b = DataConverter.GetBytesLE (d);
- sb.Append ("(");
- int index = 0;
- for (int i = 0; i < b.Length; ++i) {
- if (index > 0)
- sb.Append (" ");
- sb.Append (String.Format ("{0:x2}", b [i]));
- index ++;
- }
- sb.Append (")");
- }
- } else if (operand is float) {
- float d = (float)operand;
- // FIXME:
- //if (Single.IsNaN (d) || Single.IsInfinity (d)) {
- {
- byte[] b = DataConverter.GetBytesLE (d);
- sb.Append ("(");
- int index = 0;
- for (int i = 0; i < b.Length; ++i) {
- if (index > 0)
- sb.Append (" ");
- sb.Append (String.Format ("{0:x2}", b [i]));
- index ++;
- }
- sb.Append (")");
- }
- } else if (operand.GetType ().Assembly == typeof (int).Assembly)
- sb.Append (operand.ToString ());
- else
- throw new NotImplementedException (operand.GetType ().ToString ());
- }
-
- void EmitConstant (object o, StringBuilder sb) {
- if (o is byte)
- sb.Append (String.Format (" = int8(0x{0:x2})", (byte)o));
- else if (o is sbyte)
- sb.Append (String.Format (" = int8(0x{0:x2})", (sbyte)o));
- else if (o is short)
- sb.Append (String.Format (" = int16(0x{0:x4})", (short)o));
- else if (o is ushort)
- sb.Append (String.Format (" = int16(0x{0:x4})", (ushort)o));
- else if (o is int)
- sb.Append (String.Format (" = int32(0x{0:x8})", (int)o));
- else if (o is uint)
- sb.Append (String.Format (" = int32(0x{0:x8})", (uint)o));
- else if (o is long)
- sb.Append (String.Format (" = int64(0x{0:x8})", (long)o));
- else if (o is ulong)
- sb.Append (String.Format (" = int64(0x{0:x8})", (ulong)o));
- else if (o is string)
- sb.Append (String.Format (" = \"{0}\"", EscapeString ((string)o)));
- else if (o is bool)
- sb.Append (String.Format (" = bool({0})", (bool)o ? "true" : " false"));
- else if (o is char)
- sb.Append (String.Format (" = char(0x{0:x4})", (int)(char)o));
- else if (o is double)
- // FIXME:
- sb.Append (String.Format (" = float64({0:f})", (double)o));
- else if (o is float)
- // FIXME:
- sb.Append (String.Format (" = float32({0:f})", (float)o));
- else if (o == null)
- sb.Append ("= nullref");
- else
- throw new NotImplementedException ("" + o.GetType ().ToString () + " " + o.ToString ());
- }
-}
+++ /dev/null
-ildasm.cs
-tables.cs
-DataConverter.cs
-
-
+++ /dev/null
-using System;
-using System.IO;
-using System.Text;
-using System.Collections.Generic;
-using System.Linq;
-using Mono.Cecil;
-using Mono.Cecil.Cil;
-using Mono;
-
-/*
- * This partial class contains the tables used by the disassembler.
- */
-public partial class ILDAsm {
-
- Dictionary<uint, string> type_access_map = new Dictionary <uint, string> () {
- { (uint)TypeAttributes.NotPublic, "private " },
- { (uint)TypeAttributes.Public, "public " },
- { (uint)TypeAttributes.NestedPublic, "nested public " },
- { (uint)TypeAttributes.NestedPrivate, "nested private " },
- { (uint)TypeAttributes.NestedFamily, "nested family " },
- { (uint)TypeAttributes.NestedAssembly, "nested assembly " },
- { (uint)TypeAttributes.NestedFamANDAssem, "nested famandassem " },
- { (uint)TypeAttributes.NestedFamORAssem, "nested famorassem " },
- };
- Dictionary<uint, string> type_layout_map = new Dictionary <uint, string> () {
- { (uint)TypeAttributes.AutoLayout, "auto " },
- { (uint)TypeAttributes.SequentialLayout, "sequential " },
- { (uint)TypeAttributes.ExplicitLayout, "explicit " }
- };
- Dictionary<uint, string> type_string_format_map = new Dictionary <uint, string> () {
- { (uint)TypeAttributes.AnsiClass, "ansi " },
- { (uint)TypeAttributes.UnicodeClass, "unicode " },
- //{ (uint)TypeAttributes.AutoClass, "unicode " },
- };
- Dictionary<uint, string> type_flag_map = new Dictionary <uint, string> () {
- { (uint)TypeAttributes.Abstract, "abstract " },
- { (uint)TypeAttributes.Sealed, "sealed " },
- { (uint)TypeAttributes.SpecialName, "specialname " },
- { (uint)TypeAttributes.Import, "import " },
- { (uint)TypeAttributes.Serializable, "serializable " },
- { (uint)TypeAttributes.BeforeFieldInit, "beforefieldinit " },
- { (uint)TypeAttributes.RTSpecialName, "rtspecialname " },
- //{ (uint)TypeAttributes.HasSecurity, "rtspecialname " },
- //{ (uint)TypeAttributes.Forwarder, "rtspecialname " },
- };
-
- Dictionary<uint, string> type_sem_map = new Dictionary <uint, string> () {
- { (uint)TypeAttributes.Class, "" },
- { (uint)TypeAttributes.Interface, "interface " },
- };
-
-
- Dictionary<uint, string> field_access_map = new Dictionary <uint, string> () {
- { (uint)FieldAttributes.Private, "private " },
- { (uint)FieldAttributes.FamANDAssem, "famandassem " },
- { (uint)FieldAttributes.Assembly, "assembly " },
- { (uint)FieldAttributes.Family, "family " },
- { (uint)FieldAttributes.FamORAssem, "famorassem " },
- { (uint)FieldAttributes.Public, "public " },
- };
-
- Dictionary<uint, string> field_flag_map = new Dictionary <uint, string> () {
- { (uint)FieldAttributes.Static, "static " },
- { (uint)FieldAttributes.Literal, "literal " },
- { (uint)FieldAttributes.InitOnly, "initonly " },
- { (uint)FieldAttributes.SpecialName, "specialname " },
- { (uint)FieldAttributes.RTSpecialName, "rtspecialname " },
- { (uint)FieldAttributes.NotSerialized, "notserialized " },
- };
-
-
- Dictionary<uint, string> method_access_map = new Dictionary <uint, string> () {
- { (uint)MethodAttributes.CompilerControlled, "privatescope " },
- { (uint)MethodAttributes.Private, "private " },
- { (uint)MethodAttributes.Public, "public " },
- { (uint)MethodAttributes.Family, "family " },
- { (uint)MethodAttributes.FamORAssem, "famorassem " },
- { (uint)MethodAttributes.Assembly, "assembly " }
- };
-
- Dictionary<uint, string> method_flag_map = new Dictionary <uint, string> () {
- { (uint)MethodAttributes.Static, "static " },
- { (uint)MethodAttributes.Final, "final " },
- { (uint)MethodAttributes.Virtual, "virtual " },
- { (uint)MethodAttributes.HideBySig, "hidebysig " },
- { (uint)MethodAttributes.NewSlot, "newslot " },
- { (uint)MethodAttributes.CheckAccessOnOverride, "strict " },
- { (uint)MethodAttributes.Abstract, "abstract " },
- { (uint)MethodAttributes.SpecialName, "specialname " },
- { (uint)MethodAttributes.RTSpecialName, "rtspecialname " },
- };
-
-
- Dictionary<uint, string> method_impl_map = new Dictionary <uint, string> () {
- { (uint)MethodImplAttributes.IL, "cil " },
- { (uint)MethodImplAttributes.Runtime, "runtime " }
- };
- Dictionary<uint, string> method_managed_map = new Dictionary <uint, string> () {
- { (uint)MethodImplAttributes.Managed, "managed " }
- };
- Dictionary<uint, string> method_impl_flag_map = new Dictionary <uint, string> () {
- { (uint)MethodImplAttributes.PreserveSig, "preservesig " },
- { (uint)MethodImplAttributes.InternalCall, "internalcall " },
- { (uint)MethodImplAttributes.Synchronized, "synchronized " },
- { (uint)MethodImplAttributes.NoInlining, "noinlining " },
- };
-
-
- Dictionary<NativeType, string> native_type_to_str = new Dictionary<NativeType, string> () {
- { NativeType.Boolean, "bool" },
- { NativeType.I1, "int8" },
- { NativeType.U1, "unsigned int8" },
- { NativeType.I2, "int16" },
- { NativeType.U2, "unsigned int16" },
- { NativeType.I4, "int32" },
- { NativeType.U4, "unsigned int32" },
- { NativeType.I8, "int64" },
- { NativeType.U8, "unsigned int64" },
- //{ NativeType.R4, "int32" },
- //{ NativeType.R8, "unsigned int32" },
- { NativeType.LPStr, "lpstr" },
- { NativeType.Int, "int" },
- //{ NativeType.Int, "int" },
- { NativeType.Func, "method" },
- //{ NativeType.Array, "int" },
- //{ NativeType.Currency, "method" },
- { NativeType.BStr, "bstr " },
- { NativeType.LPWStr, "lpwstr" },
- //{ NativeType.LPTStr, "lpwstr" },
- //{ NativeType.FixedSysString, "lpwstr" },
- { NativeType.IUnknown, "iunknown" },
- { NativeType.IDispatch, "idispatch" },
- { NativeType.Struct, "struct" },
- { NativeType.IntF, "interface" },
- //{ NativeType.SafeArray, "interface" },
- //{ NativeType.FixedArray, "interface" },
- //{ NativeType.ByValStr, "interface" },
- //{ NativeType.ANSIBStr, "interface" },
- //{ NativeType.TBStr, "interface" },
- { NativeType.VariantBool, "variant bool" },
- { NativeType.ASAny, "as any" },
- { NativeType.LPStruct, "lpstruct" },
- //{ NativeType.CustomMarshaler, "lpstruct" },
- //{ NativeType.Error, "lpstruct" },
- };
-
-
- Dictionary<uint, string> pinvoke_char_set_map = new Dictionary <uint, string> () {
- { (uint)PInvokeAttributes.CharSetNotSpec, "" },
- { (uint)PInvokeAttributes.CharSetAnsi, "ansi " },
- { (uint)PInvokeAttributes.CharSetUnicode, "unicode " },
- { (uint)PInvokeAttributes.CharSetAuto, "autochar " },
- };
-
- Dictionary<uint, string> pinvoke_cconv_map = new Dictionary <uint, string> () {
- { (uint)PInvokeAttributes.CallConvWinapi, "winapi " },
- { (uint)PInvokeAttributes.CallConvCdecl, "cdecl " },
- { (uint)PInvokeAttributes.CallConvStdCall, "stdcall " },
- { (uint)PInvokeAttributes.CallConvThiscall, "thiscall " },
- { (uint)PInvokeAttributes.CallConvFastcall, "fastcall " },
- };
-
- Dictionary<uint, string> pinvoke_flags_map = new Dictionary <uint, string> () {
- { (uint)PInvokeAttributes.SupportsLastError, "lasterr " },
- };
-
-
- Dictionary<SecurityAction, string> sec_action_to_string = new Dictionary<SecurityAction, string> () {
- //{ SecurityAction.Request, "reqmin" },
- { SecurityAction.Demand, "demand" },
- { SecurityAction.Assert, "assert" },
- { SecurityAction.Deny, "deny" },
- { SecurityAction.PermitOnly, "permitonly" },
- { SecurityAction.LinkDemand, "linkcheck" },
- { SecurityAction.InheritDemand, "inheritcheck" },
- { SecurityAction.RequestMinimum, "reqmin" },
- { SecurityAction.RequestOptional, "reqopt" },
- { SecurityAction.RequestRefuse, "reqrefuse" },
- //{ SecurityAction.PreJitGrant, "reqmin" },
- //{ SecurityAction.PreJitDeny, "reqmin" },
- //{ SecurityAction.NonCasDemand, "reqmin" },
- //{ SecurityAction.NonCasLinkDemand, "reqmin" },
- //{ SecurityAction.NonCasInheritance, "reqmin" },
- };
-
-
- Dictionary<string, bool> keyword_table = new Dictionary<string, bool> {
- {"9", true},
- {"abstract", true},
- {"add", true},
- {"add.ovf", true},
- {"add.ovf.un", true},
- {"algorithm", true},
- {"alignment", true},
- {"and", true},
- {"ansi", true},
- {"any", true},
- {"arglist", true},
- {"array", true},
- {"as", true},
- {"assembly", true},
- {"assert", true},
- {"at", true},
- {"autochar", true},
- {"auto", true},
- {"beforefieldinit", true},
- {"bestfit", true},
- {"beq", true},
- {"beq.s", true},
- {"bge", true},
- {"bge.s", true},
- {"bge.un", true},
- {"bge.un.s", true},
- {"bgt", true},
- {"bgt.s", true},
- {"bgt.un", true},
- {"bgt.un.s", true},
- {"ble", true},
- {"ble.s", true},
- {"ble.un", true},
- {"ble.un.s", true},
- {"blob", true},
- {"blob_object", true},
- {"blt", true},
- {"blt.s", true},
- {"blt.un", true},
- {"blt.un.s", true},
- {"bne.un", true},
- {"bne.un.s", true},
- {"bool", true},
- {"box", true},
- {"break", true},
- {"brfalse", true},
- {"brfalse.s", true},
- {"br", true},
- {"brinst", true},
- {"brinst.s", true},
- {"brnull", true},
- {"brnull.s", true},
- {"br.s", true},
- {"brtrue", true},
- {"brtrue.s", true},
- {"brzero", true},
- {"brzero.s", true},
- {"bstr", true},
- {"bytearray", true},
- {"byvalstr", true},
- {"call", true},
- {"callconv", true},
- {"calli", true},
- {"callmostderived", true},
- {"callvirt", true},
- {"carray", true},
- {"castclass", true},
- {"catch", true},
- {"cdecl", true},
- {"ceq", true},
- {"cf", true},
- {"cgt", true},
- {"cgt.un", true},
- {"char", true},
- {"charmaperror", true},
- {"cil", true},
- {"ckfinite", true},
- {"class", true},
- {"clsid", true},
- {"clt", true},
- {"clt.un", true},
- {"Compilercontrolled", true},
- {"const", true},
- {"conv.i1", true},
- {"conv.i2", true},
- {"conv.i4", true},
- {"conv.i8", true},
- {"conv.i", true},
- {"conv.ovf.i1", true},
- {"conv.ovf.i1.un", true},
- {"conv.ovf.i2", true},
- {"conv.ovf.i2.un", true},
- {"conv.ovf.i4", true},
- {"conv.ovf.i4.un", true},
- {"conv.ovf.i8", true},
- {"conv.ovf.i8.un", true},
- {"conv.ovf.i", true},
- {"conv.ovf.i.un", true},
- {"conv.ovf.u1", true},
- {"conv.ovf.u1.un", true},
- {"conv.ovf.u2", true},
- {"conv.ovf.u2.un", true},
- {"conv.ovf.u4", true},
- {"conv.ovf.u4.un", true},
- {"conv.ovf.u8", true},
- {"conv.ovf.u8.un", true},
- {"conv.ovf.u", true},
- {"conv.ovf.u.un", true},
- {"conv.r4", true},
- {"conv.r8", true},
- {"conv.r.un", true},
- {"conv.u1", true},
- {"conv.u2", true},
- {"conv.u4", true},
- {"conv.u8", true},
- {"conv.u", true},
- {"cpblk", true},
- {"cpobj", true},
- {"currency", true},
- {"custom", true},
- {"date", true},
- {"decimal", true},
- {"default", true},
- {"demand", true},
- {"deny", true},
- {"div", true},
- {"div.un", true},
- {"dup", true},
- {"endfault", true},
- {"endfilter", true},
- {"endfinally", true},
- {"endmac", true},
- {"enum", true},
- {"error", true},
- {"explicit", true},
- {"extends", true},
- {"extern", true},
- {"false", true},
- {"famandassem", true},
- {"family", true},
- {"famorassem", true},
- {"fastcall", true},
- {"fault", true},
- {"field", true},
- {"filetime", true},
- {"filter", true},
- {"final", true},
- {"finally", true},
- {"fixed", true},
- {"flags", true},
- {"float32", true},
- {"float64", true},
- {"float", true},
- {"forwardref", true},
- {"fromunmanaged", true},
- {"handler", true},
- {"hidebysig", true},
- {"hresult", true},
- {"idispatch", true},
- {"il", true},
- {"illegal", true},
- {"implements", true},
- {"implicitcom", true},
- {"implicitres", true},
- {"import", true},
- {"in", true},
- {"inheritcheck", true},
- {"initblk", true},
- {"init", true},
- {"initobj", true},
- {"initonly", true},
- {"instance", true},
- {"int16", true},
- {"int32", true},
- {"int64", true},
- {"int8", true},
- {"interface", true},
- {"internalcall", true},
- {"int", true},
- {"isinst", true},
- {"iunknown", true},
- {"jmp", true},
- {"lasterr", true},
- {"lcid", true},
- {"ldarg.0", true},
- {"ldarg.1", true},
- {"ldarg.2", true},
- {"ldarg.3", true},
- {"ldarga", true},
- {"ldarga.s", true},
- {"ldarg", true},
- {"ldarg.s", true},
- {"ldc.i4.0", true},
- {"ldc.i4.1", true},
- {"ldc.i4.2", true},
- {"ldc.i4.3", true},
- {"ldc.i4.4", true},
- {"ldc.i4.5", true},
- {"ldc.i4.6", true},
- {"ldc.i4.7", true},
- {"ldc.i4.8", true},
- {"ldc.i4", true},
- {"ldc.i4.m1", true},
- {"ldc.i4.M1", true},
- {"ldc.i4.s", true},
- {"ldc.i8", true},
- {"ldc.r4", true},
- {"ldc.r8", true},
- {"ldelem", true},
- {"ldelema", true},
- {"ldelem.i1", true},
- {"ldelem.i2", true},
- {"ldelem.i4", true},
- {"ldelem.i8", true},
- {"ldelem.i", true},
- {"ldelem.r4", true},
- {"ldelem.r8", true},
- {"ldelem.ref", true},
- {"ldelem.u1", true},
- {"ldelem.u2", true},
- {"ldelem.u4", true},
- {"ldelem.u8", true},
- {"ldflda", true},
- {"ldfld", true},
- {"ldftn", true},
- {"ldind.i1", true},
- {"ldind.i2", true},
- {"ldind.i4", true},
- {"ldind.i8", true},
- {"ldind.i", true},
- {"ldind.r4", true},
- {"ldind.r8", true},
- {"ldind.ref", true},
- {"ldind.u1", true},
- {"ldind.u2", true},
- {"ldind.u4", true},
- {"ldind.u8", true},
- {"ldlen", true},
- {"ldloc.0", true},
- {"ldloc.1", true},
- {"ldloc.2", true},
- {"ldloc.3", true},
- {"ldloca", true},
- {"ldloca.s", true},
- {"ldloc", true},
- {"ldloc.s", true},
- {"ldnull", true},
- {"ldobj", true},
- {"ldsflda", true},
- {"ldsfld", true},
- {"ldstr", true},
- {"ldtoken", true},
- {"ldvirtftn", true},
- {"leave", true},
- {"leave.s", true},
- {"legacy", true},
- {"linkcheck", true},
- {"literal", true},
- {"localloc", true},
- {"lpstr", true},
- {"lpstruct", true},
- {"lptstr", true},
- {"lpvoid", true},
- {"lpwstr", true},
- {"managed", true},
- {"marshal", true},
- {"method", true},
- {"mkrefany", true},
- {"modopt", true},
- {"modreq", true},
- {"mul", true},
- {"mul.ovf", true},
- {"mul.ovf.un", true},
- {"native", true},
- {"neg", true},
- {"nested", true},
- {"newarr", true},
- {"newobj", true},
- {"newslot", true},
- {"noappdomain", true},
- {"noinlining", true},
- {"nomachine", true},
- {"nomangle", true},
- {"nometadata", true},
- {"noncasdemand", true},
- {"noncasinheritance", true},
- {"noncaslinkdemand", true},
- {"nop", true},
- {"noprocess", true},
- {"not", true},
- {"not_in_gc_heap", true},
- {"notremotable", true},
- {"notserialized", true},
- {"null", true},
- {"nullref", true},
- {"object", true},
- {"objectref", true},
- {"off", true},
- {"on", true},
- {"opt", true},
- {"optil", true},
- {"or", true},
- {"out", true},
- {"permitonly", true},
- {"pinned", true},
- {"pinvokeimpl", true},
- {"pop", true},
- {"prefix1", true},
- {"prefix2", true},
- {"prefix3", true},
- {"prefix4", true},
- {"prefix5", true},
- {"prefix6", true},
- {"prefix7", true},
- {"prefixref", true},
- {"prejitdeny", true},
- {"prejitgrant", true},
- {"preservesig", true},
- {"private", true},
- {"privatescope", true},
- {"property", true},
- {"protected", true},
- {"public", true},
- {"readonly", true},
- {"record", true},
- {"refany", true},
- {"refanytype", true},
- {"refanyval", true},
- {"rem", true},
- {"rem.un", true},
- {"reqmin", true},
- {"reqopt", true},
- {"reqrefuse", true},
- {"reqsecobj", true},
- {"request", true},
- {"ret", true},
- {"rethrow", true},
- {"retval", true},
- {"rtspecialname", true},
- {"runtime", true},
- {"safearray", true},
- {"sealed", true},
- {"sequential", true},
- {"serializable", true},
- {"shl", true},
- {"shr", true},
- {"shr.un", true},
- {"sizeof", true},
- {"special", true},
- {"specialname", true},
- {"starg", true},
- {"starg.s", true},
- {"static", true},
- {"stdcall", true},
- {"stelem", true},
- {"stelem.i1", true},
- {"stelem.i2", true},
- {"stelem.i4", true},
- {"stelem.i8", true},
- {"stelem.i", true},
- {"stelem.r4", true},
- {"stelem.r8", true},
- {"stelem.ref", true},
- {"stfld", true},
- {"stind.i1", true},
- {"stind.i2", true},
- {"stind.i4", true},
- {"stind.i8", true},
- {"stind.i", true},
- {"stind.r4", true},
- {"stind.r8", true},
- {"stloc", true},
- {"stobj", true},
- {"storage", true},
- {"stored_object", true},
- {"streamed_object", true},
- {"stream", true},
- {"strict", true},
- {"string", true},
- {"struct", true},
- {"stsfld", true},
- {"sub", true},
- {"sub.ovf", true},
- {"sub.ovf.un", true},
- {"switch", true},
- {"synchronized", true},
- {"syschar", true},
- {"sysstring", true},
- {"tbstr", true},
- {"thiscall", true},
- {"tls", true},
- {"to", true},
- {"true", true},
- {"type", true},
- {"typedref", true},
- {"uint", true},
- {"uint8", true},
- {"uint16", true},
- {"uint32", true},
- {"uint64", true},
- {"unbox", true},
- {"unicode", true},
- {"unmanagedexp", true},
- {"unmanaged", true},
- {"unsigned", true},
- {"userdefined", true},
- {"value", true},
- {"valuetype", true},
- {"vararg", true},
- {"variant", true},
- {"vector", true},
- {"virtual", true},
- {"void", true},
- {"wchar", true},
- {"winapi", true},
- {"with", true},
- {"xor", true},
- };
-}
\ No newline at end of file
internal ExceptionSources (TypeReference exception)
{
Exception = exception;
- SourcesList = new List<MemberReference> ();
- Sources = new ReadOnlyCollection<MemberReference> (SourcesList);
+ Sources = new HashSet<MemberReference> ();
}
public TypeReference Exception { get; private set; }
- public ReadOnlyCollection<MemberReference> Sources { get; private set; }
- internal List<MemberReference> SourcesList;
+ internal HashSet<MemberReference> Sources;
}
Dictionary<string, ExceptionSources> e;
if (!db.TryGetValue (memberDecl, out e)) {
e = new Dictionary<string, ExceptionSources> ();
+ db.Add (memberDecl, e);
var bodies = GetMethodBodies (member);
foreach (var body in bodies) {
if (body == null)
continue;
FillExceptions (body, e);
}
- db.Add (memberDecl, e);
}
return e.Values;
}
body.Method.DeclaringType.Scope.Name == memberRef.DeclaringType.Scope.Name) ||
((locations & ExceptionLocations.DependentAssemblies) != 0 &&
body.Method.DeclaringType.Scope.Name != memberRef.DeclaringType.Scope.Name)) {
+
IEnumerable<ExceptionSources> memberExceptions = this [memberRef];
AddExceptions (body, instruction,
memberExceptions.Select (es => es.Exception),
s = new ExceptionSources (ex);
exceptions.Add (eName, s);
}
- s.SourcesList.AddRange (sources);
+ foreach (var m in sources)
+ s.Sources.Add (m);
}
}
}
private void UpdateExceptions (XmlNode docs, MemberReference member)
{
+ string indent = new string (' ', 10);
foreach (var source in new ExceptionLookup (exceptions.Value)[member]) {
string cref = slashdocFormatter.GetDeclaration (source.Exception);
var node = docs.SelectSingleNode ("exception[@cref='" + cref + "']");
continue;
XmlElement e = docs.OwnerDocument.CreateElement ("exception");
e.SetAttribute ("cref", cref);
- e.InnerXml = "To be added; from: <see cref=\"" +
- string.Join ("\" />, <see cref=\"",
+ e.InnerXml = "To be added; from:\n" + indent + "<see cref=\"" +
+ string.Join ("\" />,\n" + indent + "<see cref=\"",
source.Sources.Select (m => slashdocFormatter.GetDeclaration (m))
- .ToArray ()) +
+ .OrderBy (s => s)) +
"\" />";
docs.AppendChild (e);
}
XmlElement members = outputfiles [assemblyname];
if (members == null) continue; // assembly is strangely not listed in the index
- //CreateMember(EcmaDoc.GetCref (type.DocumentElement), type.DocumentElement, members);
+ CreateMember (GetCref (type.DocumentElement), type.DocumentElement, members);
foreach (XmlElement memberdoc in type.SelectNodes("Type/Members/Member")) {
- //string name = EcmaDoc.GetCref (memberdoc);
- // FIXME
- string name = ns + "." + typename + "." + memberdoc.GetAttribute ("MemberName");
+ string name = GetCref (memberdoc);
CreateMember(name, memberdoc, members);
}
}
AddNamespaceSummary(nsSummaries, basepath, nsnode.GetAttribute("Name"));
}
}
+
+ static string GetCref (XmlElement member)
+ {
+ string typeName = XmlDocUtils.ToEscapedTypeName (member.SelectSingleNode("/Type/@FullName").InnerText);
+ if (member.Name == "Type")
+ return "T:" + typeName;
+ string memberType = member.SelectSingleNode("MemberType").InnerText;
+ switch (memberType) {
+ case "Constructor":
+ return "C:" + typeName + MakeArgs(member);
+ case "Event":
+ return "E:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
+ case "Field":
+ return "F:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName"));
+ case "Method": {
+ string name = "M:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
+ if (member.GetAttribute("MemberName") == "op_Implicit" || member.GetAttribute("MemberName") == "op_Explicit")
+ name += "~" + XmlDocUtils.ToTypeName (member.SelectSingleNode("ReturnValue/ReturnType").InnerText, member);
+ return name;
+ }
+ case "Property":
+ return "P:" + typeName + "." + XmlDocUtils.ToEscapedMemberName (member.GetAttribute("MemberName")) + MakeArgs(member);
+ default:
+ throw new NotSupportedException ("MemberType '" + memberType + "' is not supported.");
+ }
+ }
+
+ static string MakeArgs (XmlElement member)
+ {
+ XmlNodeList parameters = member.SelectNodes ("Parameters/Parameter");
+ if (parameters.Count == 0)
+ return "";
+ StringBuilder args = new StringBuilder ();
+ args.Append ("(");
+ args.Append (XmlDocUtils.ToTypeName (parameters [0].Attributes ["Type"].Value, member));
+ for (int i = 1; i < parameters.Count; ++i) {
+ args.Append (",");
+ args.Append (XmlDocUtils.ToTypeName (parameters [i].Attributes ["Type"].Value, member));
+ }
+ args.Append (")");
+ return args.ToString ();
+ }
private static void AddNamespaceSummary(XmlDocument nsSummaries, string basepath, string currentNs) {
foreach (var filename in new [] {
continue;
var file = XmlDocUtils.GetCachedFileName (outDir, url);
using (var o = File.AppendText (file)) {
- Node _;
- string contents = docRoot.RenderUrl (url, generator, out _);
+ string contents = docRoot.RenderUrl (url, generator, hs);
o.Write (contents);
}
}
<xsl:template name="create-index">
<xsl:if test="
count(PageTitle/@id) > 0 and
- count(Signature/@id) > 0 and
+ (count(Signature/@id) > 0 or count(Signature/div/@id) > 0) and
count(Remarks/@id) > 0 and
count(Members/@id) > 0
">
<xsl:attribute name="href">
<xsl:text>#</xsl:text>
<xsl:value-of select="Signature/@id" />
+ <xsl:value-of select="Signature/div/@id" />
</xsl:attribute>
<xsl:text>Signature</xsl:text>
</a>
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="MyEvent">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="op_Explicit">
<param name="docs">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
</Docs>
</Member>
<Member MemberName="Field">
<param name="i">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ApplicationException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
- <exception cref="T:System.SystemException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.ApplicationException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.SystemException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="total">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
</Docs>
</Member>
<Member MemberName="Process">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />,
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="Process<T>">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="UseHelper<T,U,V>">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="array1">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
</Docs>
</Member>
<Member MemberName="Dynamic1">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="DynamicE2">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</Docs>
</Member>
<Member MemberName="ConvertAll<TInput,TOutput>">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
</Docs>
</Member>
<Member MemberName="Resize<T>">
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</Docs>
</Member>
</Members>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
</Docs>
</Member>
</Members>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</Docs>
</Member>
<Member MemberName="ConvertAll<T,U>">
<remarks>
<para>The <see cref="T:System.Converter<T,U>" /> is a delegate that converts an array element to the target type. The elements of <paramref name="array" /> are individually passed to this converter, and the converted elements are saved in the new array. The source array remains unchanged.</para>
</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
<exception cref="T:System.ArgumentNullException">
<paramref name="array" /> is <see langword="null" /> or <paramref name="converter" /> is <see langword="null" />.</exception>
</Docs>
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</Docs>
</Member>
</Members>
property.</para>
</block>
</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
<exception cref="T:System.ArgumentException">foo</exception>
<permission cref="T:System.SomePermission">bar</permission>
<altmember cref="T:System.SomeMember">alt member</altmember>
<Docs>
<summary>To be added.</summary>
<remarks>E:Mono.DocTest.Generic.GenericBase`1.ItemChanged</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="MyEvent">
<Docs>
<summary>To be added.</summary>
<remarks>E:Mono.DocTest.Generic.GenericBase`1.MyEvent</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="op_Explicit">
<remarks>
<c>C:Mono.DocTest.DocAttribute(System.String)</c>
</remarks>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
</Docs>
</Member>
<Member MemberName="Field">
<summary>To be added.</summary>
<remarks>
<see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" />.</remarks>
- <exception cref="T:System.ApplicationException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
- <exception cref="T:System.SystemException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.ApplicationException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.SystemException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="total">
<see cref="M:System.Collections.Generic.List{System.Int32}.Remove(`0)" />
</para>
</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
</Docs>
</Member>
<Member MemberName="Process">
<summary>To be added.</summary>
<remarks>
<c>M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />,
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="Process<T>">
<summary>To be added.</summary>
<remarks>
<c>M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="UseHelper<T,U,V>">
<summary>To be added.</summary>
<remarks>
<c>E:Mono.DocTest.Widget.AnotherEvent</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="array1">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
</Docs>
</Member>
<Member MemberName="Dynamic1">
<remarks>
<c>E:Mono.DocTest.Widget.DynamicE1</c>
</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="DynamicE2">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</Docs>
</Member>
<Member MemberName="ConvertAll<TInput,TOutput>">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
</Docs>
</Member>
<Member MemberName="Resize<T>">
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</Docs>
</Member>
</Members>
<remarks>
<c>M:System.Environment.GetFolderPath(System.Environment+SpecialFolder)</c>
</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
</Docs>
</Member>
</Members>
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="MyEvent">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="op_Explicit">
<param name="docs">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
</Docs>
</Member>
<Member MemberName="Field">
<param name="i">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ApplicationException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
- <exception cref="T:System.SystemException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.ApplicationException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.SystemException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="total">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
</Docs>
</Member>
<Member MemberName="Process">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />,
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="Process<T>">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="UseHelper<T,U,V>">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="array1">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
</Docs>
</Member>
<Member MemberName="Dynamic1">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="DynamicE2">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</Docs>
</Member>
<Member MemberName="ConvertAll<TInput,TOutput>">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
</Docs>
</Member>
<Member MemberName="Resize<T>">
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</Docs>
</Member>
</Members>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
</Docs>
</Member>
</Members>
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="MyEvent">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="op_Explicit">
<param name="docs">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
</Docs>
</Member>
<Member MemberName="Field">
<param name="i">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ApplicationException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
- <exception cref="T:System.SystemException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.ApplicationException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.SystemException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="total">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
</Docs>
</Member>
<Member MemberName="Process">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />,
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="Process<T>">
<param name="list">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</Docs>
</Member>
<Member MemberName="UseHelper<T,U,V>">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="array1">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
</Docs>
</Member>
<Member MemberName="Dynamic1">
<Docs>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</Docs>
</Member>
<Member MemberName="DynamicE2">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</Docs>
</Member>
<Member MemberName="ConvertAll<TInput,TOutput>">
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
</Docs>
</Member>
<Member MemberName="Resize<T>">
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</Docs>
</Member>
</Members>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
</Docs>
</Member>
</Members>
</div>
<h1 class="PageTitle" id="T:Mono.DocTest.Generic.Extensions">Extensions Class</h1>
<p class="Summary" id="T:Mono.DocTest.Generic.Extensions:Summary">extension methods!</p>
- <div id="T:Mono.DocTest.Generic.Extensions:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public static class <b>Extensions</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.Extensions:Signature">public static class <b>Extensions</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.Extensions:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:Mono.DocTest.Generic.Func`2:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.Func`2:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">[Mono.DocTest.Doc("method")]<br />[return:Mono.DocTest.Doc("return", Field=false)]<br />public delegate <i title="return type, with attributes!">TRet</i> <b>Func<[Mono.DocTest.Doc("arg!")] TArg, [Mono.DocTest.Doc("ret!")] TRet></b> ([Mono.DocTest.Doc("arg-actual")] <i title="argument type, with attributes!">TArg</i> a)<br /> where TArg : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Exception">Exception</a><br /> where TRet : </div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.Func`2:Signature">[Mono.DocTest.Doc("method")]<br />[return:Mono.DocTest.Doc("return", Field=false)]<br />public delegate <i title="return type, with attributes!">TRet</i> <b>Func<[Mono.DocTest.Doc("arg!")] TArg, [Mono.DocTest.Doc("ret!")] TRet></b> ([Mono.DocTest.Doc("arg-actual")] <i title="argument type, with attributes!">TArg</i> a)<br /> where TArg : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Exception">Exception</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.Func`2:Docs">
<h4 class="Subsection">Type Parameters</h4>
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>GenericBase<U>.FooEventArgs</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventArgs">EventArgs</a></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Signature">public class <b>GenericBase<U>.FooEventArgs</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.EventArgs">EventArgs</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs">GenericBase</a>
+ <a href="#C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs()">GenericBase</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs">GenericBase Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:member">
+ <h3 id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs()">GenericBase Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.FooEventArgs():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">protected struct <b>GenericBase<U>.NestedCollection.Enumerator</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Signature">protected struct <b>GenericBase<U>.NestedCollection.Enumerator</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection.Enumerator:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>GenericBase<U>.NestedCollection</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Signature">public class <b>GenericBase<U>.NestedCollection</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.GenericBase`1.NestedCollection">GenericBase</a>
+ <a href="#C:Mono.DocTest.Generic.GenericBase`1.NestedCollection()">GenericBase</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection">GenericBase Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:member">
+ <h3 id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection()">GenericBase Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1.NestedCollection():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Generic.GenericBase`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.GenericBase`1:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>GenericBase<U></b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.GenericBase`1:Signature">public class <b>GenericBase<U></b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.GenericBase`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.GenericBase`1">GenericBase</a>
+ <a href="#C:Mono.DocTest.Generic.GenericBase`1()">GenericBase</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Generic.GenericBase`1:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.GenericBase`1">GenericBase Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.GenericBase`1:member">
+ <h3 id="C:Mono.DocTest.Generic.GenericBase`1()">GenericBase Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.GenericBase`1():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>GenericBase</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.GenericBase`1():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</td>
</tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentNullException">ArgumentNullException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentOutOfRangeException">ArgumentOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.FormatException">FormatException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IndexOutOfRangeException">IndexOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
<tr valign="top">
<td>
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.MulticastNotSupportedException">MulticastNotSupportedException</a>
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</td>
</tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentNullException">ArgumentNullException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentOutOfRangeException">ArgumentOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.FormatException">FormatException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IndexOutOfRangeException">IndexOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
<tr valign="top">
<td>
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.MulticastNotSupportedException">MulticastNotSupportedException</a>
<p class="Summary" id="T:Mono.DocTest.Generic.IFoo`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.IFoo`1:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public interface <b>IFoo<T></b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.IFoo`1:Signature">public interface <b>IFoo<T></b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.IFoo`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
<p class="Summary" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>MyList<T, U, V></b></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Signature">public class <b>MyList<T, U, V></b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Docs">
<h4 class="Subsection">Type Parameters</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.MyList`1.Helper`2">MyList</a>
+ <a href="#C:Mono.DocTest.Generic.MyList`1.Helper`2()">MyList</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Generic.MyList`1.Helper`2:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.MyList`1.Helper`2">MyList Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.MyList`1.Helper`2:member">
+ <h3 id="C:Mono.DocTest.Generic.MyList`1.Helper`2()">MyList Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.MyList`1.Helper`2():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>MyList</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1.Helper`2():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Generic.MyList`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.MyList`1:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>MyList<[Mono.DocTest.Doc("Type Parameter!")] T></b> : <a href="../Mono.DocTest.Generic/GenericBase`1.html">GenericBase<T></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<Int32[]></a></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.MyList`1:Signature">public class <b>MyList<[Mono.DocTest.Doc("Type Parameter!")] T></b> : <a href="../Mono.DocTest.Generic/GenericBase`1.html">GenericBase<T></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<Int32[]></a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.MyList`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.MyList`1">MyList</a>
+ <a href="#C:Mono.DocTest.Generic.MyList`1()">MyList</a>
</b>()</div>
</td>
<td>
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`1.GetEnumerator">GetEnumerator</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`1.GetEnumerator()">GetEnumerator</a>
</b>()<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<Int32[]></a></nobr><blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`1.GetHelper``2">GetHelper<U,V></a>
+ <a href="#M:Mono.DocTest.Generic.MyList`1.GetHelper``2()">GetHelper<U,V></a>
</b>()<nobr> : <a href="../Mono.DocTest.Generic/MyList`1+Helper`2.html">MyList<T>.Helper<U, V></a></nobr><blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</div>
</td>
<td>
- <a href="#M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator">
+ <a href="#M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator()">
<b>IEnumerable.GetEnumerator</b>
</a>
</td>
<div class="Members" id="T:Mono.DocTest.Generic.MyList`1:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.MyList`1">MyList Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.MyList`1:member">
+ <h3 id="C:Mono.DocTest.Generic.MyList`1()">MyList Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.MyList`1():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>MyList</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`1():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator">GetEnumerator Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator()">GetEnumerator Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<Int32[]></a> <b>GetEnumerator</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator():Returns">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator():Remarks">
<tt>M:Mono.DocTest.MyList`1.GetEnumerator</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetEnumerator():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2">GetHelper<U,V> Generic Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2()">GetHelper<U,V> Generic Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="../Mono.DocTest.Generic/MyList`1+Helper`2.html">MyList<T>.Helper<U, V></a> <b>GetHelper<U, V></b> ()</div>
<h4 class="Subsection">Type Parameters</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2:Type Parameters">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2():Type Parameters">
<dl>
<dt>
<i>U</i>
</dl>
</blockquote>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2():Returns">
<tt>null</tt>.</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2():Remarks">
<tt>M:Mono.DocTest.Generic.MyList`1.GetHelper``2</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.GetHelper``2():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator">System.Collections.IEnumerable.GetEnumerator Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator()">System.Collections.IEnumerable.GetEnumerator Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div class="Signature">
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.IEnumerator">IEnumerator</a> <b>System.Collections.IEnumerable.GetEnumerator</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator():Returns">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator():Remarks">
<tt>M:Mono.DocTest.MyList`1.System#Collections#GetEnumerator</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`1.System#Collections#IEnumerable#GetEnumerator():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Generic.MyList`2:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Generic.MyList`2:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>MyList<A, B></b> : <a href="../Mono.DocTest.Generic/GenericBase`1.html">GenericBase<Dictionary<A, B>></a>, <a href="../Mono.DocTest.Generic/IFoo`1.html">IFoo<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.ICollection`1">ICollection<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<A></a><br /> where A : class, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IList`1">IList<B></a>, new()<br /> where B : class, <i title="Ako generic param">A</i></div>
+ <div class="Signature" id="T:Mono.DocTest.Generic.MyList`2:Signature">public class <b>MyList<A, B></b> : <a href="../Mono.DocTest.Generic/GenericBase`1.html">GenericBase<Dictionary<A, B>></a>, <a href="../Mono.DocTest.Generic/IFoo`1.html">IFoo<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.ICollection`1">ICollection<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerable`1">IEnumerable<A></a>, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<A></a><br /> where A : class, <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IList`1">IList<B></a>, new()<br /> where B : class, <i title="Ako generic param">A</i></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Generic.MyList`2:Docs">
<h4 class="Subsection">Type Parameters</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Generic.MyList`2">MyList</a>
+ <a href="#C:Mono.DocTest.Generic.MyList`2()">MyList</a>
</b>()</div>
</td>
<td>
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`2.Dispose">Dispose</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`2.Dispose()">Dispose</a>
</b>()<blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`2.Foo">Foo</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`2.Foo()">Foo</a>
</b>()<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.KeyValuePair`2">KeyValuePair<IEnumerable<A>, IEnumerable<B>></a></nobr><blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`2.GetEnumerator">GetEnumerator</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`2.GetEnumerator()">GetEnumerator</a>
</b>()<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.List`1.Enumerator">List<A>.Enumerator</a></nobr><blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`2.MoveNext">MoveNext</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`2.MoveNext()">MoveNext</a>
</b>()<nobr> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a></nobr><blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Generic.MyList`2.Reset">Reset</a>
+ <a href="#M:Mono.DocTest.Generic.MyList`2.Reset()">Reset</a>
</b>()<blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
</table>
</div>
</td>
<td>
- <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear">
+ <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear()">
<b>ICollection<A>.Clear</b>
</a>
</td>
</div>
</td>
<td>
- <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator">
+ <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator()">
<b>IEnumerable<A>.GetEnumerator</b>
</a>
</td>
</div>
</td>
<td>
- <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator">
+ <a href="#M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator()">
<b>IEnumerable.GetEnumerator</b>
</a>
</td>
<div class="Members" id="T:Mono.DocTest.Generic.MyList`2:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Generic.MyList`2">MyList Constructor</h3>
- <blockquote id="C:Mono.DocTest.Generic.MyList`2:member">
+ <h3 id="C:Mono.DocTest.Generic.MyList`2()">MyList Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Generic.MyList`2():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>MyList</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`2:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`2():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`2:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Generic.MyList`2():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.Dispose">Dispose Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.Dispose:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.Dispose()">Dispose Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.Dispose():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Dispose</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Dispose:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Dispose():Remarks">
<tt>M:Mono.DocTest.MyList`2.Dispose</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Dispose:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Dispose():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.Foo">Foo Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.Foo:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.Foo()">Foo Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.Foo():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.KeyValuePair`2">KeyValuePair<IEnumerable<A>, IEnumerable<B>></a> <b>Foo</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo():Returns">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo:Remarks">M:Mono.DocTest.Generic.MyList`2.Foo</div>
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo():Remarks">M:Mono.DocTest.Generic.MyList`2.Foo</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Foo():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator">GetEnumerator Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator()">GetEnumerator Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.List`1.Enumerator">List<A>.Enumerator</a> <b>GetEnumerator</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator:Returns">A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.List`1.Enumerator">List<`0>.Enumerator</a>.</blockquote>
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator():Returns">A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.List`1.Enumerator">List<`0>.Enumerator</a>.</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator():Remarks">
<tt>M:Mono.DocTest.MyList`2.GetEnumerator</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.GetEnumerator():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.MoveNext">MoveNext Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.MoveNext:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.MoveNext()">MoveNext Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.MoveNext():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a> <b>MoveNext</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext():Returns">
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Boolean">bool</a>
</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext():Remarks">
<tt>M:Mono.DocTest.MyList`2.MoveNext</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.MoveNext():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.Reset">Reset Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.Reset:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.Reset()">Reset Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.Reset():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Reset</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Reset:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Reset():Remarks">
<tt>M:Mono.DocTest.MyList`2.Reset</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Reset:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.Reset():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear">System.Collections.Generic.ICollection<A>.Clear Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear()">System.Collections.Generic.ICollection<A>.Clear Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div class="Signature">
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>System.Collections.Generic.ICollection<A>.Clear</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear():Remarks">
<tt>M:Mono.DocTest.MyList`2.System#Collections#Generic#ICollection{A}#Clear</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#ICollection{A}#Clear():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator">System.Collections.Generic.IEnumerable<A>.GetEnumerator Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator()">System.Collections.Generic.IEnumerable<A>.GetEnumerator Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div class="Signature">
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<A></a> <b>System.Collections.Generic.IEnumerable<A>.GetEnumerator</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator:Returns">A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<`0></a>.</blockquote>
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator():Returns">A <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.Generic.IEnumerator`1">IEnumerator<`0></a>.</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator():Remarks">
<tt>M:Mono.DocTest.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#Generic#IEnumerable{A}#GetEnumerator():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator">System.Collections.IEnumerable.GetEnumerator Method</h3>
- <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator:member">
+ <h3 id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator()">System.Collections.IEnumerable.GetEnumerator Method</h3>
+ <blockquote id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<div class="Signature">
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Collections.IEnumerator">IEnumerator</a> <b>System.Collections.IEnumerable.GetEnumerator</b> ()</div>
<h4 class="Subsection">Returns</h4>
- <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator:Returns">
+ <blockquote class="SubsectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator():Returns">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</blockquote>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator():Remarks">
<tt>M:Mono.DocTest.MyList`2.System#Collections#GetEnumerator</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Generic.MyList`2.System#Collections#IEnumerable#GetEnumerator():Version Information">
<b>Namespace: </b>Mono.DocTest.Generic<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
</div>
<h1 class="PageTitle" id="T:Mono.DocTest.Color">Color Enum</h1>
<p class="Summary" id="T:Mono.DocTest.Color:Summary">Possible colors</p>
- <div id="T:Mono.DocTest.Color:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public enum <b>Color</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Color:Signature">public enum <b>Color</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Color:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:Mono.DocTest.D:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.D:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Object">object</a> <b>D</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Func`3">Func<string, object, object></a> value)</div>
+ <div class="Signature" id="T:Mono.DocTest.D:Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Object">object</a> <b>D</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Func`3">Func<string, object, object></a> value)</div>
</div>
<div class="Remarks" id="T:Mono.DocTest.D:Docs">
<h4 class="Subsection">Parameters</h4>
<p class="Summary" id="T:Mono.DocTest.DocAttribute:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.DocAttribute:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">[System.AttributeUsage(System.AttributeTargets.All)]<br />public class <b>DocAttribute</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Attribute">Attribute</a></div>
+ <div class="Signature" id="T:Mono.DocTest.DocAttribute:Signature">[System.AttributeUsage(System.AttributeTargets.All)]<br />public class <b>DocAttribute</b> : <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Attribute">Attribute</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.DocAttribute:Docs">
<h2 class="Section">Remarks</h2>
</div>
<h1 class="PageTitle" id="T:Mono.DocTest.DocValueType">DocValueType Struct</h1>
<p class="Summary" id="T:Mono.DocTest.DocValueType:Summary">Process interface</p>
- <div id="T:Mono.DocTest.DocValueType:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public struct <b>DocValueType</b> : <a href="../Mono.DocTest/IProcess.html">IProcess</a></div>
+ <div class="Signature" id="T:Mono.DocTest.DocValueType:Signature">public struct <b>DocValueType</b> : <a href="../Mono.DocTest/IProcess.html">IProcess</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.DocValueType:Docs">
<h2 class="Section">Remarks</h2>
</div>
<h1 class="PageTitle" id="T:Mono.DocTest.IProcess">IProcess Interface</h1>
<p class="Summary" id="T:Mono.DocTest.IProcess:Summary">Process interface</p>
- <div id="T:Mono.DocTest.IProcess:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public interface <b>IProcess</b></div>
+ <div class="Signature" id="T:Mono.DocTest.IProcess:Signature">public interface <b>IProcess</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.IProcess:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:Mono.DocTest.UseLists:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.UseLists:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>UseLists</b></div>
+ <div class="Signature" id="T:Mono.DocTest.UseLists:Signature">public class <b>UseLists</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.UseLists:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.UseLists">UseLists</a>
+ <a href="#C:Mono.DocTest.UseLists()">UseLists</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.UseLists:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.UseLists">UseLists Constructor</h3>
- <blockquote id="C:Mono.DocTest.UseLists:member">
+ <h3 id="C:Mono.DocTest.UseLists()">UseLists Constructor</h3>
+ <blockquote id="C:Mono.DocTest.UseLists():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>UseLists</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.UseLists:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.UseLists():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.UseLists:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.UseLists():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.Del:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.Del:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Widget.Del</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> i)</div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.Del:Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Widget.Del</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Int32">int</a> i)</div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.Del:Docs">
<h4 class="Subsection">Parameters</h4>
<p class="Summary" id="T:Mono.DocTest.Widget.Direction:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.Direction:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">[System.Flags]<br />protected enum <b>Widget.Direction</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.Direction:Signature">[System.Flags]<br />protected enum <b>Widget.Direction</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.Direction:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:Mono.DocTest.Widget.IMenuItem:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.IMenuItem:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public interface <b>Widget.IMenuItem</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.IMenuItem:Signature">public interface <b>Widget.IMenuItem</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.IMenuItem:Docs">
<h2 class="Section">Remarks</h2>
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Widget.IMenuItem.A">A</a>
+ <a href="#M:Mono.DocTest.Widget.IMenuItem.A()">A</a>
</b>()<blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
</table>
<div class="Members" id="T:Mono.DocTest.Widget.IMenuItem:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="M:Mono.DocTest.Widget.IMenuItem.A">A Method</h3>
- <blockquote id="M:Mono.DocTest.Widget.IMenuItem.A:member">
+ <h3 id="M:Mono.DocTest.Widget.IMenuItem.A()">A Method</h3>
+ <blockquote id="M:Mono.DocTest.Widget.IMenuItem.A():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>A</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Widget.IMenuItem.A:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Widget.IMenuItem.A():Remarks">
<tt>M:Mono.DocTest.Widget.IMenuItem.A</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Widget.IMenuItem.A:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Widget.IMenuItem.A():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget.NestedClass.Double.Triple.Quadruple</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Signature">public class <b>Widget.NestedClass.Double.Triple.Quadruple</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple">Widget.NestedClass.Double.Triple.Quadruple</a>
+ <a href="#C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple()">Widget.NestedClass.Double.Triple.Quadruple</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple">Widget.NestedClass.Double.Triple.Quadruple Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:member">
+ <h3 id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple()">Widget.NestedClass.Double.Triple.Quadruple Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget.NestedClass.Double.Triple.Quadruple</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple.Quadruple():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.NestedClass.Double.Triple:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget.NestedClass.Double.Triple</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple:Signature">public class <b>Widget.NestedClass.Double.Triple</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget.NestedClass.Double.Triple">Widget.NestedClass.Double.Triple</a>
+ <a href="#C:Mono.DocTest.Widget.NestedClass.Double.Triple()">Widget.NestedClass.Double.Triple</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Widget.NestedClass.Double.Triple:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget.NestedClass.Double.Triple">Widget.NestedClass.Double.Triple Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double.Triple:member">
+ <h3 id="C:Mono.DocTest.Widget.NestedClass.Double.Triple()">Widget.NestedClass.Double.Triple Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double.Triple():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget.NestedClass.Double.Triple</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double.Triple():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.NestedClass.Double:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.NestedClass.Double:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget.NestedClass.Double</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.NestedClass.Double:Signature">public class <b>Widget.NestedClass.Double</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.NestedClass.Double:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget.NestedClass.Double">Widget.NestedClass.Double</a>
+ <a href="#C:Mono.DocTest.Widget.NestedClass.Double()">Widget.NestedClass.Double</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Widget.NestedClass.Double:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget.NestedClass.Double">Widget.NestedClass.Double Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double:member">
+ <h3 id="C:Mono.DocTest.Widget.NestedClass.Double()">Widget.NestedClass.Double Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget.NestedClass.Double():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget.NestedClass.Double</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass.Double():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.NestedClass:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.NestedClass:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget.NestedClass</b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.NestedClass:Signature">public class <b>Widget.NestedClass</b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.NestedClass:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget.NestedClass">Widget.NestedClass</a>
+ <a href="#C:Mono.DocTest.Widget.NestedClass()">Widget.NestedClass</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Widget.NestedClass:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget.NestedClass">Widget.NestedClass Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget.NestedClass:member">
+ <h3 id="C:Mono.DocTest.Widget.NestedClass()">Widget.NestedClass Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget.NestedClass():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget.NestedClass</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget.NestedClass`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget.NestedClass`1:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget.NestedClass<T></b></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget.NestedClass`1:Signature">public class <b>Widget.NestedClass<T></b></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget.NestedClass`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget.NestedClass`1">Widget.NestedClass</a>
+ <a href="#C:Mono.DocTest.Widget.NestedClass`1()">Widget.NestedClass</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:Mono.DocTest.Widget.NestedClass`1:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget.NestedClass`1">Widget.NestedClass Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget.NestedClass`1:member">
+ <h3 id="C:Mono.DocTest.Widget.NestedClass`1()">Widget.NestedClass Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget.NestedClass`1():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget.NestedClass</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass`1:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass`1():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass`1:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget.NestedClass`1():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:Mono.DocTest.Widget:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:Mono.DocTest.Widget:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Widget</b> : <a href="../Mono.DocTest/IProcess.html">IProcess</a></div>
+ <div class="Signature" id="T:Mono.DocTest.Widget:Signature">public class <b>Widget</b> : <a href="../Mono.DocTest/IProcess.html">IProcess</a></div>
</div>
<div class="Remarks" id="T:Mono.DocTest.Widget:Docs">
<h4 class="Subsection">See Also</h4>
<td>
<div>
<b>
- <a href="#C:Mono.DocTest.Widget">Widget</a>
+ <a href="#C:Mono.DocTest.Widget()">Widget</a>
</b>()</div>
</td>
<td>
</td>
<td colspan="2">
<b>
- <a href="#M:Mono.DocTest.Widget.M0">M0</a>
+ <a href="#M:Mono.DocTest.Widget.M0()">M0</a>
</b>()<blockquote><span class="NotEntered">Documentation for this section has not yet been entered.</span></blockquote></td>
</tr>
<tr valign="top">
<div class="Members" id="T:Mono.DocTest.Widget:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:Mono.DocTest.Widget">Widget Constructor</h3>
- <blockquote id="C:Mono.DocTest.Widget:member">
+ <h3 id="C:Mono.DocTest.Widget()">Widget Constructor</h3>
+ <blockquote id="C:Mono.DocTest.Widget():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Widget</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget:Remarks">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget():Remarks">
<p>
<tt>C:Mono.DocTest.Widget</tt>.</p>
<p>
</p>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:Mono.DocTest.Widget:Version Information">
+ <div class="SectionBox" id="C:Mono.DocTest.Widget():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</td>
</tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentNullException">ArgumentNullException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentOutOfRangeException">ArgumentOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.FormatException">FormatException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IndexOutOfRangeException">IndexOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
<tr valign="top">
<td>
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.MulticastNotSupportedException">MulticastNotSupportedException</a>
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</td>
</tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentNullException">ArgumentNullException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.ArgumentOutOfRangeException">ArgumentOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.FormatException">FormatException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
+ <tr valign="top">
+ <td>
+ <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IndexOutOfRangeException">IndexOutOfRangeException</a>
+ </td>
+ <td>
+ <span class="NotEntered">Documentation for this section has not yet been entered.</span>
+ </td>
+ </tr>
<tr valign="top">
<td>
<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.MulticastNotSupportedException">MulticastNotSupportedException</a>
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
- <h3 id="M:Mono.DocTest.Widget.M0">M0 Method</h3>
- <blockquote id="M:Mono.DocTest.Widget.M0:member">
+ <h3 id="M:Mono.DocTest.Widget.M0()">M0 Method</h3>
+ <blockquote id="M:Mono.DocTest.Widget.M0():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public static <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>M0</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Widget.M0:Remarks">
+ <div class="SectionBox" id="M:Mono.DocTest.Widget.M0():Remarks">
<tt>M:Mono.DocTest.Widget.M0</tt>.</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="M:Mono.DocTest.Widget.M0:Version Information">
+ <div class="SectionBox" id="M:Mono.DocTest.Widget.M0():Version Information">
<b>Namespace: </b>Mono.DocTest<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
</div>
<h1 class="PageTitle" id="T:NoNamespace">NoNamespace Class</h1>
<p class="Summary" id="T:NoNamespace:Summary">Namespace Test: [<a href="Mono.DocTest/index.html">Mono.DocTest</a>]</p>
- <div id="T:NoNamespace:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>NoNamespace</b></div>
+ <div class="Signature" id="T:NoNamespace:Signature">public class <b>NoNamespace</b></div>
</div>
<div class="Remarks" id="T:NoNamespace:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:NoNamespace">NoNamespace</a>
+ <a href="#C:NoNamespace()">NoNamespace</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:NoNamespace:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:NoNamespace">NoNamespace Constructor</h3>
- <blockquote id="C:NoNamespace:member">
+ <h3 id="C:NoNamespace()">NoNamespace Constructor</h3>
+ <blockquote id="C:NoNamespace():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>NoNamespace</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:NoNamespace:Remarks">
+ <div class="SectionBox" id="C:NoNamespace():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:NoNamespace:Version Information">
+ <div class="SectionBox" id="C:NoNamespace():Version Information">
<b>Namespace: </b>
<br />
<b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<p class="Summary" id="T:System.Action`1:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:System.Action`1:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Action<T></b> (<i title="To be added.">T</i> obj)</div>
+ <div class="Signature" id="T:System.Action`1:Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>Action<T></b> (<i title="To be added.">T</i> obj)</div>
</div>
<div class="Remarks" id="T:System.Action`1:Docs">
<h4 class="Subsection">Type Parameters</h4>
<p class="Summary" id="T:System.Array:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:System.Array:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public class <b>Array</b></div>
+ <div class="Signature" id="T:System.Array:Signature">public class <b>Array</b></div>
</div>
<div class="Remarks" id="T:System.Array:Docs">
<h2 class="Section">Remarks</h2>
<td>
<div>
<b>
- <a href="#C:System.Array">Array</a>
+ <a href="#C:System.Array()">Array</a>
</b>()</div>
</td>
<td>
<div class="Members" id="T:System.Array:Members">
<h2 class="Section" id="MemberDetails">Member Details</h2>
<div class="SectionBox" id="_MemberDetails">
- <h3 id="C:System.Array">Array Constructor</h3>
- <blockquote id="C:System.Array:member">
+ <h3 id="C:System.Array()">Array Constructor</h3>
+ <blockquote id="C:System.Array():member">
<p class="Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
<h2>Syntax</h2>
<div class="Signature">public <b>Array</b> ()</div>
<h2 class="Section">Remarks</h2>
- <div class="SectionBox" id="C:System.Array:Remarks">
+ <div class="SectionBox" id="C:System.Array():Remarks">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</div>
<h2 class="Section">Requirements</h2>
- <div class="SectionBox" id="C:System.Array:Version Information">
+ <div class="SectionBox" id="C:System.Array():Version Information">
<b>Namespace: </b>System<br /><b>Assembly: </b>DocTest (in DocTest.dll)<br /><b>Assembly Versions: </b>0.0.0.0</div>
<hr size="1" />
</blockquote>
<p class="Summary" id="T:System.AsyncCallback:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:System.AsyncCallback:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>AsyncCallback</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IAsyncResult">IAsyncResult</a> ar)</div>
+ <div class="Signature" id="T:System.AsyncCallback:Signature">public delegate <a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.Void">void</a> <b>AsyncCallback</b> (<a href="http://www.go-mono.com/docs/monodoc.ashx?link=T:System.IAsyncResult">IAsyncResult</a> ar)</div>
</div>
<div class="Remarks" id="T:System.AsyncCallback:Docs">
<h4 class="Subsection">Parameters</h4>
<p class="Summary" id="T:System.Environment.SpecialFolder:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:System.Environment.SpecialFolder:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public enum <b>Environment.SpecialFolder</b></div>
+ <div class="Signature" id="T:System.Environment.SpecialFolder:Signature">public enum <b>Environment.SpecialFolder</b></div>
</div>
<div class="Remarks" id="T:System.Environment.SpecialFolder:Docs">
<h2 class="Section">Remarks</h2>
<p class="Summary" id="T:System.Environment:Summary">
<span class="NotEntered">Documentation for this section has not yet been entered.</span>
</p>
- <div id="T:System.Environment:Signature">
+ <div>
<h2>Syntax</h2>
- <div class="Signature">public static class <b>Environment</b></div>
+ <div class="Signature" id="T:System.Environment:Signature">public static class <b>Environment</b></div>
</div>
<div class="Remarks" id="T:System.Environment:Docs">
<h2 class="Section">Remarks</h2>
<remarks>
<c>C:Mono.DocTest.DocAttribute(System.String)</c>
</remarks>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.DocAttribute.#ctor(System.String)" /></exception>
</member>
<member name="F:Mono.DocTest.DocAttribute.Field">
<summary>To be added.</summary>
<summary>To be added.</summary>
<remarks>
<see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" />.</remarks>
- <exception cref="T:System.ApplicationException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
- <exception cref="T:System.SystemException">To be added; from: <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.ApplicationException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
+ <exception cref="T:System.SystemException">To be added; from:
+ <see cref="M:Mono.DocTest.DocValueType.M(System.Int32)" /></exception>
</member>
<member name="F:Mono.DocTest.DocValueType.total">
<summary>To be added.</summary>
<see cref="M:System.Collections.Generic.List{System.Int32}.Remove(`0)" />
</para>
</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Int32})" /></exception>
</member>
<member name="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})">
<param name="list">A <see cref="T:Mono.DocTest.Generic.MyList{System.Predicate{System.Int32}}" />.</param>
<summary>To be added.</summary>
<remarks>
<c>M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process(System.Collections.Generic.List{System.Predicate{System.Int32}})" />,
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" />,
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</member>
<member name="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})">
<typeparam name="T">Something Else</typeparam>
<summary>To be added.</summary>
<remarks>
<c>M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
- <exception cref="T:System.ArgumentNullException">To be added; from: <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" />, <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:Mono.DocTest.UseLists.Process``1(System.Collections.Generic.List{System.Predicate{``0}})" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Linq.Check.SourceAndPredicate(System.Object,System.Object)" /></exception>
</member>
<member name="M:Mono.DocTest.UseLists.UseHelper``3(Mono.DocTest.Generic.MyList{``0}+Helper{``1,``2})">
<typeparam name="T">
<summary>To be added.</summary>
<remarks>
<c>E:Mono.DocTest.Widget.AnotherEvent</c>.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</member>
<member name="F:Mono.DocTest.Widget.array1">
<summary>To be added.</summary>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Linq.Expressions.Error.TypeMustBeDerivedFromSystemDelegate" /></exception>
</member>
<member name="M:Mono.DocTest.Widget.Dynamic1(System.Collections.Generic.Dictionary{System.Object,System.String})">
<param name="value">To be added.</param>
<remarks>
<c>E:Mono.DocTest.Widget.DynamicE1</c>
</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</member>
<member name="E:Mono.DocTest.Widget.DynamicE2">
<summary>To be added.</summary>
<member name="E:Mono.DocTest.Generic.GenericBase`1.ItemChanged">
<summary>To be added.</summary>
<remarks>E:Mono.DocTest.Generic.GenericBase`1.ItemChanged</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</member>
<member name="E:Mono.DocTest.Generic.GenericBase`1.MyEvent">
<summary>To be added.</summary>
<remarks>E:Mono.DocTest.Generic.GenericBase`1.MyEvent</remarks>
- <exception cref="T:System.ArgumentException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />, <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" /></exception>
- <exception cref="T:System.MulticastNotSupportedException">To be added; from: <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />, <see cref="M:System.Delegate.CombineImpl(System.Delegate)" /></exception>
+ <exception cref="T:System.ArgumentException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.Delegate.Remove(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentNullException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.ArgumentOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.FormatException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.IndexOutOfRangeException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
+ <exception cref="T:System.MulticastNotSupportedException">To be added; from:
+ <see cref="M:System.Delegate.Combine(System.Delegate,System.Delegate)" />,
+ <see cref="M:System.Delegate.CombineImpl(System.Delegate)" />,
+ <see cref="M:System.String.FormatHelper(System.Text.StringBuilder,System.IFormatProvider,System.String,System.Object[])" />,
+ <see cref="M:System.String.get_Chars(System.Int32)" />,
+ <see cref="M:System.String.InternalSetChar(System.Int32,System.Char)" />,
+ <see cref="M:System.String.ParseFormatSpecifier(System.String,System.Int32@,System.Int32@,System.Int32@,System.Boolean@,System.String@)" />,
+ <see cref="M:System.String.Substring(System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.Char,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.Append(System.String,System.Int32,System.Int32)" />,
+ <see cref="M:System.Text.StringBuilder.InternalEnsureCapacity(System.Int32)" /></exception>
</member>
<member name="M:Mono.DocTest.Generic.GenericBase`1.op_Explicit(`0Mono`0.`0DocTest`0.`0Generic`0.`0GenericBase`0{`0U`0})~`0U`0">
<param name="list">Insert description here</param>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.NotImplementedException">To be added; from: <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
+ <exception cref="T:System.NotImplementedException">To be added; from:
+ <see cref="M:System.Array.AsReadOnly``1(``0[])" /></exception>
</member>
<member name="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})">
<typeparam name="TInput">To be added.</typeparam>
<summary>To be added.</summary>
<returns>To be added.</returns>
<remarks>To be added.</remarks>
- <exception cref="T:System.InvalidOperationException">To be added; from: <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
+ <exception cref="T:System.InvalidOperationException">To be added; from:
+ <see cref="M:System.Array.ConvertAll``2(``0[],System.Converter{``0,``1})" /></exception>
</member>
<member name="M:System.Array.Resize``1(``0[]@,System.Int32)">
<typeparam name="T">To be added.</typeparam>
<param name="newSize">To be added.</param>
<summary>To be added.</summary>
<remarks>To be added.</remarks>
- <exception cref="T:System.Exception">To be added; from: <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
+ <exception cref="T:System.Exception">To be added; from:
+ <see cref="M:System.Array.Resize``1(``0[]@,System.Int32)" /></exception>
</member>
<member name="T:System.AsyncCallback">
<param name="ar">To be added.</param>
<remarks>
<c>M:System.Environment.GetFolderPath(System.Environment+SpecialFolder)</c>
</remarks>
- <exception cref="T:System.NotSupportedException">To be added; from: <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
+ <exception cref="T:System.NotSupportedException">To be added; from:
+ <see cref="M:System.Environment.GetFolderPath(System.Environment.SpecialFolder)" /></exception>
</member>
<member name="T:System.Environment+SpecialFolder">
<summary>To be added.</summary>
LOCAL_MCS_FLAGS= $(OTHER_RES:%=-resource:%)
+LOCAL_MCS_FLAGS += -d:STATIC,NO_SYMBOL_WRITER,NO_AUTHENTICODE
+
EXTRA_DISTFILES = $(RESOURCE_FILES)
include ../../build/executable.make
using System.Diagnostics;
using System.Xml;
using System.Collections.Generic;
-using System.Reflection;
using System.IO;
using System.IO.Compression;
using System.Runtime.InteropServices;
using System.Text;
+using IKVM.Reflection;
#if NET_4_5
static string style = "linux";
static bool compress;
static bool nomain;
+ static bool? use_dos2unix = null;
static int Main (string [] args)
{
using (StreamWriter tc = new StreamWriter (File.Create (temp_c))) {
string prog = null;
+#if XAMARIN_ANDROID
tc.WriteLine ("/* This source code was produced by mkbundle, do not edit */");
+ tc.WriteLine ("\n#ifndef NULL\n#define NULL (void *)0\n#endif");
+ tc.WriteLine (@"
+typedef struct {
+ const char *name;
+ const unsigned char *data;
+ const unsigned int size;
+} MonoBundledAssembly;
+void mono_register_bundled_assemblies (const MonoBundledAssembly **assemblies);
+void mono_register_config_for_assembly (const char* assembly_name, const char* config_xml);
+");
+#else
tc.WriteLine ("#include <mono/metadata/mono-config.h>");
tc.WriteLine ("#include <mono/metadata/assembly.h>\n");
+#endif
if (compress) {
tc.WriteLine ("typedef struct _compressed_data {");
Stream template_stream;
if (compress) {
- template_stream = Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template_z.c");
+ template_stream = System.Reflection.Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template_z.c");
} else {
- template_stream = Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template.c");
+ template_stream = System.Reflection.Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template.c");
}
StreamReader s = new StreamReader (template_stream);
tc.Write (template);
if (!nomain) {
- Stream template_main_stream = Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template_main.c");
+ Stream template_main_stream = System.Reflection.Assembly.GetAssembly (typeof(MakeBundle)).GetManifestResourceStream ("template_main.c");
StreamReader st = new StreamReader (template_main_stream);
string maintemplate = st.ReadToEnd ();
tc.Write (maintemplate);
return assemblies;
}
+ static readonly Universe universe = new Universe ();
+
static void QueueAssembly (List<string> files, string codebase)
{
if (files.Contains (codebase))
return;
files.Add (codebase);
- Assembly a = Assembly.LoadFrom (new Uri(codebase).LocalPath);
+ Assembly a = universe.LoadFile (new Uri(codebase).LocalPath);
if (!autodeps)
return;
foreach (AssemblyName an in a.GetReferencedAssemblies ()) {
- a = Assembly.Load (an);
+ a = universe.Load (an.Name);
QueueAssembly (files, a.CodeBase);
}
}
char[] path_chars = { '/', '\\' };
if (assembly.IndexOfAny (path_chars) != -1) {
- a = Assembly.LoadFrom (assembly);
+ a = universe.LoadFile (assembly);
} else {
string ass = assembly;
if (ass.EndsWith (".dll"))
ass = assembly.Substring (0, assembly.Length - 4);
- a = Assembly.Load (ass);
+ a = universe.Load (ass);
}
return a;
} catch (FileNotFoundException){
full_path += ".dll";
try {
- a = Assembly.LoadFrom (full_path);
+ a = universe.LoadFile (full_path);
return a;
} catch (FileNotFoundException ff) {
total_log += ff.FusionLog;
}
Error ("Cannot find assembly `" + assembly + "'" );
Console.WriteLine ("Log: \n" + total_log);
- } catch (BadImageFormatException f) {
- Error ("Cannot load assembly (bad file format)" + f.FusionLog);
+ } catch (IKVM.Reflection.BadImageFormatException f) {
+ Error ("Cannot load assembly (bad file format) " + f.Message);
} catch (FileLoadException f){
- Error ("Cannot load assembly " + f.FusionLog);
+ Error ("Cannot load assembly " + f.Message);
} catch (ArgumentNullException){
Error("Cannot load assembly (null argument)");
}
Console.WriteLine (cmdLine);
return system (cmdLine);
}
-
+
// on Windows, we have to pipe the output of a
// `cmd` interpolation to dos2unix, because the shell does not
// strip the CRLFs generated by the native pkg-config distributed
// with Mono.
+ //
+ // But if it's *not* on cygwin, just skip it.
+
+ // check if dos2unix is applicable.
+ if (use_dos2unix == null) {
+ use_dos2unix = false;
+ try {
+ var dos2unix = Process.Start ("dos2unix");
+ dos2unix.StandardInput.WriteLine ("aaa");
+ dos2unix.StandardInput.WriteLine ("\u0004");
+ dos2unix.WaitForExit ();
+ if (dos2unix.ExitCode == 0)
+ use_dos2unix = true;
+ } catch {
+ // ignore
+ }
+ }
+ // and if there is no dos2unix, just run cmd /c.
+ if (use_dos2unix == false) {
+ Console.WriteLine (cmdLine);
+ ProcessStartInfo dos2unix = new ProcessStartInfo ();
+ dos2unix.UseShellExecute = false;
+ dos2unix.FileName = "cmd";
+ dos2unix.Arguments = String.Format ("/c \"{0}\"", cmdLine);
+
+ using (Process p = Process.Start (dos2unix)) {
+ p.WaitForExit ();
+ return p.ExitCode;
+ }
+ }
+
StringBuilder b = new StringBuilder ();
int count = 0;
for (int i = 0; i < cmdLine.Length; i++) {
mkbundle.cs
+../../../external/ikvm/reflect/*.cs
+../../../external/ikvm/reflect/Emit/*.cs
+../../../external/ikvm/reflect/Metadata/*.cs
+../../../external/ikvm/reflect/Reader/*.cs
+../../../external/ikvm/reflect/Writer/*.cs
+../../../external/ikvm/reflect/Impl/ITypeOwner.cs
+../../../external/ikvm/reflect/Impl/SymbolSupport.cs
info (logname, "Stopping service {0}", service.ServiceName);
call (service, "OnStop", null);
if (service.ExitCode != 0)
- error (logname, "Service stopped with a non-zero ExitCode: {0}", service.ExitCode);
+ error (logname, "Service {0} stopped returning a non-zero ExitCode: {1}",
+ service.ServiceName, service.ExitCode);
running = false;
}
else if (usr1.IsSet && service.CanPauseAndContinue) {
PORTABLE_DIR = $(mono_libdir)/mono/xbuild/Microsoft/Portable
EXTRAS_DIR = $(mono_libdir)/mono/$(INSTALL_FRAMEWORK_VERSION)
install-extras:
- $(MKINSTALLDIRS) $(DESTDIR)$(EXTRAS_DIR) $(DESTDIR)$(REDISTLIST_DIR) $(DESTDIR)$(XBUILD_FRAMEWORKS_DIR)/v3.0/RedistList $(DESTDIR)$(XBUILD_FRAMEWORKS_DIR)/v4.0/RedistList $(DESTDIR)$(mono_libdir)/mono/3.5
+ $(MKINSTALLDIRS) $(DESTDIR)$(EXTRAS_DIR) $(DESTDIR)$(REDISTLIST_DIR) $(DESTDIR)$(XBUILD_FRAMEWORKS_DIR)/v3.0/RedistList $(DESTDIR)$(XBUILD_FRAMEWORKS_DIR)/v4.0/RedistList $(DESTDIR)$(mono_libdir)/mono/3.5 $(DESTDIR)$(mono_libdir)/mono/4.0
$(INSTALL_DATA) xbuild/xbuild.rsp $(DESTDIR)$(mono_libdir)/mono/$(FRAMEWORK_VERSION)
$(INSTALL_DATA) xbuild/$(INSTALL_FRAMEWORK_VERSION)/Microsoft.Common.tasks $(DESTDIR)$(EXTRAS_DIR)
$(INSTALL_DATA) xbuild/$(INSTALL_FRAMEWORK_VERSION)/Microsoft.Common.targets $(DESTDIR)$(EXTRAS_DIR)
sed -e 's/@SILVERLIGHT_VERSION@/2.0/g' xbuild/Microsoft.Silverlight.Common.targets > $(DESTDIR)$(SILVERLIGHT_DIR)/v2.0/Microsoft.Silverlight.Common.targets
sed -e 's/@SILVERLIGHT_VERSION@/3.0/g' xbuild/Microsoft.Silverlight.Common.targets > $(DESTDIR)$(SILVERLIGHT_DIR)/v3.0/Microsoft.Silverlight.Common.targets
$(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_DIR)/v4.0
- $(INSTALL_DATA) xbuild/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_DIR)/v4.0
+ $(MKINSTALLDIRS) $(DESTDIR)$(PORTABLE_DIR)/v4.5
+ $(INSTALL_DATA) xbuild/4.0/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_DIR)/v4.0
+ $(INSTALL_DATA) xbuild/4.5/Microsoft.Portable.CSharp.targets $(DESTDIR)$(PORTABLE_DIR)/v4.5
+ $(INSTALL_DATA) xbuild/Microsoft.Portable.CSharp.targets $(DESTDIR)$(mono_libdir)/mono/4.0
EXTRA_DISTFILES = \
xbuild/xbuild.rsp \
xbuild/2.0/Microsoft.Common.targets \
xbuild/3.5/Microsoft.Common.targets \
xbuild/4.0/Microsoft.Common.targets \
+ xbuild/4.0/Microsoft.Portable.CSharp.targets \
+ xbuild/4.5/Microsoft.Portable.CSharp.targets \
xbuild/2.0/FrameworkList.xml \
xbuild/3.5/FrameworkList.xml \
xbuild/4.0/FrameworkList.xml \
<Output TaskParameter="TargetFrameworkMonikerDisplayName" PropertyName="TargetFrameworkMonikerDisplayName"/>
</GetReferenceAssemblyPaths>
- <CreateProperty Value="$(_TargetFrameworkDirectories);$(TargetFrameworkDirectory)">
- <Output TaskParameter="Value" PropertyName="TargetFrameworkDirectory"/>
- </CreateProperty>
+
+ <!-- Remove duplicates. -->
+ <ItemGroup>
+ <_TargetFrameworkDirectories Include="$(_TargetFrameworkDirectories);$(TargetFrameworkDirectory)" KeepDuplicates="false" />
+ </ItemGroup>
+ <PropertyGroup>
+ <TargetFrameworkDirectory>@(_TargetFrameworkDirectories)</TargetFrameworkDirectory>
+ </PropertyGroup>
+
+ <ItemGroup Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'">
+ <DesignTimeFacadeDirectoryRoots Include="$(TargetFrameworkDirectory)" />
+ <DesignTimeFacadeDirectories Include="%(DesignTimeFacadeDirectoryRoots.Identity)\Facades\" Condition="Exists('%(DesignTimeFacadeDirectoryRoots.Identity)\Facades\')" />
+ <_DesignTimeFacadeAssemblies Include="%(DesignTimeFacadeDirectories.Identity)\*.dll"/>
+ </ItemGroup>
+
+ <PropertyGroup Condition="'@(DesignTimeFacadeDirectories)' != ''">
+ <TargetFrameworkDirectory>$(TargetFrameworkDirectory);@(DesignTimeFacadeDirectories)</TargetFrameworkDirectory>
+ </PropertyGroup>
+
</Target>
<PropertyGroup>
PrepareForBuild
</ResolveAssemblyReferencesDependsOn>
</PropertyGroup>
+
+ <PropertyGroup Condition="'$(TargetFrameworkMoniker)' != ''">
+ <TargetFrameworkMonikerAssemblyAttributesPath Condition="'$(TargetFrameworkMonikerAssemblyAttributesPath)' == ''">$(IntermediateOutputPath)$(TargetFrameworkMoniker).AssemblyAttribute$(DefaultLanguageSourceExtension)</TargetFrameworkMonikerAssemblyAttributesPath>
+ <GenerateTargetFrameworkAttribute Condition="'$(GenerateTargetFrameworkAttribute)' == '' and '$(TargetFrameworkMoniker)'
+ != '' and '$(TargetingClr2Framework)' != 'true'">true</GenerateTargetFrameworkAttribute>
+ </PropertyGroup>
+
+ <ItemGroup Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
+ <FileWrites Include="$(TargetFrameworkMonikerAssemblyAttributesPath)" />
+ </ItemGroup>
+
+ <Target Name="GenerateTargetFrameworkMonikerAttribute"
+ DependsOnTargets="PrepareForBuild;GetReferenceAssemblyPaths"
+ Inputs="$(MSBuildToolsPath)\Microsoft.Common.targets"
+ Outputs="$(TargetFrameworkMonikerAssemblyAttributesPath)"
+ Condition="'$(GenerateTargetFrameworkAttribute)' == 'true'">
+
+ <WriteLinesToFile
+ File="$(TargetFrameworkMonikerAssemblyAttributesPath)"
+ Lines="$(TargetFrameworkMonikerAssemblyAttributeText)"
+ Overwrite="true"
+ ContinueOnError="true"
+ Condition="'@(Compile)' != '' and '$(TargetFrameworkMonikerAssemblyAttributeText)' != ''"
+ />
+ </Target>
<Target Name="ResolveReferences" DependsOnTargets="$(ResolveReferencesDependsOn)"/>
>
<Output TaskParameter="ResolvedFiles" ItemName="ResolvedFiles"/>
<Output TaskParameter="ResolvedFiles" ItemName="ReferencePath"/>
- <Output TaskParameter="ResolvedDependencyFiles" ItemName="_ResolvedDependencyFiles"/>
+ <Output TaskParameter="ResolvedDependencyFiles" ItemName="ReferenceDependencyPaths"/>
<Output TaskParameter="RelatedFiles" ItemName="_ReferenceRelatedPaths"/>
<Output TaskParameter="SatelliteFiles" ItemName="ReferenceSatellitePaths"/>
<Output TaskParameter="CopyLocalFiles" ItemName="ReferenceCopyLocalPaths"/>
+
+ <!-- FIXME: backwards compatibility -->
+ <Output TaskParameter="ResolvedDependencyFiles" ItemName="_ResolvedDependencyFiles"/>
</ResolveAssemblyReference>
</Target>
<PropertyGroup>
<BuildDependsOn>
+ BuildOnlySettings;
BeforeBuild;
CoreBuild;
AfterBuild
</BuildDependsOn>
</PropertyGroup>
-
+
+ <Target Name="BuildOnlySettings"/>
<Target Name="BeforeBuild"/>
<Target Name="AfterBuild"/>
<PropertyGroup>
<CompileDependsOn>
ResolveReferences;
+ GenerateTargetFrameworkMonikerAttribute;
BeforeCompile;
_TimestampBeforeCompile;
CoreCompile;
LicenseTarget = "$(TargetFileName)"
OutputDirectory = "$(IntermediateOutputPath)"
OutputLicense = "$(IntermediateOutputPath)$(TargetFileName).licenses"
- ReferencedAssemblies = "@(ReferencePath);@(_ResolvedDependencyFiles)"
+ ReferencedAssemblies = "@(ReferencePath);@(ReferenceDependencyPaths)"
ToolPath = "$(LCToolPath)"
ToolExe = "$(LCToolExe)">
we can safely remove the file list now -->
<Delete Files="$(IntermediateOutputPath)$(CleanFile)" TreatErrorsAsWarnings="true" />
</Target>
+
+ <PropertyGroup>
+ <ImplicitlyExpandDesignTimeFacades>true</ImplicitlyExpandDesignTimeFacades>
+
+ <ResolveReferencesDependsOn>
+ $(ResolveReferencesDependsOn);
+ ImplicitlyExpandDesignTimeFacades
+ </ResolveReferencesDependsOn>
+
+ <ImplicitlyExpandDesignTimeFacadesDependsOn>
+ $(ImplicitlyExpandDesignTimeFacadesDependsOn);
+ GetReferenceAssemblyPaths
+ </ImplicitlyExpandDesignTimeFacadesDependsOn>
+ </PropertyGroup>
+
+ <Target Name="ImplicitlyExpandDesignTimeFacades" Condition="'$(ImplicitlyExpandDesignTimeFacades)' == 'true'" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)">
+
+ <PropertyGroup>
+ <_HasReferenceToSystemRuntime Condition="'%(_ResolvedDependencyFiles.Filename)' == 'System.Runtime'">true</_HasReferenceToSystemRuntime>
+ </PropertyGroup>
+
+ <ItemGroup Condition="'$(_HasReferenceToSystemRuntime)' == 'true'">
+ <!-- If the user has manually referenced these assemblies, remove them so we don't end up with duplicates -->
+ <ReferencePath Remove="@(_DesignTimeFacadeAssemblies)"/>
+ <ReferencePath Include="%(_DesignTimeFacadeAssemblies.Identity)">
+ <WinMDFile>false</WinMDFile>
+ <CopyLocal>false</CopyLocal>
+ <ResolvedFrom>ImplicitlyExpandDesignTimeFacades</ResolvedFrom>
+ </ReferencePath>
+ <_ResolveAssemblyReferenceResolvedFiles Include="@(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
+ </ItemGroup>
+
+ <Message Importance="Low" Text="Including @(ReferencePath)" Condition="'%(ReferencePath.ResolvedFrom)' == 'ImplicitlyExpandDesignTimeFacades'" />
+ </Target>
+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter\*"
Condition="'$(ImportByWildcardAfterMicrosoftCommonTargets)' == 'true' and Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\$(MSBuildThisFile)\ImportAfter')"/>
</Project>
--- /dev/null
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildToolsPath)\Microsoft.Portable.CSharp.Targets" />
+</Project>
--- /dev/null
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(MSBuildToolsPath)\Microsoft.Portable.CSharp.Targets" />
+</Project>
<CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == 'v4.0' and '$(OS)' != 'Windows_NT'">dmcs</CscToolExe>
<CscToolExe Condition="'$(CscToolExe)' == '' and '$(TargetFrameworkVersion)' == 'v4.0' and '$(OS)' == 'Windows_NT'">dmcs.bat</CscToolExe>
</PropertyGroup>
+
+ <PropertyGroup>
+ <TargetFrameworkMonikerAssemblyAttributeText Condition="'$(TargetFrameworkMoniker)' != '' and '$(TargetingClr2Framework)' != 'true'">
+// <autogenerated />
+[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute("$(TargetFrameworkMoniker)", FrameworkDisplayName = "$(TargetFrameworkMonikerDisplayName)")]
+ </TargetFrameworkMonikerAssemblyAttributeText>
+ </PropertyGroup>
</Project>
-<!-- Note: This is a dummy CSharp.targets file that tries to map Portable Library Project targets to something available in Mono on Mac -->
-
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-
+
<PropertyGroup>
- <TargetFrameworkIdentifier>.NETFramework</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <TargetFrameworkProfile></TargetFrameworkProfile>
- </PropertyGroup>
-
- <PropertyGroup Condition = "Exists ('/Developer/MonoTouch/License.rtf')">
- <TargetFrameworkIdentifier>MonoTouch</TargetFrameworkIdentifier>
- <TargetFrameworkVersion>v1.0</TargetFrameworkVersion>
- <TargetFrameworkProfile></TargetFrameworkProfile>
- </PropertyGroup>
-
- <PropertyGroup Condition = "Exists ('/Developer/MonoAndroid/License.rtf') And !Exists ('/Developer/MonoTouch/License.rtf')">
- <TargetFrameworkIdentifier>MonoAndroid</TargetFrameworkIdentifier>
+ <AvailablePlatforms>Any CPU</AvailablePlatforms>
+
+ <TargetPlatformIdentifier>Portable</TargetPlatformIdentifier>
+ <TargetFrameworkIdentifier>.NETPortable</TargetFrameworkIdentifier>
+ <TargetFrameworkMonikerDisplayName>.NET Portable Subset</TargetFrameworkMonikerDisplayName>
+
+ <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
+ <NoStdLib>true</NoStdLib>
+
+ <ImplicitlyExpandTargetFramework Condition="'$(ImplicitlyExpandTargetFramework)' == '' ">true</ImplicitlyExpandTargetFramework>
</PropertyGroup>
-
- <Import Project="$(MSBuildExtensionsPath)\Novell\Novell.MonoDroid.CSharp.targets" Condition = "Exists ('/Developer/MonoAndroid/License.rtf') And !Exists ('/Developer/MonoTouch/License.rtf')"/>
- <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" Condition = "Exists ('/Developer/MonoTouch/License.rtf') Or !Exists ('/Developer/MonoAndroid/License.rtf')"/>
+
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.Targets" />
<PropertyGroup>
- <BuildDependsOn>
- PortableCompatWarning;
- $(BuildDependsOn);
- </BuildDependsOn>
+ <ResolveReferencesDependsOn>
+ $(ResolveReferencesDependsOn);
+ ImplicitlyExpandTargetFramework;
+ </ResolveReferencesDependsOn>
+
+ <ImplicitlyExpandTargetFrameworkDependsOn>
+ $(ImplicitlyExpandTargetFrameworkDependsOn);
+ GetReferenceAssemblyPaths
+ </ImplicitlyExpandTargetFrameworkDependsOn>
</PropertyGroup>
- <Target Name="PortableCompatWarning">
- <Warning Text="This Portable Library Project has been built against the $(TargetFrameworkIdentifier) framework."/>
+ <Target Name="ImplicitlyExpandTargetFramework"
+ DependsOnTargets="$(ImplicitlyExpandTargetFrameworkDependsOn)">
+
+ <ItemGroup>
+ <ReferenceAssemblyPaths Include="$(_TargetFrameworkDirectories)"/>
+ <ReferencePath Include="%(ReferenceAssemblyPaths.Identity)\*.dll">
+ <CopyLocal>false</CopyLocal>
+ <ResolvedFrom>ImplicitlyExpandTargetFramework</ResolvedFrom>
+ <IsSystemReference>True</IsSystemReference>
+ </ReferencePath>
+ </ItemGroup>
</Target>
-
+
</Project>
test-local: copy-targets
copy-targets:
- for p in net_2_0 net_3_5 net_4_0 net_4_5; do \
+ for p in net_2_0 net_3_5 net_4_0; do \
cp $(XBUILD_DIR)/xbuild/Microsoft.CSharp.targets $(topdir)/class/lib/$$p; \
cp $(XBUILD_DIR)/xbuild/Microsoft.VisualBasic.targets $(topdir)/class/lib/$$p; \
cp $(XBUILD_DIR)/xbuild/Microsoft.Silverlight*.targets $(topdir)/class/lib/$$p; \
cp $(XBUILD_DIR)/xbuild/2.0/Microsoft.Common.* $(topdir)/class/lib/net_2_0
cp $(XBUILD_DIR)/xbuild/3.5/Microsoft.Common.* $(topdir)/class/lib/net_3_5
cp $(XBUILD_DIR)/xbuild/4.0/Microsoft.Common.* $(topdir)/class/lib/net_4_0
- cp $(XBUILD_DIR)/xbuild/4.5/Microsoft.Common.* $(topdir)/class/lib/net_4_5
clean-local: clean-target-files
clean-target-files:
- for p in net_2_0 net_3_5 net_4_0 net_4_5; do \
+ for p in net_2_0 net_3_5 net_4_0; do \
rm -f $(topdir)/class/lib/$$p/Microsoft.Common.targets; \
rm -f $(topdir)/class/lib/$$p/Microsoft.CSharp.targets; \
rm -f $(topdir)/class/lib/$$p/Microsoft.VisualBasic.targets; \
%_prefix/lib/mono/4.5/System.Json.Microsoft.dll
%_prefix/lib/mono/4.5/System.Net.dll
%_prefix/lib/mono/4.5/System.Net.Http.dll
+%_prefix/lib/mono/4.5/System.Net.Http.WebRequest.dll
%_prefix/lib/mono/4.5/System.Numerics.dll
%_prefix/lib/mono/4.5/System.Security.dll
%_prefix/lib/mono/4.5/System.Threading.Tasks.Dataflow.dll
%_prefix/lib/mono/4.5/System.dll
%_prefix/lib/mono/4.5/cscompmgd.dll
%_prefix/lib/mono/4.5/mscorlib.dll*
+%_prefix/lib/mono/4.5/System.Windows.dll
+%_prefix/lib/mono/4.5/System.Xml.Serialization.dll
%_prefix/lib/mono/4.5/Facades/*.dll
%_prefix/lib/mono/4.5/Facades/*.dll.mdb
%_prefix/lib/mono/compat-2.0/ICSharpCode.SharpZipLib.dll
%_prefix/lib/mono/gac/System.IO.Compression.FileSystem
%_prefix/lib/mono/gac/System.Net
%_prefix/lib/mono/gac/System.Net.Http
+%_prefix/lib/mono/gac/System.Net.Http.WebRequest
%_prefix/lib/mono/gac/System.Numerics
%_prefix/lib/mono/gac/System.Security
%_prefix/lib/mono/gac/System.Threading.Tasks.Dataflow
%_prefix/lib/mono/gac/System.Xml.Linq
%_prefix/lib/mono/gac/System.Json
%_prefix/lib/mono/gac/System.Json.Microsoft
+%_prefix/lib/mono/gac/System.Windows
+%_prefix/lib/mono/gac/System.Xml.Serialization
%_prefix/lib/mono/gac/cscompmgd
%_prefix/lib/mono/mono-configuration-crypto
%_prefix/lib/mono/4.0/Microsoft.Common.targets
%_prefix/lib/mono/4.0/Microsoft.Common.tasks
%_prefix/lib/mono/4.0/Microsoft.VisualBasic.targets
+%_prefix/lib/mono/4.0/Microsoft.Portable.CSharp.targets
%_prefix/lib/mono/4.0/Mono.Debugger.Soft.dll
%_prefix/lib/mono/4.0/PEAPI.dll
%_prefix/lib/mono/4.5/Microsoft.Build.dll
%_prefix/lib/mono/gac/Mono.Debugger.Soft
%_prefix/lib/mono/gac/PEAPI
%_prefix/lib/mono/xbuild
+%_prefix/lib/mono/xbuild/Microsoft/Portable/v4.0/Microsoft.Portable.CSharp.targets
+%_prefix/lib/mono/xbuild/Microsoft/Portable/v4.5/Microsoft.Portable.CSharp.targets
%_prefix/lib/mono/xbuild-frameworks
%package -n monodoc-core
ARM_RORS_REG_COND(p, rd, rm, rs, ARMCOND_AL)
#define ARM_RORS_REG_REG(p, rd, rm, rs) ARM_RORS_REG(p, rd, rm, rs)
+#ifdef __native_client_codegen__
+#define ARM_DBRK(p) ARM_EMIT(p, 0xE7FEDEF0)
+#else
#define ARM_DBRK(p) ARM_EMIT(p, 0xE6000010)
+#endif
#define ARM_IASM_DBRK() ARM_IASM_EMIT(0xE6000010)
#define ARM_INC(p, reg) ARM_ADD_REG_IMM8(p, reg, reg, 1)
#include <config.h>
#include <glib.h>
#include <errno.h>
-#include <signal.h>
#include <string.h>
#include <sys/types.h>
#include <pthread.h>
#include <errno.h>
#include <unistd.h>
+#include <signal.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_SYS_SOCKET_H
*/
static void _wapi_handle_check_share_by_pid (struct _WapiFileShare *share_info)
{
+#if defined(__native_client__)
+ g_assert_not_reached ();
+#else
if (kill (share_info->opened_by_pid, 0) == -1 &&
(errno == ESRCH ||
errno == EPERM)) {
_wapi_free_share_info (share_info);
}
+#endif
}
#ifdef __linux__
#include "mono/io-layer/uglify.h"
#endif /* HOST_WIN32 */
+#ifdef __native_client__
+#include "mono/metadata/nacl-stub.h"
+#endif
+
#endif /* _MONO_IOLAYER_IOLAYER_H_ */
#include <glib.h>
+#if defined(__native_client__)
+#include <mono/metadata/nacl-stub.h>
+#endif
+
#define MAKEWORD(low, high) ((guint16)(((guint8)(low)) | \
((guint16)((guint8)(high))) << 8))
#define MAKELONG(low, high) ((guint32)(((guint16)(low)) | \
* by ExitThread()
*/
static void thread_exit (guint32 exitstatus, gpointer handle) G_GNUC_NORETURN;
+#if defined(__native_client__)
+void nacl_shutdown_gc_thread(void);
+#endif
static void thread_exit (guint32 exitstatus, gpointer handle)
{
+#if defined(__native_client__)
+ nacl_shutdown_gc_thread();
+#endif
_wapi_thread_set_termination_details (handle, exitstatus);
/* Call pthread_exit() to call destructors and really exit the
/* Try again */
}
- WAIT_DEBUG (printf ("%p: state -> INTERRUPTED.\n", thread_handle->id););
+ WAIT_DEBUG (printf ("%p: state -> INTERRUPTED.\n", thread->id););
if (!wait_handle)
/* Not waiting */
/* Try again */
}
- WAIT_DEBUG (printf ("%p: state -> INTERRUPTED.\n", thread_handle->id););
+ WAIT_DEBUG (printf ("%p: state -> INTERRUPTED.\n", thread->id););
return wait_handle;
}
#include <mono/utils/mono-io-portability.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/atomic.h>
+#include <mono/utils/mono-memory-model.h>
#ifdef HOST_WIN32
#include <direct.h>
#endif
static gunichar2 process_guid [36];
static gboolean process_guid_set = FALSE;
-static gboolean shutting_down = FALSE;
-
static gboolean no_exec = FALSE;
static MonoAssembly *
void
mono_runtime_cleanup (MonoDomain *domain)
{
- shutting_down = TRUE;
-
mono_attach_cleanup ();
/* This ends up calling any pending pending (for at most 2 seconds) */
quit_function (mono_get_root_domain (), NULL);
}
-/**
- * mono_runtime_set_shutting_down:
- *
- * Invoked by System.Environment.Exit to flag that the runtime
- * is shutting down.
- */
-void
-mono_runtime_set_shutting_down (void)
-{
- shutting_down = TRUE;
-}
-
-/**
- * mono_runtime_is_shutting_down:
- *
- * Returns whether the runtime has been flagged for shutdown.
- *
- * This is consumed by the P:System.Environment.HasShutdownStarted
- * property.
- *
- */
-gboolean
-mono_runtime_is_shutting_down (void)
-{
- return shutting_down;
-}
-
/**
* mono_domain_create_appdomain:
* @friendly_name: The friendly name of the appdomain to create
}
typedef struct unload_data {
+ gboolean done;
MonoDomain *domain;
char *failure_reason;
+ gint32 refcount;
} unload_data;
+static void
+unload_data_unref (unload_data *data)
+{
+ gint32 count;
+ do {
+ count = mono_atomic_load_acquire (&data->refcount);
+ g_assert (count >= 1 && count <= 2);
+ if (count == 1) {
+ g_free (data);
+ return;
+ }
+ } while (InterlockedCompareExchange (&data->refcount, count, count - 1) != count);
+}
+
static void
deregister_reflection_info_roots_nspace_table (gpointer key, gpointer value, gpointer image)
{
int i;
/* Have to attach to the runtime so shutdown can wait for this thread */
- thread = mono_thread_attach (mono_get_root_domain ());
+ /* Force it to be attached to avoid racing during shutdown. */
+ thread = mono_thread_attach_full (mono_get_root_domain (), TRUE);
/*
* FIXME: Abort our parent thread last, so we can return a failure
*/
if (!mono_threads_abort_appdomain_threads (domain, -1)) {
data->failure_reason = g_strdup_printf ("Aborting of threads in domain %s timed out.", domain->friendly_name);
- return 1;
+ goto failure;
}
if (!mono_thread_pool_remove_domain_jobs (domain, -1)) {
data->failure_reason = g_strdup_printf ("Cleanup of threadpool jobs of domain %s timed out.", domain->friendly_name);
- return 1;
+ goto failure;
}
/* Finalize all finalizable objects in the doomed appdomain */
if (!mono_domain_finalize (domain, -1)) {
data->failure_reason = g_strdup_printf ("Finalization of domain %s timed out.", domain->friendly_name);
- return 1;
+ goto failure;
}
/* Clear references to our vtables in class->runtime_info.
mono_gc_collect (mono_gc_max_generation ());
+ mono_atomic_store_release (&data->done, TRUE);
+ unload_data_unref (data);
mono_thread_detach (thread);
-
return 0;
+
+failure:
+ mono_atomic_store_release (&data->done, TRUE);
+ unload_data_unref (data);
+ mono_thread_detach (thread);
+ return 1;
}
/*
{
HANDLE thread_handle;
gsize tid;
- guint32 res;
MonoAppDomainState prev_state;
MonoMethod *method;
- unload_data thread_data;
+ unload_data *thread_data;
MonoDomain *caller_domain = mono_domain_get ();
/* printf ("UNLOAD STARTING FOR %s (%p) IN THREAD 0x%x.\n", domain->friendly_name, domain, GetCurrentThreadId ()); */
}
mono_domain_set (caller_domain, FALSE);
- thread_data.domain = domain;
- thread_data.failure_reason = NULL;
+ thread_data = g_new0 (unload_data, 1);
+ thread_data->domain = domain;
+ thread_data->failure_reason = NULL;
+ thread_data->done = FALSE;
+ thread_data->refcount = 2; /*Must be 2: unload thread + initiator */
/*The managed callback finished successfully, now we start tearing down the appdomain*/
domain->state = MONO_APPDOMAIN_UNLOADING;
#if 0
thread_handle = mono_create_thread (NULL, 0, unload_thread_main, &thread_data, 0, &tid);
#else
- thread_handle = mono_create_thread (NULL, 0, (LPTHREAD_START_ROUTINE)unload_thread_main, &thread_data, CREATE_SUSPENDED, &tid);
+ thread_handle = mono_create_thread (NULL, 0, (LPTHREAD_START_ROUTINE)unload_thread_main, thread_data, CREATE_SUSPENDED, &tid);
if (thread_handle == NULL) {
return;
}
#endif
/* Wait for the thread */
- while ((res = WaitForSingleObjectEx (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION)) {
+ while (!thread_data->done && WaitForSingleObjectEx (thread_handle, INFINITE, TRUE) == WAIT_IO_COMPLETION) {
if (mono_thread_internal_has_appdomain_ref (mono_thread_internal_current (), domain) && (mono_thread_interruption_requested ())) {
/* The unload thread tries to abort us */
/* The icall wrapper will execute the abort */
CloseHandle (thread_handle);
+ unload_data_unref (thread_data);
return;
}
}
CloseHandle (thread_handle);
- if (thread_data.failure_reason) {
+ if (thread_data->failure_reason) {
/* Roll back the state change */
domain->state = MONO_APPDOMAIN_CREATED;
- g_warning ("%s", thread_data.failure_reason);
+ g_warning ("%s", thread_data->failure_reason);
- *exc = (MonoObject *) mono_get_exception_cannot_unload_appdomain (thread_data.failure_reason);
+ *exc = (MonoObject *) mono_get_exception_cannot_unload_appdomain (thread_data->failure_reason);
- g_free (thread_data.failure_reason);
- thread_data.failure_reason = NULL;
+ g_free (thread_data->failure_reason);
+ thread_data->failure_reason = NULL;
}
+
+ unload_data_unref (thread_data);
}
/* the default search path is empty, the first slot is replaced with the computed value */
static const char*
default_path [] = {
+ NULL,
NULL,
NULL
};
gchar buf[4096];
guint buf_size = sizeof (buf);
+ name = NULL;
if (_NSGetExecutablePath (buf, &buf_size) == 0)
name = g_strdup (buf);
{ "System.ComponentModel.Composition", WINFX_KEY, ECMA_KEY },
{ "System.ComponentModel.DataAnnotations", "ddd0da4d3e678217", WINFX_KEY },
{ "System.Core", SILVERLIGHT_KEY, ECMA_KEY },
+ // FIXME: MS uses MSFINAL_KEY for .NET 4.5
+ { "System.Net", SILVERLIGHT_KEY, ECMA_KEY },
{ "System.Numerics", WINFX_KEY, ECMA_KEY },
{ "System.Runtime.Serialization", SILVERLIGHT_KEY, ECMA_KEY },
{ "System.ServiceModel", WINFX_KEY, ECMA_KEY },
MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLYREF];
image->references = g_new0 (MonoAssembly *, t->rows + 1);
+ image->nreferences = t->rows;
}
reference = image->references [index];
mono_assemblies_unlock ();
}
corlib = load_in_path (corlib_file, default_path, status, FALSE);
g_free (corlib_file);
-
+
+ if (corlib && !strcmp (runtime->framework_version, "4.5"))
+ default_path [1] = g_strdup_printf ("%s/mono/4.5/Facades", default_path [0]);
+
return corlib;
}
*/
MonoMethod*
-mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
+mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box)
{
int offset = -1;
int atype;
- MonoClass *klass = vtable->klass;
MONO_THREAD_VAR_OFFSET (GC_thread_tls, offset);
/*g_print ("thread tls: %d\n", offset);*/
return NULL;
if (klass->rank)
return NULL;
+ if (mono_class_is_open_constructed_type (&klass->byval_arg))
+ return NULL;
if (klass->byval_arg.type == MONO_TYPE_STRING) {
atype = ATYPE_STRING;
} else if (!klass->has_references) {
}
MonoMethod*
-mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
+mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box)
{
return NULL;
}
MonoClass *internals_visible_class;
MonoClass *generic_ilist_class;
MonoClass *generic_nullable_class;
-#ifndef DISABLE_COM
- MonoClass *variant_class;
- MonoClass *com_object_class;
- MonoClass *com_interop_proxy_class;
- MonoClass *iunknown_class;
- MonoClass *idispatch_class;
-#endif
MonoClass *safehandle_class;
MonoClass *handleref_class;
MonoClass *attribute_class;
#define mono_object_is_transparent_proxy(object) (((MonoObject*)object)->vtable->klass == mono_defaults.transparent_proxy_class)
#endif
+
+#define GENERATE_GET_CLASS_WITH_CACHE_DECL(shortname) \
+MonoClass* mono_class_get_##shortname##_class (void);
+
+#define GENERATE_GET_CLASS_WITH_CACHE(shortname,namespace,name) \
+MonoClass* \
+mono_class_get_##shortname##_class (void) \
+{ \
+ static MonoClass *tmp_class; \
+ MonoClass *class = tmp_class; \
+ if (!class) { \
+ class = mono_class_from_name (mono_defaults.corlib, #namespace, #name); \
+ g_assert (class); \
+ mono_memory_barrier (); \
+ tmp_class = class; \
+ } \
+ return class; \
+}
+
+#define GENERATE_STATIC_GET_CLASS_WITH_CACHE(shortname,namespace,name) \
+static GENERATE_GET_CLASS_WITH_CACHE (shortname,namespace,name)
+
+
+#ifndef DISABLE_COM
+
+GENERATE_GET_CLASS_WITH_CACHE_DECL (interop_proxy)
+GENERATE_GET_CLASS_WITH_CACHE_DECL (idispatch)
+GENERATE_GET_CLASS_WITH_CACHE_DECL (iunknown)
+GENERATE_GET_CLASS_WITH_CACHE_DECL (com_object)
+GENERATE_GET_CLASS_WITH_CACHE_DECL (variant)
+
+#endif
+
extern MonoDefaults mono_defaults MONO_INTERNAL;
void
#ifndef DISABLE_COM
/*
- * COM initialization (using mono_init_com_types) is delayed until needed.
+ * COM initialization is delayed until needed.
* However when a [ComImport] attribute is present on a type it will trigger
* the initialization. This is not a problem unless the BCL being executed
* lacks the types that COM depends on (e.g. Variant on Silverlight).
}
/* FIXME : we should add an extra checks to ensure COM can be initialized properly before continuing */
- mono_init_com_types ();
}
#endif /*DISABLE_COM*/
if (MONO_CLASS_IS_IMPORT (class)) {
init_com_from_comimport (class);
if (parent == mono_defaults.object_class)
- parent = mono_defaults.com_object_class;
+ parent = mono_class_get_com_object_class ();
}
#endif
if (!parent) {
if (!class->enumtype) {
if (!mono_metadata_interfaces_from_typedef_full (
image, type_token, &interfaces, &icount, FALSE, context)){
- mono_class_set_failure_and_error (class, error, g_strdup ("Could not load interfaces"));
+ mono_class_set_failure_from_loader_error (class, error, g_strdup ("Could not load interfaces"));
mono_loader_unlock ();
mono_profiler_class_loaded (class, MONO_PROFILE_FAILED);
- g_assert (!mono_loader_get_last_error ());
return NULL;
}
#include "mono/metadata/attrdefs.h"
#include "mono/metadata/gc-internal.h"
#include "mono/utils/mono-counters.h"
+#include "mono/utils/strenc.h"
#include "mono/utils/atomic.h"
#include <string.h>
#include <errno.h>
#define STDCALL
#endif
+GENERATE_GET_CLASS_WITH_CACHE (interop_proxy, Mono.Interop, ComInteropProxy)
+GENERATE_GET_CLASS_WITH_CACHE (idispatch, Mono.Interop, IDispatch)
+GENERATE_GET_CLASS_WITH_CACHE (iunknown, Mono.Interop, IUnknown)
+
+GENERATE_GET_CLASS_WITH_CACHE (com_object, System, __ComObject)
+GENERATE_GET_CLASS_WITH_CACHE (variant, System, Variant)
+
/* Upon creation of a CCW, only allocate a weak handle and set the
* reference count to 0. If the unmanaged client code decides to addref and
* hold onto the CCW, I then allocate a strong handle. Once the reference count
return FALSE;
klass = mono_object_class (real_proxy);
- return (klass && klass == mono_defaults.com_interop_proxy_class);
+ return (klass && klass == mono_class_get_interop_proxy_class ());
}
static int
int real_proxy;
guint32 pos_null = 0, pos_ccw = 0, pos_end = 0;
MonoClass *klass = NULL;
-
- /* COM types are initialized lazily */
- mono_init_com_types ();
klass = mono_class_from_mono_type (type);
mono_mb_emit_ldloc (mb, 0);
mono_mb_emit_byte (mb, CEE_LDIND_I);
- mono_mb_emit_ptr (mb, &mono_defaults.com_object_class->byval_arg);
+ mono_mb_emit_ptr (mb, &mono_class_get_com_object_class ()->byval_arg);
mono_mb_emit_icall (mb, cominterop_type_from_handle);
mono_mb_emit_managed_call (mb, com_interop_proxy_get_proxy, NULL);
mono_mb_emit_managed_call (mb, get_transparent_proxy, NULL);
case MONO_MARSHAL_CONV_OBJECT_IDISPATCH:
case MONO_MARSHAL_CONV_OBJECT_IUNKNOWN: {
guint32 pos_null = 0, pos_rcw = 0, pos_end = 0;
-
- /* COM types are initialized lazily */
- mono_init_com_types ();
-
mono_mb_emit_ldloc (mb, 1);
mono_mb_emit_icon (mb, 0);
static MonoProperty* iunknown = NULL;
if (!iunknown)
- iunknown = mono_class_get_property_from_name (mono_defaults.com_object_class, "IUnknown");
+ iunknown = mono_class_get_property_from_name (mono_class_get_com_object_class (), "IUnknown");
mono_mb_emit_managed_call (mb, iunknown->get, NULL);
}
else if (conv == MONO_MARSHAL_CONV_OBJECT_IDISPATCH) {
static MonoProperty* idispatch = NULL;
if (!idispatch)
- idispatch = mono_class_get_property_from_name (mono_defaults.com_object_class, "IDispatch");
+ idispatch = mono_class_get_property_from_name (mono_class_get_com_object_class (), "IDispatch");
mono_mb_emit_managed_call (mb, idispatch->get, NULL);
}
else {
if (conv == MONO_MARSHAL_CONV_OBJECT_INTERFACE)
mono_mb_emit_ptr (mb, mono_type_get_class (type));
else if (conv == MONO_MARSHAL_CONV_OBJECT_IUNKNOWN)
- mono_mb_emit_ptr (mb, mono_defaults.iunknown_class);
+ mono_mb_emit_ptr (mb, mono_class_get_iunknown_class ());
else if (conv == MONO_MARSHAL_CONV_OBJECT_IDISPATCH)
- mono_mb_emit_ptr (mb, mono_defaults.idispatch_class);
+ mono_mb_emit_ptr (mb, mono_class_get_idispatch_class ());
else
g_assert_not_reached ();
mono_mb_emit_icall (mb, cominterop_get_ccw);
if ((res = mono_marshal_find_in_cache (cache, method)))
return res;
- mono_init_com_types ();
-
if (!method->klass->vtable)
mono_class_setup_vtable (method->klass);
static MonoMethod *ctor = NULL;
if (!ctor)
- ctor = mono_class_get_method_from_name (mono_defaults.com_object_class, ".ctor", 0);
+ ctor = mono_class_get_method_from_name (mono_class_get_com_object_class (), ".ctor", 0);
mono_mb_emit_ldarg (mb, 0);
mono_mb_emit_managed_call (mb, ctor, NULL);
mono_mb_emit_byte (mb, CEE_RET);
if (!marshal_release)
marshal_release = mono_class_get_method_from_name (mono_defaults.marshal_class, "Release", 1);
- /* COM types are initialized lazily */
- mono_init_com_types ();
-
switch (action) {
case MARSHAL_ACTION_CONV_IN: {
guint32 pos_null = 0;
#define MONO_S_OK 0x00000000L
#define MONO_E_NOINTERFACE 0x80004002L
#define MONO_E_NOTIMPL 0x80004001L
+#define MONO_E_INVALIDARG 0x80070057L
+#define MONO_E_DISP_E_UNKNOWNNAME 0x80020006L
+#define MONO_E_DISPID_UNKNOWN (gint32)-1
int
ves_icall_System_Runtime_InteropServices_Marshal_AddRefInternal (gpointer pUnk)
if (cominterop_object_is_rcw (object)) {
return cominterop_get_interface (((MonoComInteropProxy*)((MonoTransparentProxy*)object)->rp)->com_object,
- mono_defaults.idispatch_class, TRUE);
+ mono_class_get_idispatch_class (), TRUE);
}
else {
MonoClass* klass = mono_object_class (object);
if (!cominterop_can_support_dispatch (klass) )
cominterop_raise_hr_exception (MONO_E_NOINTERFACE);
- return cominterop_get_ccw (object, mono_defaults.idispatch_class);
+ return cominterop_get_ccw (object, mono_class_get_idispatch_class ());
}
}
if (!object)
return NULL;
- mono_init_com_types ();
-
if (cominterop_object_is_rcw (object)) {
MonoClass *klass = NULL;
MonoRealProxy* real_proxy = NULL;
}
klass = mono_object_class (real_proxy);
- if (klass != mono_defaults.com_interop_proxy_class) {
+ if (klass != mono_class_get_interop_proxy_class ()) {
g_assert_not_reached ();
return NULL;
}
return ((MonoComInteropProxy*)real_proxy)->com_object->iunknown;
}
else {
- return cominterop_get_ccw (object, mono_defaults.iunknown_class);
+ return cominterop_get_ccw (object, mono_class_get_iunknown_class ());
}
#else
g_assert_not_reached ();
ves_icall_System_Runtime_InteropServices_Marshal_GetIDispatchForObjectInternal (MonoObject* object)
{
#ifndef DISABLE_COM
- mono_init_com_types ();
-
return cominterop_get_idispatch_for_object (object);
#else
g_assert_not_reached ();
}
iface = itf;
- if (iface == mono_defaults.iunknown_class) {
+ if (iface == mono_class_get_iunknown_class ()) {
start_slot = 3;
}
- else if (iface == mono_defaults.idispatch_class) {
+ else if (iface == mono_class_get_idispatch_class ()) {
start_slot = 7;
}
else {
if (!ccw->free_marshaler) {
int ret = 0;
gpointer tunk;
- tunk = cominterop_get_ccw (object, mono_defaults.iunknown_class);
+ tunk = cominterop_get_ccw (object, mono_class_get_iunknown_class ());
ret = CoCreateFreeThreadedMarshaler (tunk, (LPUNKNOWN*)&ccw->free_marshaler);
}
mono_thread_attach (mono_get_root_domain ());
/* handle IUnknown special */
- if (cominterop_class_guid_equal (riid, mono_defaults.iunknown_class)) {
- *ppv = cominterop_get_ccw (object, mono_defaults.iunknown_class);
+ if (cominterop_class_guid_equal (riid, mono_class_get_iunknown_class ())) {
+ *ppv = cominterop_get_ccw (object, mono_class_get_iunknown_class ());
/* remember to addref on QI */
cominterop_ccw_addref (*ppv);
return MONO_S_OK;
}
/* handle IDispatch special */
- if (cominterop_class_guid_equal (riid, mono_defaults.idispatch_class)) {
+ if (cominterop_class_guid_equal (riid, mono_class_get_idispatch_class ())) {
if (!cominterop_can_support_dispatch (klass))
return MONO_E_NOINTERFACE;
- *ppv = cominterop_get_ccw (object, mono_defaults.idispatch_class);
+ *ppv = cominterop_get_ccw (object, mono_class_get_idispatch_class ());
/* remember to addref on QI */
cominterop_ccw_addref (*ppv);
return MONO_S_OK;
static int STDCALL
cominterop_ccw_get_type_info_count (MonoCCWInterface* ccwe, guint32 *pctinfo)
{
- return MONO_E_NOTIMPL;
+ if(!pctinfo)
+ return MONO_E_INVALIDARG;
+
+ *pctinfo = 1;
+
+ return MONO_S_OK;
}
static int STDCALL
gunichar2** rgszNames, guint32 cNames,
guint32 lcid, gint32 *rgDispId)
{
- return MONO_E_NOTIMPL;
+ int i,ret = MONO_S_OK;
+ MonoMethod* method;
+ gchar* methodname;
+ MonoClass *klass = NULL;
+ MonoCCW* ccw = ccwe->ccw;
+ MonoObject* object = mono_gchandle_get_target (ccw->gc_handle);
+
+ g_assert (object);
+ klass = mono_object_class (object);
+
+ if (!mono_domain_get ())
+ mono_thread_attach (mono_get_root_domain ());
+
+ for (i=0; i < cNames; i++) {
+ methodname = mono_unicode_to_external (rgszNames[i]);
+
+ method = mono_class_get_method_from_name(klass, methodname, -1);
+ if (method)
+ rgDispId[i] = (gint32)method->token;
+ else {
+ rgDispId[i] = MONO_E_DISPID_UNKNOWN;
+ ret = MONO_E_DISP_E_UNKNOWNNAME;
+ }
+ }
+
+ return ret;
}
static int STDCALL
{
MonoMethodBuilder *mb = m->mb;
- mono_init_com_types ();
-
switch (action) {
case MARSHAL_ACTION_CONV_IN: {
get_native_variant_for_object = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetNativeVariantForObject", 2);
g_assert (get_native_variant_for_object);
- elem_var = mono_mb_add_local (mb, &mono_defaults.variant_class->byval_arg);
+ elem_var = mono_mb_add_local (mb, &mono_class_get_variant_class ()->byval_arg);
mono_mb_emit_ldloc_addr (mb, elem_var);
mono_mb_emit_managed_call (mb, get_native_variant_for_object, NULL);
mono_mb_emit_icall (mb, mono_marshal_safearray_set_value);
if (!variant_clear)
- variant_clear = mono_class_get_method_from_name (mono_defaults.variant_class, "Clear", 0);
+ variant_clear = mono_class_get_method_from_name (mono_class_get_variant_class (), "Clear", 0);
mono_mb_emit_ldloc_addr (mb, elem_var);
mono_mb_emit_managed_call (mb, variant_clear, NULL);
return NULL;
}
/* allow two :: to separate the method name */
- if (method_name [-1] == ':')
+ if (method_name != class_nspace && method_name [-1] == ':')
method_name [-1] = 0;
*method_name++ = 0;
class_name = strrchr (class_nspace, '.');
void
mono_install_free_domain_hook (MonoFreeDomainFunc func) MONO_INTERNAL;
-void
-mono_init_com_types (void) MONO_INTERNAL;
-
void
mono_cleanup (void) MONO_INTERNAL;
#include <mono/metadata/mono-debug-debugger.h>
#include <mono/metadata/mono-config.h>
#include <mono/metadata/threads-types.h>
+#include <mono/metadata/runtime.h>
#include <metadata/threads.h>
#include <metadata/profiler-private.h>
#include <mono/metadata/coree.h>
mono_classes_init ();
mono_loader_init ();
mono_reflection_init ();
+ mono_runtime_init_tls ();
/* FIXME: When should we release this memory? */
MONO_GC_REGISTER_ROOT_FIXED (appdomains_list);
mono_defaults.corlib, "System.Reflection", "CustomAttributeData");
/* these are initialized lazily when COM features are used */
-#ifndef DISABLE_COM
- mono_defaults.variant_class = NULL;
- mono_defaults.com_object_class = NULL;
- mono_defaults.com_interop_proxy_class = NULL;
- mono_defaults.iunknown_class = NULL;
- mono_defaults.idispatch_class = NULL;
-#endif
mono_class_init (mono_defaults.array_class);
mono_defaults.generic_nullable_class = mono_class_from_name (
return mono_init_internal (domain_name, NULL, version);
}
-#ifndef DISABLE_COM
-/**
- * mono_init_com_types:
- *
- * Initializes all types needed for COM Interop in mono_defaults structure.
- */
-void
-mono_init_com_types (void)
-{
- static gboolean initialized = FALSE;
-
- if (initialized)
- return;
-
- /* FIXME: do I need some threading protection here */
-
- g_assert (mono_defaults.corlib);
-
- mono_defaults.variant_class = mono_class_from_name (
- mono_defaults.corlib, "System", "Variant");
- g_assert (mono_defaults.variant_class != 0);
-
- mono_defaults.com_object_class = mono_class_from_name (
- mono_defaults.corlib, "System", "__ComObject");
- g_assert (mono_defaults.com_object_class != 0);
-
- mono_defaults.com_interop_proxy_class = mono_class_from_name (
- mono_defaults.corlib, "Mono.Interop", "ComInteropProxy");
- g_assert (mono_defaults.com_interop_proxy_class != 0);
-
- mono_defaults.iunknown_class = mono_class_from_name (
- mono_defaults.corlib, "Mono.Interop", "IUnknown");
- g_assert (mono_defaults.iunknown_class != 0);
-
- mono_defaults.idispatch_class = mono_class_from_name (
- mono_defaults.corlib, "Mono.Interop", "IDispatch");
- g_assert (mono_defaults.idispatch_class != 0);
-
- initialized = TRUE;
-}
-#endif /*DISABLE_COM*/
-
/**
* mono_cleanup:
*
/* This needs to be done before closing assemblies */
mono_gc_clear_domain (domain);
+ /* Close dynamic assemblies first, since they have no ref count */
+ for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
+ MonoAssembly *ass = tmp->data;
+ if (!ass->image || !ass->image->dynamic)
+ continue;
+ mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Unloading domain %s[%p], assembly %s[%p], ref_count=%d", domain->friendly_name, domain, ass->aname.name, ass, ass->ref_count);
+ if (!mono_assembly_close_except_image_pools (ass))
+ tmp->data = NULL;
+ }
+
for (tmp = domain->domain_assemblies; tmp; tmp = tmp->next) {
MonoAssembly *ass = tmp->data;
+ if (!ass)
+ continue;
+ if (!ass->image || ass->image->dynamic)
+ continue;
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_ASSEMBLY, "Unloading domain %s[%p], assembly %s[%p], ref_count=%d", domain->friendly_name, domain, ass->aname.name, ass, ass->ref_count);
if (!mono_assembly_close_except_image_pools (ass))
tmp->data = NULL;
int alloc_type;
} AllocatorWrapperInfo;
-MonoMethod* mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box) MONO_INTERNAL;
+MonoMethod* mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box) MONO_INTERNAL;
MonoMethod* mono_gc_get_managed_array_allocator (MonoClass *klass) MONO_INTERNAL;
MonoMethod *mono_gc_get_managed_allocator_by_type (int atype) MONO_INTERNAL;
RefQueueEntry **iter = &queue->queue;
RefQueueEntry *entry;
while ((entry = *iter)) {
- MonoObject *obj;
if (entry->domain == domain) {
#ifdef HAVE_SGEN_GC
mono_gc_weak_link_remove (&entry->dis_link, TRUE);
* NaCl exits anyway.
*/
#ifndef __native_client__
- mono_runtime_shutdown ();
-
- /* This will kill the tp threads which cannot be suspended */
- mono_thread_pool_cleanup ();
+ if (!mono_runtime_try_shutdown ())
+ mono_thread_exit ();
/* Suspend all managed threads since the runtime is going away */
mono_thread_suspend_all_other_threads ();
* MonoImage might outlive its associated MonoAssembly.
*/
if (image->references && !image->dynamic) {
- MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLYREF];
- int i;
-
- for (i = 0; i < t->rows; i++) {
+ for (i = 0; i < image->nreferences; i++) {
if (image->references [i] && image->references [i] != REFERENCE_MISSING) {
if (!mono_assembly_close_except_image_pools (image->references [i]))
image->references [i] = NULL;
image->reflection_info_unregister_classes = NULL;
if (image->references && !image->dynamic) {
- MonoTableInfo *t = &image->tables [MONO_TABLE_ASSEMBLYREF];
- int i;
-
- for (i = 0; i < t->rows; i++) {
+ for (i = 0; i < image->nreferences; i++) {
if (image->references [i] && image->references [i] != REFERENCE_MISSING)
mono_assembly_close_finish (image->references [i]);
}
return sig;
}
+void
+mono_marshal_init_tls (void)
+{
+ mono_native_tls_alloc (&last_error_tls_id, NULL);
+ mono_native_tls_alloc (&load_type_info_tls_id, NULL);
+}
+
void
mono_marshal_init (void)
{
module_initialized = TRUE;
InitializeCriticalSection (&marshal_mutex);
marshal_mutex_initialized = TRUE;
- mono_native_tls_alloc (&last_error_tls_id, NULL);
- mono_native_tls_alloc (&load_type_info_tls_id, NULL);
register_icall (ves_icall_System_Threading_Thread_ResetAbort, "ves_icall_System_Threading_Thread_ResetAbort", "void", TRUE);
register_icall (mono_marshal_string_to_utf16, "mono_marshal_string_to_utf16", "ptr obj", FALSE);
}
case MONO_TYPE_OBJECT: {
#ifndef DISABLE_COM
- mono_init_com_types ();
if (to_object) {
static MonoMethod *variant_clear = NULL;
static MonoMethod *get_object_for_native_variant = NULL;
if (!variant_clear)
- variant_clear = mono_class_get_method_from_name (mono_defaults.variant_class, "Clear", 0);
+ variant_clear = mono_class_get_method_from_name (mono_class_get_variant_class (), "Clear", 0);
if (!get_object_for_native_variant)
get_object_for_native_variant = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetObjectForNativeVariant", 1);
mono_mb_emit_ldloc (mb, 1);
/* this seems to be the best plase to put this, as all remoting invokes seem to get filtered through here */
#ifndef DISABLE_COM
- if (mono_class_is_com_object (method->klass) || method->klass == mono_defaults.com_object_class) {
+ if (mono_class_is_com_object (method->klass) || method->klass == mono_class_get_com_object_class ()) {
MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass);
g_assert (vtable); /*FIXME do proper error handling*/
static MonoMethod *get_object_for_native_variant = NULL;
static MonoMethod *get_native_variant_for_object = NULL;
- mono_init_com_types ();
-
if (!get_object_for_native_variant)
get_object_for_native_variant = mono_class_get_method_from_name (mono_defaults.marshal_class, "GetObjectForNativeVariant", 1);
g_assert (get_object_for_native_variant);
switch (action) {
case MARSHAL_ACTION_CONV_IN: {
- conv_arg = mono_mb_add_local (mb, &mono_defaults.variant_class->byval_arg);
+ conv_arg = mono_mb_add_local (mb, &mono_class_get_variant_class ()->byval_arg);
if (t->byref)
- *conv_arg_type = &mono_defaults.variant_class->this_arg;
+ *conv_arg_type = &mono_class_get_variant_class ()->this_arg;
else
- *conv_arg_type = &mono_defaults.variant_class->byval_arg;
+ *conv_arg_type = &mono_class_get_variant_class ()->byval_arg;
if (t->byref && !(t->attrs & PARAM_ATTRIBUTE_IN) && t->attrs & PARAM_ATTRIBUTE_OUT)
break;
static MonoMethod *variant_clear = NULL;
if (!variant_clear)
- variant_clear = mono_class_get_method_from_name (mono_defaults.variant_class, "Clear", 0);
+ variant_clear = mono_class_get_method_from_name (mono_class_get_variant_class (), "Clear", 0);
g_assert (variant_clear);
conv_arg = mono_mb_add_local (mb, &mono_defaults.object_class->byval_arg);
if (t->byref)
- *conv_arg_type = &mono_defaults.variant_class->this_arg;
+ *conv_arg_type = &mono_class_get_variant_class ()->this_arg;
else
- *conv_arg_type = &mono_defaults.variant_class->byval_arg;
+ *conv_arg_type = &mono_class_get_variant_class ()->byval_arg;
if (t->byref && !(t->attrs & PARAM_ATTRIBUTE_IN) && t->attrs & PARAM_ATTRIBUTE_OUT)
break;
void
mono_marshal_init (void) MONO_INTERNAL;
+void
+mono_marshal_init_tls (void) MONO_INTERNAL;
+
void
mono_marshal_cleanup (void) MONO_INTERNAL;
* It is NULL terminated.
*/
MonoAssembly **references;
+ int nreferences;
MonoImage **modules;
guint32 module_count;
static void
collect_method_images (MonoMethodInflated *method, CollectData *data)
{
+ MonoMethod *m = method->declaring;
+
add_image (method->declaring->klass->image, data);
if (method->context.class_inst)
collect_ginst_images (method->context.class_inst, data);
if (method->context.method_inst)
collect_ginst_images (method->context.method_inst, data);
/*
- if (((MonoMethod*)method)->signature)
- collect_signature_images (mono_method_signature ((MonoMethod*)method), data);
- */
+ * Dynamic assemblies have no references, so the images they depend on can be unloaded before them.
+ */
+ if (m->klass->image->dynamic)
+ collect_signature_images (mono_method_signature (m), data);
}
static void
mono_config_parse_file (mono_cfg);
g_free (mono_cfg);
-#ifndef TARGET_WIN32
+#if !defined(TARGET_WIN32) && !defined(__native_client__)
home = g_get_home_dir ();
user_cfg = g_strconcat (home, G_DIR_SEPARATOR_S, ".mono/config", NULL);
mono_config_parse_file (user_cfg);
for (i = 0; i < jit->num_locals; i++)
write_variable (&jit->locals [i], ptr, &ptr);
+ *ptr++ = jit->gsharedvt_info_var ? 1 : 0;
+ if (jit->gsharedvt_info_var) {
+ write_variable (jit->gsharedvt_info_var, ptr, &ptr);
+ write_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+ }
+
size = ptr - oldptr;
g_assert (size < max_size);
total_size = size + sizeof (MonoDebugMethodAddress);
g_free (jit->this_var);
g_free (jit->params);
g_free (jit->locals);
+ g_free (jit->gsharedvt_info_var);
+ g_free (jit->gsharedvt_locals_var);
g_free (jit);
}
for (i = 0; i < jit->num_locals; i++)
read_variable (&jit->locals [i], ptr, &ptr);
+ if (*ptr++) {
+ jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+ jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+ read_variable (jit->gsharedvt_info_var, ptr, &ptr);
+ read_variable (jit->gsharedvt_locals_var, ptr, &ptr);
+ }
+
return jit;
}
MonoDebugVarInfo *params;
uint32_t num_locals;
MonoDebugVarInfo *locals;
+ MonoDebugVarInfo *gsharedvt_info_var;
+ MonoDebugVarInfo *gsharedvt_locals_var;
};
struct _MonoDebugMethodAddressList {
/* The variable is dead. */
#define MONO_DEBUG_VAR_ADDRESS_MODE_DEAD 0x30000000
+/* Same as REGOFFSET, but do an indirection */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR 0x40000000
+
+/* gsharedvt local */
+#define MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL 0x50000000
+
struct _MonoDebugVarInfo {
uint32_t index;
uint32_t offset;
-
#if defined(__native_client__)
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-#include <eglib/src/glib.h>
-#include <errno.h>
-#include <sys/types.h>
+#include "nacl-stub.h"
-struct group *getgrnam(const char *name) { return NULL; }
-struct group *getgrgid(gid_t gid) { errno=EIO; return NULL; }
-int fsync(int fd) { errno=EINVAL; return -1; }
-dev_t makedev(guint32 maj, guint32 min) { return (maj)*256+(min); }
+struct group *getgrnam(const char *name)
+{
+ return NULL;
+}
+
+struct group *getgrgid(gid_t gid)
+{
+ errno = EIO;
+ return NULL;
+}
+
+int fsync(int fd)
+{
+ errno = EINVAL;
+ return -1;
+}
#ifdef USE_NEWLIB
-int getdtablesize(void) {
+dev_t makedev(int maj, int min)
+{
+ return (maj)*256+(min);
+}
+
+int utime(const char *filename, const void *times)
+{
+ errno = EACCES;
+ return -1;
+}
+
+int kill(pid_t pid, int sig)
+{
+ errno = EACCES;
+ return -1;
+}
+
+int getrusage(int who, void *usage)
+{
+ errno = EACCES;
+ return -1;
+}
+
+int lstat(const char *path, struct stat *buf)
+{
+ return stat (path, buf);
+}
+
+int getdtablesize(void)
+{
#ifdef OPEN_MAX
return OPEN_MAX;
#else
#endif
}
-size_t getpagesize(void) {
+size_t getpagesize(void)
+{
#ifdef PAGE_SIZE
return PAGE_SIZE;
#else
#endif
}
-#include <semaphore.h>
-
int sem_trywait(sem_t *sem) {
g_assert_not_reached ();
return -1;
}
MonoMethod*
-mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
+mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box)
{
return NULL;
}
type = ((MonoReflectionType *)rp->class_to_proxy)->type;
klass = mono_class_from_mono_type (type);
#ifndef DISABLE_COMf
- if ((mono_class_is_com_object (klass) || (mono_defaults.com_object_class && klass == mono_defaults.com_object_class)) && !mono_vtable_is_remote (mono_class_vtable (mono_domain_get (), klass)))
+ if ((mono_class_is_com_object (klass) || (mono_class_get_com_object_class () && klass == mono_class_get_com_object_class ())) && !mono_vtable_is_remote (mono_class_vtable (mono_domain_get (), klass)))
remote_class->default_vtable = mono_class_proxy_vtable (domain, remote_class, MONO_REMOTING_TARGET_COMINTEROP);
else
#endif
res = mono_marshal_get_remoting_invoke_with_check (res);
else {
#ifndef DISABLE_COM
- if (klass == mono_defaults.com_object_class || mono_class_is_com_object (klass))
+ if (klass == mono_class_get_com_object_class () || mono_class_is_com_object (klass))
res = mono_cominterop_get_invoke (res);
else
#endif
#include <mono/metadata/runtime.h>
#include <mono/metadata/monitor.h>
#include <mono/metadata/threads-types.h>
+#include <mono/metadata/threadpool.h>
+#include <mono/metadata/marshal.h>
+#include <mono/utils/atomic.h>
+
+static gboolean shutting_down_inited = FALSE;
+static gboolean shutting_down = FALSE;
+
+/**
+ * mono_runtime_set_shutting_down:
+ *
+ * Invoked by System.Environment.Exit to flag that the runtime
+ * is shutting down.
+ *
+ * Deprecated. This function can break the shutdown sequence.
+ */
+void
+mono_runtime_set_shutting_down (void)
+{
+ shutting_down = TRUE;
+}
+
+/**
+ * mono_runtime_is_shutting_down:
+ *
+ * Returns whether the runtime has been flagged for shutdown.
+ *
+ * This is consumed by the P:System.Environment.HasShutdownStarted
+ * property.
+ *
+ */
+gboolean
+mono_runtime_is_shutting_down (void)
+{
+ return shutting_down;
+}
static void
fire_process_exit_event (MonoDomain *domain, gpointer user_data)
#endif
}
-/*
-Initialize runtime shutdown.
-After this call completes the thread pool will stop accepting new jobs and
-*/
-void
-mono_runtime_shutdown (void)
+/*
+ * Try to initialize runtime shutdown.
+ * After this call completes the thread pool will stop accepting new jobs and no further threads will be created.
+ *
+ * @return true if shutdown was initiated by this call or false is other thread beat this one
+ */
+gboolean
+mono_runtime_try_shutdown (void)
{
+ if (InterlockedCompareExchange (&shutting_down_inited, TRUE, FALSE))
+ return FALSE;
+
mono_runtime_fire_process_exit_event ();
+ shutting_down = TRUE;
+
mono_threads_set_shutting_down ();
/* No new threads will be created after this point */
mono_runtime_set_shutting_down ();
+ /* This will kill the tp threads which cannot be suspended */
+ mono_thread_pool_cleanup ();
+
+ /*TODO move the follow to here:
+ mono_thread_suspend_all_other_threads (); OR mono_thread_wait_all_other_threads
+
+ mono_runtime_quit ();
+ */
+
+ return TRUE;
}
return TRUE;
return FALSE;
}
+
+/*
+Coordinate the creation of all remaining TLS slots in the runtime.
+No further TLS slots should be created after this function finishes.
+This restriction exists because AOT requires offsets to be constant
+across runs.
+*/
+void
+mono_runtime_init_tls (void)
+{
+ mono_marshal_init_tls ();
+ mono_thread_pool_init_tls ();
+ mono_thread_init_tls ();
+}
MONO_BEGIN_DECLS
gboolean mono_runtime_is_critical_method (MonoMethod *method) MONO_INTERNAL;
-void mono_runtime_shutdown (void) MONO_INTERNAL;
+gboolean mono_runtime_try_shutdown (void) MONO_INTERNAL;
+void mono_runtime_init_tls (void) MONO_INTERNAL;
MONO_END_DECLS
#endif /* _MONO_METADATA_RUNTIME_H_ */
if (!registered) {
mono_register_jit_icall (mono_gc_alloc_obj, "mono_gc_alloc_obj", mono_create_icall_signature ("object ptr int"), FALSE);
mono_register_jit_icall (mono_gc_alloc_vector, "mono_gc_alloc_vector", mono_create_icall_signature ("object ptr int int"), FALSE);
+ mono_register_jit_icall (mono_gc_alloc_string, "mono_gc_alloc_string", mono_create_icall_signature ("object ptr int int32"), FALSE);
registered = TRUE;
}
} else if (atype == ATYPE_VECTOR) {
num_params = 2;
name = "AllocVector";
+ } else if (atype == ATYPE_STRING) {
+ num_params = 2;
+ name = "AllocString";
} else {
g_assert_not_reached ();
}
csig = mono_metadata_signature_alloc (mono_defaults.corlib, num_params);
- csig->ret = &mono_defaults.object_class->byval_arg;
- for (i = 0; i < num_params; ++i)
- csig->params [i] = &mono_defaults.int_class->byval_arg;
+ if (atype == ATYPE_STRING) {
+ csig->ret = &mono_defaults.string_class->byval_arg;
+ csig->params [0] = &mono_defaults.int_class->byval_arg;
+ csig->params [1] = &mono_defaults.int32_class->byval_arg;
+ } else {
+ csig->ret = &mono_defaults.object_class->byval_arg;
+ for (i = 0; i < num_params; ++i)
+ csig->params [i] = &mono_defaults.int_class->byval_arg;
+ }
mb = mono_mb_new (mono_defaults.object_class, name, MONO_WRAPPER_ALLOC);
mono_mb_set_clauses (mb, 1, clause);
mono_mb_patch_branch (mb, pos_leave);
/* end catch */
+ } else if (atype == ATYPE_STRING) {
+ /* a string allocator method takes the args: (vtable, len) */
+ /* bytes = (sizeof (MonoString) + ((len + 1) * 2)); */
+ mono_mb_emit_ldarg (mb, 1);
+ mono_mb_emit_icon (mb, 1);
+ mono_mb_emit_byte (mb, MONO_CEE_SHL);
+ //WE manually fold the above + 2 here
+ mono_mb_emit_icon (mb, sizeof (MonoString) + 2);
+ mono_mb_emit_byte (mb, CEE_ADD);
+ mono_mb_emit_stloc (mb, size_var);
} else {
g_assert_not_reached ();
}
} else if (atype == ATYPE_VECTOR) {
mono_mb_emit_ldarg (mb, 1);
mono_mb_emit_icall (mb, mono_gc_alloc_vector);
+ } else if (atype == ATYPE_STRING) {
+ mono_mb_emit_ldarg (mb, 1);
+ mono_mb_emit_icall (mb, mono_gc_alloc_string);
} else {
g_assert_not_reached ();
}
#else
mono_mb_emit_byte (mb, CEE_STIND_I4);
#endif
+ } else if (atype == ATYPE_STRING) {
+ /* need to set length and clear the last char */
+ /* s->length = len; */
+ mono_mb_emit_ldloc (mb, p_var);
+ mono_mb_emit_icon (mb, G_STRUCT_OFFSET (MonoString, length));
+ mono_mb_emit_byte (mb, MONO_CEE_ADD);
+ mono_mb_emit_ldarg (mb, 1);
+ mono_mb_emit_byte (mb, MONO_CEE_STIND_I4);
+ /* s->chars [len] = 0; */
+ mono_mb_emit_ldloc (mb, p_var);
+ mono_mb_emit_ldloc (mb, size_var);
+ mono_mb_emit_icon (mb, 2);
+ mono_mb_emit_byte (mb, MONO_CEE_SUB);
+ mono_mb_emit_byte (mb, MONO_CEE_ADD);
+ mono_mb_emit_icon (mb, 0);
+ mono_mb_emit_byte (mb, MONO_CEE_STIND_I2);
}
/*
* object allocate (MonoVTable *vtable)
*/
MonoMethod*
-mono_gc_get_managed_allocator (MonoVTable *vtable, gboolean for_box)
+mono_gc_get_managed_allocator (MonoClass *klass, gboolean for_box)
{
#ifdef MANAGED_ALLOCATION
- MonoClass *klass = vtable->klass;
#ifdef HAVE_KW_THREAD
int tlab_next_offset = -1;
return NULL;
if (klass->instance_size > tlab_size)
return NULL;
+
if (klass->has_finalize || mono_class_is_marshalbyref (klass) || (mono_profiler_get_events () & MONO_PROFILE_ALLOCATIONS))
return NULL;
if (klass->rank)
return NULL;
if (klass->byval_arg.type == MONO_TYPE_STRING)
- return NULL;
+ return mono_gc_get_managed_allocator_by_type (ATYPE_STRING);
if (collect_before_allocs)
return NULL;
-
- if (ALIGN_TO (klass->instance_size, ALLOC_ALIGN) < MAX_SMALL_OBJ_SIZE)
+ /* Generic classes have dynamic field and can go above MAX_SMALL_OBJ_SIZE. */
+ if (ALIGN_TO (klass->instance_size, ALLOC_ALIGN) < MAX_SMALL_OBJ_SIZE && !mono_class_is_open_constructed_type (&klass->byval_arg))
return mono_gc_get_managed_allocator_by_type (ATYPE_SMALL);
else
return mono_gc_get_managed_allocator_by_type (ATYPE_NORMAL);
void
mono_gc_pthread_exit (void *retval)
{
+ mono_thread_info_dettach ();
pthread_exit (retval);
}
ATYPE_NORMAL,
ATYPE_VECTOR,
ATYPE_SMALL,
+ ATYPE_STRING,
ATYPE_NUM
} SgenAllocatorType;
*/
if (!card_data)
continue;
+#else
+ g_assert_not_reached ();
+ card_data = NULL;
#endif
} else {
card_data = card_base = sgen_card_table_get_card_scan_address ((mword)block_start);
#include "metadata/sgen-protocol.h"
#include "metadata/sgen-archdep.h"
#include "metadata/sgen-bridge.h"
+#include "metadata/sgen-memory-governor.h"
#include "metadata/mono-gc.h"
#include "metadata/method-builder.h"
#include "metadata/profiler-private.h"
static volatile int next_record;
static volatile int alloc_count;
+void dump_alloc_records (void);
+void verify_alloc_records (void);
static const char*
get_reason_name (AllocRecord *rec)
}
void
-mono_thread_pool_init ()
+mono_thread_pool_init_tls (void)
+{
+ mono_wsq_init ();
+}
+
+void
+mono_thread_pool_init (void)
{
gint threads_per_cpu = 1;
gint thread_count;
InitializeCriticalSection (&wsqs_lock);
wsqs = g_ptr_array_sized_new (MAX (100 * cpu_count, thread_count));
- mono_wsq_init ();
#ifndef DISABLE_PERFCOUNTERS
async_tp.pc_nitems = init_perf_counter ("Mono Threadpool", "Work Items Added");
threadpool_clear_queue (ThreadPool *tp, MonoDomain *domain)
{
MonoObject *obj;
- MonoMList *other;
+ MonoMList *other = NULL;
+ MonoCQ *queue = tp->queue;
- other = NULL;
- while (mono_cq_dequeue (tp->queue, &obj)) {
+ if (!queue)
+ return;
+
+ while (mono_cq_dequeue (queue, &obj)) {
if (obj == NULL)
continue;
if (obj->vtable->domain != domain)
threadpool_jobs_dec (obj);
}
+ if (mono_runtime_is_shutting_down ())
+ return;
+
while (other) {
threadpool_append_job (tp, (MonoObject *) mono_mlist_get_data (other));
other = mono_mlist_next (other);
/* No managed code here */
void mono_thread_pool_init (void) MONO_INTERNAL;
+void mono_thread_pool_init_tls (void) MONO_INTERNAL;
void icall_append_job (MonoObject *ar) MONO_INTERNAL;
void icall_append_io_job (MonoObject *target, MonoSocketAsyncResult *state) MONO_INTERNAL;
void mono_thread_cleanup_apartment_state (void) MONO_INTERNAL;
void mono_threads_set_shutting_down (void) MONO_INTERNAL;
-gboolean mono_threads_is_shutting_down (void) MONO_INTERNAL;
gunichar2* mono_thread_get_name (MonoInternalThread *this_obj, guint32 *name_len) MONO_INTERNAL;
MonoException* mono_thread_resume_interruption (void) MONO_INTERNAL;
void mono_threads_perform_thread_dump (void) MONO_INTERNAL;
+MonoThread *mono_thread_attach_full (MonoDomain *domain, gboolean force_attach) MONO_INTERNAL;
+
+void mono_thread_init_tls (void) MONO_INTERNAL;
#endif /* _MONO_METADATA_THREADS_TYPES_H_ */
* If handle_store() returns FALSE the thread must not be started
* because Mono is shutting down.
*/
-static gboolean handle_store(MonoThread *thread)
+static gboolean handle_store(MonoThread *thread, gboolean force_attach)
{
mono_threads_lock ();
if (threads_starting_up)
mono_g_hash_table_remove (threads_starting_up, thread);
- if (shutting_down) {
+ if (shutting_down && !force_attach) {
mono_threads_unlock ();
return FALSE;
}
if (threadpool_thread)
mono_thread_set_state (internal, ThreadState_Background);
- if (handle_store (thread))
+ if (handle_store (thread, FALSE))
ResumeThread (thread_handle);
/* Check that the managed and unmanaged layout of MonoInternalThread matches */
# endif
# if !defined(sun)
-# if !defined(__OpenBSD__)
+# if defined(__native_client__)
+ *staddr = NULL;
+ pthread_attr_getstacksize (&attr, &stsize);
+# elif !defined(__OpenBSD__)
pthread_attr_getstack (&attr, (void**)staddr, stsize);
# endif
if (*staddr)
/* When running under emacs, sometimes staddr is not aligned to a page size */
*staddr = (guint8*)((gssize)*staddr & ~(mono_pagesize () - 1));
-}
+}
MonoThread *
mono_thread_attach (MonoDomain *domain)
+{
+ return mono_thread_attach_full (domain, FALSE);
+}
+
+MonoThread *
+mono_thread_attach_full (MonoDomain *domain, gboolean force_attach)
{
MonoThreadInfo *info;
MonoInternalThread *thread;
current_thread = new_thread_with_internal (domain, thread);
- if (!handle_store (current_thread)) {
+ if (!handle_store (current_thread, force_attach)) {
/* Mono is shutting down, so just wait for the end */
for (;;)
Sleep (10000);
* launched, to avoid the main thread deadlocking while trying
* to clean up a thread that will never be signalled.
*/
- if (!handle_store (thread))
+ if (!handle_store (thread, FALSE))
return;
ResumeThread (internal->handle);
mono_gc_wbarrier_generic_nostore (ptr);
}
+void
+mono_thread_init_tls (void)
+{
+ MONO_FAST_TLS_INIT (tls_current_object);
+ mono_native_tls_alloc (¤t_object_key, NULL);
+}
+
void mono_thread_init (MonoThreadStartCB start_cb,
MonoThreadAttachCB attach_cb)
{
mono_init_static_data_info (&thread_static_info);
mono_init_static_data_info (&context_static_info);
- MONO_FAST_TLS_INIT (tls_current_object);
- mono_native_tls_alloc (¤t_object_key, NULL);
THREAD_DEBUG (g_message ("%s: Allocated current_object_key %d", __func__, current_object_key));
mono_thread_start_cb = start_cb;
}
}
-/**
- * mono_threads_is_shutting_down:
- *
- * Returns whether a thread has commenced shutdown of Mono. Note that
- * if the function returns FALSE the caller must not assume that
- * shutdown is not in progress, because the situation might have
- * changed since the function returned. For that reason this function
- * is of very limited utility.
- */
-gboolean
-mono_threads_is_shutting_down (void)
-{
- return shutting_down;
-}
-
void mono_thread_manage (void)
{
struct wait_data wait_data;
THREAD_DEBUG (g_message ("%s: I have %d threads after waiting.", __func__, wait->num));
} while(wait->num>0);
- mono_runtime_shutdown ();
-
- THREAD_DEBUG (g_message ("%s: threadpool cleanup", __func__));
- mono_thread_pool_cleanup ();
+ /* Mono is shutting down, so just wait for the end */
+ if (!mono_runtime_try_shutdown ()) {
+ /*FIXME mono_thread_suspend probably should call mono_thread_execute_interruption when self interrupting. */
+ mono_thread_suspend (mono_thread_internal_current ());
+ mono_thread_execute_interruption (mono_thread_internal_current ());
+ }
/*
* Remove everything but the finalizer thread and self.
if (!is_valid_type_in_context (ctx, type)) {
char *str = mono_type_full_name (type);
ADD_VERIFY_ERROR2 (ctx, g_strdup_printf ("Invalid generic type (%s%s) (argument out of range or %s is not generic) at 0x%04x",
- type->type == MONO_TYPE_VAR ? "!" : "!!",
+ str [0] == '!' ? "" : type->type == MONO_TYPE_VAR ? "!" : "!!",
str,
type->type == MONO_TYPE_VAR ? "class" : "method",
ctx->ip_offset),
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Catch clause %d with invalid type", i));
break;
}
-
+ if (!mono_type_is_valid_in_context (&ctx, &clause->data.catch_class->byval_arg))
+ break;
+
init_stack_with_value_at_exception_boundary (&ctx, ctx.code + clause->handler_offset, clause->data.catch_class);
}
else if (clause->flags == MONO_EXCEPTION_CLAUSE_FILTER) {
}
}
+ if (!ctx.valid)
+ goto cleanup;
+
original_bb = bb = mono_basic_block_split (method, &error);
if (!mono_error_ok (&error)) {
ADD_VERIFY_ERROR (&ctx, g_strdup_printf ("Invalid branch target: %s", mono_error_get_message (&error)));
/inssel.c
/inssel.h
/mini.pc
-/cpu-pentium.h
-/cpu-g4.h
-/cpu-amd64.h
+/cpu-*.h
/mono
/monow
-/cpu-sparc.h
-/cpu-s390.h
-/cpu-x86.h
/.hidden
/semantic.cache
/.project
CLASS=$(mcs_topdir)/class/lib/net_4_5
-RUNTIME_EXECUTABLE = $(if $(SGEN),$(top_builddir)/mono/mini/mono-sgen,$(top_builddir)/runtime/mono-wrapper)
+RUNTIME_EXECUTABLE = $(if $(BOEHM),$(top_builddir)/mono/mini/mono-boehm,$(top_builddir)/runtime/mono-wrapper)
RUNTIME = MONO_PATH=$(CLASS) $(RUNTIME_EXECUTABLE)
RUNTIME_AOTCHECK = MONO_PATH=$(CLASS):. $(RUNTIME_EXECUTABLE)
if NO_VERSION_SCRIPT
monoldflags=$(export_ldflags)
-monobinldflags=$(export_ldflags)
+monobinldflags=$(export_ldflags) $(extra_runtime_ldflags)
else
monoldflags=-Wl,-version-script=$(srcdir)/ldscript $(export_ldflags)
-monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags)
+monobinldflags=-Wl,-version-script=$(srcdir)/ldscript.mono $(export_ldflags) $(extra_runtime_ldflags)
endif
if HOST_WIN32
-libmono_2_0_la_LDFLAGS=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
+libmonoldflags=-no-undefined -avoid-version -Wl,--kill-at $(monoldflags)
else
-libmono_2_0_la_LDFLAGS=$(monoldflags) -version-info 1:0:0
+if PLATFORM_ANDROID
+libmonoldflags= -avoid-version $(monoldflags)
+else
+libmonoldflags=$(monoldflags) -version-info 1:0:0
+endif
endif
if JIT_SUPPORTED
endif
if SUPPORT_BOEHM
-boehm_libraries = libmono-2.0.la
+boehm_libraries = libmonoboehm-2.0.la
boehm_static_libraries = libmini-static.la $(static_libs)
-boehm_binaries = mono
+boehm_binaries = mono-boehm
endif
+#The mono uses sgen, while libmono remains boehm
+mono_bin_suffix = sgen
+libmono_suffix = boehm
+
+bin_SCRIPTS = mono
+noinst_SCRIPTS = mono
+
+mono: mono-$(mono_bin_suffix)
+ ln -sf $< $@
+
+install-exec-hook:
+ ln -sf $(DESTDIR)$(bindir)/mono-$(libmono_suffix) $(DESTDIR)$(bindir)/mono
+ (cd $(DESTDIR)$(libdir); for i in libmono$(libmono_suffix)*; do ln -sf $$i `echo $$i | sed s/$(libmono_suffix)//` ; done)
+
+
if DISABLE_EXECUTABLES
else
if HOST_WIN32
endif
endif
-noinst_PROGRAMS = genmdesc
+noinst_PROGRAMS = genmdesc mono
if DISABLE_EXECUTABLES
shared_libraries = $(boehm_libraries) $(sgen_libraries)
endif
-mono_SOURCES = \
+mono_boehm_SOURCES = \
main.c
mono_CFLAGS = $(AM_CFLAGS)
+mono_boehm_CFLAGS = $(AM_CFLAGS)
+
AM_CPPFLAGS = $(LIBGC_CPPFLAGS)
-mono_sgen_SOURCES = $(mono_SOURCES)
+mono_sgen_SOURCES = \
+ main-sgen.c
+
+mono_SOURCES = \
+ main-sgen.c
+
mono_sgen_CFLAGS = $(AM_CFLAGS)
# We build this after libmono was built so it contains the date when the final
# link was done
if SUPPORT_BOEHM
-buildver.h: libmini-static.la
- @echo "const char *build_date = \"`date`\";" > buildver.h
-mono-main.$(OBJEXT): buildver.h
+buildver-boehm.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntime-static.la
+ @echo "const char *build_date = \"`date`\";" > buildver-boehm.h
+mono_boehm-main.$(OBJEXT): buildver-boehm.h
endif
-buildver-sgen.h: libmini-static.la
+buildver-sgen.h: libmini-static.la $(monodir)/mono/metadata/libmonoruntimesgen-static.la
@echo "const char *build_date = \"`date`\";" > buildver-sgen.h
-mono_sgen-main.$(OBJEXT): buildver-sgen.h
+mono_sgen-main-sgen.$(OBJEXT): buildver-sgen.h
if DTRACE_G_REQUIRED
LIBMONO_DTRACE_OBJECT = .libs/mono-dtrace.$(OBJEXT)
MONO_LIB=$(boehm_static_libraries)
MONO_SGEN_LIB=$(sgen_static_libraries)
else
-MONO_LIB=libmono-2.0.la
-MONO_SGEN_LIB=libmonosgen-2.0.la
+MONO_LIB=libmonoboehm-2.0.la
+MONO_LIBLIB=libmonosgen-2.0.la
endif
if LOADED_LLVM
LLVMMONOF=$(LLVM_LIBS) $(LLVM_LDFLAGS)
endif
-mono_LDADD = \
+mono_boehm_LDADD = \
$(MONO_LIB) \
$(GLIB_LIBS) \
$(LLVMMONOF) \
-lm \
$(MONO_DTRACE_OBJECT)
-mono_LDFLAGS = \
+mono_boehm_LDFLAGS = \
$(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
mono_sgen_LDADD = \
mono_sgen_LDFLAGS = $(static_flags) -export-dynamic $(monobinldflags) $(monobin_platform_ldflags)
+# if SUPPORT_SGEN
+#
+# mono_LDADD = $(mono_sgen_LDADD)
+# mono_LDFLAGS = $(mono_sgen_LDFLAGS)
+#
+# endif
+
+
if DTRACE_G_REQUIRED
mono-dtrace.$(OBJEXT): $(top_srcdir)/data/mono.d mini.lo $(monodir)/mono/metadata/libmonoruntime-static.la
# Create monow.exe, linked for the 'windows' subsystem
if HOST_WIN32
-monow_LDADD = $(mono_LDADD)
-monow_LDFLAGS = $(mono_LDFLAGS) -mwindows
-monow_SOURCES = $(mono_SOURCES)
+monow_LDADD = $(mono_boehm_LDADD)
+monow_LDFLAGS = $(mono_boehm_LDFLAGS) -mwindows
+monow_SOURCES = $(mono_boehm_SOURCES)
endif
genmdesc_SOURCES = \
libmini_la_SOURCES = $(common_sources) $(llvm_sources) $(arch_sources) $(os_sources)
libmini_la_CFLAGS = $(mono_CFLAGS)
-libmono_2_0_la_SOURCES =
-libmono_2_0_la_CFLAGS = $(mono_CFLAGS)
-libmono_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
+libmonoboehm_2_0_la_SOURCES =
+libmonoboehm_2_0_la_CFLAGS = $(mono_boehm_CFLAGS)
+libmonoboehm_2_0_la_LIBADD = libmini.la $(libs) $(LIBMONO_DTRACE_OBJECT)
+libmonoboehm_2_0_la_LDFLAGS = $(libmonoldflags)
libmonosgen_2_0_la_SOURCES =
libmonosgen_2_0_la_CFLAGS = $(mono_sgen_CFLAGS)
libmonosgen_2_0_la_LIBADD = libmini.la $(sgen_libs) $(LIBMONO_DTRACE_OBJECT)
-
-if PLATFORM_ANDROID
-libmonosgen_2_0_la_LDFLAGS = -avoid-version
-endif
+libmonosgen_2_0_la_LDFLAGS = $(libmonoldflags)
if MOONLIGHT
libmono_moon_la_SOURCES = $(libmini_la_SOURCES)
check-local: rcheck
clean-local:
- rm -f mono a.out gmon.out *.o buildver.h buildver-sgen.h test.exe
+ rm -f mono a.out gmon.out *.o buildver-boehm.h buildver-sgen.h test.exe
pkgconfigdir = $(libdir)/pkgconfig
gboolean no_direct_calls;
gboolean use_trampolines_page;
gboolean no_instances;
+ gboolean gnu_asm;
int nthreads;
int ntrampolines;
int nrgctx_trampolines;
char *static_linking_symbol;
CRITICAL_SECTION mutex;
gboolean use_bin_writer;
+ gboolean gas_line_numbers;
MonoImageWriter *w;
MonoDwarfWriter *dwarf;
FILE *fp;
GHashTable *plt_entry_debug_sym_cache;
gboolean thumb_mixed, need_no_dead_strip, need_pt_gnu_stack;
GHashTable *ginst_hash;
+ GHashTable *dwarf_ln_filenames;
gboolean global_symbols;
gboolean direct_method_addresses;
} MonoAotCompile;
acfg->llvm_label_prefix = "";
acfg->user_symbol_prefix = "";
+#if defined(TARGET_AMD64) && defined(TARGET_MACH)
+ /* osx contains an old as which doesn't support avx opcodes */
+ g_string_append (acfg->llc_args, "-mattr=-avx");
+#endif
+
#ifdef TARGET_ARM
if (acfg->aot_opts.mtriple && strstr (acfg->aot_opts.mtriple, "darwin")) {
g_string_append (acfg->llc_args, "-mattr=+v6");
acfg->user_symbol_prefix = "_";
acfg->llvm_label_prefix = "_";
acfg->need_no_dead_strip = TRUE;
+ acfg->aot_opts.gnu_asm = TRUE;
#endif
#if defined(__linux__) && !defined(TARGET_ARM)
}
if (strcmp (acfg->image->assembly->aname.name, "mscorlib") == 0) {
-#ifdef MONO_ARCH_HAVE_TLS_GET
MonoMethodDesc *desc;
MonoMethod *orig_method;
int nallocators;
-#endif
/* Runtime invoke wrappers */
/* stelemref */
add_method (acfg, mono_marshal_get_stelemref ());
-#ifdef MONO_ARCH_HAVE_TLS_GET
- /* Managed Allocators */
- nallocators = mono_gc_get_managed_allocator_types ();
- for (i = 0; i < nallocators; ++i) {
- m = mono_gc_get_managed_allocator_by_type (i);
- if (m)
- add_method (acfg, m);
- }
+ if (MONO_ARCH_HAVE_TLS_GET) {
+ /* Managed Allocators */
+ nallocators = mono_gc_get_managed_allocator_types ();
+ for (i = 0; i < nallocators; ++i) {
+ m = mono_gc_get_managed_allocator_by_type (i);
+ if (m)
+ add_method (acfg, m);
+ }
+
+ /* Monitor Enter/Exit */
+ desc = mono_method_desc_new ("Monitor:Enter(object,bool&)", FALSE);
+ orig_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
+ /* This is a v4 method */
+ if (orig_method) {
+ method = mono_monitor_get_fast_path (orig_method);
+ if (method)
+ add_method (acfg, method);
+ }
+ mono_method_desc_free (desc);
- /* Monitor Enter/Exit */
- desc = mono_method_desc_new ("Monitor:Enter(object,bool&)", FALSE);
- orig_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
- /* This is a v4 method */
- if (orig_method) {
+ desc = mono_method_desc_new ("Monitor:Exit(object)", FALSE);
+ orig_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
+ g_assert (orig_method);
+ mono_method_desc_free (desc);
method = mono_monitor_get_fast_path (orig_method);
if (method)
- add_method (acfg, method);
+ add_method (acfg, method);
}
- mono_method_desc_free (desc);
-
- desc = mono_method_desc_new ("Monitor:Exit(object)", FALSE);
- orig_method = mono_method_desc_search_in_class (desc, mono_defaults.monitor_class);
- g_assert (orig_method);
- mono_method_desc_free (desc);
- method = mono_monitor_get_fast_path (orig_method);
- if (method)
- add_method (acfg, method);
-#endif
/* Stelemref wrappers */
{
return FALSE;
}
+static gboolean
+is_vt_inst (MonoGenericInst *inst)
+{
+ int i;
+
+ for (i = 0; i < inst->type_argc; ++i) {
+ MonoType *t = inst->type_argv [i];
+ if (t->type == MONO_TYPE_VALUETYPE)
+ return TRUE;
+ }
+ return FALSE;
+}
+
static gboolean
method_has_type_vars (MonoMethod *method)
{
MonoMethod *method;
MonoClassField *field;
gpointer iter;
+ gboolean use_gsharedvt = FALSE;
if (!acfg->ginst_hash)
acfg->ginst_hash = g_hash_table_new (NULL, NULL);
g_hash_table_insert (acfg->ginst_hash, klass, klass);
+ /*
+ * Use gsharedvt for generic collections with vtype arguments to avoid code blowup.
+ * Enable this only for some classes since gsharedvt might not support all methods.
+ */
+ if ((acfg->opts & MONO_OPT_GSHAREDVT) && klass->image == mono_defaults.corlib && klass->generic_class && klass->generic_class->context.class_inst && is_vt_inst (klass->generic_class->context.class_inst) && (!strcmp (klass->name, "Dictionary`2") || !strcmp (klass->name, "List`1")))
+ use_gsharedvt = TRUE;
+
iter = NULL;
while ((method = mono_class_get_methods (klass, &iter))) {
- if (mono_method_is_generic_sharable_full (method, FALSE, FALSE, FALSE))
+ if (mono_method_is_generic_sharable_full (method, FALSE, FALSE, use_gsharedvt))
/* Already added */
continue;
direct_callable = FALSE;
}
+ if (callee_cfg->method->wrapper_type == MONO_WRAPPER_ALLOC)
+ /* sgen does some initialization when the allocator method is created */
+ direct_callable = FALSE;
+
if (direct_callable)
return TRUE;
}
return import;
}
+static gint
+compare_lne (MonoDebugLineNumberEntry *a, MonoDebugLineNumberEntry *b)
+{
+ if (a->native_offset == b->native_offset)
+ return a->il_offset - b->il_offset;
+ else
+ return a->native_offset - b->native_offset;
+}
+
+/*
+ * compute_line_numbers:
+ *
+ * Returns a sparse array of size CODE_SIZE containing MonoDebugSourceLocation* entries for the native offsets which have a corresponding line number
+ * entry.
+ */
+static MonoDebugSourceLocation**
+compute_line_numbers (MonoMethod *method, int code_size, MonoDebugMethodJitInfo *debug_info)
+{
+ MonoDebugMethodInfo *minfo;
+ MonoDebugLineNumberEntry *ln_array;
+ MonoDebugSourceLocation *loc;
+ int i, prev_line, prev_il_offset;
+ int *native_to_il_offset = NULL;
+ MonoDebugSourceLocation **res;
+ gboolean first;
+
+ minfo = mono_debug_lookup_method (method);
+ if (!minfo)
+ return NULL;
+ // FIXME: This seems to happen when two methods have the same cfg->method_to_register
+ if (debug_info->code_size != code_size)
+ return NULL;
+
+ g_assert (code_size);
+
+ /* Compute the native->IL offset mapping */
+
+ ln_array = g_new0 (MonoDebugLineNumberEntry, debug_info->num_line_numbers);
+ memcpy (ln_array, debug_info->line_numbers, debug_info->num_line_numbers * sizeof (MonoDebugLineNumberEntry));
+
+ qsort (ln_array, debug_info->num_line_numbers, sizeof (MonoDebugLineNumberEntry), (gpointer)compare_lne);
+
+ native_to_il_offset = g_new0 (int, code_size + 1);
+
+ for (i = 0; i < debug_info->num_line_numbers; ++i) {
+ int j;
+ MonoDebugLineNumberEntry *lne = &ln_array [i];
+
+ if (i == 0) {
+ for (j = 0; j < lne->native_offset; ++j)
+ native_to_il_offset [j] = -1;
+ }
+
+ if (i < debug_info->num_line_numbers - 1) {
+ MonoDebugLineNumberEntry *lne_next = &ln_array [i + 1];
+
+ for (j = lne->native_offset; j < lne_next->native_offset; ++j)
+ native_to_il_offset [j] = lne->il_offset;
+ } else {
+ for (j = lne->native_offset; j < code_size; ++j)
+ native_to_il_offset [j] = lne->il_offset;
+ }
+ }
+ g_free (ln_array);
+
+ /* Compute the native->line number mapping */
+ res = g_new0 (MonoDebugSourceLocation*, code_size);
+ prev_il_offset = -1;
+ prev_line = -1;
+ first = TRUE;
+ for (i = 0; i < code_size; ++i) {
+ int il_offset = native_to_il_offset [i];
+
+ if (il_offset == -1 || il_offset == prev_il_offset)
+ continue;
+ prev_il_offset = il_offset;
+ loc = mono_debug_symfile_lookup_location (minfo, il_offset);
+ if (!(loc && loc->source_file))
+ continue;
+ if (loc->row == prev_line) {
+ mono_debug_symfile_free_location (loc);
+ continue;
+ }
+ prev_line = loc->row;
+ //printf ("D: %s:%d il=%x native=%x\n", loc->source_file, loc->row, il_offset, i);
+ if (first)
+ /* This will cover the prolog too */
+ res [0] = loc;
+ else
+ res [i] = loc;
+ first = FALSE;
+ }
+ return res;
+}
+
+static int
+get_file_index (MonoAotCompile *acfg, const char *source_file)
+{
+ int findex;
+
+ // FIXME: Free these
+ if (!acfg->dwarf_ln_filenames)
+ acfg->dwarf_ln_filenames = g_hash_table_new (g_str_hash, g_str_equal);
+ findex = GPOINTER_TO_INT (g_hash_table_lookup (acfg->dwarf_ln_filenames, source_file));
+ if (!findex) {
+ findex = g_hash_table_size (acfg->dwarf_ln_filenames) + 1;
+ g_hash_table_insert (acfg->dwarf_ln_filenames, g_strdup (source_file), GINT_TO_POINTER (findex));
+ img_writer_emit_unset_mode (acfg->w);
+ fprintf (acfg->fp, ".file %d \"%s\"\n", findex, source_file);
+ }
+ return findex;
+}
+
/*
* emit_and_reloc_code:
*
* since trampolines are needed to make PTL work.
*/
static void
-emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, guint32 code_len, MonoJumpInfo *relocs, gboolean got_only)
+emit_and_reloc_code (MonoAotCompile *acfg, MonoMethod *method, guint8 *code, guint32 code_len, MonoJumpInfo *relocs, gboolean got_only, MonoDebugMethodJitInfo *debug_info)
{
int i, pindex, start_index, method_index;
GPtrArray *patches;
MonoJumpInfo *patch_info;
MonoMethodHeader *header;
+ MonoDebugSourceLocation **locs = NULL;
gboolean skip, direct_call, external_call;
guint32 got_slot;
const char *direct_call_target;
method_index = get_method_index (acfg, method);
}
+ if (acfg->gas_line_numbers && method && debug_info) {
+ locs = compute_line_numbers (method, code_len, debug_info);
+ if (!locs) {
+ int findex = get_file_index (acfg, "<unknown>");
+ img_writer_emit_unset_mode (acfg->w);
+ fprintf (acfg->fp, ".loc %d %d 0\n", findex, 1);
+ }
+ }
+
/* Collect and sort relocations */
patches = g_ptr_array_new ();
for (patch_info = relocs; patch_info; patch_info = patch_info->next)
break;
}
+ if (locs && locs [i]) {
+ MonoDebugSourceLocation *loc = locs [i];
+ int findex;
+
+ findex = get_file_index (acfg, loc->source_file);
+ img_writer_emit_unset_mode (acfg->w);
+ fprintf (acfg->fp, ".loc %d %d 0\n", findex, loc->row);
+ mono_debug_symfile_free_location (loc);
+ }
+
#ifdef MONO_ARCH_AOT_SUPPORTED
skip = FALSE;
if (patch_info && (patch_info->ip.i == i) && (pindex < patches->len)) {
/* Try to emit multiple bytes at once */
if (pindex < patches->len && patch_info->ip.i > i) {
- emit_bytes (acfg, code + i, patch_info->ip.i - i);
- i = patch_info->ip.i - 1;
+ int limit;
+
+ for (limit = i + 1; limit < patch_info->ip.i; ++limit) {
+ if (locs && locs [limit])
+ break;
+ }
+
+ emit_bytes (acfg, code + i, limit - i);
+ i = limit - 1;
} else {
emit_bytes (acfg, code + i, 1);
}
}
}
+
+ g_free (locs);
}
/*
acfg->cfgs [method_index]->got_offset = acfg->got_offset;
- emit_and_reloc_code (acfg, method, code, cfg->code_len, cfg->patch_info, FALSE);
+ emit_and_reloc_code (acfg, method, code, cfg->code_len, cfg->patch_info, FALSE, mono_debug_find_method (cfg->jit_info->method, mono_domain_get ()));
emit_line (acfg);
}
encode_value (offset, p, &p);
- g_assert (entry->info_type < 256);
+ g_assert ((int)entry->info_type < 256);
g_assert (entry->data->type < 256);
encode_value ((entry->in_mrgctx ? 1 : 0) | (entry->info_type << 1) | (entry->data->type << 9), p, &p);
encode_patch (acfg, entry->data, p, &p);
case MONO_PATCH_INFO_SIGNATURE:
encode_signature (acfg, (MonoMethodSignature*)patch_info->data.target, p, &p);
break;
+ case MONO_PATCH_INFO_TLS_OFFSET:
+ encode_value (GPOINTER_TO_INT (patch_info->data.target), p, &p);
+ break;
case MONO_PATCH_INFO_GSHAREDVT_CALL:
encode_signature (acfg, (MonoMethodSignature*)patch_info->data.gsharedvt->sig, p, &p);
encode_method_ref (acfg, patch_info->data.gsharedvt->method, p, &p);
break;
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD: {
+ MonoGSharedVtMethodInfo *info = patch_info->data.gsharedvt_method;
+ int i;
+
+ encode_method_ref (acfg, info->method, p, &p);
+ encode_value (info->entries->len, p, &p);
+ for (i = 0; i < info->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *template = g_ptr_array_index (info->entries, i);
+
+ encode_value (template->info_type, p, &p);
+ switch (mini_rgctx_info_type_to_patch_info_type (template->info_type)) {
+ case MONO_PATCH_INFO_CLASS:
+ encode_klass_ref (acfg, mono_class_from_mono_type (template->data), p, &p);
+ break;
+ case MONO_PATCH_INFO_FIELD:
+ encode_field_info (acfg, template->data, p, &p);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+ }
+ break;
+ }
default:
g_warning ("unable to handle jump info %d", patch_info->type);
g_assert_not_reached ();
* The code should access everything through the GOT, so we pass
* TRUE here.
*/
- emit_and_reloc_code (acfg, NULL, code, code_size, ji, TRUE);
+ emit_and_reloc_code (acfg, NULL, code, code_size, ji, TRUE, NULL);
emit_symbol_size (acfg, start_symbol, ".");
* does not need to support them by creating a fake GOT etc.
*/
cfg = mini_method_compile (method, acfg->opts, mono_get_root_domain (), FALSE, TRUE, 0);
+ mono_loader_clear_error ();
+
if (cfg->exception_type == MONO_EXCEPTION_GENERIC_SHARING_FAILED) {
if (acfg->aot_opts.print_skipped_methods)
printf ("Skip (gshared failure): %s (%s)\n", mono_method_full_name (method, TRUE), cfg->exception_message);
mono_destroy_compile (cfg);
return;
}
+ cfg->method_index = index;
/* Nullify patches which need no aot processing */
for (patch_info = cfg->patch_info; patch_info; patch_info = patch_info->next) {
#endif
}
+int
+mono_aot_get_method_index (MonoMethod *method)
+{
+ g_assert (llvm_acfg);
+ return get_method_index (llvm_acfg, method);
+}
+
MonoJumpInfo*
mono_aot_patch_info_dup (MonoJumpInfo* ji)
{
if (acfg->aot_opts.mtriple)
g_string_append_printf (acfg->llc_args, " -mtriple=%s", acfg->aot_opts.mtriple);
+#if defined(TARGET_MACH) && defined(TARGET_ARM)
+ /* ios requires PIC code now */
+ g_string_append_printf (acfg->llc_args, " -relocation-model=pic");
+#else
if (llvm_acfg->aot_opts.static_link)
g_string_append_printf (acfg->llc_args, " -relocation-model=static");
else
g_string_append_printf (acfg->llc_args, " -relocation-model=pic");
+#endif
unlink (acfg->tmpfname);
command = g_strdup_printf ("%sllc %s -disable-gnu-eh-frame -enable-mono-eh-frame -o %s %s.opt.bc", acfg->aot_opts.llvm_path, acfg->llc_args->str, acfg->tmpfname, acfg->tmpfname);
memset (&t, 0, sizeof (MonoType));
t.type = MONO_TYPE_R8;
mono_type_size (&t, &align);
-
emit_int32 (acfg, align);
memset (&t, 0, sizeof (MonoType));
method = mono_get_method (acfg->image, token, NULL);
if (!method)
continue;
+ /*
+ if (strcmp (method->name, "gshared2"))
+ continue;
+ */
+ /*
+ if (!strstr (method->klass->image->name, "mini"))
+ continue;
+ */
if (method->is_generic || method->klass->generic_container) {
MonoMethod *gshared;
int i, res;
MonoAotCompile *acfg;
char *outfile_name, *tmp_outfile_name, *p;
+ char llvm_stats_msg [256];
TV_DECLARE (atv);
TV_DECLARE (btv);
acfg->method_index = 1;
+ // FIXME:
+ /*
+ if (acfg->aot_opts.full_aot)
+ mono_set_partial_sharing_supported (TRUE);
+ */
+
collect_methods (acfg);
acfg->cfgs_size = acfg->methods->len + 32;
}
}
+ if (acfg->aot_opts.dwarf_debug && acfg->aot_opts.asm_only && acfg->aot_opts.gnu_asm) {
+ /*
+ * CLANG supports GAS .file/.loc directives, so emit line number information this way
+ */
+ acfg->gas_line_numbers = TRUE;
+ }
+
if (!acfg->aot_opts.nodebug || acfg->aot_opts.dwarf_debug) {
if (acfg->aot_opts.dwarf_debug && mono_debug_format == MONO_DEBUG_FORMAT_NONE) {
fprintf (stderr, "The dwarf AOT option requires the --debug option.\n");
return 1;
}
- acfg->dwarf = mono_dwarf_writer_create (acfg->w, NULL, 0, FALSE);
+ acfg->dwarf = mono_dwarf_writer_create (acfg->w, NULL, 0, FALSE, !acfg->gas_line_numbers);
}
img_writer_emit_start (acfg->w);
if (acfg->llvm)
g_assert (acfg->got_offset <= acfg->final_got_size);
+ if (acfg->llvm)
+ sprintf (llvm_stats_msg, ", LLVM: %d (%d%%)", acfg->stats.llvm_count, acfg->stats.mcount ? (acfg->stats.llvm_count * 100) / acfg->stats.mcount : 100);
+ else
+ strcpy (llvm_stats_msg, "");
printf ("Code: %d Info: %d Ex Info: %d Unwind Info: %d Class Info: %d PLT: %d GOT Info: %d GOT: %d Offsets: %d\n", acfg->stats.code_size, acfg->stats.info_size, acfg->stats.ex_info_size, acfg->stats.unwind_info_size, acfg->stats.class_info_size, acfg->plt_offset, acfg->stats.got_info_size, (int)(acfg->got_offset * sizeof (gpointer)), acfg->stats.offsets_size);
- printf ("Compiled: %d/%d (%d%%), No GOT slots: %d (%d%%), Direct calls: %d (%d%%)\n",
+ printf ("Compiled: %d/%d (%d%%)%s, No GOT slots: %d (%d%%), Direct calls: %d (%d%%)\n",
acfg->stats.ccount, acfg->stats.mcount, acfg->stats.mcount ? (acfg->stats.ccount * 100) / acfg->stats.mcount : 100,
+ llvm_stats_msg,
acfg->stats.methods_without_got_slots, acfg->stats.mcount ? (acfg->stats.methods_without_got_slots * 100) / acfg->stats.mcount : 100,
acfg->stats.direct_calls, acfg->stats.all_calls ? (acfg->stats.direct_calls * 100) / acfg->stats.all_calls : 100);
if (acfg->stats.genericcount)
printf ("%d methods contain lmf pointers (%d%%)\n", acfg->stats.lmfcount, acfg->stats.mcount ? (acfg->stats.lmfcount * 100) / acfg->stats.mcount : 100);
if (acfg->stats.ocount)
printf ("%d methods have other problems (%d%%)\n", acfg->stats.ocount, acfg->stats.mcount ? (acfg->stats.ocount * 100) / acfg->stats.mcount : 100);
- if (acfg->llvm)
- printf ("Methods compiled with LLVM: %d (%d%%)\n", acfg->stats.llvm_count, acfg->stats.mcount ? (acfg->stats.llvm_count * 100) / acfg->stats.mcount : 100);
TV_GETTIME (atv);
res = img_writer_emit_writeout (acfg->w);
int i, version;
guint8 *blob;
gboolean do_load_image = TRUE;
+ int align_double, align_int64;
if (mono_compile_aot)
return;
return;
}
+#if defined (TARGET_ARM) && defined (TARGET_MACH)
+ {
+ MonoType t;
+ int align = 0;
+
+ memset (&t, 0, sizeof (MonoType));
+ t.type = MONO_TYPE_R8;
+ mono_type_size (&t, &align);
+ align_double = align;
+
+ memset (&t, 0, sizeof (MonoType));
+ t.type = MONO_TYPE_I8;
+ align_int64 = align;
+ }
+#else
+ align_double = __alignof__ (double);
+ align_int64 = __alignof__ (gint64);
+#endif
+
/* Sanity check */
- g_assert (info->double_align == __alignof__ (double));
- g_assert (info->long_align == __alignof__ (gint64));
+ g_assert (info->double_align == align_double);
+ g_assert (info->long_align == align_int64);
blob = info->blob;
/* Header */
version = *p;
- g_assert (version == 1 || version == 2);
+ g_assert (version == 3);
+ p ++;
+ func_encoding = *p;
p ++;
- if (version == 2) {
- func_encoding = *p;
- p ++;
- } else {
- func_encoding = DW_EH_PE_pcrel;
- }
p = ALIGN_PTR_TO (p, 4);
fde_count = *(guint32*)p;
cie = p + ((fde_count + 1) * 8);
/* Binary search in the table to find the entry for code */
- if (func_encoding == DW_EH_PE_absptr) {
- /*
- * Table entries are encoded as DW_EH_PE_absptr, because the ios linker can move functions inside object files to make thumb work,
- * so the offsets between two symbols in the text segment are not assembler constant.
- */
- g_assert (sizeof(gpointer) == 4);
- offset = GPOINTER_TO_INT (code);
- } else {
- /* Table entries are encoded as DW_EH_PE_pcrel relative to mono_eh_frame */
- offset = code - amodule->mono_eh_frame;
- }
-
+ offset = code - amodule->code;
left = 0;
right = fde_count;
while (TRUE) {
pos = (left + right) / 2;
- offset1 = table [(pos * 2)];
+ /* The table contains method index/fde offset pairs */
+ g_assert (table [(pos * 2)] != -1);
+ offset1 = amodule->code_offsets [table [(pos * 2)]];
if (pos + 1 == fde_count) {
- if (func_encoding == DW_EH_PE_absptr)
- offset2 = GPOINTER_TO_INT (amodule->code_end);
- else
- offset2 = amodule->code_end - amodule->code;
+ offset2 = amodule->code_end - amodule->code;
} else {
- offset2 = table [(pos + 1) * 2];
+ g_assert (table [(pos + 1) * 2] != -1);
+ offset2 = amodule->code_offsets [table [(pos + 1) * 2]];
}
if (offset < offset1)
break;
}
- if (func_encoding == DW_EH_PE_absptr) {
- code_start = (gpointer)(gsize)table [(pos * 2)];
- code_end = (gpointer)(gsize)table [(pos * 2) + 2];
- } else {
- code_start = amodule->mono_eh_frame + table [(pos * 2)];
- /* This won't overflow because there is +1 entry in the table */
- code_end = amodule->mono_eh_frame + table [(pos * 2) + 2];
- }
+ code_start = amodule->code + amodule->code_offsets [table [(pos * 2)]];
+ if (pos + 1 == fde_count)
+ /* End of table */
+ code_end = amodule->code_end;
+ else
+ code_end = amodule->code + amodule->code_offsets [table [(pos + 1) * 2]];
code_len = code_end - code_start;
g_assert (code >= code_start && code < code_end);
case MONO_PATCH_INFO_SIGNATURE:
ji->data.target = decode_signature (aot_module, p, &p);
break;
+ case MONO_PATCH_INFO_TLS_OFFSET:
+ ji->data.target = GINT_TO_POINTER (decode_value (p, &p));
+ break;
case MONO_PATCH_INFO_GSHAREDVT_CALL: {
MonoJumpInfoGSharedVtCall *info = g_new0 (MonoJumpInfoGSharedVtCall, 1);
info->sig = decode_signature (aot_module, p, &p);
ji->data.target = info;
break;
}
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD: {
+ MonoGSharedVtMethodInfo *info = g_new0 (MonoGSharedVtMethodInfo, 1);
+ int i, nentries;
+
+ info->method = decode_resolve_method_ref (aot_module, p, &p);
+ g_assert (info->method);
+ nentries = decode_value (p, &p);
+ info->entries = g_ptr_array_new ();
+ for (i = 0; i < nentries; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *template = g_new0 (MonoRuntimeGenericContextInfoTemplate, 1);
+
+ template->info_type = decode_value (p, &p);
+ switch (mini_rgctx_info_type_to_patch_info_type (template->info_type)) {
+ case MONO_PATCH_INFO_CLASS: {
+ MonoClass *klass = decode_klass_ref (aot_module, p, &p);
+ if (!klass)
+ goto cleanup;
+ template->data = &klass->byval_arg;
+ break;
+ }
+ case MONO_PATCH_INFO_FIELD:
+ template->data = decode_field_info (aot_module, p, &p);
+ if (!template->data)
+ goto cleanup;
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
+
+ g_ptr_array_add (info->entries, template);
+ }
+ ji->data.target = info;
+ break;
+ }
default:
g_warning ("unhandled type %d", ji->type);
g_assert_not_reached ();
g_assert (klass->inited);
/* Find method index */
+ method_index = 0xffffff;
if (method->is_inflated && !method->wrapper_type && mono_method_is_generic_sharable_full (method, FALSE, FALSE, FALSE)) {
/*
* For generic methods, we store the fully shared instance in place of the
* the IL code looks.
*/
-class Tests {
-
+#if MOBILE
+class ArrayTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_10_create () {
int[] a = new int [10];
return 0;
}
- private Int32[] m_array = new int [10];
-
- void setBit (int bitIndex, bool value) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ class BitClass {
+ private Int32[] m_array = new int [10];
- Int32 theBit = 1 << shift;
- if (value)
- m_array[index] |= theBit;
- else
- m_array[index] &= ~theBit;
- }
-
- bool getBit (int bitIndex) {
- int index = bitIndex/32;
- int shift = bitIndex%32;
+ public void setBit (int bitIndex, bool value) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
- Int32 theBit = m_array[index] & (1 << shift);
- return (theBit == 0) ? false : true;
+ Int32 theBit = 1 << shift;
+ if (value)
+ m_array[index] |= theBit;
+ else
+ m_array[index] &= ~theBit;
+ }
+
+ public bool getBit (int bitIndex) {
+ int index = bitIndex/32;
+ int shift = bitIndex%32;
+ Int32 theBit = m_array[index] & (1 << shift);
+ return (theBit == 0) ? false : true;
+ }
}
public static int test_1_bit_index () {
- Tests t = new Tests ();
+ var t = new BitClass ();
t.setBit (0, true);
t.setBit (3, true);
if (t.getBit (1))
return y;
}
+ class RefClass {
+ }
+
public static int test_0_stelem_ref_null_opt () {
- object[] arr = new Tests [1];
+ object[] arr = new RefClass [1];
- arr [0] = new Tests ();
+ arr [0] = new RefClass ();
arr [0] = null;
return arr [0] == null ? 0 : 1;
* the IL code looks.
*/
-class Tests {
-
+#if MOBILE
+class CallsTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
static void dummy () {
}
/* A comparison made to same variable. */
#pragma warning disable 1718
-class Tests {
-
+#if MOBILE
+class FloatTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_0_beq () {
double a = 2.0;
* the IL code looks.
*/
-class Tests {
-
+#if MOBILE
+class LongTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_10_simple_cast () {
long a = 10;
* the IL code looks.
*/
-class Tests {
-
+#if MOBILE
+class MathTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_0_sin_precision () {
double d1 = Math.Sin (1);
* the IL code looks.
*/
-class Tests {
-
+#if MOBILE
+class BasicTests
+#else
+class Tests
+#endif
+{
+
+#if !MOBILE
public static int Main (string[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_0_return () {
return 0;
amd64_set_xmmreg_r8: dest:f src1:f len:14 clob:m
amd64_save_sp_to_lmf: len:16
tls_get: dest:i len:16
+tls_get_reg: dest:i src1:i len:20
atomic_add_i4: src1:b src2:i dest:i len:32
atomic_add_new_i4: src1:b src2:i dest:i len:32
atomic_exchange_i4: src1:b src2:i dest:a len:32
sext_i1: dest:i src1:y len:3
sext_i2: dest:i src1:y len:3
tls_get: dest:i len:20
+tls_get_reg: dest:i src1:i len:20
atomic_add_i4: src1:b src2:i dest:i len:16
atomic_add_new_i4: src1:b src2:i dest:i len:16
atomic_exchange_i4: src1:b src2:i dest:a len:24
var->index = inst->dreg | MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER;
else if (inst->flags & MONO_INST_IS_DEAD)
var->index = MONO_DEBUG_VAR_ADDRESS_MODE_DEAD;
- else {
+ else if (inst->opcode == OP_REGOFFSET) {
/* the debug interface needs fixing to allow 0(%base) address */
var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET;
var->offset = inst->inst_offset;
+ } else if (inst->opcode == OP_GSHAREDVT_ARG_REGOFFSET) {
+ var->index = inst->inst_basereg | MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR;
+ var->offset = inst->inst_offset;
+ } else if (inst->opcode == OP_GSHAREDVT_LOCAL) {
+ var->index = inst->inst_imm | MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL;
+ } else {
+ g_assert_not_reached ();
}
}
for (i = 0; i < jit->num_params; i++)
write_variable (cfg->args [i + sig->hasthis], &jit->params [i]);
+ if (cfg->gsharedvt_info_var) {
+ jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+ jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+ write_variable (cfg->gsharedvt_info_var, jit->gsharedvt_info_var);
+ write_variable (cfg->gsharedvt_locals_var, jit->gsharedvt_locals_var);
+ }
+
jit->num_line_numbers = info->line_numbers->len;
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
encode_value (var->offset, p, &p);
break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
for (i = 0; i < jit->num_locals; i++)
serialize_variable (&jit->locals [i], p, &p);
+ if (jit->gsharedvt_info_var) {
+ encode_value (1, p, &p);
+ serialize_variable (jit->gsharedvt_info_var, p, &p);
+ serialize_variable (jit->gsharedvt_locals_var, p, &p);
+ } else {
+ encode_value (0, p, &p);
+ }
+
encode_value (jit->num_line_numbers, p, &p);
prev_offset = 0;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER:
break;
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
var->offset = decode_value (p, &p);
break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
break;
default:
for (i = 0; i < jit->num_locals; i++)
deserialize_variable (&jit->locals [i], p, &p);
+ if (decode_value (p, &p)) {
+ jit->gsharedvt_info_var = g_new0 (MonoDebugVarInfo, 1);
+ jit->gsharedvt_locals_var = g_new0 (MonoDebugVarInfo, 1);
+ deserialize_variable (jit->gsharedvt_info_var, p, &p);
+ deserialize_variable (jit->gsharedvt_locals_var, p, &p);
+ }
+
jit->num_line_numbers = decode_value (p, &p);
jit->line_numbers = g_new0 (MonoDebugLineNumberEntry, jit->num_line_numbers);
case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET:
g_print ("%s %s (%d) in memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
+ g_print ("%s %s (%d) in indir memory: base register %s + %d\n", type, name, idx, mono_arch_regname (info->index & (~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS)), info->offset);
+ break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL:
+ g_print ("%s %s (%d) gsharedvt local.\n", type, name, idx);
+ break;
case MONO_DEBUG_VAR_ADDRESS_MODE_TWO_REGISTERS:
default:
g_assert_not_reached ();
#include <mono/metadata/assembly.h>
#include <mono/metadata/runtime.h>
#include <mono/metadata/threadpool.h>
+#include <mono/metadata/verify-internals.h>
#include <mono/utils/mono-semaphore.h>
#include <mono/utils/mono-error-internals.h>
#include <mono/utils/mono-stack-unwinding.h>
#define HEADER_LENGTH 11
#define MAJOR_VERSION 2
-#define MINOR_VERSION 23
+#define MINOR_VERSION 24
typedef enum {
CMD_SET_VM = 1,
CMD_METHOD_GET_BODY = 7,
CMD_METHOD_RESOLVE_TOKEN = 8,
CMD_METHOD_GET_CATTRS = 9,
+ CMD_METHOD_MAKE_GENERIC_METHOD = 10
} CmdMethod;
typedef enum {
GSList *l;
MonoDomain *domain = mono_domain_get ();
MonoThread *thread = NULL;
+ MonoObject *keepalive_obj = NULL;
gboolean send_success = FALSE;
static int ecount;
int nevents;
case EVENT_KIND_EXCEPTION: {
EventInfo *ei = arg;
buffer_add_objid (&buf, ei->exc);
+ /*
+ * We are not yet suspending, so get_objref () will not keep this object alive. So we need to do it
+ * later after the suspension. (#12494).
+ */
+ keepalive_obj = ei->exc;
break;
}
case EVENT_KIND_USER_BREAK:
*/
save_thread_context (ctx);
suspend_vm ();
+
+ if (keepalive_obj)
+ /* This will keep this object alive */
+ get_objref (keepalive_obj);
}
send_success = send_packet (CMD_SET_EVENT, CMD_COMPOSITE, &buf);
if (val == 0)
mono_arch_stop_single_stepping ();
+ if (ss_req != NULL)
+ ss_invoke_addr = NULL;
#else
g_assert_not_reached ();
#endif
}
static void
-add_var (Buffer *buf, MonoType *t, MonoDebugVarInfo *var, MonoContext *ctx, MonoDomain *domain, gboolean as_vtype)
+add_var (Buffer *buf, MonoDebugMethodJitInfo *jit, MonoType *t, MonoDebugVarInfo *var, MonoContext *ctx, MonoDomain *domain, gboolean as_vtype)
{
guint32 flags;
int reg;
- guint8 *addr;
+ guint8 *addr, *gaddr;
mgreg_t reg_val;
flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
NOT_IMPLEMENTED;
break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
+ /* Same as regoffset, but with an indirection */
+ addr = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ addr += (gint32)var->offset;
+
+ gaddr = *(gpointer*)addr;
+ g_assert (gaddr);
+ buffer_add_value_full (buf, t, gaddr, domain, as_vtype);
+ break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_GSHAREDVT_LOCAL: {
+ MonoDebugVarInfo *info_var = jit->gsharedvt_info_var;
+ MonoDebugVarInfo *locals_var = jit->gsharedvt_locals_var;
+ MonoGSharedVtMethodRuntimeInfo *info;
+ guint8 *locals;
+ int idx;
+
+ idx = reg;
+
+ g_assert (info_var);
+ g_assert (locals_var);
+
+ flags = info_var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ reg = info_var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ if (flags == MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET) {
+ addr = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ addr += (gint32)info_var->offset;
+ info = *(gpointer*)addr;
+ } else if (flags == MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER) {
+ info = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ } else {
+ g_assert_not_reached ();
+ }
+ g_assert (info);
+
+ flags = locals_var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ reg = locals_var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
+ if (flags == MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET) {
+ addr = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ addr += (gint32)locals_var->offset;
+ locals = *(gpointer*)addr;
+ } else if (flags == MONO_DEBUG_VAR_ADDRESS_MODE_REGISTER) {
+ locals = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ } else {
+ g_assert_not_reached ();
+ }
+ g_assert (locals);
+
+ addr = locals + GPOINTER_TO_INT (info->entries [idx]);
+
+ buffer_add_value_full (buf, t, addr, domain, as_vtype);
+ break;
+ }
+
default:
g_assert_not_reached ();
}
{
guint32 flags;
int reg, size;
- guint8 *addr;
+ guint8 *addr, *gaddr;
flags = var->index & MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
reg = var->index & ~MONO_DEBUG_VAR_ADDRESS_MODE_FLAGS;
// FIXME: Write barriers
mono_gc_memmove (addr, val, size);
break;
+ case MONO_DEBUG_VAR_ADDRESS_MODE_REGOFFSET_INDIR:
+ /* Same as regoffset, but with an indirection */
+ addr = (gpointer)mono_arch_context_get_int_reg (ctx, reg);
+ addr += (gint32)var->offset;
+
+ gaddr = *(gpointer*)addr;
+ g_assert (gaddr);
+ // FIXME: Write barriers
+ mono_gc_memmove (gaddr, val, size);
+ break;
case MONO_DEBUG_VAR_ADDRESS_MODE_DEAD:
NOT_IMPLEMENTED;
break;
while (suspend_count > 0)
resume_vm ();
- mono_runtime_shutdown ();
+ if (!mono_runtime_try_shutdown ())
+ break;
/* Suspend all managed threads since the runtime is going away */
DEBUG(1, fprintf (log_file, "Suspending all threads...\n"));
buffer_add_cattrs (buf, domain, method->klass->image, attr_klass, cinfo);
break;
}
+ case CMD_METHOD_MAKE_GENERIC_METHOD: {
+ MonoType **type_argv;
+ int i, type_argc;
+ MonoDomain *d;
+ MonoClass *klass;
+ MonoGenericInst *ginst;
+ MonoGenericContext tmp_context;
+ MonoMethod *inflated;
+
+ type_argc = decode_int (p, &p, end);
+ type_argv = g_new0 (MonoType*, type_argc);
+ for (i = 0; i < type_argc; ++i) {
+ klass = decode_typeid (p, &p, end, &d, &err);
+ if (err) {
+ g_free (type_argv);
+ return err;
+ }
+ if (domain != d) {
+ g_free (type_argv);
+ return ERR_INVALID_ARGUMENT;
+ }
+ type_argv [i] = &klass->byval_arg;
+ }
+ ginst = mono_metadata_get_generic_inst (type_argc, type_argv);
+ g_free (type_argv);
+ tmp_context.class_inst = method->klass->generic_class ? method->klass->generic_class->context.class_inst : NULL;
+ tmp_context.method_inst = ginst;
+
+ inflated = mono_class_inflate_generic_method (method, &tmp_context);
+ if (!mono_verifier_is_method_valid_generic_instantiation (inflated))
+ return ERR_INVALID_ARGUMENT;
+ buffer_add_methodid (buf, domain, inflated);
+ break;
+ }
default:
return ERR_NOT_IMPLEMENTED;
}
frame = tls->frames [frame_idx];
if (!frame->has_ctx)
- // FIXME:
- return ERR_INVALID_FRAMEID;
+ return ERR_ABSENT_INFORMATION;
if (!frame->jit) {
frame->jit = mono_debug_find_method (frame->api_method, frame->domain);
var = &jit->params [pos];
- add_var (buf, sig->params [pos], &jit->params [pos], &frame->ctx, frame->domain, FALSE);
+ add_var (buf, jit, sig->params [pos], &jit->params [pos], &frame->ctx, frame->domain, FALSE);
} else {
g_assert (pos >= 0 && pos < jit->num_locals);
var = &jit->locals [pos];
- add_var (buf, header->locals [pos], &jit->locals [pos], &frame->ctx, frame->domain, FALSE);
+ add_var (buf, jit, header->locals [pos], &jit->locals [pos], &frame->ctx, frame->domain, FALSE);
}
}
mono_metadata_free_mh (header);
MonoObject *p = NULL;
buffer_add_value (buf, &mono_defaults.object_class->byval_arg, &p, frame->domain);
} else {
- add_var (buf, &frame->actual_method->klass->this_arg, jit->this_var, &frame->ctx, frame->domain, TRUE);
+ add_var (buf, jit, &frame->actual_method->klass->this_arg, jit->this_var, &frame->ctx, frame->domain, TRUE);
}
} else {
if (!sig->hasthis) {
MonoObject *p = NULL;
buffer_add_value (buf, &frame->actual_method->klass->byval_arg, &p, frame->domain);
} else {
- add_var (buf, &frame->api_method->klass->byval_arg, jit->this_var, &frame->ctx, frame->domain, TRUE);
+ add_var (buf, jit, &frame->api_method->klass->byval_arg, jit->this_var, &frame->ctx, frame->domain, TRUE);
}
}
break;
g_free (data);
buffer_free (&buf);
- if (command_set == CMD_SET_VM && command == CMD_VM_DISPOSE)
+ if (command_set == CMD_SET_VM && (command == CMD_VM_DISPOSE || command == CMD_VM_EXIT))
break;
}
}
#endif
}
-
+
+static void
+switch_gc (char* argv[], const char* target_gc)
+{
+ GString *path;
+
+ printf ("current gc is %s\n", mono_gc_get_gc_name ());
+ if (!strcmp (mono_gc_get_gc_name (), target_gc)) {
+ printf ("same gc\n");
+ return;
+ }
+
+ path = g_string_new (argv [0]);
+
+ /*Running mono without any argument*/
+ if (strstr (argv [0], "-sgen"))
+ g_string_truncate (path, path->len - 5);
+ else if (strstr (argv [0], "-boehm"))
+ g_string_truncate (path, path->len - 6);
+
+ g_string_append_c (path, '-');
+ g_string_append (path, target_gc);
+
+ printf ("executing %s\n", path->str);
+#ifdef HAVE_EXECVP
+ execvp (path->str, argv);
+#else
+ fprintf (stderr, "Error: --gc=<NAME> option not supported on this platform.\n");
+#endif
+}
/**
* mono_main:
} else if (strncmp (argv [i], "-O=", 3) == 0) {
opt = parse_optimizations (argv [i] + 3);
} else if (strcmp (argv [i], "--gc=sgen") == 0) {
- if (!strcmp (mono_gc_get_gc_name (), "boehm")) {
- GString *path = g_string_new (argv [0]);
- g_string_append (path, "-sgen");
- argv [0] = path->str;
-#ifdef HAVE_EXECVP
- execvp (path->str, argv);
-#else
- fprintf (stderr, "Error: --gc=<NAME> option not supported on this platform.\n");
-#endif
- }
+ switch_gc (argv, "sgen");
} else if (strcmp (argv [i], "--gc=boehm") == 0) {
- if (!strcmp (mono_gc_get_gc_name (), "sgen")) {
- char *copy = g_strdup (argv [0]);
- char *p = strstr (copy, "-sgen");
- if (p == NULL){
- fprintf (stderr, "Error, this process is not named mono-sgen and the command line option --boehm was passed");
- exit (1);
- }
- *p = 0;
- argv [0] = p;
-#ifdef HAVE_EXECVP
- execvp (p, argv);
-#else
- fprintf (stderr, "Error: --gc=<NAME> option not supported on this platform.\n");
-#endif
- }
+ switch_gc (argv, "boehm");
} else if (strcmp (argv [i], "--config") == 0) {
if (i +1 >= argc){
fprintf (stderr, "error: --config requires a filename argument\n");
* debug information.
*/
MonoDwarfWriter*
-mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending)
+mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending, gboolean emit_line_numbers)
{
MonoDwarfWriter *w = g_new0 (MonoDwarfWriter, 1);
w->collect_line_info = TRUE;
}
+ if (!emit_line_numbers) {
+ w->emit_line = FALSE;
+ w->collect_line_info = FALSE;
+ }
+
w->fp = img_writer_get_fp (w->w);
w->temp_prefix = img_writer_get_temp_label_prefix (w->w);
//printf ("FIRST: %d %d %d\n", prev_line, loc->row, il_offset);
emit_sleb128 (w, (gint32)loc->row - (gint32)prev_line);
prev_line = loc->row;
+ prev_native_offset = i;
first = FALSE;
}
typedef struct _MonoDwarfWriter MonoDwarfWriter;
-MonoDwarfWriter* mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending) MONO_INTERNAL;
+MonoDwarfWriter* mono_dwarf_writer_create (MonoImageWriter *writer, FILE *il_file, int il_file_start_line, gboolean appending, gboolean emit_line_numbers) MONO_INTERNAL;
void mono_dwarf_writer_destroy (MonoDwarfWriter *w) MONO_INTERNAL;
using System.Threading;
using System.Threading.Tasks;
-class Tests {
-
+#if MOBILE
+class GenericsTests
+#else
+class Tests
+#endif
+{
struct TestStruct {
public int i;
public int j;
}
}
+#if !MOBILE
class Enumerator <T> : MyIEnumerator <T> {
T MyIEnumerator<T>.Current {
get {
return true;
}
}
+#endif
+#if !MOBILE
static int Main (string[] args)
{
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
public static int test_1_nullable_unbox ()
{
public static int test_0_constrained_vtype_box () {
GenericClass<TestStruct> t = new GenericClass<TestStruct> ();
+#if MOBILE
+ return t.toString (new TestStruct ()) == "GenericsTests+TestStruct" ? 0 : 1;
+#else
return t.toString (new TestStruct ()) == "Tests+TestStruct" ? 0 : 1;
+#endif
}
public static int test_0_constrained_vtype () {
return 0;
}
+#if !MOBILE
public static int test_0_variance_reflection () {
// covariance on IEnumerator
if (!typeof (MyIEnumerator<object>).IsAssignableFrom (typeof (MyIEnumerator<string>)))
return 6;
return 0;
}
+#endif
public static int test_0_ldvirtftn_generic_method () {
- new Tests ().ldvirtftn<string> ();
+ new GenericsTests ().ldvirtftn<string> ();
return the_type == typeof (string) ? 0 : 1;
}
/* Test that treating arrays as generic collections works with full-aot */
public static int test_0_fullaot_array_wrappers () {
- Tests[] arr = new Tests [10];
- enumerate<Tests> (arr);
+ GenericsTests[] arr = new GenericsTests [10];
+ enumerate<GenericsTests> (arr);
return 0;
}
}
public static int test_0_full_aot_nullable_unbox_from_gshared_code () {
- if (!new Tests ().IsNull2<FooStruct> (null))
+ if (!new GenericsTests ().IsNull2<FooStruct> (null))
return 1;
- if (new Tests ().IsNull2<FooStruct> (new FooStruct ()))
+ if (new GenericsTests ().IsNull2<FooStruct> (new FooStruct ()))
return 2;
return 0;
}
public static int test_0_partial_sharing () {
if (PartialShared1 (new List<string> (), 1) != typeof (string))
return 1;
- if (PartialShared1 (new List<Tests> (), 1) != typeof (Tests))
+ if (PartialShared1 (new List<GenericsTests> (), 1) != typeof (GenericsTests))
return 2;
if (PartialShared2 (new List<string> (), 1) != typeof (int))
return 3;
- if (PartialShared2 (new List<Tests> (), 1) != typeof (int))
+ if (PartialShared2 (new List<GenericsTests> (), 1) != typeof (int))
return 4;
return 0;
}
}
#endif
}
+
+#if !MOBILE
+class GenericsTests : Tests
+{
+}
+#endif
using System.Runtime.CompilerServices;
struct Foo {
- public int i, j;
+ public int i, j, k, l, m, n;
}
struct GFoo<T> {
// FIXME: Add mixed ref/noref tests, i.e. Dictionary<string, int>
+#if MOBILE
+public class GSharedTests
+#else
public class Tests
+#endif
{
+#if !MOBILE
public static int Main (String[] args) {
return TestDriver.RunTests (typeof (Tests), args);
}
+#endif
[MethodImplAttribute (MethodImplOptions.NoInlining)]
static void gshared<T> (T [] array, int i, int j) {
}
public static int test_0_vt_unbox_any () {
+ int[] iarr = new int [16];
+ unbox_any<int> (iarr, new object [] { 12 });
+
Foo[] arr = new Foo [2];
object[] arr2 = new object [16];
var v2 = return_t<GFoo2<int>> (v);
if (v2.t != 55 || v2.t2 != 32)
return 6;
- i = new Tests ().return_this_t<int> (42);
+ i = new GSharedTests ().return_this_t<int> (42);
if (i != 42)
return 7;
return 0;
return 0;
}
+ interface IFaceKVP {
+ T do_kvp<T> (T a);
+ }
+
static KeyValuePair<T1, T2> make_kvp<T1, T2> (T1 t1, T2 t2) {
return new KeyValuePair<T1, T2> (t1, t2);
}
static T2 use_kvp<T1, T2> (KeyValuePair<T1, T2> kvp) {
return kvp.Value;
}
-
- [MethodImplAttribute (MethodImplOptions.NoInlining)]
- static T do_kvp<T> (T a) {
- var t = make_kvp (a, a);
- // argument is an instance of a vtype instantiated with gsharedvt type arguments
- return use_kvp (t);
+
+ class ClassKVP : IFaceKVP {
+ public T do_kvp<T> (T a) {
+ var t = make_kvp (a, a);
+ // argument is an instance of a vtype instantiated with gsharedvt type arguments
+ return use_kvp (t);
+ }
}
public static int test_0_gsharedvt_ginstvt_constructed_arg () {
- if (do_kvp<long> (1) != 1)
+ IFaceKVP c = new ClassKVP ();
+ if (c.do_kvp<long> (1) != 1)
return 1;
return 0;
}
return t.ToString ();
}
+ enum AnEnum {
+ One
+ };
+
public static int test_0_constrained_tostring () {
if (to_string<int, int> (1, 1) != "1")
return 1;
- if (to_string<string, int> ("A", 1) != "A")
+ if (to_string<AnEnum, int> (AnEnum.One, 1) != "One")
return 2;
+ if (to_string<string, int> ("A", 1) != "A")
+ return 3;
return 0;
}
return 1;
if (get_hash<double, int> (1.0, 1) != 1.0.GetHashCode ())
return 2;
+ if (get_hash<AnEnum, int> (AnEnum.One, 1) != AnEnum.One.GetHashCode ())
+ return 3;
if (get_hash<string, int> ("A", 1) != "A".GetHashCode ())
+ return 4;
+ return 0;
+ }
+
+ [MethodImplAttribute (MethodImplOptions.NoInlining)]
+ static bool equals<T, T2>(T t, T2 t2) {
+ return t.Equals (t);
+ }
+
+ public static int test_0_constrained_equals () {
+ if (equals<int, int> (1, 1) != true)
+ return 1;
+ if (equals<double, int> (1.0, 1) != true)
+ return 2;
+ if (equals<AnEnum, int> (AnEnum.One, 1) != true)
return 3;
+ if (equals<string, int> ("A", 1) != true)
+ return 4;
return 0;
}
TAbstractTableItem<object>.Test ();
return 0;
}
+
+ interface IFaceBox {
+ object box<T> (T t);
+ }
+
+ class ClassBox : IFaceBox {
+ public object box<T> (T t) {
+ object o = t;
+ return o;
+ }
+ }
+
+ public static int test_0_nullable_box () {
+ IFaceBox c = new ClassBox ();
+ int i = 5;
+ object o = c.box<int?> (i);
+ if ((int)o != i)
+ return 1;
+ if (c.box<int?> (null) != null)
+ return 2;
+ long l = Int64.MaxValue - 1;
+ o = c.box<long?> (l);
+ if ((long)o != l)
+ return 3;
+ if (c.box<long?> (null) != null)
+ return 4;
+ string s = "A";
+ if (c.box<string> (s) != (object)s)
+ return 5;
+ return 0;
+ }
+
+ interface IFaceUnbox2 {
+ T unbox<T> (object o);
+ }
+
+ class ClassUnbox2 : IFaceUnbox2 {
+ public T unbox<T> (object o) {
+ return (T)o;
+ }
+ }
+
+ public static int test_0_nullable_unbox () {
+ IFaceUnbox2 c = new ClassUnbox2 ();
+ int? i = c.unbox<int?> (5);
+ if (i != 5)
+ return 1;
+ int? j = c.unbox<int?> (null);
+ if (j != null)
+ return 2;
+ return 0;
+ }
+}
+
+#if !MOBILE
+public class GSharedTests : Tests {
}
+#endif
#define NEW_LDTOKENCONST(cfg,dest,image,token,generic_context) NEW_AOTCONST_TOKEN ((cfg), (dest), MONO_PATCH_INFO_LDTOKEN, (image), (token), (generic_context), STACK_PTR, NULL)
+#define NEW_TLS_OFFSETCONST(cfg,dest,key) do { \
+ if (cfg->compile_aot) { \
+ NEW_AOTCONST ((cfg), (dest), MONO_PATCH_INFO_TLS_OFFSET, GINT_TO_POINTER (key)); \
+ } else { \
+ int _offset = mini_get_tls_offset ((key)); \
+ NEW_PCONST ((cfg), (dest), GINT_TO_POINTER (_offset)); \
+ } \
+ } while (0)
+
#define NEW_DECLSECCONST(cfg,dest,image,entry) do { \
if (cfg->compile_aot) { \
NEW_AOTCONST_TOKEN (cfg, dest, MONO_PATCH_INFO_DECLSEC, image, (entry).index, NULL, STACK_OBJ, NULL); \
#define DECOMPOSE_INTO_REGPAIR(stack_type) ((stack_type) == STACK_I8)
#endif
+static inline void
+handle_gsharedvt_ldaddr (MonoCompile *cfg)
+{
+ /* The decomposition of ldaddr makes use of these two variables, so add uses for them */
+ MonoInst *use;
+
+ MONO_INST_NEW (cfg, use, OP_DUMMY_USE);
+ use->sreg1 = cfg->gsharedvt_info_var->dreg;
+ MONO_ADD_INS (cfg->cbb, use);
+ MONO_INST_NEW (cfg, use, OP_DUMMY_USE);
+ use->sreg1 = cfg->gsharedvt_locals_var->dreg;
+ MONO_ADD_INS (cfg->cbb, use);
+}
+
#define NEW_VARLOADA(cfg,dest,var,vartype) do { \
MONO_INST_NEW ((cfg), (dest), OP_LDADDR); \
(dest)->inst_p0 = (var); \
(dest)->type = STACK_MP; \
(dest)->klass = (var)->klass; \
(dest)->dreg = alloc_dreg ((cfg), STACK_MP); \
+ if (G_UNLIKELY (cfg->gsharedvt) && mini_is_gsharedvt_variable_type ((cfg), (var)->inst_vtype)) { handle_gsharedvt_ldaddr ((cfg)); } \
if (SIZEOF_REGISTER == 4 && DECOMPOSE_INTO_REGPAIR ((var)->type)) { MonoInst *var1 = get_vreg_to_inst (cfg, (var)->dreg + 1); MonoInst *var2 = get_vreg_to_inst (cfg, (var)->dreg + 2); g_assert (var1); g_assert (var2); var1->flags |= MONO_INST_INDIRECT; var2->flags |= MONO_INST_INDIRECT; } \
} while (0)
#define EMIT_NEW_LDTOKENCONST(cfg,dest,image,token,generic_context) do { NEW_AOTCONST_TOKEN ((cfg), (dest), MONO_PATCH_INFO_LDTOKEN, (image), (token), (generic_context), STACK_PTR, NULL); MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
+#define EMIT_NEW_TLS_OFFSETCONST(cfg,dest,key) do { NEW_TLS_OFFSETCONST ((cfg), (dest), (key)); MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
+
#define EMIT_NEW_DOMAINCONST(cfg,dest) do { NEW_DOMAINCONST ((cfg), (dest)); MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
#define EMIT_NEW_DECLSECCONST(cfg,dest,image,entry) do { NEW_DECLSECCONST ((cfg), (dest), (image), (entry)); MONO_ADD_INS ((cfg)->cbb, (dest)); } while (0)
return mono_compile_method (m);
}
-MonoObject*
-mono_object_tostring_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass)
+static MonoMethod*
+constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gpointer *this_arg)
{
MonoMethod *m;
int vt_slot;
- gpointer this_arg;
/* Lookup the virtual method */
mono_class_setup_vtable (klass);
g_assert (klass->vtable);
vt_slot = mono_method_get_vtable_slot (cmethod);
m = klass->vtable [vt_slot];
- if (klass->valuetype)
- this_arg = mp;
+ if (klass->valuetype && (m->klass == mono_defaults.object_class || m->klass == mono_defaults.enum_class->parent || m->klass == mono_defaults.enum_class))
+ /*
+ * Calling a non-vtype method with a vtype receiver, has to box.
+ */
+ *this_arg = mono_value_box (mono_domain_get (), klass, mp);
+ else if (klass->valuetype)
+ /*
+ * Calling a vtype method with a vtype receiver
+ */
+ *this_arg = mp;
else
- this_arg = *(gpointer*)mp;
+ /*
+ * Calling a non-vtype method
+ */
+ *this_arg = *(gpointer*)mp;
+ return m;
+}
+
+MonoObject*
+mono_object_tostring_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass)
+{
+ MonoMethod *m;
+ gpointer this_arg;
+
+ m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg);
return mono_runtime_invoke (m, this_arg, NULL, NULL);
}
mono_object_gethashcode_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass)
{
MonoMethod *m;
- int vt_slot;
gpointer this_arg;
MonoObject *res;
gpointer p;
- /* Lookup the virtual method */
- mono_class_setup_vtable (klass);
- g_assert (klass->vtable);
- vt_slot = mono_method_get_vtable_slot (cmethod);
- m = klass->vtable [vt_slot];
- if (klass->valuetype)
- this_arg = mp;
- else
- this_arg = *(gpointer*)mp;
+ m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg);
// FIXME: This boxes the result
res = mono_runtime_invoke (m, this_arg, NULL, NULL);
p = mono_object_unbox (res);
return *(int*)p;
}
+MonoBoolean
+mono_object_equals_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass, MonoObject *arg)
+{
+ MonoMethod *m;
+ gpointer this_arg;
+ MonoObject *res;
+ gpointer p;
+ void **args;
+
+ m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg);
+ // FIXME: This boxes the result
+ args = (void**)&arg;
+ res = mono_runtime_invoke (m, this_arg, args, NULL);
+ p = mono_object_unbox (res);
+ return *(MonoBoolean*)p;
+}
+
+void
+mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass)
+{
+ if (klass->valuetype)
+ mono_value_copy (dest, src, klass);
+ else
+ mono_gc_wbarrier_generic_store (dest, *(MonoObject**)src);
+}
int mono_object_gethashcode_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass) MONO_INTERNAL;
+MonoBoolean mono_object_equals_gsharedvt (gpointer mp, MonoMethod *cmethod, MonoClass *klass, MonoObject *arg) MONO_INTERNAL;
+
+void mono_gsharedvt_value_copy (gpointer dest, gpointer src, MonoClass *klass) MONO_INTERNAL;
+
#endif /* __MONO_JIT_ICALLS_H__ */
--- /dev/null
+
+#include "buildver-sgen.h"
+#define BUILDVER_INCLUDED
+
+#include "main.c"
#include <config.h>
#include "mini.h"
#ifndef HOST_WIN32
-#ifdef HAVE_SGEN_GC
-#include "buildver-sgen.h"
-#else
-#include "buildver.h"
+#ifndef BUILDVER_INCLUDED
+#include "buildver-boehm.h"
#endif
#endif
case MONO_TYPE_GENERICINST:
type = &type->data.generic_class->container_class->byval_arg;
goto handle_enum;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ /* gsharedvt */
+ return calli? OP_VCALL_REG: virt? OP_VCALLVIRT: OP_VCALL;
default:
g_error ("unknown type 0x%02x in ret_type_to_call_opcode", type->type);
}
case MONO_TYPE_GENERICINST:
simple_type = &simple_type->data.generic_class->container_class->byval_arg;
goto handle_enum;
-
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ /* gsharedvt */
+ if (args [i]->type != STACK_VTYPE)
+ return 1;
+ continue;
default:
g_error ("unknown type 0x%02x in check_call_signature",
simple_type->type);
return 0;
}
+/*
+ * check_method_sharing:
+ *
+ * Check whenever the vtable or an mrgctx needs to be passed when calling CMETHOD.
+ */
+static void
+check_method_sharing (MonoCompile *cfg, MonoMethod *cmethod, gboolean *out_pass_vtable, gboolean *out_pass_mrgctx)
+{
+ gboolean pass_vtable = FALSE;
+ gboolean pass_mrgctx = FALSE;
+
+ if (((cmethod->flags & METHOD_ATTRIBUTE_STATIC) || cmethod->klass->valuetype) &&
+ (cmethod->klass->generic_class || cmethod->klass->generic_container)) {
+ gboolean sharable = FALSE;
+
+ if (mono_method_is_generic_sharable (cmethod, TRUE)) {
+ sharable = TRUE;
+ } else {
+ gboolean sharing_enabled = mono_class_generic_sharing_enabled (cmethod->klass);
+ MonoGenericContext *context = mini_class_get_context (cmethod->klass);
+ gboolean context_sharable = mono_generic_context_is_sharable (context, TRUE);
+
+ sharable = sharing_enabled && context_sharable;
+ }
+
+ /*
+ * Pass vtable iff target method might
+ * be shared, which means that sharing
+ * is enabled for its class and its
+ * context is sharable (and it's not a
+ * generic method).
+ */
+ if (sharable && !(mini_method_get_context (cmethod) && mini_method_get_context (cmethod)->method_inst))
+ pass_vtable = TRUE;
+ }
+
+ if (mini_method_get_context (cmethod) &&
+ mini_method_get_context (cmethod)->method_inst) {
+ g_assert (!pass_vtable);
+
+ if (mono_method_is_generic_sharable (cmethod, TRUE)) {
+ pass_mrgctx = TRUE;
+ } else {
+ gboolean sharing_enabled = mono_class_generic_sharing_enabled (cmethod->klass);
+ MonoGenericContext *context = mini_method_get_context (cmethod);
+ gboolean context_sharable = mono_generic_context_is_sharable (context, TRUE);
+
+ if (sharing_enabled && context_sharable)
+ pass_mrgctx = TRUE;
+ if (cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, mono_method_signature (cmethod)))
+ pass_mrgctx = TRUE;
+ }
+ }
+
+ if (out_pass_vtable)
+ *out_pass_vtable = pass_vtable;
+ if (out_pass_mrgctx)
+ *out_pass_mrgctx = pass_mrgctx;
+}
+
inline static MonoCallInst *
mono_emit_call_args (MonoCompile *cfg, MonoMethodSignature *sig,
MonoInst **args, int calli, int virtual, int tail, int rgctx, int unbox_trampoline)
return (MonoInst*)call;
}
+static MonoInst*
+emit_get_gsharedvt_info_klass (MonoCompile *cfg, MonoClass *klass, MonoRgctxInfoType rgctx_type);
+
static MonoInst*
emit_get_rgctx_method (MonoCompile *cfg, int context_used, MonoMethod *cmethod, MonoRgctxInfoType rgctx_type);
static MonoInst*
emit_get_rgctx_klass (MonoCompile *cfg, int context_used, MonoClass *klass, MonoRgctxInfoType rgctx_type);
static MonoInst*
-mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSignature *sig,
+mono_emit_method_call_full (MonoCompile *cfg, MonoMethod *method, MonoMethodSignature *sig, gboolean tail,
MonoInst **args, MonoInst *this, MonoInst *imt_arg, MonoInst *rgctx_arg)
{
#ifndef DISABLE_REMOTING
int rgctx_reg = 0;
gboolean need_unbox_trampoline;
+ if (!sig)
+ sig = mono_method_signature (method);
+
if (rgctx_arg) {
rgctx_reg = mono_alloc_preg (cfg);
MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, rgctx_reg, rgctx_arg->dreg);
need_unbox_trampoline = method->klass == mono_defaults.object_class || (method->klass->flags & TYPE_ATTRIBUTE_INTERFACE);
- call = mono_emit_call_args (cfg, sig, args, FALSE, virtual, FALSE, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
+ call = mono_emit_call_args (cfg, sig, args, FALSE, virtual, tail, rgctx_arg ? TRUE : FALSE, need_unbox_trampoline);
#ifndef DISABLE_REMOTING
if (might_be_remote)
call->method = method;
call->inst.flags |= MONO_INST_HAS_METHOD;
call->inst.inst_left = this;
+ call->tail_call = tail;
if (virtual) {
int vtable_reg, slot_reg, this_reg;
+ int offset;
this_reg = this->dreg;
-#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
- if ((method->klass->parent == mono_defaults.multicastdelegate_class) && (!strcmp (method->name, "Invoke"))) {
+ if (ARCH_HAVE_DELEGATE_TRAMPOLINES && (method->klass->parent == mono_defaults.multicastdelegate_class) && !strcmp (method->name, "Invoke")) {
MonoInst *dummy_use;
MONO_EMIT_NULL_CHECK (cfg, this_reg);
return (MonoInst*)call;
}
-#endif
if ((!cfg->compile_aot || enable_for_aot) &&
(!(method->flags & METHOD_ATTRIBUTE_VIRTUAL) ||
guint32 imt_slot = mono_method_get_imt_slot (method);
emit_imt_argument (cfg, call, call->method, imt_arg);
slot_reg = vtable_reg;
- call->inst.inst_offset = ((gint32)imt_slot - MONO_IMT_SIZE) * SIZEOF_VOID_P;
+ 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;
+ offset = mono_method_get_vtable_index (method) * SIZEOF_VOID_P;
}
} else {
slot_reg = vtable_reg;
- call->inst.inst_offset = G_STRUCT_OFFSET (MonoVTable, vtable) +
+ offset = G_STRUCT_OFFSET (MonoVTable, vtable) +
((mono_method_get_vtable_index (method)) * (SIZEOF_VOID_P));
#ifdef MONO_ARCH_HAVE_IMT
if (imt_arg) {
}
call->inst.sreg1 = slot_reg;
+ call->inst.inst_offset = offset;
call->virtual = TRUE;
}
}
MonoInst*
mono_emit_method_call (MonoCompile *cfg, MonoMethod *method, MonoInst **args, MonoInst *this)
{
- return mono_emit_method_call_full (cfg, method, mono_method_signature (method), args, this, NULL, NULL);
+ return mono_emit_method_call_full (cfg, method, mono_method_signature (method), FALSE, args, this, NULL, NULL);
}
MonoInst*
guint32 align = 0;
MonoMethod *memcpy_method;
MonoInst *size_ins = NULL;
+ MonoInst *memcpy_ins = NULL;
g_assert (klass);
/*
if (mini_is_gsharedvt_klass (cfg, klass)) {
g_assert (!native);
context_used = mini_class_check_context_used (cfg, klass);
- size_ins = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_VALUE_SIZE);
+ size_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_VALUE_SIZE);
+ memcpy_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_MEMCPY);
}
if (native)
}
}
- mono_emit_jit_icall (cfg, mono_value_copy, iargs);
+ if (size_ins)
+ mono_emit_jit_icall (cfg, mono_gsharedvt_value_copy, iargs);
+ else
+ mono_emit_jit_icall (cfg, mono_value_copy, iargs);
return;
}
}
EMIT_NEW_ICONST (cfg, iargs [2], n);
memcpy_method = get_memcpy_method ();
- mono_emit_method_call (cfg, memcpy_method, iargs, NULL);
+ if (memcpy_ins)
+ mono_emit_calli (cfg, mono_method_signature (memcpy_method), iargs, memcpy_ins, NULL, NULL);
+ else
+ mono_emit_method_call (cfg, memcpy_method, iargs, NULL);
}
}
guint32 align;
MonoMethod *memset_method;
MonoInst *size_ins = NULL;
+ MonoInst *bzero_ins = NULL;
+ static MonoMethod *bzero_method;
/* FIXME: Optimize this for the case when dest is an LDADDR */
mono_class_init (klass);
if (mini_is_gsharedvt_klass (cfg, klass)) {
context_used = mini_class_check_context_used (cfg, klass);
- size_ins = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_VALUE_SIZE);
- n = -1;
- } else {
- n = mono_class_value_size (klass, &align);
+ size_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_VALUE_SIZE);
+ bzero_ins = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_BZERO);
+ if (!bzero_method)
+ bzero_method = mono_class_get_method_from_name (mono_defaults.string_class, "bzero_aligned_1", 2);
+ g_assert (bzero_method);
+ iargs [0] = dest;
+ iargs [1] = size_ins;
+ mono_emit_calli (cfg, mono_method_signature (bzero_method), iargs, bzero_ins, NULL, NULL);
+ return;
}
- if (!size_ins && n <= sizeof (gpointer) * 5) {
+ n = mono_class_value_size (klass, &align);
+
+ if (n <= sizeof (gpointer) * 5) {
mini_emit_memset (cfg, dest->dreg, 0, n, 0, align);
}
else {
memset_method = get_memset_method ();
iargs [0] = dest;
EMIT_NEW_ICONST (cfg, iargs [1], 0);
- if (size_ins)
- iargs [2] = size_ins;
- else
- EMIT_NEW_ICONST (cfg, iargs [2], n);
+ EMIT_NEW_ICONST (cfg, iargs [2], n);
mono_emit_method_call (cfg, memset_method, iargs, NULL);
}
}
return emit_rgctx_fetch (cfg, rgctx, entry);
}
+
+static MonoInst*
+emit_get_rgctx_gsharedvt_method (MonoCompile *cfg, int context_used,
+ MonoMethod *cmethod, MonoGSharedVtMethodInfo *info)
+{
+ MonoJumpInfoRgctxEntry *entry;
+ MonoInst *rgctx;
+
+ entry = mono_patch_info_rgctx_entry_new (cfg->mempool, cfg->current_method, context_used & MONO_GENERIC_CONTEXT_USED_METHOD, MONO_PATCH_INFO_GSHAREDVT_METHOD, info, MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO);
+ rgctx = emit_get_rgctx (cfg, cfg->current_method, context_used);
+
+ return emit_rgctx_fetch (cfg, rgctx, entry);
+}
+
/*
* emit_get_rgctx_method:
*
return emit_rgctx_fetch (cfg, rgctx, entry);
}
+static int
+get_gsharedvt_info_slot (MonoCompile *cfg, gpointer data, MonoRgctxInfoType rgctx_type)
+{
+ MonoGSharedVtMethodInfo *info = cfg->gsharedvt_info;
+ MonoRuntimeGenericContextInfoTemplate *template;
+ int i, idx;
+
+ g_assert (info);
+
+ for (i = 0; i < info->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *otemplate = g_ptr_array_index (info->entries, i);
+
+ if (otemplate->info_type == rgctx_type && otemplate->data == data && rgctx_type != MONO_RGCTX_INFO_LOCAL_OFFSET)
+ return i;
+ }
+
+ template = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoRuntimeGenericContextInfoTemplate));
+ template->info_type = rgctx_type;
+ template->data = data;
+
+ idx = info->entries->len;
+
+ g_ptr_array_add (info->entries, template);
+
+ return idx;
+}
+
+/*
+ * emit_get_gsharedvt_info:
+ *
+ * This is similar to emit_get_rgctx_.., but loads the data from the gsharedvt info var instead of calling an rgctx fetch trampoline.
+ */
+static MonoInst*
+emit_get_gsharedvt_info (MonoCompile *cfg, gpointer data, MonoRgctxInfoType rgctx_type)
+{
+ MonoInst *ins;
+ int idx, dreg;
+
+ idx = get_gsharedvt_info_slot (cfg, data, rgctx_type);
+ /* Load info->entries [idx] */
+ dreg = alloc_preg (cfg);
+ EMIT_NEW_LOAD_MEMBASE (cfg, ins, OP_LOAD_MEMBASE, dreg, cfg->gsharedvt_info_var->dreg, G_STRUCT_OFFSET (MonoGSharedVtMethodRuntimeInfo, entries) + (idx * sizeof (gpointer)));
+
+ return ins;
+}
+
+static MonoInst*
+emit_get_gsharedvt_info_klass (MonoCompile *cfg, MonoClass *klass, MonoRgctxInfoType rgctx_type)
+{
+ return emit_get_gsharedvt_info (cfg, &klass->byval_arg, rgctx_type);
+}
+
/*
* On return the caller must check @klass for load errors.
*/
return mono_emit_calli (cfg, mono_method_signature (method), &val, addr, NULL, rgctx);
} else {
- return mono_emit_method_call (cfg, method, &val, NULL);
+ gboolean pass_vtable, pass_mrgctx;
+ MonoInst *rgctx_arg = NULL;
+
+ check_method_sharing (cfg, method, &pass_vtable, &pass_mrgctx);
+ g_assert (!pass_mrgctx);
+
+ if (pass_vtable) {
+ MonoVTable *vtable = mono_class_vtable (cfg->domain, method->klass);
+
+ g_assert (vtable);
+ EMIT_NEW_VTABLECONST (cfg, rgctx_arg, vtable);
+ }
+
+ return mono_emit_method_call_full (cfg, method, NULL, FALSE, &val, NULL, NULL, rgctx_arg);
}
}
return add;
}
+static MonoInst*
+handle_unbox_gsharedvt (MonoCompile *cfg, int context_used, MonoClass *klass, MonoInst *obj, MonoBasicBlock **out_cbb)
+{
+ MonoInst *addr, *klass_inst, *is_ref, *args[16];
+ MonoBasicBlock *is_ref_bb, *is_nullable_bb, *end_bb;
+ MonoInst *ins;
+ int dreg, addr_reg;
+
+ klass_inst = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_KLASS);
+
+ /* obj */
+ args [0] = obj;
+
+ /* klass */
+ args [1] = klass_inst;
+
+ /* CASTCLASS */
+ obj = mono_emit_jit_icall (cfg, mono_object_castclass, args);
+
+ NEW_BBLOCK (cfg, is_ref_bb);
+ NEW_BBLOCK (cfg, is_nullable_bb);
+ NEW_BBLOCK (cfg, end_bb);
+ is_ref = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_CLASS_BOX_TYPE);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, is_ref->dreg, 1);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, is_ref_bb);
+
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, is_ref->dreg, 2);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, is_nullable_bb);
+
+ /* This will contain either the address of the unboxed vtype, or an address of the temporary where the ref is stored */
+ addr_reg = alloc_dreg (cfg, STACK_MP);
+
+ /* Non-ref case */
+ /* UNBOX */
+ NEW_BIALU_IMM (cfg, addr, OP_ADD_IMM, addr_reg, obj->dreg, sizeof (MonoObject));
+ MONO_ADD_INS (cfg->cbb, addr);
+
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+
+ /* Ref case */
+ MONO_START_BB (cfg, is_ref_bb);
+
+ /* Save the ref to a temporary */
+ dreg = alloc_ireg (cfg);
+ EMIT_NEW_VARLOADA_VREG (cfg, addr, dreg, &klass->byval_arg);
+ addr->dreg = addr_reg;
+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, addr->dreg, 0, obj->dreg);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+
+ /* Nullable case */
+ MONO_START_BB (cfg, is_nullable_bb);
+
+ {
+ MonoInst *addr = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX);
+ MonoInst *unbox_call;
+ MonoMethodSignature *unbox_sig;
+ MonoInst *var;
+
+ var = mono_compile_create_var (cfg, &klass->byval_arg, OP_LOCAL);
+
+ unbox_sig = mono_mempool_alloc0 (cfg->mempool, MONO_SIZEOF_METHOD_SIGNATURE + (1 * sizeof (MonoType *)));
+ unbox_sig->ret = &klass->byval_arg;
+ unbox_sig->param_count = 1;
+ unbox_sig->params [0] = &mono_defaults.object_class->byval_arg;
+ unbox_call = mono_emit_calli (cfg, unbox_sig, &obj, addr, NULL, NULL);
+
+ EMIT_NEW_VARLOADA_VREG (cfg, addr, unbox_call->dreg, &klass->byval_arg);
+ addr->dreg = addr_reg;
+ }
+
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+
+ /* End */
+ MONO_START_BB (cfg, end_bb);
+
+ /* LDOBJ */
+ EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &klass->byval_arg, addr_reg, 0);
+
+ *out_cbb = cfg->cbb;
+
+ return ins;
+}
+
/*
* Returns NULL and set the cfg exception on error.
*/
int rgctx_info;
MonoInst *iargs [2];
- /*
- FIXME: we cannot get managed_alloc here because we can't get
- the class's vtable (because it's not a closed class)
-
- MonoVTable *vtable = mono_class_vtable (cfg->domain, klass);
- MonoMethod *managed_alloc = mono_gc_get_managed_allocator (vtable, for_box);
- */
+ MonoMethod *managed_alloc = mono_gc_get_managed_allocator (klass, for_box);
if (cfg->opt & MONO_OPT_SHARED)
rgctx_info = MONO_RGCTX_INFO_KLASS;
alloc_ftn = mono_object_new_specific;
}
+ if (managed_alloc && !(cfg->opt & MONO_OPT_SHARED))
+ return mono_emit_method_call (cfg, managed_alloc, iargs, NULL);
+
return mono_emit_jit_icall (cfg, alloc_ftn, iargs);
}
}
#ifndef MONO_CROSS_COMPILE
- managed_alloc = mono_gc_get_managed_allocator (vtable, for_box);
+ managed_alloc = mono_gc_get_managed_allocator (klass, for_box);
#endif
if (managed_alloc) {
* Returns NULL and set the cfg exception on error.
*/
static MonoInst*
-handle_box (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_used)
+handle_box (MonoCompile *cfg, MonoInst *val, MonoClass *klass, int context_used, MonoBasicBlock **out_cbb)
{
MonoInst *alloc, *ins;
+ *out_cbb = cfg->cbb;
+
if (mono_class_is_nullable (klass)) {
MonoMethod* method = mono_class_get_method_from_name (klass, "Box", 1);
return mono_emit_calli (cfg, mono_method_signature (method), &val, addr, NULL, rgctx);
} else {
- return mono_emit_method_call (cfg, method, &val, NULL);
+ gboolean pass_vtable, pass_mrgctx;
+ MonoInst *rgctx_arg = NULL;
+
+ check_method_sharing (cfg, method, &pass_vtable, &pass_mrgctx);
+ g_assert (!pass_mrgctx);
+
+ if (pass_vtable) {
+ MonoVTable *vtable = mono_class_vtable (cfg->domain, method->klass);
+
+ g_assert (vtable);
+ EMIT_NEW_VTABLECONST (cfg, rgctx_arg, vtable);
+ }
+
+ return mono_emit_method_call_full (cfg, method, NULL, FALSE, &val, NULL, NULL, rgctx_arg);
}
}
if (mini_is_gsharedvt_klass (cfg, klass)) {
- MonoBasicBlock *is_ref_bb, *end_bb;
+ MonoBasicBlock *is_ref_bb, *is_nullable_bb, *end_bb;
MonoInst *res, *is_ref, *src_var, *addr;
int addr_reg, dreg;
dreg = alloc_ireg (cfg);
NEW_BBLOCK (cfg, is_ref_bb);
+ NEW_BBLOCK (cfg, is_nullable_bb);
NEW_BBLOCK (cfg, end_bb);
- is_ref = emit_get_rgctx_klass (cfg, context_used, klass,
- MONO_RGCTX_INFO_CLASS_IS_REF);
+ is_ref = emit_get_gsharedvt_info_klass (cfg, klass, MONO_RGCTX_INFO_CLASS_BOX_TYPE);
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, is_ref->dreg, 1);
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, is_ref_bb);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, is_ref->dreg, 2);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, is_nullable_bb);
+
/* Non-ref case */
alloc = handle_alloc (cfg, klass, TRUE, context_used);
if (!alloc)
MONO_EMIT_NEW_LOAD_MEMBASE (cfg, dreg, addr->dreg, 0);
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+ /* Nullable case */
+ MONO_START_BB (cfg, is_nullable_bb);
+
+ {
+ MonoInst *addr = emit_get_gsharedvt_info_klass (cfg, klass,
+ MONO_RGCTX_INFO_NULLABLE_CLASS_BOX);
+ MonoInst *box_call;
+ MonoMethodSignature *box_sig;
+
+ /*
+ * klass is Nullable<T>, need to call Nullable<T>.Box () using a gsharedvt signature, but we cannot
+ * construct that method at JIT time, so have to do things by hand.
+ */
+ box_sig = mono_mempool_alloc0 (cfg->mempool, MONO_SIZEOF_METHOD_SIGNATURE + (1 * sizeof (MonoType *)));
+ box_sig->ret = &mono_defaults.object_class->byval_arg;
+ box_sig->param_count = 1;
+ box_sig->params [0] = &klass->byval_arg;
+ box_call = mono_emit_calli (cfg, box_sig, &val, addr, NULL, NULL);
+ EMIT_NEW_UNALU (cfg, res, OP_MOVE, dreg, box_call->dreg);
+ res->type = STACK_OBJ;
+ res->klass = klass;
+ }
+
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+
MONO_START_BB (cfg, end_bb);
+ *out_cbb = cfg->cbb;
+
return res;
} else {
alloc = handle_alloc (cfg, klass, TRUE, context_used);
if (context_used) {
MonoInst *args [3];
- if(mini_class_has_reference_variant_generic_argument (cfg, klass, context_used)) {
+ if(mini_class_has_reference_variant_generic_argument (cfg, klass, context_used) || is_complex_isinst (klass)) {
MonoMethod *mono_castclass = mono_marshal_get_castclass_with_cache ();
MonoInst *cache_ins;
}
klass_inst = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS);
-
- if (is_complex_isinst (klass)) {
- /* Complex case, handle by an icall */
-
- /* obj */
- args [0] = src;
-
- /* klass */
- args [1] = klass_inst;
-
- return mono_emit_jit_icall (cfg, mono_object_castclass, args);
- } else {
- /* Simple case, handled by the code below */
- }
}
NEW_BBLOCK (cfg, is_null_bb);
if (context_used) {
MonoInst *args [3];
- if(mini_class_has_reference_variant_generic_argument (cfg, klass, context_used)) {
+ if(mini_class_has_reference_variant_generic_argument (cfg, klass, context_used) || is_complex_isinst (klass)) {
MonoMethod *mono_isinst = mono_marshal_get_isinst_with_cache ();
MonoInst *cache_ins;
}
klass_inst = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS);
-
- if (is_complex_isinst (klass)) {
- /* Complex case, handle by an icall */
-
- /* obj */
- args [0] = src;
-
- /* klass */
- args [1] = klass_inst;
-
- return mono_emit_jit_icall (cfg, mono_object_isinst, args);
- } else {
- /* Simple case, the code below can handle it */
- }
}
NEW_BBLOCK (cfg, is_null_bb);
g_assert (cfg->generic_sharing_context);
context_used = mini_class_check_context_used (cfg, klass);
g_assert (context_used);
- rgctx_ins = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE);
+ rgctx_ins = emit_get_gsharedvt_info (cfg, &klass->byval_arg, MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE);
MONO_EMIT_NEW_BIALU (cfg, OP_IMUL, mult_reg, index2_reg, rgctx_ins->dreg);
} else {
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_MUL_IMM, mult_reg, index2_reg, size);
} else
return NULL;
} else if (cmethod->klass == mono_defaults.array_class) {
- if (strcmp (cmethod->name + 1, "etGenericValueImpl") == 0)
+ if (!cfg->gsharedvt && strcmp (cmethod->name + 1, "etGenericValueImpl") == 0)
return emit_array_generic_access (cfg, fsig, args, *cmethod->name == 'S');
#ifndef MONO_BIG_ARRAYS
g_assert (vtable); /*Should not fail since it System.String*/
#ifndef MONO_CROSS_COMPILE
- managed_alloc = mono_gc_get_managed_allocator (vtable, FALSE);
+ managed_alloc = mono_gc_get_managed_allocator (method->klass, FALSE);
#endif
if (!managed_alloc)
return NULL;
link_bblock (cfg, start_bblock, bblock);
}
+ if (cfg->gsharedvt && cfg->method == method) {
+ MonoGSharedVtMethodInfo *info;
+ MonoInst *var, *locals_var;
+ int dreg;
+
+ info = mono_mempool_alloc0 (cfg->mempool, sizeof (MonoGSharedVtMethodInfo));
+ info->method = cfg->method;
+ // FIXME: Free this
+ info->entries = g_ptr_array_new ();
+ cfg->gsharedvt_info = info;
+
+ var = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+ /* prevent it from being register allocated */
+ //var->flags |= MONO_INST_INDIRECT;
+ cfg->gsharedvt_info_var = var;
+
+ ins = emit_get_rgctx_gsharedvt_method (cfg, mini_method_check_context_used (cfg, method), method, info);
+ MONO_EMIT_NEW_UNALU (cfg, OP_MOVE, var->dreg, ins->dreg);
+
+ /* Allocate locals */
+ locals_var = mono_compile_create_var (cfg, &mono_defaults.int_class->byval_arg, OP_LOCAL);
+ /* prevent it from being register allocated */
+ //locals_var->flags |= MONO_INST_INDIRECT;
+ cfg->gsharedvt_locals_var = locals_var;
+
+ dreg = alloc_ireg (cfg);
+ MONO_EMIT_NEW_LOAD_MEMBASE_OP (cfg, OP_LOADI4_MEMBASE, dreg, var->dreg, G_STRUCT_OFFSET (MonoGSharedVtMethodRuntimeInfo, locals_size));
+
+ MONO_INST_NEW (cfg, ins, OP_LOCALLOC);
+ ins->dreg = locals_var->dreg;
+ ins->sreg1 = dreg;
+ MONO_ADD_INS (cfg->cbb, ins);
+ cfg->gsharedvt_locals_var_ins = ins;
+
+ cfg->flags |= MONO_CFG_HAS_ALLOCA;
+ /*
+ if (init_locals)
+ ins->flags |= MONO_INST_INIT;
+ */
+ }
+
/* at this point we know, if security is TRUE, that some code needs to be generated */
if (security && (cfg->method == method)) {
MonoInst *args [2];
MonoInst *vtable_arg = NULL;
gboolean check_this = FALSE;
gboolean supported_tail_call = FALSE;
+ gboolean tail_call = FALSE;
gboolean need_seq_point = FALSE;
guint32 call_opcode = *ip;
gboolean emit_widen = TRUE;
/*
* Constrained calls need to behave differently at runtime dependending on whenever the receiver is instantiated as ref type or as a vtype.
*/
- /* Special case Object:ToString () as its easy to implement */
- if (cmethod->klass == mono_defaults.object_class && !strcmp (cmethod->name, "ToString")) {
- MonoInst *args [3];
+ /* Special case Object methods as they are easy to implement */
+ if (cmethod->klass == mono_defaults.object_class) {
+ MonoInst *args [16];
args [0] = sp [0];
EMIT_NEW_METHODCONST (cfg, args [1], cmethod);
args [2] = emit_get_rgctx_klass (cfg, mono_class_check_context_used (constrained_call), constrained_call, MONO_RGCTX_INFO_KLASS);
- ins = mono_emit_jit_icall (cfg, mono_object_tostring_gsharedvt, args);
- goto call_end;
- } else if (cmethod->klass == mono_defaults.object_class && !strcmp (cmethod->name, "GetHashCode")) {
- MonoInst *args [3];
- args [0] = sp [0];
- EMIT_NEW_METHODCONST (cfg, args [1], cmethod);
- args [2] = emit_get_rgctx_klass (cfg, mono_class_check_context_used (constrained_call), constrained_call, MONO_RGCTX_INFO_KLASS);
- ins = mono_emit_jit_icall (cfg, mono_object_gethashcode_gsharedvt, args);
+ if (!strcmp (cmethod->name, "ToString")) {
+ ins = mono_emit_jit_icall (cfg, mono_object_tostring_gsharedvt, args);
+ } else if (!strcmp (cmethod->name, "Equals")) {
+ args [3] = sp [1];
+ ins = mono_emit_jit_icall (cfg, mono_object_equals_gsharedvt, args);
+ } else if (!strcmp (cmethod->name, "GetHashCode")) {
+ ins = mono_emit_jit_icall (cfg, mono_object_gethashcode_gsharedvt, args);
+ } else {
+ GSHAREDVT_FAILURE (*ip);
+ }
goto call_end;
} else if (constrained_call->valuetype && cmethod->klass->valuetype) {
/* The 'Own method' case below */
*/
EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_call->byval_arg, sp [0]->dreg, 0);
ins->klass = constrained_call;
- sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call));
- bblock = cfg->cbb;
+ sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call), &bblock);
CHECK_CFG_EXCEPTION;
} else if (!constrained_call->valuetype) {
int dreg = alloc_ireg_ref (cfg);
/* Enum implements some interfaces, so treat this as the first case */
EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &constrained_call->byval_arg, sp [0]->dreg, 0);
ins->klass = constrained_call;
- sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call));
- bblock = cfg->cbb;
+ sp [0] = handle_box (cfg, ins, constrained_call, mono_class_check_context_used (constrained_call), &bblock);
CHECK_CFG_EXCEPTION;
}
}
CHECK_TYPELOAD (cmethod->klass);
}
- if (cmethod && ((cmethod->flags & METHOD_ATTRIBUTE_STATIC) || cmethod->klass->valuetype) &&
- (cmethod->klass->generic_class || cmethod->klass->generic_container)) {
- gboolean sharable = FALSE;
-
- if (mono_method_is_generic_sharable (cmethod, TRUE)) {
- sharable = TRUE;
- } else {
- gboolean sharing_enabled = mono_class_generic_sharing_enabled (cmethod->klass);
- MonoGenericContext *context = mini_class_get_context (cmethod->klass);
- gboolean context_sharable = mono_generic_context_is_sharable (context, TRUE);
-
- sharable = sharing_enabled && context_sharable;
- }
-
- /*
- * Pass vtable iff target method might
- * be shared, which means that sharing
- * is enabled for its class and its
- * context is sharable (and it's not a
- * generic method).
- */
- if (sharable && !(mini_method_get_context (cmethod) && mini_method_get_context (cmethod)->method_inst))
- pass_vtable = TRUE;
- }
-
- if (cmethod && mini_method_get_context (cmethod) &&
- mini_method_get_context (cmethod)->method_inst) {
- g_assert (!pass_vtable);
-
- if (mono_method_is_generic_sharable (cmethod, TRUE)) {
- pass_mrgctx = TRUE;
- } else {
- gboolean sharing_enabled = mono_class_generic_sharing_enabled (cmethod->klass);
- MonoGenericContext *context = mini_method_get_context (cmethod);
- gboolean context_sharable = mono_generic_context_is_sharable (context, TRUE);
-
- if (sharing_enabled && context_sharable)
- pass_mrgctx = TRUE;
- if (cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, fsig))
- pass_mrgctx = TRUE;
- }
- }
+ if (cmethod)
+ check_method_sharing (cfg, cmethod, &pass_vtable, &pass_mrgctx);
if (cfg->generic_sharing_context && cmethod) {
MonoGenericContext *cmethod_context = mono_method_get_context (cmethod);
g_assert (cmethod->is_inflated);
imt_arg = emit_get_rgctx_method (cfg, context_used,
cmethod, MONO_RGCTX_INFO_METHOD);
- ins = mono_emit_method_call_full (cfg, cmethod, fsig, sp, sp [0], imt_arg, NULL);
+ ins = mono_emit_method_call_full (cfg, cmethod, fsig, FALSE, sp, sp [0], imt_arg, NULL);
} else {
this_temp = mono_compile_create_var (cfg, type_from_stack_type (sp [0]), OP_LOCAL);
NEW_TEMPSTORE (cfg, store, this_temp->inst_c0, sp [0]);
/* FIXME: Enabling TAILC breaks some inlining/stack trace/etc tests */
/* FIXME: runtime generic context pointer for jumps? */
/* FIXME: handle this for generic sharing eventually */
- if (cmethod &&
- ((((ins_flag & MONO_INST_TAILCALL) && (call_opcode == CEE_CALL))
- ))//|| ((cfg->opt & MONO_OPT_TAILC) && *ip == CEE_CALL && ip [5] == CEE_RET))
- && !vtable_arg && !cfg->generic_sharing_context && is_supported_tail_call (cfg, method, cmethod, fsig))
+ if (cmethod && (ins_flag & MONO_INST_TAILCALL) &&
+ !vtable_arg && !cfg->generic_sharing_context && is_supported_tail_call (cfg, method, cmethod, fsig))
supported_tail_call = TRUE;
+ if (supported_tail_call) {
+ if (call_opcode != CEE_CALL)
+ supported_tail_call = FALSE;
+ }
+
if (supported_tail_call) {
MonoCallInst *call;
//printf ("HIT: %s -> %s\n", mono_method_full_name (cfg->method, TRUE), mono_method_full_name (cmethod, TRUE));
-#ifdef MONO_ARCH_USE_OP_TAIL_CALL
- /* Handle tail calls similarly to calls */
- call = mono_emit_call_args (cfg, mono_method_signature (cmethod), sp, FALSE, FALSE, TRUE, FALSE, FALSE);
-#else
- MONO_INST_NEW_CALL (cfg, call, OP_JMP);
- call->tail_call = TRUE;
- call->method = cmethod;
- call->signature = mono_method_signature (cmethod);
-
- /*
- * We implement tail calls by storing the actual arguments into the
- * argument variables, then emitting a CEE_JMP.
- */
- for (i = 0; i < n; ++i) {
- /* Prevent argument from being register allocated */
- arg_array [i]->flags |= MONO_INST_VOLATILE;
- EMIT_NEW_ARGSTORE (cfg, ins, i, sp [i]);
- }
-#endif
+ if (ARCH_USE_OP_TAIL_CALL) {
+ /* Handle tail calls similarly to normal calls */
+ tail_call = TRUE;
+ } else {
+ MONO_INST_NEW_CALL (cfg, call, OP_JMP);
+ call->tail_call = TRUE;
+ call->method = cmethod;
+ call->signature = mono_method_signature (cmethod);
- ins = (MonoInst*)call;
- ins->inst_p0 = cmethod;
- ins->inst_p1 = arg_array [0];
- MONO_ADD_INS (bblock, ins);
- link_bblock (cfg, bblock, end_bblock);
- start_new_bblock = 1;
+ /*
+ * We implement tail calls by storing the actual arguments into the
+ * argument variables, then emitting a CEE_JMP.
+ */
+ for (i = 0; i < n; ++i) {
+ /* Prevent argument from being register allocated */
+ arg_array [i]->flags |= MONO_INST_VOLATILE;
+ EMIT_NEW_ARGSTORE (cfg, ins, i, sp [i]);
+ }
+ ins = (MonoInst*)call;
+ ins->inst_p0 = cmethod;
+ ins->inst_p1 = arg_array [0];
+ MONO_ADD_INS (bblock, ins);
+ link_bblock (cfg, bblock, end_bblock);
+ start_new_bblock = 1;
- // FIXME: Eliminate unreachable epilogs
+ // FIXME: Eliminate unreachable epilogs
- /*
- * OP_TAILCALL has no return value, so skip the CEE_RET if it is
- * only reachable from this call.
- */
- GET_BBLOCK (cfg, tblock, ip + 5);
- if (tblock == bblock || tblock->in_count == 0)
- skip_ret = TRUE;
- push_res = FALSE;
+ /*
+ * OP_TAILCALL has no return value, so skip the CEE_RET if it is
+ * only reachable from this call.
+ */
+ GET_BBLOCK (cfg, tblock, ip + 5);
+ if (tblock == bblock || tblock->in_count == 0)
+ skip_ret = TRUE;
+ push_res = FALSE;
- goto call_end;
+ goto call_end;
+ }
}
/*
/* Common call */
INLINE_FAILURE ("call");
- ins = mono_emit_method_call_full (cfg, cmethod, fsig, sp, virtual ? sp [0] : NULL,
+ ins = mono_emit_method_call_full (cfg, cmethod, fsig, tail_call, sp, virtual ? sp [0] : NULL,
imt_arg, vtable_arg);
+ if (tail_call) {
+ link_bblock (cfg, bblock, end_bblock);
+ start_new_bblock = 1;
+
+ // FIXME: Eliminate unreachable epilogs
+
+ /*
+ * OP_TAILCALL has no return value, so skip the CEE_RET if it is
+ * only reachable from this call.
+ */
+ GET_BBLOCK (cfg, tblock, ip + 5);
+ if (tblock == bblock || tblock->in_count == 0)
+ skip_ret = TRUE;
+ push_res = FALSE;
+ }
+
call_end:
/* End of call, INS should contain the result of the call, if any */
/* we simply pass a null pointer */
EMIT_NEW_PCONST (cfg, *sp, NULL);
/* now call the string ctor */
- alloc = mono_emit_method_call_full (cfg, cmethod, fsig, sp, NULL, NULL, NULL);
+ alloc = mono_emit_method_call_full (cfg, cmethod, fsig, FALSE, sp, NULL, NULL, NULL);
} else {
MonoInst* callvirt_this_arg = NULL;
// FIXME-VT: Clean this up
if (cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, fsig))
GSHAREDVT_FAILURE(*ip);
- mono_emit_method_call_full (cfg, cmethod, fsig, sp, callvirt_this_arg, NULL, NULL);
+ mono_emit_method_call_full (cfg, cmethod, fsig, FALSE, sp, callvirt_this_arg, NULL, NULL);
}
} else if (cfg->gsharedvt && mini_is_gsharedvt_signature (cfg, fsig)) {
MonoInst *addr;
mono_emit_calli (cfg, fsig, sp, cmethod_addr, NULL, vtable_arg);
} else {
INLINE_FAILURE ("ctor call");
- ins = mono_emit_method_call_full (cfg, cmethod, fsig, sp,
+ ins = mono_emit_method_call_full (cfg, cmethod, fsig, FALSE, sp,
callvirt_this_arg, NULL, vtable_arg);
}
}
context_used = mini_class_check_context_used (cfg, klass);
if (mini_is_gsharedvt_klass (cfg, klass)) {
- MonoInst *obj, *addr, *klass_inst, *is_ref, *args[16];
- MonoBasicBlock *is_ref_bb, *end_bb;
- int dreg, addr_reg;
-
- /* Need to check for nullable types at runtime, but those are disabled in mini_is_gsharedvt_sharable_method*/
- if (mono_class_is_nullable (klass))
- GSHAREDVT_FAILURE (*ip);
-
- obj = *sp;
-
- klass_inst = emit_get_rgctx_klass (cfg, context_used, klass, MONO_RGCTX_INFO_KLASS);
-
- /* obj */
- args [0] = obj;
-
- /* klass */
- args [1] = klass_inst;
-
- /* CASTCLASS */
- obj = mono_emit_jit_icall (cfg, mono_object_castclass, args);
-
- NEW_BBLOCK (cfg, is_ref_bb);
- NEW_BBLOCK (cfg, end_bb);
- is_ref = emit_get_rgctx_klass (cfg, context_used, klass,
- MONO_RGCTX_INFO_CLASS_IS_REF);
- MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, is_ref->dreg, 1);
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, is_ref_bb);
-
- /* This will contain either the address of the unboxed vtype, or an address of the temporary where the ref is stored */
- addr_reg = alloc_dreg (cfg, STACK_MP);
-
- /* Non-ref case */
- /* UNBOX */
- NEW_BIALU_IMM (cfg, addr, OP_ADD_IMM, addr_reg, obj->dreg, sizeof (MonoObject));
- MONO_ADD_INS (cfg->cbb, addr);
-
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
-
- /* Ref case */
- MONO_START_BB (cfg, is_ref_bb);
-
- /* Save the ref to a temporary */
- dreg = alloc_ireg (cfg);
- EMIT_NEW_VARLOADA_VREG (cfg, addr, dreg, &klass->byval_arg);
- addr->dreg = addr_reg;
- MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, addr->dreg, 0, obj->dreg);
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
-
- MONO_START_BB (cfg, end_bb);
- bblock = cfg->cbb;
-
- /* LDOBJ */
- EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, ins, &klass->byval_arg, addr_reg, 0);
- *sp++ = ins;
+ *sp = handle_unbox_gsharedvt (cfg, context_used, klass, *sp, &bblock);
+ sp ++;
ip += 5;
inline_costs += 2;
break;
}
- *sp++ = handle_box (cfg, val, klass, context_used);
- bblock = cfg->cbb;
+ *sp++ = handle_box (cfg, val, klass, context_used, &bblock);
CHECK_CFG_EXCEPTION;
ip += 5;
context_used = mini_class_check_context_used (cfg, klass);
- offset_ins = emit_get_rgctx_field (cfg, context_used, field, MONO_RGCTX_INFO_FIELD_OFFSET);
+ offset_ins = emit_get_gsharedvt_info (cfg, field, MONO_RGCTX_INFO_FIELD_OFFSET);
dreg = alloc_ireg_mp (cfg);
EMIT_NEW_BIALU (cfg, ins, OP_PADD, dreg, sp [0]->dreg, offset_ins->dreg);
/* The decomposition will call mini_emit_stobj () which will emit a wbarrier if needed */
if (mini_is_gsharedvt_klass (cfg, klass)) {
MonoInst *offset_ins;
- offset_ins = emit_get_rgctx_field (cfg, context_used, field, MONO_RGCTX_INFO_FIELD_OFFSET);
+ offset_ins = emit_get_gsharedvt_info (cfg, field, MONO_RGCTX_INFO_FIELD_OFFSET);
EMIT_NEW_BIALU (cfg, ins, OP_PADD, dreg, sp [0]->dreg, offset_ins->dreg);
} else {
EMIT_NEW_BIALU_IMM (cfg, ins, OP_PADD_IMM, dreg, sp [0]->dreg, foffset);
if (mini_is_gsharedvt_klass (cfg, klass)) {
MonoInst *offset_ins;
- offset_ins = emit_get_rgctx_field (cfg, context_used, field, MONO_RGCTX_INFO_FIELD_OFFSET);
+ offset_ins = emit_get_gsharedvt_info (cfg, field, MONO_RGCTX_INFO_FIELD_OFFSET);
dreg = alloc_ireg_mp (cfg);
EMIT_NEW_BIALU (cfg, ins, OP_PADD, dreg, sp [0]->dreg, offset_ins->dreg);
EMIT_NEW_LOAD_MEMBASE_TYPE (cfg, load, field->type, dreg, 0);
lmf_ins = mono_get_lmf_intrinsic (cfg);
#endif
-#ifdef MONO_ARCH_HAVE_TLS_GET
if (MONO_ARCH_HAVE_TLS_GET && ad_ins && lmf_ins) {
NEW_BBLOCK (cfg, next_bb);
MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, lmf_ins->dreg, 0);
MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_PBNE_UN, next_bb);
}
-#endif
if (cfg->compile_aot) {
/* AOT code is only used in the root domain */
#endif
/* Arguments are implicitly global */
/* Putting R4 vars into registers doesn't work currently */
- if ((var->opcode != OP_ARG) && (var != cfg->ret) && !(var->flags & (MONO_INST_VOLATILE|MONO_INST_INDIRECT)) && (vreg_to_bb [var->dreg] != -1) && (var->klass->byval_arg.type != MONO_TYPE_R4) && !cfg->disable_vreg_to_lvreg) {
+ /* The gsharedvt vars are implicitly referenced by ldaddr opcodes, but those opcodes are only generated later */
+ if ((var->opcode != OP_ARG) && (var != cfg->ret) && !(var->flags & (MONO_INST_VOLATILE|MONO_INST_INDIRECT)) && (vreg_to_bb [var->dreg] != -1) && (var->klass->byval_arg.type != MONO_TYPE_R4) && !cfg->disable_vreg_to_lvreg && var != cfg->gsharedvt_info_var && var != cfg->gsharedvt_locals_var) {
/*
* Make that the variable's liveness interval doesn't contain a call, since
* that would cause the lvreg to be spilled, making the whole optimization
guint32 stacktypes [128];
MonoInst **live_range_start, **live_range_end;
MonoBasicBlock **live_range_start_bb, **live_range_end_bb;
+ int *gsharedvt_vreg_to_idx = NULL;
*need_local_opts = FALSE;
ins->flags |= MONO_INST_GC_TRACK;
}
}
+
+ if (cfg->gsharedvt) {
+ gsharedvt_vreg_to_idx = g_new0 (int, cfg->next_vreg);
+
+ for (i = 0; i < cfg->num_varinfo; ++i) {
+ MonoInst *ins = cfg->varinfo [i];
+ int idx;
+
+ if (mini_is_gsharedvt_variable_type (cfg, ins->inst_vtype)) {
+ if (i >= cfg->locals_start) {
+ /* Local */
+ idx = get_gsharedvt_info_slot (cfg, ins->inst_vtype, MONO_RGCTX_INFO_LOCAL_OFFSET);
+ gsharedvt_vreg_to_idx [ins->dreg] = idx + 1;
+ ins->opcode = OP_GSHAREDVT_LOCAL;
+ ins->inst_imm = idx;
+ } else {
+ /* Arg */
+ gsharedvt_vreg_to_idx [ins->dreg] = -1;
+ ins->opcode = OP_GSHAREDVT_ARG_REGOFFSET;
+ }
+ }
+ }
+ }
/* FIXME: widening and truncation */
ins->inst_offset = vtaddr->inst_offset;
} else
NOT_IMPLEMENTED;
+ } else if (cfg->gsharedvt && gsharedvt_vreg_to_idx [var->dreg] < 0) {
+ /* gsharedvt arg passed by ref */
+ g_assert (var->opcode == OP_GSHAREDVT_ARG_REGOFFSET);
+
+ ins->opcode = OP_LOAD_MEMBASE;
+ ins->inst_basereg = var->inst_basereg;
+ ins->inst_offset = var->inst_offset;
+ } else if (cfg->gsharedvt && gsharedvt_vreg_to_idx [var->dreg]) {
+ MonoInst *load, *load2, *load3;
+ int idx = gsharedvt_vreg_to_idx [var->dreg] - 1;
+ int reg1, reg2, reg3;
+ MonoInst *info_var = cfg->gsharedvt_info_var;
+ MonoInst *locals_var = cfg->gsharedvt_locals_var;
+
+ /*
+ * gsharedvt local.
+ * Compute the address of the local as gsharedvt_locals_var + gsharedvt_info_var->locals_offsets [idx].
+ */
+
+ g_assert (var->opcode == OP_GSHAREDVT_LOCAL);
+
+ g_assert (info_var);
+ g_assert (locals_var);
+
+ /* Mark the instruction used to compute the locals var as used */
+ cfg->gsharedvt_locals_var_ins = NULL;
+
+ /* Load the offset */
+ if (info_var->opcode == OP_REGOFFSET) {
+ reg1 = alloc_ireg (cfg);
+ NEW_LOAD_MEMBASE (cfg, load, OP_LOAD_MEMBASE, reg1, info_var->inst_basereg, info_var->inst_offset);
+ } else if (info_var->opcode == OP_REGVAR) {
+ load = NULL;
+ reg1 = info_var->dreg;
+ } else {
+ g_assert_not_reached ();
+ }
+ reg2 = alloc_ireg (cfg);
+ NEW_LOAD_MEMBASE (cfg, load2, OP_LOADI4_MEMBASE, reg2, reg1, G_STRUCT_OFFSET (MonoGSharedVtMethodRuntimeInfo, entries) + (idx * sizeof (gpointer)));
+ /* Load the locals area address */
+ reg3 = alloc_ireg (cfg);
+ if (locals_var->opcode == OP_REGOFFSET) {
+ NEW_LOAD_MEMBASE (cfg, load3, OP_LOAD_MEMBASE, reg3, locals_var->inst_basereg, locals_var->inst_offset);
+ } else if (locals_var->opcode == OP_REGVAR) {
+ NEW_UNALU (cfg, load3, OP_MOVE, reg3, locals_var->dreg);
+ } else {
+ g_assert_not_reached ();
+ }
+ /* Compute the address */
+ ins->opcode = OP_PADD;
+ ins->sreg1 = reg3;
+ ins->sreg2 = reg2;
+
+ mono_bblock_insert_before_ins (bb, ins, load3);
+ mono_bblock_insert_before_ins (bb, load3, load2);
+ if (load)
+ mono_bblock_insert_before_ins (bb, load2, load);
} else {
g_assert (var->opcode == OP_REGOFFSET);
}
#endif
+ if (cfg->gsharedvt_locals_var_ins) {
+ /* Nullify if unused */
+ cfg->gsharedvt_locals_var_ins->opcode = OP_PCONST;
+ cfg->gsharedvt_locals_var_ins->inst_imm = 0;
+ }
+
g_free (live_range_start);
g_free (live_range_end);
g_free (live_range_start_bb);
return class1;
}
#ifdef __native_client_codegen__
-const guint kNaClAlignment = kNaClAlignmentAMD64;
-const guint kNaClAlignmentMask = kNaClAlignmentMaskAMD64;
/* Default alignment for Native Client is 32-byte. */
gint8 nacl_align_byte = -32; /* signed version of 0xe0 */
jinfo = g_hash_table_lookup (cfg->abs_patches, data);
if (jinfo) {
if (jinfo->type == MONO_PATCH_INFO_JIT_ICALL_ADDR) {
- if ((((guint64)data) >> 32) == 0)
+ MonoJitICallInfo *mi = mono_find_jit_icall_by_name (jinfo->data.name);
+ if (mi && (((guint64)mi->func) >> 32) == 0)
near_call = TRUE;
no_patch = TRUE;
} else {
}
offset = code - cfg->native_code;
- mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, ins->inst_p0);
+ mono_add_patch_info (cfg, code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, call->method);
if (cfg->compile_aot)
amd64_mov_reg_membase (code, AMD64_R11, AMD64_RIP, 0, 8);
else
code = mono_amd64_emit_tls_get (code, ins->dreg, ins->inst_offset);
break;
}
+ case OP_TLS_GET_REG:
+#ifdef TARGET_OSX
+ // FIXME: tls_gs_offset can change too, do these when calculating the tls offset
+ if (ins->dreg != ins->sreg1)
+ amd64_mov_reg_reg (code, ins->dreg, ins->sreg1, sizeof (gpointer));
+ amd64_shift_reg_imm (code, X86_SHL, ins->dreg, 3);
+ if (tls_gs_offset)
+ amd64_alu_reg_imm (code, X86_ADD, ins->dreg, tls_gs_offset);
+ x86_prefix (code, X86_GS_PREFIX);
+ amd64_mov_reg_membase (code, ins->dreg, ins->dreg, 0, sizeof (gpointer));
+#else
+ g_assert_not_reached ();
+#endif
+ break;
case OP_MEMORY_BARRIER: {
switch (ins->backend.memory_barrier_kind) {
case StoreLoadBarrier:
#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
#define MONO_ARCH_HAVE_CREATE_LLVM_NATIVE_THUNK 1
+#ifdef TARGET_OSX
+#define MONO_ARCH_HAVE_TLS_GET_REG 1
+#endif
+
gboolean
mono_amd64_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
#include "mini.h"
#include <string.h>
+#if !defined(__APPLE__) && !defined(PLATFORM_ANDROID)
+#include <sys/auxv.h>
+#endif
+
#include <mono/metadata/appdomain.h>
#include <mono/metadata/debug-helpers.h>
#include <mono/utils/mono-mmap.h>
#include "mini-gc.h"
#include "mono/arch/arm/arm-vfp-codegen.h"
+/* Sanity check: This makes no sense */
+#if defined(ARM_FPU_NONE) && (defined(ARM_FPU_VFP) || defined(ARM_FPU_VFP_HARD))
+#error "ARM_FPU_NONE is defined while one of ARM_FPU_VFP/ARM_FPU_VFP_HARD is defined"
+#endif
+
#if defined(__ARM_EABI__) && defined(__linux__) && !defined(PLATFORM_ANDROID) && !defined(__native_client__)
#define HAVE_AEABI_READ_TP 1
#endif
#define mono_mini_arch_unlock() LeaveCriticalSection (&mini_arch_mutex)
static CRITICAL_SECTION mini_arch_mutex;
-static int v5_supported = 0;
-static int v6_supported = 0;
-static int v7_supported = 0;
-static int v7s_supported = 0;
-static int thumb_supported = 0;
-static int thumb2_supported = 0;
+static gboolean v5_supported = FALSE;
+static gboolean v6_supported = FALSE;
+static gboolean v7_supported = FALSE;
+static gboolean v7s_supported = FALSE;
+static gboolean thumb_supported = FALSE;
+static gboolean thumb2_supported = FALSE;
/*
* Whenever to use the ARM EABI
*/
-static int eabi_supported = 0;
+static gboolean eabi_supported = FALSE;
/*
* Whenever we are on arm/darwin aka the iphone.
*/
-static int darwin = 0;
+static gboolean darwin = FALSE;
/*
* Whenever to use the iphone ABI extensions:
* http://developer.apple.com/library/ios/documentation/Xcode/Conceptual/iPhoneOSABIReference/index.html
* This is required for debugging/profiling tools to work, but it has some overhead so it should
* only be turned on in debug builds.
*/
-static int iphone_abi = 0;
+static gboolean iphone_abi = FALSE;
/*
* The FPU we are generating code for. This is NOT runtime configurable right now,
#if defined(__ARM_EABI__)
eabi_supported = TRUE;
#endif
-#if defined(__APPLE__) && defined(MONO_CROSS_COMPILE)
+#if defined(__APPLE__)
i8_align = 4;
#else
i8_align = __alignof__ (gint64);
mono_arch_cpu_optimizations (guint32 *exclude_mask)
{
guint32 opts = 0;
+
+ /* Format: armv(5|6|7[s])[-thumb[2]] */
const char *cpu_arch = getenv ("MONO_CPU_ARCH");
if (cpu_arch != NULL) {
- thumb_supported = strstr (cpu_arch, "thumb") != NULL;
if (strncmp (cpu_arch, "armv", 4) == 0) {
v5_supported = cpu_arch [4] >= '5';
v6_supported = cpu_arch [4] >= '6';
v7_supported = cpu_arch [4] >= '7';
+ v7s_supported = strncmp (cpu_arch, "armv7s", 6) == 0;
}
+ thumb_supported = strstr (cpu_arch, "thumb") != NULL;
+ thumb2_supported = strstr (cpu_arch, "thumb2") != NULL;
} else {
#if __APPLE__
thumb_supported = TRUE;
v5_supported = TRUE;
darwin = TRUE;
iphone_abi = TRUE;
-#else
+#elif defined(PLATFORM_ANDROID)
+ /* Android is awesome and doesn't make most of /proc (including
+ * /proc/self/auxv) available to regular processes. So we use
+ * /proc/cpuinfo instead.... */
char buf [512];
char *line;
FILE *file = fopen ("/proc/cpuinfo", "r");
while ((line = fgets (buf, 512, file))) {
if (strncmp (line, "Processor", 9) == 0) {
char *ver = strstr (line, "(v");
- if (ver && (ver [2] == '5' || ver [2] == '6' || ver [2] == '7'))
- v5_supported = TRUE;
- if (ver && (ver [2] == '6' || ver [2] == '7'))
- v6_supported = TRUE;
- if (ver && (ver [2] == '7'))
- v7_supported = TRUE;
+ if (ver) {
+ if (ver [2] >= '5')
+ v5_supported = TRUE;
+ if (ver [2] >= '6')
+ v6_supported = TRUE;
+ if (ver [2] >= '7')
+ v7_supported = TRUE;
+ /* TODO: Find a way to detect v7s. */
+ }
continue;
}
if (strncmp (line, "Features", 8) == 0) {
+ /* TODO: Find a way to detect Thumb 2. */
char *th = strstr (line, "thumb");
if (th) {
thumb_supported = TRUE;
continue;
}
}
+
fclose (file);
/*printf ("features: v5: %d, thumb: %d\n", v5_supported, thumb_supported);*/
}
+#else
+ /* This solution is neat because it uses the dynamic linker
+ * instead of the kernel. Thus, it works in QEMU chroots. */
+ unsigned long int hwcap;
+ unsigned long int platform;
+
+ if ((hwcap = getauxval(AT_HWCAP))) {
+ /* We use hardcoded values to avoid depending on a
+ * specific version of the hwcap.h header. */
+
+ /* HWCAP_ARM_THUMB */
+ if ((hwcap & 4) != 0)
+ /* TODO: Find a way to detect Thumb 2. */
+ thumb_supported = TRUE;
+ }
+
+ if ((platform = getauxval(AT_PLATFORM))) {
+ /* Actually a pointer to the platform string. */
+ const char *str = (const char *) platform;
+
+ /* Possible CPU name values (from kernel sources):
+ *
+ * - v4
+ * - v5
+ * - v5t
+ * - v6
+ * - v7
+ *
+ * Value is suffixed with the endianness ('b' or 'l').
+ * We only support little endian anyway.
+ */
+
+ if (str [1] >= '5')
+ v5_supported = TRUE;
+
+ if (str [1] >= '6')
+ v6_supported = TRUE;
+
+ if (str [1] >= '7')
+ v7_supported = TRUE;
+
+ /* TODO: Find a way to detect v7s. */
+ }
+
+ /*printf ("hwcap = %i, platform = %s\n", (int) hwcap, (const char *) platform);
+ printf ("thumb = %i, thumb2 = %i, v5 = %i, v6 = %i, v7 = %i, v7s = %i\n",
+ thumb_supported, thumb2_supported, v5_supported, v6_supported, v7_supported, v7s_supported);*/
#endif
}
RegTypeBaseGen,
RegTypeFP,
RegTypeStructByVal,
- RegTypeStructByAddr
+ RegTypeStructByAddr,
+ /* gsharedvt argument passed by addr in greg */
+ RegTypeGSharedVtInReg,
+ /* gsharedvt argument passed by addr on stack */
+ RegTypeGSharedVtOnStack,
} ArgStorage;
typedef struct {
cinfo->nargs = n;
gr = ARMREG_R0;
- /* FIXME: handle returning a struct */
t = mini_type_get_underlying_type (gsctx, sig->ret);
if (MONO_TYPE_ISSTRUCT (t)) {
guint32 align;
} else {
cinfo->vtype_retaddr = TRUE;
}
+ } else if (!(t->type == MONO_TYPE_GENERICINST && !mono_type_generic_inst_is_valuetype (t)) && mini_is_gsharedvt_type_gsctx (gsctx, t)) {
+ cinfo->vtype_retaddr = TRUE;
}
pstart = 0;
DEBUG(printf("params: %d\n", sig->param_count));
for (i = pstart; i < sig->param_count; ++i) {
+ ArgInfo *ainfo = &cinfo->args [n];
+
if ((sig->call_convention == MONO_CALL_VARARG) && (i == sig->sentinelpos)) {
/* Prevent implicit arguments and sig_cookie from
being passed in registers */
DEBUG(printf("param %d: ", i));
if (sig->params [i]->byref) {
DEBUG(printf("byref\n"));
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
n++;
continue;
}
case MONO_TYPE_I1:
case MONO_TYPE_U1:
cinfo->args [n].size = 1;
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
n++;
break;
case MONO_TYPE_CHAR:
case MONO_TYPE_I2:
case MONO_TYPE_U2:
cinfo->args [n].size = 2;
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
n++;
break;
case MONO_TYPE_I4:
case MONO_TYPE_U4:
cinfo->args [n].size = 4;
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
n++;
break;
case MONO_TYPE_I:
case MONO_TYPE_ARRAY:
case MONO_TYPE_R4:
cinfo->args [n].size = sizeof (gpointer);
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
n++;
break;
case MONO_TYPE_GENERICINST:
if (!mono_type_generic_inst_is_valuetype (simpletype)) {
cinfo->args [n].size = sizeof (gpointer);
- add_general (&gr, &stack_size, cinfo->args + n, TRUE);
+ add_general (&gr, &stack_size, ainfo, TRUE);
+ n++;
+ break;
+ }
+ if (mini_is_gsharedvt_type_gsctx (gsctx, simpletype)) {
+ /* gsharedvt arguments are passed by ref */
+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, simpletype));
+ add_general (&gr, &stack_size, ainfo, TRUE);
+ switch (ainfo->storage) {
+ case RegTypeGeneral:
+ ainfo->storage = RegTypeGSharedVtInReg;
+ break;
+ case RegTypeBase:
+ ainfo->storage = RegTypeGSharedVtOnStack;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
n++;
break;
}
align_size += (sizeof (gpointer) - 1);
align_size &= ~(sizeof (gpointer) - 1);
nwords = (align_size + sizeof (gpointer) -1 ) / sizeof (gpointer);
- cinfo->args [n].storage = RegTypeStructByVal;
- cinfo->args [n].struct_size = size;
+ ainfo->storage = RegTypeStructByVal;
+ ainfo->struct_size = size;
/* FIXME: align stack_size if needed */
if (eabi_supported) {
if (align >= 8 && (gr & 1))
gr ++;
}
if (gr > ARMREG_R3) {
- cinfo->args [n].size = 0;
- cinfo->args [n].vtsize = nwords;
+ ainfo->size = 0;
+ ainfo->vtsize = nwords;
} else {
int rest = ARMREG_R3 - gr + 1;
int n_in_regs = rest >= nwords? nwords: rest;
- cinfo->args [n].size = n_in_regs;
- cinfo->args [n].vtsize = nwords - n_in_regs;
- cinfo->args [n].reg = gr;
+ ainfo->size = n_in_regs;
+ ainfo->vtsize = nwords - n_in_regs;
+ ainfo->reg = gr;
gr += n_in_regs;
nwords -= n_in_regs;
}
- cinfo->args [n].offset = stack_size;
+ ainfo->offset = stack_size;
/*g_print ("offset for arg %d at %d\n", n, stack_size);*/
stack_size += nwords * sizeof (gpointer);
n++;
case MONO_TYPE_U8:
case MONO_TYPE_I8:
case MONO_TYPE_R8:
- cinfo->args [n].size = 8;
- add_general (&gr, &stack_size, cinfo->args + n, FALSE);
+ ainfo->size = 8;
+ add_general (&gr, &stack_size, ainfo, FALSE);
+ n++;
+ break;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ /* gsharedvt arguments are passed by ref */
+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, simpletype));
+ add_general (&gr, &stack_size, ainfo, TRUE);
+ switch (ainfo->storage) {
+ case RegTypeGeneral:
+ ainfo->storage = RegTypeGSharedVtInReg;
+ break;
+ case RegTypeBase:
+ ainfo->storage = RegTypeGSharedVtOnStack;
+ break;
+ default:
+ g_assert_not_reached ();
+ }
n++;
break;
default:
cinfo->ret.reg = ARMREG_R0;
break;
}
+ // FIXME: Only for variable types
+ if (mini_is_gsharedvt_type_gsctx (gsctx, simpletype)) {
+ cinfo->ret.storage = RegTypeStructByAddr;
+ g_assert (cinfo->vtype_retaddr);
+ break;
+ }
/* Fall through */
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_TYPEDBYREF:
if (cinfo->ret.storage != RegTypeStructByVal)
cinfo->ret.storage = RegTypeStructByAddr;
break;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, simpletype));
+ cinfo->ret.storage = RegTypeStructByAddr;
+ g_assert (cinfo->vtype_retaddr);
+ break;
case MONO_TYPE_VOID:
break;
default:
t = ins->inst_vtype;
if (cfg->gsharedvt && mini_is_gsharedvt_variable_type (cfg, t))
- t = mini_get_gsharedvt_alloc_type_for_type (cfg, t);
+ continue;
/* inst->backend.is_pinvoke indicates native sized value types, this is used by the
* pinvoke wrappers when they call functions returning structure */
#endif
break;
case RegTypeStructByVal:
+ case RegTypeGSharedVtInReg:
+ case RegTypeGSharedVtOnStack:
MONO_INST_NEW (cfg, ins, OP_OUTARG_VT);
ins->opcode = OP_OUTARG_VT;
ins->sreg1 = in->dreg;
int struct_size = ainfo->struct_size;
int i, soffset, dreg, tmpreg;
+ if (ainfo->storage == RegTypeGSharedVtInReg) {
+ /* Pass by addr */
+ mono_call_inst_add_outarg_reg (cfg, call, src->dreg, ainfo->reg, FALSE);
+ return;
+ }
+ if (ainfo->storage == RegTypeGSharedVtOnStack) {
+ /* Pass by addr on stack */
+ MONO_EMIT_NEW_STORE_MEMBASE (cfg, OP_STORE_MEMBASE_REG, ARMREG_SP, ainfo->offset, src->dreg);
+ return;
+ }
+
soffset = 0;
for (i = 0; i < ainfo->size; ++i) {
dreg = mono_alloc_ireg (cfg);
break;
case OP_IREM:
g_assert (v7s_supported);
- ARM_SDIV (code, ARMREG_IP, ins->sreg1, ins->sreg2);
- ARM_MLS (code, ins->dreg, ARMREG_IP, ins->sreg2, ins->sreg1);
+ ARM_SDIV (code, ARMREG_LR, ins->sreg1, ins->sreg2);
+ ARM_MLS (code, ins->dreg, ARMREG_LR, ins->sreg2, ins->sreg1);
break;
case OP_IREM_UN:
g_assert (v7s_supported);
- ARM_UDIV (code, ARMREG_IP, ins->sreg1, ins->sreg2);
- ARM_MLS (code, ins->dreg, ARMREG_IP, ins->sreg2, ins->sreg1);
+ ARM_UDIV (code, ARMREG_LR, ins->sreg1, ins->sreg2);
+ ARM_MLS (code, ins->dreg, ARMREG_LR, ins->sreg2, ins->sreg1);
break;
case OP_DIV_IMM:
case OP_REM_IMM:
pos = 0;
prev_sp_offset = 0;
+ if (iphone_abi) {
+ /*
+ * The iphone uses R7 as the frame pointer, and it points at the saved
+ * r7+lr:
+ * <lr>
+ * r7 -> <r7>
+ * <rest of frame>
+ * We can't use r7 as a frame pointer since it points into the middle of
+ * the frame, so we keep using our own frame pointer.
+ * FIXME: Optimize this.
+ */
+ g_assert (darwin);
+ ARM_PUSH (code, (1 << ARMREG_R7) | (1 << ARMREG_LR));
+ ARM_MOV_REG_REG (code, ARMREG_R7, ARMREG_SP);
+ prev_sp_offset += 8; /* r7 and lr */
+ mono_emit_unwind_op_def_cfa_offset (cfg, code, prev_sp_offset);
+ mono_emit_unwind_op_offset (cfg, code, ARMREG_R7, (- prev_sp_offset) + 0);
+ }
+
if (!method->save_lmf) {
if (iphone_abi) {
- /*
- * The iphone uses R7 as the frame pointer, and it points at the saved
- * r7+lr:
- * <lr>
- * r7 -> <r7>
- * <rest of frame>
- * We can't use r7 as a frame pointer since it points into the middle of
- * the frame, so we keep using our own frame pointer.
- * FIXME: Optimize this.
- */
- g_assert (darwin);
- ARM_PUSH (code, (1 << ARMREG_R7) | (1 << ARMREG_LR));
- ARM_MOV_REG_REG (code, ARMREG_R7, ARMREG_SP);
- prev_sp_offset += 8; /* r7 and lr */
- mono_emit_unwind_op_def_cfa_offset (cfg, code, prev_sp_offset);
- mono_emit_unwind_op_offset (cfg, code, ARMREG_R7, (- prev_sp_offset) + 0);
-
/* No need to push LR again */
if (cfg->used_int_regs)
ARM_PUSH (code, cfg->used_int_regs);
reg_offset += 4;
}
}
- pos += sizeof (MonoLMF) - prev_sp_offset;
+ pos += sizeof (MonoLMF) - (4 * 10);
lmf_offset = pos;
}
alloc_size += pos;
g_print ("Argument %d assigned to register %s\n", pos, mono_arch_regname (inst->dreg));
} else {
/* the argument should be put on the stack: FIXME handle size != word */
- if (ainfo->storage == RegTypeGeneral || ainfo->storage == RegTypeIRegPair) {
+ if (ainfo->storage == RegTypeGeneral || ainfo->storage == RegTypeIRegPair || ainfo->storage == RegTypeGSharedVtInReg) {
switch (ainfo->size) {
case 1:
if (arm_is_imm12 (inst->inst_offset))
ARM_LDR_IMM (code, ARMREG_LR, ARMREG_SP, (prev_sp_offset + ainfo->offset));
ARM_STR_IMM (code, ARMREG_LR, inst->inst_basereg, inst->inst_offset + 4);
ARM_STR_IMM (code, ARMREG_R3, inst->inst_basereg, inst->inst_offset);
- } else if (ainfo->storage == RegTypeBase) {
+ } else if (ainfo->storage == RegTypeBase || ainfo->storage == RegTypeGSharedVtOnStack) {
if (arm_is_imm12 (prev_sp_offset + ainfo->offset)) {
ARM_LDR_IMM (code, ARMREG_LR, ARMREG_SP, (prev_sp_offset + ainfo->offset));
} else {
sp_adj += 4;
reg ++;
}
+ if (iphone_abi)
+ /* Restored later */
+ regmask &= ~(1 << ARMREG_PC);
/* point sp at the registers to restore: 10 is 14 -4, because we skip r0-r3 */
code = emit_big_add (code, ARMREG_SP, cfg->frame_reg, cfg->stack_usage - lmf_offset + sp_adj);
/* restore iregs */
ARM_POP (code, regmask);
+ if (iphone_abi) {
+ /* Restore saved r7, restore LR to PC */
+ /* Skip lr from the lmf */
+ ARM_ADD_REG_IMM (code, ARMREG_SP, ARMREG_SP, sizeof (gpointer), 0);
+ ARM_POP (code, (1 << ARMREG_R7) | (1 << ARMREG_PC));
+ }
} else {
if ((i = mono_arm_is_rotated_imm8 (cfg->stack_usage, &rot_amount)) >= 0) {
ARM_ADD_REG_IMM (code, ARMREG_SP, cfg->frame_reg, i, rot_amount);
* reproduceable results for benchmarks */
#define MONO_ARCH_CODE_ALIGNMENT 32
-
/* Return value marshalling for calls between gsharedvt and normal code */
typedef enum {
GSHAREDVT_RET_NONE = 0,
- GSHAREDVT_RET_IREGS = 1,
- GSHAREDVT_RET_I1 = 5,
- GSHAREDVT_RET_U1 = 6,
- GSHAREDVT_RET_I2 = 7,
- GSHAREDVT_RET_U2 = 8
+ GSHAREDVT_RET_IREG = 1,
+ GSHAREDVT_RET_IREGS = 2,
+ GSHAREDVT_RET_I1 = 3,
+ GSHAREDVT_RET_U1 = 4,
+ GSHAREDVT_RET_I2 = 5,
+ GSHAREDVT_RET_U2 = 6
} GSharedVtRetMarshal;
typedef struct {
mono_arm_throw_exception_by_token (guint32 type_token, mgreg_t pc, mgreg_t sp, mgreg_t *int_regs, gdouble *fp_regs);
gpointer
-mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer *caller_regs, gpointer *callee_regs, gpointer mrgctx_reg) MONO_INTERNAL;
+mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg) MONO_INTERNAL;
typedef enum {
MONO_ARM_FPU_NONE = 0,
printf (" R%d", ((MonoInst*)ins->inst_p0)->dreg);
break;
case OP_REGOFFSET:
+ case OP_GSHAREDVT_ARG_REGOFFSET:
printf (" + 0x%lx", (long)ins->inst_offset);
break;
default:
mono_gdb_render_native_backtraces (pid_t crashed_pid)
{
const char *argv [5];
- char gdb_template [] = "/tmp/mono-gdb-commands.XXXXXX";
+ char template [] = "/tmp/mono-gdb-commands.XXXXXX";
+ FILE *commands;
+ gboolean using_lldb = FALSE;
argv [0] = g_find_program_in_path ("gdb");
- if (argv [0] == NULL) {
- return;
+ if (!argv [0]) {
+ argv [0] = g_find_program_in_path ("lldb");
+ using_lldb = TRUE;
}
- if (mkstemp (gdb_template) != -1) {
- FILE *gdb_commands = fopen (gdb_template, "w");
-
- fprintf (gdb_commands, "attach %ld\n", (long) crashed_pid);
- fprintf (gdb_commands, "info threads\n");
- fprintf (gdb_commands, "thread apply all bt\n");
+ if (argv [0] == NULL)
+ return;
- fflush (gdb_commands);
- fclose (gdb_commands);
+ if (mkstemp (template) == -1)
+ return;
+ commands = fopen (template, "w");
+ if (using_lldb) {
+ fprintf (commands, "process attach --pid %ld\n", (long) crashed_pid);
+ fprintf (commands, "script lldb.debugger.HandleCommand (\"thread list\")\n");
+ fprintf (commands, "script lldb.debugger.HandleCommand (\"thread backtrace all\")\n");
+ fprintf (commands, "detach\n");
+ fprintf (commands, "quit\n");
+ argv [1] = "--source";
+ argv [2] = template;
+ argv [3] = 0;
+
+ } else {
+ fprintf (commands, "attach %ld\n", (long) crashed_pid);
+ fprintf (commands, "info threads\n");
+ fprintf (commands, "thread apply all bt\n");
argv [1] = "-batch";
argv [2] = "-x";
- argv [3] = gdb_template;
+ argv [3] = template;
argv [4] = 0;
-
- execv (argv [0], (char**)argv);
-
- unlink (gdb_template);
}
+ fflush (commands);
+ fclose (commands);
+
+ execv (argv [0], (char**)argv);
+ unlink (template);
}
gboolean
gboolean err;
gpointer ip = MONO_CONTEXT_GET_IP (ctx);
MonoJitInfo *ji;
- MonoDomain *target_domain;
+ MonoDomain *target_domain = domain;
if (trace)
*trace = NULL;
static void
mono_class_unregister_image_generic_subclasses (MonoImage *image, gpointer user_data);
-static MonoType*
-mini_get_gsharedvt_alloc_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t);
+static gboolean partial_supported;
+
+static inline gboolean
+partial_sharing_supported (void)
+{
+ if (!ALLOW_PARTIAL_SHARING)
+ return FALSE;
+ /* Enable this only when AOT compiling or running in full-aot mode */
+ if (partial_supported || mono_aot_only)
+ return TRUE;
+ return FALSE;
+}
static int
type_check_context_used (MonoType *type, gboolean recursive)
case MONO_RGCTX_INFO_CAST_CACHE:
case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE:
case MONO_RGCTX_INFO_VALUE_SIZE:
- case MONO_RGCTX_INFO_CLASS_IS_REF: {
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE:
+ case MONO_RGCTX_INFO_MEMCPY:
+ case MONO_RGCTX_INFO_BZERO:
+ case MONO_RGCTX_INFO_LOCAL_OFFSET:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX: {
gpointer result = mono_class_inflate_generic_type_with_mempool (temporary ? NULL : class->image,
data, context, &error);
g_assert (mono_error_ok (&error)); /*FIXME proper error handling*/
g_assert (inflated_method->klass == inflated_class);
return inflated_method;
}
+ case MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO: {
+ MonoGSharedVtMethodInfo *info = data;
+ MonoGSharedVtMethodInfo *res;
+ int i;
+
+ // FIXME:
+ res = g_new0 (MonoGSharedVtMethodInfo, 1);
+ /*
+ res->nlocals = info->nlocals;
+ res->locals_types = g_new0 (MonoType*, info->nlocals);
+ for (i = 0; i < info->nlocals; ++i)
+ res->locals_types [i] = mono_class_inflate_generic_type (info->locals_types [i], context);
+ */
+ res->entries = g_ptr_array_new ();
+ for (i = 0; i < info->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *otemplate = g_ptr_array_index (info->entries, i);
+ MonoRuntimeGenericContextInfoTemplate *template = g_new0 (MonoRuntimeGenericContextInfoTemplate, 1);
+
+ memcpy (template, otemplate, sizeof (MonoRuntimeGenericContextInfoTemplate));
+ template->data = inflate_info (template, context, class, FALSE);
+ g_ptr_array_add (res->entries, template);
+ }
+ return res;
+ }
case MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE:
case MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE_VIRT: {
MonoJumpInfoGSharedVtCall *info = data;
return GUINT_TO_POINTER (sizeof (gpointer));
else
return GUINT_TO_POINTER (mono_class_value_size (class, NULL));
- case MONO_RGCTX_INFO_CLASS_IS_REF:
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE:
if (MONO_TYPE_IS_REFERENCE (&class->byval_arg))
return GUINT_TO_POINTER (1);
+ else if (mono_class_is_nullable (class))
+ return GUINT_TO_POINTER (2);
else
return GUINT_TO_POINTER (0);
+ case MONO_RGCTX_INFO_MEMCPY:
+ case MONO_RGCTX_INFO_BZERO: {
+ static MonoMethod *memcpy_method [17];
+ static MonoMethod *bzero_method [17];
+ MonoJitDomainInfo *domain_info;
+ int size;
+ guint32 align;
+
+ domain_info = domain_jit_info (domain);
+
+ if (MONO_TYPE_IS_REFERENCE (&class->byval_arg)) {
+ size = sizeof (gpointer);
+ align = sizeof (gpointer);
+ } else {
+ size = mono_class_value_size (class, &align);
+ }
+
+ if (size != 1 && size != 2 && size != 4 && size != 8)
+ size = 0;
+ if (align < size)
+ size = 0;
+
+ if (info_type == MONO_RGCTX_INFO_MEMCPY) {
+ if (!memcpy_method [size]) {
+ MonoMethod *m;
+ char name [32];
+
+ if (size == 0)
+ sprintf (name, "memcpy");
+ else
+ sprintf (name, "memcpy_aligned_%d", size);
+ m = mono_class_get_method_from_name (mono_defaults.string_class, name, 3);
+ g_assert (m);
+ mono_memory_barrier ();
+ memcpy_method [size] = m;
+ }
+ if (!domain_info->memcpy_addr [size]) {
+ gpointer addr = mono_compile_method (memcpy_method [size]);
+ mono_memory_barrier ();
+ domain_info->memcpy_addr [size] = addr;
+ }
+ return domain_info->memcpy_addr [size];
+ } else {
+ if (!bzero_method [size]) {
+ MonoMethod *m;
+ char name [32];
+
+ if (size == 0)
+ sprintf (name, "bzero");
+ else
+ sprintf (name, "bzero_aligned_%d", size);
+ m = mono_class_get_method_from_name (mono_defaults.string_class, name, 2);
+ g_assert (m);
+ mono_memory_barrier ();
+ bzero_method [size] = m;
+ }
+ if (!domain_info->bzero_addr [size]) {
+ gpointer addr = mono_compile_method (bzero_method [size]);
+ mono_memory_barrier ();
+ domain_info->bzero_addr [size] = addr;
+ }
+ return domain_info->bzero_addr [size];
+ }
+ }
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX: {
+ MonoMethod *method;
+ gpointer addr;
+ MonoJitInfo *ji;
+ MonoGenericContext *ctx;
+
+ if (!mono_class_is_nullable (class))
+ /* This can happen since all the entries in MonoGSharedVtMethodInfo are inflated, even those which are not used */
+ return NULL;
+
+ if (info_type == MONO_RGCTX_INFO_NULLABLE_CLASS_BOX)
+ method = mono_class_get_method_from_name (class, "Box", 1);
+ else
+ method = mono_class_get_method_from_name (class, "Unbox", 1);
+
+ addr = mono_compile_method (method);
+ // The caller uses the gsharedvt call signature
+ ji = mini_jit_info_table_find (mono_domain_get (), mono_get_addr_from_ftnptr (addr), NULL);
+ g_assert (ji);
+ if (mini_jit_info_is_gsharedvt (ji))
+ return mono_create_static_rgctx_trampoline (method, addr);
+ else {
+ MonoGenericSharingContext gsctx;
+ MonoMethodSignature *sig, *gsig;
+ MonoMethod *gmethod;
+
+ /* Need to add an out wrapper */
+
+ /* FIXME: We have no access to the gsharedvt signature/gsctx used by the caller, so have to construct it ourselves */
+ gmethod = mini_get_shared_method (method);
+ sig = mono_method_signature (method);
+ gsig = mono_method_signature (gmethod);
+ ctx = mono_method_get_context (gmethod);
+ mini_init_gsctx (ctx, &gsctx);
+
+ addr = mini_get_gsharedvt_wrapper (FALSE, addr, sig, gsig, &gsctx, -1, FALSE);
+ addr = mono_create_static_rgctx_trampoline (method, addr);
+ return addr;
+ }
+ }
default:
g_assert_not_reached ();
}
case MONO_RGCTX_INFO_CAST_CACHE:
case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE:
case MONO_RGCTX_INFO_VALUE_SIZE:
- case MONO_RGCTX_INFO_CLASS_IS_REF: {
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE:
+ case MONO_RGCTX_INFO_MEMCPY:
+ case MONO_RGCTX_INFO_BZERO:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX: {
MonoClass *arg_class = mono_class_from_mono_type (data);
free_inflated_info (oti->info_type, data);
gpointer addr;
addr = mono_compile_method (data);
- return mini_add_method_trampoline (NULL, data, addr, mono_method_needs_static_rgctx_invoke (data, FALSE));
+ return mini_add_method_trampoline (NULL, data, addr, mono_method_needs_static_rgctx_invoke (data, FALSE), FALSE);
}
#ifndef DISABLE_REMOTING
case MONO_RGCTX_INFO_REMOTING_INVOKE_WITH_CHECK:
gji = mono_jit_info_get_generic_jit_info (caller_ji);
g_assert (gji);
- addr = mini_get_gsharedvt_wrapper (FALSE, addr, sig, gsig, gji->generic_sharing_context, -1, TRUE);
+ addr = mini_get_gsharedvt_wrapper (FALSE, NULL, sig, gsig, gji->generic_sharing_context, -1, TRUE);
return addr;
}
return addr;
}
+ case MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO: {
+ MonoGSharedVtMethodInfo *info = data;
+ MonoGSharedVtMethodRuntimeInfo *res;
+ MonoType *t;
+ int i, offset, align, size;
+
+ // FIXME:
+ res = g_malloc0 (sizeof (MonoGSharedVtMethodRuntimeInfo) + (info->entries->len * sizeof (gpointer)));
+
+ offset = 0;
+ for (i = 0; i < info->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *template = g_ptr_array_index (info->entries, i);
+
+ switch (template->info_type) {
+ case MONO_RGCTX_INFO_LOCAL_OFFSET:
+ t = template->data;
+
+ size = mono_type_size (t, &align);
+
+ if (align < sizeof (gpointer))
+ align = sizeof (gpointer);
+ if (MONO_TYPE_ISSTRUCT (t) && align < 2 * sizeof (gpointer))
+ align = 2 * sizeof (gpointer);
+
+ // FIXME: Do the same things as alloc_stack_slots
+ offset += align - 1;
+ offset &= ~(align - 1);
+ res->entries [i] = GINT_TO_POINTER (offset);
+ offset += size;
+ break;
+ default:
+ res->entries [i] = instantiate_info (domain, template, context, class, NULL);
+ break;
+ }
+ }
+ res->locals_size = offset;
+
+ return res;
+ }
default:
g_assert_not_reached ();
}
case MONO_RGCTX_INFO_TYPE: return "TYPE";
case MONO_RGCTX_INFO_REFLECTION_TYPE: return "REFLECTION_TYPE";
case MONO_RGCTX_INFO_METHOD: return "METHOD";
+ case MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO: return "GSHAREDVT_INFO";
case MONO_RGCTX_INFO_GENERIC_METHOD_CODE: return "GENERIC_METHOD_CODE";
case MONO_RGCTX_INFO_CLASS_FIELD: return "CLASS_FIELD";
case MONO_RGCTX_INFO_METHOD_RGCTX: return "METHOD_RGCTX";
case MONO_RGCTX_INFO_CAST_CACHE: return "CAST_CACHE";
case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE: return "ARRAY_ELEMENT_SIZE";
case MONO_RGCTX_INFO_VALUE_SIZE: return "VALUE_SIZE";
- case MONO_RGCTX_INFO_CLASS_IS_REF: return "CLASS_IS_REF";
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE: return "CLASS_BOX_TYPE";
case MONO_RGCTX_INFO_FIELD_OFFSET: return "FIELD_OFFSET";
case MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE: return "METHOD_GSHAREDVT_OUT_TRAMPOLINE";
case MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE_VIRT: return "METHOD_GSHAREDVT_OUT_TRAMPOLINE_VIRT";
case MONO_RGCTX_INFO_SIG_GSHAREDVT_OUT_TRAMPOLINE_CALLI: return "SIG_GSHAREDVT_OUT_TRAMPOLINE_CALLI";
+ case MONO_RGCTX_INFO_MEMCPY: return "MEMCPY";
+ case MONO_RGCTX_INFO_BZERO: return "BZERO";
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX: return "NULLABLE_CLASS_BOX";
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX: return "NULLABLE_CLASS_UNBOX";
default:
return "<UNKNOWN RGCTX INFO TYPE>";
}
case MONO_RGCTX_INFO_CAST_CACHE:
case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE:
case MONO_RGCTX_INFO_VALUE_SIZE:
- case MONO_RGCTX_INFO_CLASS_IS_REF:
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE:
+ case MONO_RGCTX_INFO_MEMCPY:
+ case MONO_RGCTX_INFO_BZERO:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX:
return mono_class_from_mono_type (data1) == mono_class_from_mono_type (data2);
case MONO_RGCTX_INFO_METHOD:
+ case MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO:
case MONO_RGCTX_INFO_GENERIC_METHOD_CODE:
case MONO_RGCTX_INFO_CLASS_FIELD:
case MONO_RGCTX_INFO_FIELD_OFFSET:
return FALSE;
}
+/*
+ * mini_rgctx_info_type_to_patch_info_type:
+ *
+ * Return the type of the runtime object referred to by INFO_TYPE.
+ */
+MonoJumpInfoType
+mini_rgctx_info_type_to_patch_info_type (MonoRgctxInfoType info_type)
+{
+ switch (info_type) {
+ case MONO_RGCTX_INFO_STATIC_DATA:
+ case MONO_RGCTX_INFO_KLASS:
+ case MONO_RGCTX_INFO_VTABLE:
+ case MONO_RGCTX_INFO_TYPE:
+ case MONO_RGCTX_INFO_REFLECTION_TYPE:
+ case MONO_RGCTX_INFO_CAST_CACHE:
+ case MONO_RGCTX_INFO_ARRAY_ELEMENT_SIZE:
+ case MONO_RGCTX_INFO_VALUE_SIZE:
+ case MONO_RGCTX_INFO_CLASS_BOX_TYPE:
+ case MONO_RGCTX_INFO_MEMCPY:
+ case MONO_RGCTX_INFO_BZERO:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_BOX:
+ case MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX:
+ case MONO_RGCTX_INFO_LOCAL_OFFSET:
+ return MONO_PATCH_INFO_CLASS;
+ case MONO_RGCTX_INFO_FIELD_OFFSET:
+ return MONO_PATCH_INFO_FIELD;
+ default:
+ g_assert_not_reached ();
+ return -1;
+ }
+}
+
static int
lookup_or_register_info (MonoClass *class, int type_argc, gpointer data, MonoRgctxInfoType info_type,
MonoGenericContext *generic_context)
gboolean
mono_generic_context_is_sharable (MonoGenericContext *context, gboolean allow_type_vars)
{
- return mono_generic_context_is_sharable_full (context, allow_type_vars, ALLOW_PARTIAL_SHARING);
+ return mono_generic_context_is_sharable_full (context, allow_type_vars, partial_sharing_supported ());
}
/*
iclass_set = TRUE;
}
- if (iclass && klass->valuetype && strstr (klass->name, "c__async") && mono_class_is_assignable_from (iclass, klass))
+ if (iclass && klass->valuetype && mono_class_is_assignable_from (iclass, klass))
return TRUE;
return FALSE;
}
if (!mono_method_is_generic_impl (method))
return FALSE;
- if (!ALLOW_PARTIAL_SHARING)
+ if (!partial_sharing_supported ())
allow_partial = FALSE;
/*
gboolean
mono_method_is_generic_sharable (MonoMethod *method, gboolean allow_type_vars)
{
- return mono_method_is_generic_sharable_full (method, allow_type_vars, ALLOW_PARTIAL_SHARING, TRUE);
+ return mono_method_is_generic_sharable_full (method, allow_type_vars, partial_sharing_supported (), TRUE);
}
gboolean
gsharedvt_supported = supported;
}
+void
+mono_set_partial_sharing_supported (gboolean supported)
+{
+ partial_supported = supported;
+}
+
/*
* mono_class_generic_sharing_enabled:
* @class: a class
g_assert (gsctx);
*/
if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && mini_is_gsharedvt_type_gsctx (gsctx, type))
- return mini_get_gsharedvt_alloc_type_gsctx (gsctx, type);
+ return type;
else
return mono_type_get_basic_type_from_generic (type);
}
{
if (type->byref)
return &mono_defaults.int_class->byval_arg;
+ if (!type->byref && (type->type == MONO_TYPE_VAR || type->type == MONO_TYPE_MVAR) && mini_is_gsharedvt_type_gsctx (gsctx, type))
+ return type;
return mini_get_basic_type_from_generic (gsctx, mono_type_get_underlying_type (type));
}
g_assert (gsctx);
*/
- if (mini_is_gsharedvt_type_gsctx (gsctx, t))
- t = mini_get_gsharedvt_alloc_type_gsctx (gsctx, t);
+ //g_assert (!mini_is_gsharedvt_type_gsctx (gsctx, t));
if (pinvoke) {
size = mono_type_native_stack_size (t, align);
return FALSE;
}
-static MonoType*
-mini_get_gsharedvt_alloc_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t)
-{
- return NULL;
-}
-
-MonoType*
-mini_get_gsharedvt_alloc_type_for_type (MonoCompile *cfg, MonoType *t)
-{
- return NULL;
-}
-
gboolean
mini_is_gsharedvt_sharable_method (MonoMethod *method)
{
#include <llvm/ExecutionEngine/JITMemoryManager.h>
#include <llvm/ExecutionEngine/JITEventListener.h>
#include <llvm/Target/TargetOptions.h>
-#include <llvm/Target/TargetData.h>
#include <llvm/Target/TargetRegisterInfo.h>
#include <llvm/Analysis/Verifier.h>
#include <llvm/Analysis/Passes.h>
(void) llvm::createLCSSAPass();
(void) llvm::createLICMPass();
(void) llvm::createLazyValueInfoPass();
- (void) llvm::createLoopDependenceAnalysisPass();
+ //(void) llvm::createLoopDependenceAnalysisPass();
/*
(void) llvm::createLoopExtractorPass();
*/
fpm = new FunctionPassManager (unwrap (MP));
- fpm->add(new TargetData(*EE->getTargetData()));
+ fpm->add(new DataLayout(*EE->getDataLayout()));
PassRegistry &Registry = *PassRegistry::getPassRegistry();
initializeCore(Registry);
//initializeInstrumentation(Registry);
initializeTarget(Registry);
- llvm::cl::ParseEnvironmentOptions("mono", "MONO_LLVM", "", false);
+ llvm::cl::ParseEnvironmentOptions("mono", "MONO_LLVM", "");
if (PassList.size() > 0) {
/* Use the passes specified by the env variable */
}
} else {
/* Use the same passes used by 'opt' by default, without the ipo passes */
- const char *opts = "-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -basiccg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -gvn -simplifycfg -preverify -domtree -verify";
+ const char *opts = "-simplifycfg -domtree -domfrontier -scalarrepl -instcombine -simplifycfg -domtree -domfrontier -scalarrepl -simplify-libcalls -instcombine -simplifycfg -instcombine -simplifycfg -reassociate -domtree -loops -loop-simplify -domfrontier -loop-simplify -lcssa -loop-rotate -licm -lcssa -loop-unswitch -instcombine -scalar-evolution -loop-simplify -lcssa -iv-users -indvars -loop-deletion -loop-simplify -lcssa -loop-unroll -instcombine -memdep -gvn -memdep -memcpyopt -sccp -instcombine -domtree -memdep -dse -adce -gvn -simplifycfg -preverify -domtree -verify";
char **args;
int i;
args = g_strsplit (opts, " ", 1000);
for (i = 0; args [i]; i++)
;
- llvm::cl::ParseCommandLineOptions (i, args, "", false);
+ llvm::cl::ParseCommandLineOptions (i, args, "");
g_strfreev (args);
for (unsigned i = 0; i < PassList.size(); ++i) {
if (PassInf->getNormalCtor())
P = PassInf->getNormalCtor()();
+ g_assert (P->getPassKind () == llvm::PT_Function || P->getPassKind () == llvm::PT_Loop);
fpm->add (P);
}
case MONO_TYPE_VAR:
case MONO_TYPE_MVAR:
/* Because of generic sharing */
- if (mini_type_var_is_vt (ctx->cfg, t))
- return type_to_llvm_type (ctx, mini_get_gsharedvt_alloc_type_for_type (ctx->cfg, t));
- else
- return IntPtrType ();
+ return IntPtrType ();
case MONO_TYPE_GENERICINST:
if (!mono_type_generic_inst_is_valuetype (t))
return IntPtrType ();
module = ctx->module = ctx->lmodule->module;
+ if (cfg->gsharedvt)
+ LLVM_FAILURE (ctx, "gsharedvt");
+
#if 1
{
static int count = 0;
}
g_free (names);
+ if (cfg->compile_aot) {
+ LLVMValueRef md_args [16];
+ LLVMValueRef md_node;
+ int method_index;
+
+ method_index = mono_aot_get_method_index (cfg->orig_method);
+ md_args [0] = LLVMMDString (method_name, strlen (method_name));
+ md_args [1] = LLVMConstInt (LLVMInt32Type (), method_index, FALSE);
+ md_node = LLVMMDNode (md_args, 2);
+ LLVMAddNamedMetadataOperand (module, "mono.function_indexes", md_node);
+ //LLVMSetMetadata (method, md_kind, LLVMMDNode (&md_arg, 1));
+ }
+
max_block_num = 0;
for (bb = cfg->bb_entry; bb; bb = bb->next_bb)
max_block_num = MAX (max_block_num, bb->block_num);
LLVMValueRef personality;
personality = LLVMAddFunction (aot_module.module, "mono_aot_personality", LLVMFunctionType (LLVMVoidType (), NULL, 0, FALSE));
- LLVMSetLinkage (personality, LLVMPrivateLinkage);
+ LLVMSetLinkage (personality, LLVMInternalLinkage);
lbb = LLVMAppendBasicBlock (personality, "BB0");
lbuilder = LLVMCreateBuilder ();
LLVMPositionBuilderAtEnd (lbuilder, lbb);
MINI_OP(OP_LCOMPARE_IMM, "lcompare_imm", NONE, LREG, NONE)
MINI_OP(OP_LOCAL, "local", NONE, NONE, NONE)
MINI_OP(OP_ARG, "arg", NONE, NONE, NONE)
+/* inst_imm contains the local index */
+MINI_OP(OP_GSHAREDVT_LOCAL, "gsharedvt_local", NONE, NONE, NONE)
+MINI_OP(OP_GSHAREDVT_ARG_REGOFFSET, "gsharedvt_arg_regoffset", NONE, NONE, NONE)
/*
* Represents passing a valuetype argument which has not been decomposed yet.
* inst_p0 points to the call.
/* arch-dep tls access */
MINI_OP(OP_TLS_GET, "tls_get", IREG, NONE, NONE)
+MINI_OP(OP_TLS_GET_REG, "tls_get_reg", IREG, IREG, NONE)
MINI_OP(OP_LOAD_GOTADDR, "load_gotaddr", IREG, NONE, NONE)
MINI_OP(OP_DUMMY_USE, "dummy_use", NONE, IREG, NONE)
#ifdef ENABLE_LLVM
MINI_OP(OP_LLVM_OUTARG_VT, "llvm_outarg_vt", IREG, VREG, NONE)
#endif
+
}
ppc_mr (code, ppc_sp, ppc_r11);
- mono_add_patch_info (cfg, (guint8*) code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, ins->inst_p0);
+ mono_add_patch_info (cfg, (guint8*) code - cfg->native_code, MONO_PATCH_INFO_METHOD_JUMP, call->method);
if (cfg->compile_aot) {
/* arch_emit_got_access () patches this */
ppc_load32 (code, ppc_r0, 0);
#define mono_trampolines_unlock() LeaveCriticalSection (&trampolines_mutex)
static CRITICAL_SECTION trampolines_mutex;
-static gpointer
-get_unbox_trampoline (MonoMethod *m, gpointer addr, gboolean need_rgctx_tramp)
-{
- if (mono_aot_only) {
- if (need_rgctx_tramp)
- /*
- * The unbox trampolines call the method directly, so need to add
- * an rgctx tramp before them.
- */
- return mono_create_static_rgctx_trampoline (m, mono_aot_get_unbox_trampoline (m));
- else
- return mono_aot_get_unbox_trampoline (m);
- } else {
- unbox_trampolines ++;
- return mono_arch_get_unbox_trampoline (m, addr);
- }
-}
-
#ifdef MONO_ARCH_GSHARED_SUPPORTED
typedef struct {
return TRUE;
return FALSE;
}
-static gboolean
-ji_is_gsharedvt (MonoJitInfo *ji)
+
+gboolean
+mini_jit_info_is_gsharedvt (MonoJitInfo *ji)
{
if (ji && ji->has_generic_jit_info && (mono_jit_info_get_generic_sharing_context (ji)->var_is_vt ||
mono_jit_info_get_generic_sharing_context (ji)->mvar_is_vt))
/*
* mini_add_method_trampoline:
*
- * Add static rgctx/gsharedvt_in trampoline to M/COMPILED_METHOD if needed. Return the trampoline address, or
+ * Add static rgctx/gsharedvt_in/unbox trampolines to M/COMPILED_METHOD if needed. Return the trampoline address, or
* COMPILED_METHOD if no trampoline is needed.
* ORIG_METHOD is the method the caller originally called i.e. an iface method, or NULL.
*/
gpointer
-mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp)
+mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp, gboolean add_unbox_tramp)
{
gpointer addr = compiled_method;
gboolean callee_gsharedvt, callee_array_helper;
mini_jit_info_table_find (mono_domain_get (), mono_get_addr_from_ftnptr (compiled_method), NULL);
// FIXME: This loads information from AOT
- callee_gsharedvt = ji_is_gsharedvt (ji);
+ callee_gsharedvt = mini_jit_info_is_gsharedvt (ji);
callee_array_helper = FALSE;
if (m->wrapper_type == MONO_WRAPPER_MANAGED_TO_MANAGED) {
addr = compiled_method;
+ if (add_unbox_tramp) {
+ /*
+ * The unbox trampolines call the method directly, so need to add
+ * an rgctx tramp before them.
+ */
+ if (mono_aot_only) {
+ addr = mono_aot_get_unbox_trampoline (m);
+ } else {
+ unbox_trampolines ++;
+ addr = mono_arch_get_unbox_trampoline (m, addr);
+ }
+ }
+
if (callee_gsharedvt && mini_is_gsharedvt_variable_signature (mono_method_signature (ji->method))) {
MonoGenericSharingContext *gsctx;
MonoMethodSignature *sig, *gsig;
sig = mono_method_signature (m);
gsig = mono_method_signature (ji->method);
- addr = mini_get_gsharedvt_wrapper (TRUE, compiled_method, sig, gsig, gsctx, -1, FALSE);
+ addr = mini_get_gsharedvt_wrapper (TRUE, addr, sig, gsig, gsctx, -1, FALSE);
//printf ("IN: %s\n", mono_method_full_name (m, TRUE));
}
{
gpointer addr, compiled_method;
gboolean generic_shared = FALSE;
+ gboolean need_unbox_tramp = FALSE;
MonoMethod *declaring = NULL;
MonoMethod *generic_virtual = NULL, *variant_iface = NULL, *orig_method = NULL;
int context_used;
mono_debugger_trampoline_compiled (code, m, addr);
- addr = mini_add_method_trampoline (orig_method, m, compiled_method, need_rgctx_tramp);
+ if (generic_virtual || variant_iface) {
+ if (vt->klass->valuetype) /*FIXME is this required variant iface?*/
+ need_unbox_tramp = TRUE;
+ } else if (orig_vtable_slot) {
+ if (m->klass->valuetype)
+ need_unbox_tramp = TRUE;
+ }
+
+ addr = mini_add_method_trampoline (orig_method, m, compiled_method, need_rgctx_tramp, need_unbox_tramp);
if (generic_virtual || variant_iface) {
MonoMethod *target = generic_virtual ? generic_virtual : variant_iface;
vtable_slot = orig_vtable_slot;
g_assert (vtable_slot);
- if (vt->klass->valuetype) /*FIXME is this required variant iface?*/
- addr = get_unbox_trampoline (m, addr, need_rgctx_tramp);
-
mono_method_add_generic_virtual_invocation (mono_domain_get (),
vt, vtable_slot,
target, addr);
vtable_slot = orig_vtable_slot;
if (vtable_slot) {
- if (m->klass->valuetype)
- addr = get_unbox_trampoline (m, addr, need_rgctx_tramp);
-
if (vtable_slot_to_patch && (mono_aot_is_got_entry (code, (guint8*)vtable_slot_to_patch) || mono_domain_owns_vtable_slot (mono_domain_get (), vtable_slot_to_patch))) {
g_assert (*vtable_slot_to_patch);
*vtable_slot_to_patch = mono_get_addr_from_ftnptr (addr);
#ifndef DISABLE_REMOTING
if (delegate->target && delegate->target->vtable->klass == mono_defaults.transparent_proxy_class) {
#ifndef DISABLE_COM
- if (((MonoTransparentProxy *)delegate->target)->remote_class->proxy_class != mono_defaults.com_object_class &&
+ if (((MonoTransparentProxy *)delegate->target)->remote_class->proxy_class != mono_class_get_com_object_class () &&
!mono_class_is_com_object (((MonoTransparentProxy *)delegate->target)->remote_class->proxy_class))
#endif
method = mono_marshal_get_remoting_invoke (method);
delegate->method_ptr = *delegate->method_code;
} else {
compiled_method = addr = mono_compile_method (method);
- if (need_unbox_tramp)
- // FIXME: GSHAREDVT
- addr = get_unbox_trampoline (method, addr, need_rgctx_tramp);
- else
- addr = mini_add_method_trampoline (NULL, method, compiled_method, need_rgctx_tramp);
+ addr = mini_add_method_trampoline (NULL, method, compiled_method, need_rgctx_tramp, need_unbox_tramp);
delegate->method_ptr = addr;
if (enable_caching && delegate->method_code)
*delegate->method_code = delegate->method_ptr;
/* The general, unoptimized case */
m = mono_marshal_get_delegate_invoke (invoke, delegate);
code = mono_compile_method (m);
- code = mini_add_method_trampoline (NULL, m, code, mono_method_needs_static_rgctx_invoke (m, FALSE));
+ code = mini_add_method_trampoline (NULL, m, code, mono_method_needs_static_rgctx_invoke (m, FALSE), FALSE);
delegate->invoke_impl = mono_get_addr_from_ftnptr (code);
mono_debugger_trampoline_compiled (NULL, m, delegate->invoke_impl);
#ifdef __native_client_codegen__
-const guint kNaClAlignment = kNaClAlignmentX86;
-const guint kNaClAlignmentMask = kNaClAlignmentMaskX86;
/* Default alignment for Native Client is 32-byte. */
gint8 nacl_align_byte = -32; /* signed version of 0xe0 */
ArgValuetypeInReg,
ArgOnFloatFpStack,
ArgOnDoubleFpStack,
+ /* gsharedvt argument passed by addr */
+ ArgGSharedVt,
ArgNone
} ArgStorage;
if (*gr >= PARAM_REGS) {
ainfo->storage = ArgOnStack;
+ ainfo->nslots = 1;
(*stack_size) += sizeof (gpointer);
}
else {
cinfo->ret.reg = X86_EAX;
break;
}
+ if (mini_is_gsharedvt_type_gsctx (gsctx, ret_type)) {
+ cinfo->ret.storage = ArgOnStack;
+ cinfo->vtype_retaddr = TRUE;
+ break;
+ }
/* Fall through */
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_TYPEDBYREF: {
}
break;
}
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, ret_type));
+ cinfo->ret.storage = ArgOnStack;
+ cinfo->vtype_retaddr = TRUE;
+ break;
case MONO_TYPE_VOID:
cinfo->ret.storage = ArgNone;
break;
add_general (&gr, &stack_size, ainfo);
break;
}
+ if (mini_is_gsharedvt_type_gsctx (gsctx, ptype)) {
+ /* gsharedvt arguments are passed by ref */
+ add_general (&gr, &stack_size, ainfo);
+ g_assert (ainfo->storage == ArgOnStack);
+ ainfo->storage = ArgGSharedVt;
+ break;
+ }
/* Fall through */
case MONO_TYPE_VALUETYPE:
case MONO_TYPE_TYPEDBYREF:
case MONO_TYPE_R8:
add_float (&fr, &stack_size, ainfo, TRUE);
break;
+ case MONO_TYPE_VAR:
+ case MONO_TYPE_MVAR:
+ /* gsharedvt arguments are passed by ref */
+ g_assert (mini_is_gsharedvt_type_gsctx (gsctx, ptype));
+ add_general (&gr, &stack_size, ainfo);
+ g_assert (ainfo->storage == ArgOnStack);
+ ainfo->storage = ArgGSharedVt;
+ break;
default:
g_error ("unexpected type 0x%x", ptype->type);
g_assert_not_reached ();
0x89, 0x02, /* mov %eax,(%edx) */
0x5b, /* pop %ebx */
0xc9, /* leave */
- 0x59, 0x83, 0xe1, 0xe0, 0xff, 0xe1 /* naclret */
+ 0x59, 0x83, 0xe1, 0xe0, 0xff, 0xe1, /* naclret */
+ 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, /* padding, to provide bundle aligned version */
+ 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4,
+ 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4,
+ 0xf4, 0xf4, 0xf4, 0xf4, 0xf4, 0xf4,
+ 0xf4
};
#endif
linfo->args [i].pair_storage [j] = arg_storage_to_llvm_arg_storage (cfg, ainfo->pair_storage [j]);
*/
break;
+ case ArgGSharedVt:
+ linfo->args [i].storage = LLVMArgGSharedVt;
+ break;
default:
cfg->exception_message = g_strdup ("ainfo->storage");
cfg->disable_llvm = TRUE;
g_assert (in->dreg != -1);
- if ((i >= sig->hasthis) && (MONO_TYPE_ISSTRUCT(t))) {
+ if (ainfo->storage == ArgGSharedVt) {
+ arg->opcode = OP_OUTARG_VT;
+ arg->sreg1 = in->dreg;
+ arg->klass = in->klass;
+ sp_offset += 4;
+ MONO_ADD_INS (cfg->cbb, arg);
+ } else if ((i >= sig->hasthis) && (MONO_TYPE_ISSTRUCT(t))) {
guint32 align;
guint32 size;
MonoInst *arg;
int size = ins->backend.size;
- if (size <= 4) {
+ if (cfg->gsharedvt && mini_is_gsharedvt_klass (cfg, ins->klass)) {
+ /* Pass by addr */
+ MONO_INST_NEW (cfg, arg, OP_X86_PUSH);
+ arg->sreg1 = src->dreg;
+ MONO_ADD_INS (cfg->cbb, arg);
+ } else if (size <= 4) {
MONO_INST_NEW (cfg, arg, OP_X86_PUSH_MEMBASE);
arg->sreg1 = src->dreg;
/* restore ESP/EBP */
x86_leave (code);
offset = code - cfg->native_code;
- mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_METHOD_JUMP, ins->inst_p0);
+ mono_add_patch_info (cfg, offset, MONO_PATCH_INFO_METHOD_JUMP, call->method);
x86_jump32 (code, 0);
ins->flags |= MONO_INST_GC_CALLSITE;
code = mono_x86_emit_tls_get (code, ins->dreg, ins->inst_offset);
break;
}
+ case OP_TLS_GET_REG: {
+#ifdef __APPLE__
+ // FIXME: tls_gs_offset can change too, do these when calculating the tls offset
+ if (ins->dreg != ins->sreg1)
+ x86_mov_reg_reg (code, ins->dreg, ins->sreg1, sizeof (gpointer));
+ x86_shift_reg_imm (code, X86_SHL, ins->dreg, 2);
+ if (tls_gs_offset)
+ x86_alu_reg_imm (code, X86_ADD, ins->dreg, tls_gs_offset);
+ x86_prefix (code, X86_GS_PREFIX);
+ x86_mov_reg_membase (code, ins->dreg, ins->dreg, 0, sizeof (gpointer));
+#else
+ g_assert_not_reached ();
+#endif
+ break;
+ }
case OP_MEMORY_BARRIER: {
/* x86 only needs barrier for StoreLoad and FullBarrier */
switch (ins->backend.memory_barrier_kind) {
code = cfg->native_code = g_malloc (cfg->code_size);
#elif defined(__native_client_codegen__)
/* native_code_alloc is not 32-byte aligned, native_code is. */
+ cfg->code_size = NACL_BUNDLE_ALIGN_UP (cfg->code_size);
cfg->native_code_alloc = g_malloc (cfg->code_size + kNaClAlignment);
/* Align native_code to next nearest kNaclAlignment byte. */
#if defined(__native_client__) && defined(__native_client_codegen__)
/* In Native Client, we don't re-use thunks, allocate from the */
/* normal code manager paths. */
+ size = NACL_BUNDLE_ALIGN_UP (size);
code = mono_domain_code_reserve (domain, size);
#else
if (fail_tramp)
#define MONO_ARCH_HAVE_SETUP_ASYNC_CALLBACK 1
#define MONO_ARCH_GSHAREDVT_SUPPORTED 1
+#ifdef TARGET_OSX
+#define MONO_ARCH_HAVE_TLS_GET_REG 1
+#endif
+
gboolean
mono_x86_tail_call_supported (MonoMethodSignature *caller_sig, MonoMethodSignature *callee_sig) MONO_INTERNAL;
GSHAREDVT_RET_I1 = 5,
GSHAREDVT_RET_U1 = 6,
GSHAREDVT_RET_I2 = 7,
- GSHAREDVT_RET_U2 = 8
+ GSHAREDVT_RET_U2 = 8,
+ GSHAREDVT_RET_IREG = 9
} GSharedVtRetMarshal;
typedef struct {
#include <ctype.h>
#include "trace.h"
#include "version.h"
+#include "ir-emit.h"
#include "jit-icalls.h"
/* Save the old alignment offset so we can re-align after the realloc. */
old_padding = (guint)(cfg->native_code - cfg->native_code_alloc);
+ cfg->code_size = NACL_BUNDLE_ALIGN_UP (cfg->code_size);
cfg->native_code_alloc = g_realloc ( cfg->native_code_alloc,
cfg->code_size + kNaClAlignment );
void mono_nacl_fix_patches(const guint8 *code, MonoJumpInfo *ji)
{
+#ifndef USE_JUMP_TABLES
MonoJumpInfo *patch_info;
for (patch_info = ji; patch_info; patch_info = patch_info->next) {
unsigned char *ip = patch_info->ip.i + code;
ip = mono_arch_nacl_skip_nops(ip);
patch_info->ip.i = ip - code;
}
+#endif
}
#endif /* __native_client_codegen__ */
* mono_tramp_info_create:
*
* Create a MonoTrampInfo structure from the arguments. This function assumes ownership
- * of NAME, JI, and UNWIND_OPS.
+ * of JI, and UNWIND_OPS.
*/
MonoTrampInfo*
mono_tramp_info_create (const char *name, guint8 *code, guint32 code_size, MonoJumpInfo *ji, GSList *unwind_ops)
{
MonoTrampInfo *info = g_new0 (MonoTrampInfo, 1);
- info->name = (char*)name;
+ info->name = g_strdup ((char*)name);
info->code = code;
info->code_size = code_size;
info->ji = ji;
t = mono_type_get_underlying_type (inst->inst_vtype);
if (cfg->gsharedvt && mini_is_gsharedvt_variable_type (cfg, t))
- t = mini_get_gsharedvt_alloc_type_for_type (cfg, t);
+ continue;
/* inst->backend.is_pinvoke indicates native sized value types, this is used by the
* pinvoke wrappers when they call functions returning structures */
t = mono_type_get_underlying_type (inst->inst_vtype);
if (cfg->gsharedvt && mini_is_gsharedvt_variable_type (cfg, t))
- t = mini_get_gsharedvt_alloc_type_for_type (cfg, t);
+ continue;
/* inst->backend.is_pinvoke indicates native sized value types, this is used by the
* pinvoke wrappers when they call functions returning structures */
}
}
+int
+mini_get_tls_offset (MonoJitTlsKey key)
+{
+ int offset;
+
+ switch (key) {
+ case TLS_KEY_THREAD:
+ offset = mono_thread_get_tls_offset ();
+ break;
+ case TLS_KEY_JIT_TLS:
+ offset = mono_get_jit_tls_offset ();
+ break;
+ case TLS_KEY_DOMAIN:
+ offset = mono_domain_get_tls_offset ();
+ break;
+ case TLS_KEY_LMF:
+ offset = mono_get_lmf_tls_offset ();
+ break;
+ default:
+ g_assert_not_reached ();
+ offset = -1;
+ break;
+ }
+ return offset;
+}
+
static MonoInst*
-mono_create_tls_get (MonoCompile *cfg, int offset)
+mono_create_tls_get_offset (MonoCompile *cfg, int offset)
{
-#ifdef MONO_ARCH_HAVE_TLS_GET
- if (MONO_ARCH_HAVE_TLS_GET) {
- MonoInst* ins;
+ MonoInst* ins;
- if (offset == -1)
- return NULL;
+ if (!MONO_ARCH_HAVE_TLS_GET)
+ return NULL;
+
+ if (offset == -1)
+ return NULL;
+
+ MONO_INST_NEW (cfg, ins, OP_TLS_GET);
+ ins->dreg = mono_alloc_preg (cfg);
+ ins->inst_offset = offset;
+ return ins;
+}
+
+static MonoInst*
+mono_create_tls_get (MonoCompile *cfg, MonoJitTlsKey key)
+{
+ /*
+ * TLS offsets might be different at AOT time, so load them from a GOT slot and
+ * use a different opcode.
+ */
+ if (cfg->compile_aot && MONO_ARCH_HAVE_TLS_GET && ARCH_HAVE_TLS_GET_REG) {
+ MonoInst *ins, *c;
- MONO_INST_NEW (cfg, ins, OP_TLS_GET);
+ EMIT_NEW_TLS_OFFSETCONST (cfg, c, key);
+ MONO_INST_NEW (cfg, ins, OP_TLS_GET_REG);
ins->dreg = mono_alloc_preg (cfg);
- ins->inst_offset = offset;
+ ins->sreg1 = c->dreg;
return ins;
}
-#endif
- return NULL;
+
+ return mono_create_tls_get_offset (cfg, mini_get_tls_offset (key));
}
MonoInst*
mono_get_jit_tls_intrinsic (MonoCompile *cfg)
{
- return mono_create_tls_get (cfg, mono_get_jit_tls_offset ());
+ return mono_create_tls_get (cfg, TLS_KEY_JIT_TLS);
}
MonoInst*
mono_get_domain_intrinsic (MonoCompile* cfg)
{
- return mono_create_tls_get (cfg, mono_domain_get_tls_offset ());
+ return mono_create_tls_get (cfg, TLS_KEY_DOMAIN);
}
MonoInst*
mono_get_thread_intrinsic (MonoCompile* cfg)
{
- return mono_create_tls_get (cfg, mono_thread_get_tls_offset ());
+ return mono_create_tls_get (cfg, TLS_KEY_THREAD);
}
MonoInst*
mono_get_lmf_intrinsic (MonoCompile* cfg)
{
- return mono_create_tls_get (cfg, mono_get_lmf_tls_offset ());
+ return mono_create_tls_get (cfg, TLS_KEY_LMF);
}
void
res->data.gsharedvt = mono_mempool_alloc (mp, sizeof (MonoJumpInfoGSharedVtCall));
memcpy (res->data.gsharedvt, patch_info->data.gsharedvt, sizeof (MonoJumpInfoGSharedVtCall));
break;
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD: {
+ MonoGSharedVtMethodInfo *info;
+ MonoGSharedVtMethodInfo *oinfo;
+ int i;
+
+ oinfo = patch_info->data.gsharedvt_method;
+ info = mono_mempool_alloc (mp, sizeof (MonoGSharedVtMethodInfo));
+ res->data.gsharedvt_method = info;
+ memcpy (info, oinfo, sizeof (MonoGSharedVtMethodInfo));
+ info->entries = g_ptr_array_new ();
+ if (oinfo->entries) {
+ for (i = 0; i < oinfo->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *otemplate = g_ptr_array_index (oinfo->entries, i);
+ MonoRuntimeGenericContextInfoTemplate *template = mono_mempool_alloc0 (mp, sizeof (MonoRuntimeGenericContextInfoTemplate));
+
+ memcpy (template, otemplate, sizeof (MonoRuntimeGenericContextInfoTemplate));
+ g_ptr_array_add (info->entries, template);
+ }
+ }
+ //info->locals_types = mono_mempool_alloc0 (mp, info->nlocals * sizeof (MonoType*));
+ //memcpy (info->locals_types, oinfo->locals_types, info->nlocals * sizeof (MonoType*));
+ break;
+ }
default:
break;
}
case MONO_PATCH_INFO_METHOD_RGCTX:
case MONO_PATCH_INFO_DELEGATE_TRAMPOLINE:
case MONO_PATCH_INFO_SIGNATURE:
+ case MONO_PATCH_INFO_TLS_OFFSET:
return (ji->type << 8) | (gssize)ji->data.target;
case MONO_PATCH_INFO_GSHAREDVT_CALL:
return (ji->type << 8) | (gssize)ji->data.gsharedvt->method;
case MONO_PATCH_INFO_MONITOR_ENTER:
case MONO_PATCH_INFO_MONITOR_EXIT:
case MONO_PATCH_INFO_CASTCLASS_CACHE:
+ case MONO_PATCH_INFO_GOT_OFFSET:
return (ji->type << 8);
case MONO_PATCH_INFO_SWITCH:
return (ji->type << 8) | ji->data.table->table_size;
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD:
+ return (ji->type << 8) | (gssize)ji->data.gsharedvt_method->method;
default:
printf ("info type: %d\n", ji->type);
mono_print_ji (ji); printf ("\n");
return c1->sig == c2->sig && c1->method == c2->method;
}
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD:
+ return ji1->data.gsharedvt_method->method == ji2->data.gsharedvt_method->method;
default:
if (ji1->data.target != ji2->data.target)
return 0;
case MONO_PATCH_INFO_METHOD_JUMP:
target = mono_create_jump_trampoline (domain, patch_info->data.method, FALSE);
#if defined(__native_client__) && defined(__native_client_codegen__)
-#if defined(TARGET_AMD64)
+# if defined(TARGET_AMD64)
/* This target is an absolute address, not relative to the */
/* current code being emitted on AMD64. */
target = nacl_inverse_modify_patch_target(target);
-#endif
+# endif
#endif
break;
case MONO_PATCH_INFO_METHOD:
+#if defined(__native_client_codegen__) && defined(USE_JUMP_TABLES)
+ /*
+ * If we use jumptables, for recursive calls we cannot
+ * avoid trampoline, as we not yet know where we will
+ * be installed.
+ */
+ target = mono_create_jit_trampoline_in_domain (domain, patch_info->data.method);
+#else
if (patch_info->data.method == method) {
target = code;
} else {
/* get the trampoline to the method from the domain */
target = mono_create_jit_trampoline_in_domain (domain, patch_info->data.method);
}
+#endif
break;
case MONO_PATCH_INFO_SWITCH: {
gpointer *jump_table;
int i;
-
#if defined(__native_client__) && defined(__native_client_codegen__)
/* This memory will leak, but we don't care if we're */
/* not deleting JIT'd methods anyway */
slot = mono_method_lookup_or_register_info (entry->method, entry->in_mrgctx, entry->data->data.sig, entry->info_type, mono_method_get_context (entry->method));
break;
case MONO_PATCH_INFO_GSHAREDVT_CALL: {
- MonoJumpInfoGSharedVtCall *call_info = mono_domain_alloc0 (domain, sizeof (MonoJumpInfoGSharedVtCall));
+ MonoJumpInfoGSharedVtCall *call_info = g_malloc0 (sizeof (MonoJumpInfoGSharedVtCall)); //mono_domain_alloc0 (domain, sizeof (MonoJumpInfoGSharedVtCall));
memcpy (call_info, entry->data->data.gsharedvt, sizeof (MonoJumpInfoGSharedVtCall));
slot = mono_method_lookup_or_register_info (entry->method, entry->in_mrgctx, call_info, entry->info_type, mono_method_get_context (entry->method));
break;
}
+ case MONO_PATCH_INFO_GSHAREDVT_METHOD: {
+ MonoGSharedVtMethodInfo *info;
+ MonoGSharedVtMethodInfo *oinfo = entry->data->data.gsharedvt_method;
+ int i;
+
+ /* Make a copy into the domain mempool */
+ info = g_malloc0 (sizeof (MonoGSharedVtMethodInfo)); //mono_domain_alloc0 (domain, sizeof (MonoGSharedVtMethodInfo));
+ info->method = oinfo->method;
+ info->entries = g_ptr_array_new ();
+ for (i = 0; i < oinfo->entries->len; ++i) {
+ MonoRuntimeGenericContextInfoTemplate *otemplate = g_ptr_array_index (oinfo->entries, i);
+ MonoRuntimeGenericContextInfoTemplate *template = g_malloc0 (sizeof (MonoRuntimeGenericContextInfoTemplate));
+
+ memcpy (template, otemplate, sizeof (MonoRuntimeGenericContextInfoTemplate));
+ g_ptr_array_add (info->entries, template);
+ }
+ slot = mono_method_lookup_or_register_info (entry->method, entry->in_mrgctx, info, entry->info_type, mono_method_get_context (entry->method));
+ break;
+ }
default:
g_assert_not_reached ();
break;
target = (gpointer) (size_t) mono_jit_tls_id;
break;
}
+ case MONO_PATCH_INFO_TLS_OFFSET:
+ target = GINT_TO_POINTER (mini_get_tls_offset (GPOINTER_TO_INT (patch_info->data.target)));
+ break;
default:
g_assert_not_reached ();
}
/* we always allocate code in cfg->domain->code_mp to increase locality */
cfg->code_size = cfg->code_len + max_epilog_size;
+#ifdef __native_client_codegen__
+ cfg->code_size = NACL_BUNDLE_ALIGN_UP (cfg->code_size);
+#endif
/* fixme: align to MONO_ARCH_CODE_ALIGNMENT */
if (cfg->method->dynamic) {
}
}
- info->compiled_method = mini_add_method_trampoline (NULL, method, info->compiled_method, mono_method_needs_static_rgctx_invoke (method, FALSE));
+ info->compiled_method = mini_add_method_trampoline (NULL, method, info->compiled_method, mono_method_needs_static_rgctx_invoke (method, FALSE), FALSE);
}
/*
#endif
#endif
-#ifdef MONO_ARCH_HAVE_TLS_GET
mono_runtime_set_has_tls_get (MONO_ARCH_HAVE_TLS_GET);
-#else
- mono_runtime_set_has_tls_get (FALSE);
-#endif
if (!global_codeman)
global_codeman = mono_code_manager_new ();
register_icall (mono_resume_unwind, "mono_resume_unwind", "void", TRUE);
register_icall (mono_object_tostring_gsharedvt, "mono_object_tostring_gsharedvt", "object ptr ptr ptr", TRUE);
register_icall (mono_object_gethashcode_gsharedvt, "mono_object_gethashcode_gsharedvt", "int ptr ptr ptr", TRUE);
+ register_icall (mono_object_equals_gsharedvt, "mono_object_equals_gsharedvt", "int ptr ptr ptr object", TRUE);
+ register_icall (mono_gsharedvt_value_copy, "mono_gsharedvt_value_copy", "void ptr ptr ptr", TRUE);
register_icall (mono_gc_wbarrier_value_copy_bitmap, "mono_gc_wbarrier_value_copy_bitmap", "void ptr ptr int int", FALSE);
#endif
/* Version number of the AOT file format */
-#define MONO_AOT_FILE_VERSION 89
+#define MONO_AOT_FILE_VERSION 90
//TODO: This is x86/amd64 specific.
#define mono_simd_shuffle_mask(a,b,c,d) ((a) | ((b) << 2) | ((c) << 4) | ((d) << 6))
GHashTable *arch_seq_points;
/* Maps a GSharedVtTrampInfo structure to a trampoline address */
GHashTable *gsharedvt_arg_tramp_hash;
+ /* memcpy/bzero methods specialized for small constant sizes */
+ gpointer *memcpy_addr [17];
+ gpointer *bzero_addr [17];
} MonoJitDomainInfo;
typedef struct {
LLVMArgInFPReg,
LLVMArgVtypeInReg,
LLVMArgVtypeByVal,
- LLVMArgVtypeRetAddr /* On on cinfo->ret */
+ LLVMArgVtypeRetAddr, /* On on cinfo->ret */
+ LLVMArgGSharedVt,
} LLVMArgStorage;
typedef struct {
gboolean orig_ex_ctx_set;
} MonoJitTlsData;
+/* TLS entries used by JITted code */
+typedef enum {
+ /* mono_thread_internal_current () */
+ TLS_KEY_THREAD = 0,
+ TLS_KEY_JIT_TLS = 1,
+ /* mono_domain_get () */
+ TLS_KEY_DOMAIN = 2,
+ TLS_KEY_LMF = 3
+} MonoJitTlsKey;
+
/*
* This structure is an extension of MonoLMF and contains extra information.
*/
MONO_RGCTX_INFO_METHOD_GSHAREDVT_OUT_TRAMPOLINE_VIRT,
/* Same for calli, associated with a signature */
MONO_RGCTX_INFO_SIG_GSHAREDVT_OUT_TRAMPOLINE_CALLI,
- MONO_RGCTX_INFO_CLASS_IS_REF
+ /*
+ * 0 - vtype
+ * 1 - ref
+ * 2 - gsharedvt type
+ */
+ MONO_RGCTX_INFO_CLASS_BOX_TYPE,
+ /* Resolves to a MonoGSharedVtMethodRuntimeInfo */
+ MONO_RGCTX_INFO_METHOD_GSHAREDVT_INFO,
+ MONO_RGCTX_INFO_LOCAL_OFFSET,
+ MONO_RGCTX_INFO_MEMCPY,
+ MONO_RGCTX_INFO_BZERO,
+ /* The address of Nullable<T>.Box () */
+ MONO_RGCTX_INFO_NULLABLE_CLASS_BOX,
+ MONO_RGCTX_INFO_NULLABLE_CLASS_UNBOX,
} MonoRgctxInfoType;
typedef struct _MonoRuntimeGenericContextInfoTemplate {
#define MONO_GSHAREDVT_DEL_INVOKE_VT_OFFSET -2
+typedef struct {
+ MonoMethod *method;
+ /* Array of MonoRuntimeGenericContextInfoTemplate* entries */
+ GPtrArray *entries;
+} MonoGSharedVtMethodInfo;
+
+/* This is used by gsharedvt methods to allocate locals and compute local offsets */
+typedef struct {
+ int locals_size;
+ /*
+ * The results of resolving the entries in MOonGSharedVtMethodInfo->entries.
+ * We use this instead of rgctx slots since these can be loaded using a load instead
+ * of a call to an rgctx fetch trampoline.
+ */
+ gpointer entries [MONO_ZERO_LEN_ARRAY];
+} MonoGSharedVtMethodRuntimeInfo;
+
typedef enum {
#define PATCH_INFO(a,b) MONO_PATCH_INFO_ ## a,
#include "patch-info.h"
MonoJumpInfoRgctxEntry *rgctx_entry;
MonoJumpInfoImtTramp *imt_tramp;
MonoJumpInfoGSharedVtCall *gsharedvt;
+ MonoGSharedVtMethodInfo *gsharedvt_method;
MonoMethodSignature *sig;
} data;
};
gboolean gsharedvt;
+ MonoGSharedVtMethodInfo *gsharedvt_info;
+
+ /* Points to the gsharedvt locals area at runtime */
+ MonoInst *gsharedvt_locals_var;
+
+ /* The localloc instruction used to initialize gsharedvt_locals_var */
+ MonoInst *gsharedvt_locals_var_ins;
+
+ /* Points to a MonoGSharedVtMethodRuntimeInfo at runtime */
+ MonoInst *gsharedvt_info_var;
+
/* For native-to-managed wrappers, the saved old domain */
MonoInst *orig_domain_var;
GSList *headers_to_free;
/* Used by AOT */
- guint32 got_offset, ex_info_offset, method_info_offset;
+ guint32 got_offset, ex_info_offset, method_info_offset, method_index;
/* Symbol used to refer to this method in generated assembly */
char *asm_symbol;
char *llvm_method_name;
gint32 mono_get_jit_tls_offset (void) MONO_INTERNAL;
gint32 mono_get_lmf_tls_offset (void) MONO_INTERNAL;
gint32 mono_get_lmf_addr_tls_offset (void) MONO_INTERNAL;
+int mini_get_tls_offset (MonoJitTlsKey key) MONO_INTERNAL;
MonoInst* mono_get_jit_tls_intrinsic (MonoCompile *cfg) MONO_INTERNAL;
MonoInst* mono_get_domain_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
MonoInst* mono_get_thread_intrinsic (MonoCompile* cfg) MONO_INTERNAL;
guint8 *mono_arch_nacl_pad(guint8 *code, int pad);
guint8 *mono_arch_nacl_skip_nops(guint8 *code);
-extern const guint kNaClAlignment;
-extern const guint kNaClAlignmentMask;
+#if defined(TARGET_X86)
+#define kNaClAlignment kNaClAlignmentX86
+#define kNaClAlignmentMask kNaClAlignmentMaskX86
+#elif defined(TARGET_AMD64)
+#define kNaClAlignment kNaClAlignmentAMD64
+#define kNaClAlignmentMask kNaClAlignmentMaskAMD64
+#elif defined(TARGET_ARM)
+#define kNaClAlignment kNaClAlignmentARM
+#define kNaClAlignmentMask kNaClAlignmentMaskARM
+#endif
+
+#define NACL_BUNDLE_ALIGN_UP(p) ((((p)+kNaClAlignmentMask)) & ~kNaClAlignmentMask)
#endif
#if defined(__native_client__) || defined(__native_client_codegen__)
extern volatile int __nacl_thread_suspension_needed;
-extern void __nacl_suspend_thread_if_needed();
-void mono_nacl_gc();
+void __nacl_suspend_thread_if_needed(void);
+void mono_nacl_gc(void);
#endif
#if defined(__native_client_codegen__) || defined(__native_client__)
guint32 mono_aot_get_got_offset (MonoJumpInfo *ji) MONO_LLVM_INTERNAL;
char* mono_aot_get_method_name (MonoCompile *cfg) MONO_LLVM_INTERNAL;
char* mono_aot_get_plt_symbol (MonoJumpInfoType type, gconstpointer data) MONO_LLVM_INTERNAL;
+int mono_aot_get_method_index (MonoMethod *method) MONO_LLVM_INTERNAL;
MonoJumpInfo* mono_aot_patch_info_dup (MonoJumpInfo* ji) MONO_LLVM_INTERNAL;
void mono_aot_set_make_unreadable (gboolean unreadable) MONO_INTERNAL;
gboolean mono_aot_is_pagefault (void *ptr) MONO_INTERNAL;
gpointer mini_get_vtable_trampoline (int slot_index) MONO_INTERNAL;
char* mono_get_generic_trampoline_name (MonoTrampolineType tramp_type) MONO_INTERNAL;
char* mono_get_rgctx_fetch_trampoline_name (int slot) MONO_INTERNAL;
-gpointer mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp) MONO_INTERNAL;
+gpointer mini_add_method_trampoline (MonoMethod *orig_method, MonoMethod *m, gpointer compiled_method, gboolean add_static_rgctx_tramp, gboolean add_unbox_tramp) MONO_INTERNAL;
+gboolean mini_jit_info_is_gsharedvt (MonoJitInfo *ji) MONO_INTERNAL;
gboolean mono_running_on_valgrind (void) MONO_INTERNAL;
void* mono_global_codeman_reserve (int size) MONO_INTERNAL;
void
mono_set_generic_sharing_vt_supported (gboolean supported) MONO_INTERNAL;
+void
+mono_set_partial_sharing_supported (gboolean supported) MONO_INTERNAL;
+
gboolean
mono_class_generic_sharing_enabled (MonoClass *class) MONO_INTERNAL;
const char*
mono_rgctx_info_type_to_str (MonoRgctxInfoType type) MONO_INTERNAL;
+MonoJumpInfoType
+mini_rgctx_info_type_to_patch_info_type (MonoRgctxInfoType info_type) MONO_INTERNAL;
+
gboolean
mono_method_needs_static_rgctx_invoke (MonoMethod *method, gboolean allow_type_vars) MONO_INTERNAL;
gboolean mini_is_gsharedvt_signature (MonoCompile *cfg, MonoMethodSignature *sig) MONO_INTERNAL;
gboolean mini_is_gsharedvt_type_gsctx (MonoGenericSharingContext *gsctx, MonoType *t) MONO_INTERNAL;
gboolean mini_is_gsharedvt_variable_type (MonoCompile *cfg, MonoType *t) MONO_INTERNAL;
-MonoType* mini_get_gsharedvt_alloc_type_for_type (MonoCompile *cfg, MonoType *t); /* should be internal but it's used by llvm */
gboolean mini_is_gsharedvt_sharable_method (MonoMethod *method) MONO_INTERNAL;
gboolean mini_is_gsharedvt_variable_signature (MonoMethodSignature *sig) MONO_INTERNAL;
gboolean mini_is_gsharedvt_sharable_inst (MonoGenericInst *inst) MONO_INTERNAL;
void SIG_HANDLER_SIGNATURE (mono_sigint_signal_handler) MONO_INTERNAL;
gboolean SIG_HANDLER_SIGNATURE (mono_chain_signal) MONO_INTERNAL;
+#ifdef MONO_ARCH_HAVE_CREATE_DELEGATE_TRAMPOLINE
+#define ARCH_HAVE_DELEGATE_TRAMPOLINES 1
+#else
+#define ARCH_HAVE_DELEGATE_TRAMPOLINES 0
+#endif
+
+#ifdef MONO_ARCH_USE_OP_TAIL_CALL
+#define ARCH_USE_OP_TAIL_CALL 1
+#else
+#define ARCH_USE_OP_TAIL_CALL 0
+#endif
+
+#ifndef MONO_ARCH_HAVE_TLS_GET
+#define MONO_ARCH_HAVE_TLS_GET 0
+#endif
+
+#ifdef MONO_ARCH_HAVE_TLS_GET_REG
+#define ARCH_HAVE_TLS_GET_REG 1
+#else
+#define ARCH_HAVE_TLS_GET_REG 0
+#endif
+
#endif /* __MONO_MINI_H__ */
PATCH_INFO(CASTCLASS_CACHE, "castclass_cache")
PATCH_INFO(SIGNATURE, "signature")
PATCH_INFO(GSHAREDVT_CALL, "gsharedvt_call")
+PATCH_INFO(GSHAREDVT_METHOD, "gsharedvt_method")
PATCH_INFO(JIT_TLS_ID, "jit_tls_id")
+PATCH_INFO(TLS_OFFSET, "tls_offset")
PATCH_INFO(NONE, "none")
+
+
mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
{
guint8 *code, *start;
- int this_reg;
+ int this_reg, size = NACL_SIZE (20, 32);
MonoDomain *domain = mono_domain_get ();
this_reg = mono_arch_get_this_arg_reg (NULL);
- start = code = mono_domain_code_reserve (domain, 20);
+ start = code = mono_domain_code_reserve (domain, size);
amd64_alu_reg_imm (code, X86_ADD, this_reg, sizeof (MonoObject));
/* FIXME: Optimize this */
amd64_mov_reg_imm (code, AMD64_RAX, addr);
amd64_jump_reg (code, AMD64_RAX);
- g_assert ((code - start) < 20);
+ g_assert ((code - start) < size);
- nacl_domain_code_validate (domain, &start, 20, &code);
+ nacl_domain_code_validate (domain, &start, size, &code);
mono_arch_flush_icache (start, code - start);
#else
/* AOTed code could still have a non-32 bit address */
if ((((guint64)addr) >> 32) == 0)
- buf_len = 16;
+ buf_len = NACL_SIZE (16, 32);
else
- buf_len = 30;
+ buf_len = NACL_SIZE (30, 32);
#endif
start = code = mono_domain_code_reserve (domain, buf_len);
mono_arch_get_nullified_class_init_trampoline (MonoTrampInfo **info)
{
guint8 *code, *buf;
+ int size = NACL_SIZE (16, 32);
- code = buf = mono_global_codeman_reserve (16);
+ code = buf = mono_global_codeman_reserve (size);
amd64_ret (code);
- nacl_global_codeman_validate(&buf, 16, &code);
+ nacl_global_codeman_validate(&buf, size, &code);
mono_arch_flush_icache (buf, code - buf);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("nullified_class_init_trampoline"), buf, code - buf, NULL, NULL);
+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
if (mono_jit_map_is_enabled ())
mono_emit_jit_tramp (buf, code - buf, "nullified_class_init_trampoline");
/* Aligning the call site below could */
/* add up to kNaClAlignment-1 bytes */
size += (kNaClAlignment-1);
+ size = NACL_BUNDLE_ALIGN_UP (size);
buf = mono_domain_code_reserve_align (domain, size, kNaClAlignment);
code = buf;
#endif
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("monitor_enter_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("monitor_enter_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("monitor_exit_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("monitor_exit_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
mono_arch_flush_icache (buf, code - buf);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("nullified_class_init_trampoline"), buf, code - buf, NULL, NULL);
+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
return buf;
}
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
#else
gpointer
-mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer *caller_regs, gpointer *callee_regs, gpointer mrgctx_reg)
+mono_arm_start_gsharedvt_call (GSharedVtCallInfo *info, gpointer *caller, gpointer *callee, gpointer mrgctx_reg)
{
g_assert_not_reached ();
return NULL;
mono_arch_flush_icache (buf, code - buf);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("nullified_class_init_trampoline"), buf, code - buf, NULL, NULL);
+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
return buf;
}
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return buf;
#else
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("nullified_class_init_trampoline"), buf, code - buf, NULL, NULL);
+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
return buf;
}
mono_arch_flush_icache (code, buf - code);
if (info)
- *info = mono_tramp_info_create (mono_get_generic_trampoline_name(tramp_type),
+ *info = mono_tramp_info_create (mono_get_generic_trampoline_name(tramp_type),
buf, buf - code, ji, unwind_ops);
/* Sanity check */
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return(buf);
#else
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return(buf);
}
mono_arch_get_unbox_trampoline (MonoMethod *m, gpointer addr)
{
guint8 *code, *start;
- int this_pos = 4;
+ int this_pos = 4, size = NACL_SIZE(16, 32);
MonoDomain *domain = mono_domain_get ();
- start = code = mono_domain_code_reserve (domain, 16);
+ start = code = mono_domain_code_reserve (domain, size);
x86_alu_membase_imm (code, X86_ADD, X86_ESP, this_pos, sizeof (MonoObject));
x86_jump_code (code, addr);
- g_assert ((code - start) < 16);
+ g_assert ((code - start) < size);
- nacl_domain_code_validate (domain, &start, 16, &code);
+ nacl_domain_code_validate (domain, &start, size, &code);
return start;
}
MonoDomain *domain = mono_domain_get ();
- buf_len = 10;
+ buf_len = NACL_SIZE (10, 32);
start = code = mono_domain_code_reserve (domain, buf_len);
mono_arch_flush_icache (buf, code - buf);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("nullified_class_init_trampoline"), buf, code - buf, NULL, NULL);
+ *info = mono_tramp_info_create ("nullified_class_init_trampoline", buf, code - buf, NULL, NULL);
if (mono_jit_map_is_enabled ())
mono_emit_jit_tramp (buf, code - buf, "nullified_class_init_trampoline");
g_assert (code - buf <= tramp_size);
- if (info)
- *info = mono_tramp_info_create (mono_get_rgctx_fetch_trampoline_name (slot), buf, code - buf, ji, unwind_ops);
+ if (info) {
+ char *name = mono_get_rgctx_fetch_trampoline_name (slot);
+ *info = mono_tramp_info_create (name, buf, code - buf, ji, unwind_ops);
+ g_free (name);
+ }
return buf;
}
nacl_global_codeman_validate (&buf, tramp_size, &code);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("generic_class_init_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("generic_class_init_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
nacl_global_codeman_validate (&buf, tramp_size, &code);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("monitor_enter_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("monitor_enter_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
g_assert (code - buf <= tramp_size);
if (info)
- *info = mono_tramp_info_create (g_strdup_printf ("monitor_exit_trampoline"), buf, code - buf, ji, unwind_ops);
+ *info = mono_tramp_info_create ("monitor_exit_trampoline", buf, code - buf, ji, unwind_ops);
return buf;
}
debugger may check the version before we can set it. */
struct jit_descriptor __jit_debug_descriptor = { 1, 0, 0, 0 };
+#if !defined(MONO_LLVM_LOADED) && defined(ENABLE_LLVM) && ((LLVM_MAJOR_VERSION == 2 && LLVM_MINOR_VERSION >= 7) || LLVM_MAJOR_VERSION > 2)
+
+/* LLVM already defines these */
+
+#else
+
/* gcc seems to inline/eliminate calls to noinline functions, thus the asm () */
void MONO_NOINLINE __jit_debug_register_code(void) {
#if defined(__GNUC__)
#endif
}
+#endif
+
static MonoImageWriter *xdebug_w;
static MonoDwarfWriter *xdebug_writer;
static FILE *xdebug_fp, *il_file;
img_writer_emit_start (w);
- xdebug_writer = mono_dwarf_writer_create (w, il_file, 0, TRUE);
+ xdebug_writer = mono_dwarf_writer_create (w, il_file, 0, TRUE, TRUE);
/* Emit something so the file has a text segment */
img_writer_emit_section_change (w, ".text", 0);
if (!il_file)
il_file = fopen ("xdb.il", "w");
- dw = mono_dwarf_writer_create (w, il_file, il_file_line_index, FALSE);
+ dw = mono_dwarf_writer_create (w, il_file, il_file_line_index, FALSE, TRUE);
mono_dwarf_writer_emit_base_info (dw, mono_unwind_get_cie_program ());
bug-6148.cs \
assembly_append_ordering.cs \
bug-10127.cs \
- allow-synchronous-major.cs
+ allow-synchronous-major.cs \
+ unload-appdomain-on-shutdown.cs
TEST_CS_SRC_DIST= \
$(BASE_TEST_CS_SRC) \
$(PLATFORM_DISABLED_TESTS_WRENCH) \
main-returns-background-resetabort.exe \
main-returns-background-abort-resetabort.exe \
- main-returns-background.exe \
thread6.exe \
assemblyresolve_event3.exe \
delegate2.exe \
- finally_guard.exe \
- finalizer-abort.exe \
- finalizer-exit.exe \
- finalizer-thread.exe \
- appdomain-async-invoke.exe
+ finally_guard.exe \
+ gc-altstack.exe
AOT_DISABLED_TESTS=constraints-load.exe
~P () {
T.finalized = true;
Thread.Sleep (1000);
- //Console.WriteLine ("finalizer done");
+ // Console.WriteLine ("finalizer done");
count++;
}
}
p = null;
}
- static void callMakeP (int i) {
- if (i <= 0)
- {
- makeP ();
- return;
- }
- callMakeP (i - 1);
- }
-
static int Main () {
- callMakeP (100);
+ var t = new Thread (makeP);
+ t.Start ();
+ t.Join ();
GC.Collect ();
while (!finalized) {
\r
.class public auto ansi beforefieldinit FieldWithMissingType\r
{\r
- .field public [T]Missing BrokenField\r
+ .field public [t]Missing BrokenField\r
.field public static int32 WorkingField\r
}\r
--- /dev/null
+using System;
+using System.Reflection;
+using System.Threading;
+
+
+class Driver {
+ public static void Bla ()
+ {
+ //DoDomainUnload is invoked as part of the unload sequence, so let's pre jit it here to increase the likehood
+ //of hanging
+ var m = typeof (AppDomain).GetMethod ("DoDomainUnload", BindingFlags.Instance | BindingFlags.NonPublic);
+ if (m != null)
+ m.MethodHandle.GetFunctionPointer ();
+ }
+
+ static AppDomain ad;
+ static ManualResetEvent evt = new ManualResetEvent (false);
+
+ static void UnloadIt ()
+ {
+ //AppDomain.Unload calls AppDomain::getDomainId () before calling into the runtime, so let's pre jit
+ //it here to increase the likehood of hanging
+ var x = ad.Id;
+ evt.Set ();
+ AppDomain.Unload (ad);
+ }
+ static int Main ()
+ {
+ AppDomain.Unload (AppDomain.CreateDomain ("Warmup unload code"));
+ Console.WriteLine (".");
+ ad = AppDomain.CreateDomain ("NewDomain");
+ ad.DoCallBack (Bla);
+ var t = new Thread (UnloadIt);
+ t.IsBackground = true;
+ t.Start ();
+ evt.WaitOne ();
+ return 0;
+ }
+}
--- /dev/null
+
+// Microsoft (R) .NET Framework IL Disassembler. Version 4.0.30319.17929
+// Copyright (c) Microsoft Corporation. All rights reserved.
+
+
+
+// Metadata version: v4.0.30319
+.assembly extern mscorlib
+{
+ .publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) // .z\V.4..
+ .ver 4:0:0:0
+}
+.assembly 'test-901'
+{
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = ( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78 // ....T..WrapNonEx
+ 63 65 70 74 69 6F 6E 54 68 72 6F 77 73 01 ) // ceptionThrows.
+ .hash algorithm 0x00008004
+ .ver 0:0:0:0
+}
+.module 'test-901.exe'
+// MVID: {66ECA143-8B2A-47EB-A840-23ED00E2033E}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003 // WINDOWS_CUI
+.corflags 0x00000001 // ILONLY
+// Image base: 0x00620000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class public auto ansi beforefieldinit Application
+ extends [mscorlib]System.Object
+{
+ .class auto ansi sealed nested private beforefieldinit '<foo>c__async0`1'<.ctor ([mscorlib]System.Exception, [mscorlib]System.Runtime.Serialization.ISerializable, [mscorlib]System.Runtime.InteropServices._Exception) TException>
+ extends [mscorlib]System.ValueType
+ implements [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.CompilerGeneratedAttribute::.ctor() = ( 01 00 00 00 )
+ .field assembly valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder $builder
+ .field assembly int32 $PC
+ .method public hidebysig newslot virtual final
+ instance void MoveNext() cil managed
+ {
+ // Code size 94 (0x5e)
+ .maxstack 3
+ .locals init (class [mscorlib]System.Exception V_0)
+ IL_0000: ldarg.0
+ IL_0001: ldfld int32 valuetype Application/'<foo>c__async0`1'<!TException>::$PC
+ IL_0006: ldarg.0
+ IL_0007: ldc.i4.m1
+ IL_0008: stfld int32 valuetype Application/'<foo>c__async0`1'<!TException>::$PC
+ IL_000d: brtrue IL_005d
+
+ .try
+ {
+ IL_0012: call !!0 [mscorlib]System.Activator::CreateInstance<!TException>()
+ IL_0017: box !TException
+ IL_001c: throw
+
+ } // end .try
+ catch !!0
+ {
+ IL_001d: pop
+ IL_001e: ldstr "caught in correct block"
+ IL_0023: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0028: leave IL_0052
+
+ } // end handler
+ catch [mscorlib]System.Exception
+ {
+ IL_002d: stloc.0
+ IL_002e: ldstr "caught in generic block"
+ IL_0033: call void [mscorlib]System.Console::WriteLine(string)
+ IL_0038: ldstr "type: "
+ IL_003d: ldloc.0
+ IL_003e: callvirt instance class [mscorlib]System.Type [mscorlib]System.Exception::GetType()
+ IL_0043: call string [mscorlib]System.String::Concat(object,
+ object)
+ IL_0048: call void [mscorlib]System.Console::WriteLine(string)
+ IL_004d: leave IL_0052
+
+ } // end handler
+ IL_0052: ldarg.0
+ IL_0053: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder valuetype Application/'<foo>c__async0`1'<!TException>::$builder
+ IL_0058: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetResult()
+ IL_005d: ret
+ } // end of method '<foo>c__async0`1'::MoveNext
+
+ .method public hidebysig newslot virtual final
+ instance void SetStateMachine(class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine stateMachine) cil managed
+ {
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 13 (0xd)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder valuetype Application/'<foo>c__async0`1'<!TException>::$builder
+ IL_0006: ldarg.1
+ IL_0007: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::SetStateMachine(class [mscorlib]System.Runtime.CompilerServices.IAsyncStateMachine)
+ IL_000c: ret
+ } // end of method '<foo>c__async0`1'::SetStateMachine
+
+ } // end of class '<foo>c__async0`1'
+
+ .method public hidebysig specialname rtspecialname
+ instance void .ctor() cil managed
+ {
+ // Code size 7 (0x7)
+ .maxstack 8
+ IL_0000: ldarg.0
+ IL_0001: call instance void [mscorlib]System.Object::.ctor()
+ IL_0006: ret
+ } // end of method Application::.ctor
+
+ .method private hidebysig static class [mscorlib]System.Threading.Tasks.Task
+ foo<.ctor ([mscorlib]System.Exception) TException>() cil managed
+ {
+ .custom instance void [mscorlib]System.Runtime.CompilerServices.AsyncStateMachineAttribute::.ctor(class [mscorlib]System.Type) = ( 01 00 1C 41 70 70 6C 69 63 61 74 69 6F 6E 2B 3C // ...Application+<
+ 66 6F 6F 3E 63 5F 5F 61 73 79 6E 63 30 60 31 00 // foo>c__async0`1.
+ 00 )
+ .custom instance void [mscorlib]System.Diagnostics.DebuggerHiddenAttribute::.ctor() = ( 01 00 00 00 )
+ // Code size 33 (0x21)
+ .maxstack 3
+ .locals init (valuetype Application/'<foo>c__async0`1'<!!TException> V_0)
+ IL_0000: ldloca.s V_0
+ IL_0002: call valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Create()
+ IL_0007: stfld valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder valuetype Application/'<foo>c__async0`1'<!!TException>::$builder
+ IL_000c: ldloca.s V_0
+ IL_000e: ldflda valuetype [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder valuetype Application/'<foo>c__async0`1'<!!TException>::$builder
+ IL_0013: dup
+ IL_0014: ldloca.s V_0
+ IL_0016: call instance void [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::Start<valuetype Application/'<foo>c__async0`1'<!!0>>(!!0&)
+ IL_001b: call instance class [mscorlib]System.Threading.Tasks.Task [mscorlib]System.Runtime.CompilerServices.AsyncTaskMethodBuilder::get_Task()
+ IL_0020: ret
+ } // end of method Application::foo
+
+ .method private hidebysig static void Main(string[] args) cil managed
+ {
+ .entrypoint
+ // Code size 11 (0xb)
+ .maxstack 8
+ IL_0000: call class [mscorlib]System.Threading.Tasks.Task Application::foo<class [mscorlib]System.InvalidOperationException>()
+ IL_0005: callvirt instance void [mscorlib]System.Threading.Tasks.Task::Wait()
+ IL_000a: ret
+ } // end of method Application::Main
+
+} // end of class Application
+
+
+// =============================================================
+
+// *********** DISASSEMBLY COMPLETE ***********************
#endif
}
+#undef NACL_ALIGN
+#undef MASK_REGISTER
+
#elif defined(__ia64__)
#ifdef __INTEL_COMPILER
*
* Authors:
* Geoff Norton (gnorton@novell.com)
+ * Rodrigo Kumpera (kumpera@gmail.com)
*
* (C) 2010 Novell, Inc.
+ * (C) 2013 Xamarin, Inc.
*/
#include <config.h>
#include "utils/mono-sigcontext.h"
#include "mach-support.h"
+/* Known offsets used for TLS storage*/
+
+/* All OSX versions up to 10.8 */
+#define TLS_VECTOR_OFFSET_CATS 0x60
+#define TLS_VECTOR_OFFSET_10_9 0xe0
+
+static int tls_vector_offset;
+
void *
mono_mach_arch_get_ip (thread_state_t state)
{
mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
{
/* OSX stores TLS values in a hidden array inside the pthread_t structure
- * They are keyed off a giant array offset 0x60 into the pointer. This value
+ * They are keyed off a giant array from a known offset into the pointer. This value
* is baked into their pthread_getspecific implementation
*/
intptr_t *p = (intptr_t *)thread;
- intptr_t **tsd = (intptr_t **) ((char*)p + 0x60);
+ intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
return (void *) &tsd [key];
}
return *(void**)mono_mach_get_tls_address_from_thread (thread, key);
}
+void
+mono_mach_init (pthread_key_t key)
+{
+ void *old_value = pthread_getspecific (key);
+ void *canary = (void*)0xDEADBEEFu;
+
+ pthread_key_create (&key, NULL);
+ g_assert (old_value != canary);
+
+ pthread_setspecific (key, canary);
+
+ /*First we probe for cats*/
+ tls_vector_offset = TLS_VECTOR_OFFSET_CATS;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ tls_vector_offset = TLS_VECTOR_OFFSET_10_9;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ g_error ("could not discover the mach TLS offset");
+ok:
+ pthread_setspecific (key, old_value);
+}
+
#endif
#include "utils/mono-sigcontext.h"
#include "mach-support.h"
+/* Known offsets used for TLS storage*/
+
+/*Found on iOS 6 */
+#define TLS_VECTOR_OFFSET_0 0x48
+#define TLS_VECTOR_OFFSET_1 0xA8
+
+static int tls_vector_offset;
+
void *
mono_mach_arch_get_ip (thread_state_t state)
{
void *
mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
{
- /* OSX stores TLS values in a hidden array inside the pthread_t structure
- * They are keyed off a giant array offset 0x48 into the pointer. This value
+ /* Mach stores TLS values in a hidden array inside the pthread_t structure
+ * They are keyed off a giant array from a known offset into the pointer. This value
* is baked into their pthread_getspecific implementation
*/
intptr_t *p = (intptr_t *) thread;
- intptr_t **tsd = (intptr_t **) ((char*)p + 0x48 + (key << 2));
+ intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
- return (void *)tsd;
+ return (void *) &tsd [key];
}
void *
return *(void**)mono_mach_get_tls_address_from_thread (thread, key);
}
+void
+mono_mach_init (pthread_key_t key)
+{
+ void *old_value = pthread_getspecific (key);
+ void *canary = (void*)0xDEADBEEFu;
+
+ pthread_key_create (&key, NULL);
+ g_assert (old_value != canary);
+
+ pthread_setspecific (key, canary);
+
+ /*First we probe for cats*/
+ tls_vector_offset = TLS_VECTOR_OFFSET_0;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ tls_vector_offset = TLS_VECTOR_OFFSET_1;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ g_error ("could not discover the mach TLS offset");
+ok:
+ pthread_setspecific (key, old_value);
+}
+
#endif
{
g_assert_not_reached ();
}
+
+void
+mono_mach_init (pthread_key_t key)
+{
+}
+
#endif
#include "utils/mono-sigcontext.h"
#include "mach-support.h"
+/* Known offsets used for TLS storage*/
+
+/* All OSX versions up to 10.8 */
+#define TLS_VECTOR_OFFSET_CATS 0x48
+#define TLS_VECTOR_OFFSET_10_9 0xb0
+
+static int tls_vector_offset;
+
void *
mono_mach_arch_get_ip (thread_state_t state)
{
mono_mach_get_tls_address_from_thread (pthread_t thread, pthread_key_t key)
{
/* OSX stores TLS values in a hidden array inside the pthread_t structure
- * They are keyed off a giant array offset 0x48 into the pointer. This value
+ * They are keyed off a giant array from a known offset into the pointer. This value
* is baked into their pthread_getspecific implementation
*/
intptr_t *p = (intptr_t *) thread;
- intptr_t **tsd = (intptr_t **) ((char*)p + 0x48);
+ intptr_t **tsd = (intptr_t **) ((char*)p + tls_vector_offset);
return (void *) &tsd [key];
}
return *(void**)mono_mach_get_tls_address_from_thread (thread, key);
}
+void
+mono_mach_init (pthread_key_t key)
+{
+ void *old_value = pthread_getspecific (key);
+ void *canary = (void*)0xDEADBEEFu;
+
+ pthread_key_create (&key, NULL);
+ g_assert (old_value != canary);
+
+ pthread_setspecific (key, canary);
+
+ /*First we probe for cats*/
+ tls_vector_offset = TLS_VECTOR_OFFSET_CATS;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ tls_vector_offset = TLS_VECTOR_OFFSET_10_9;
+ if (mono_mach_arch_get_tls_value_from_thread (pthread_self (), key) == canary)
+ goto ok;
+
+ g_error ("could not discover the mach TLS offset");
+ok:
+ pthread_setspecific (key, old_value);
+}
#endif
void *mono_mach_arch_get_ip (thread_state_t state) MONO_INTERNAL;
void *mono_mach_arch_get_sp (thread_state_t state) MONO_INTERNAL;
+void mono_mach_init (pthread_key_t key) MONO_INTERNAL;
int mono_mach_arch_get_mcontext_size (void) MONO_INTERNAL;
void mono_mach_arch_thread_state_to_mcontext (thread_state_t state, void *context) MONO_INTERNAL;
#if defined(__native_client_codegen__) && defined(__native_client__)
#include <malloc.h>
#include <nacl/nacl_dyncode.h>
+#include <mono/mini/mini.h>
#endif
static uintptr_t code_memory_used = 0;
#endif
#ifdef __native_client_codegen__
/* For Google Native Client, all targets of indirect control flow need to */
-/* be aligned to a 32-byte boundary. MIN_ALIGN was updated to 32 to force */
-/* alignment for calls from tramp-x86.c to mono_global_codeman_reserve() */
+/* be aligned to bundle boundary. 16 bytes on ARM, 32 bytes on x86.
+ * MIN_ALIGN was updated to force alignment for calls from
+ * tramp-<arch>.c to mono_global_codeman_reserve() */
/* and mono_domain_code_reserve(). */
#undef MIN_ALIGN
-#define MIN_ALIGN 32
+#define MIN_ALIGN kNaClBundleSize
+
#endif
/* if a chunk has less than this amount of free space it's considered full */
return (char *)target < next_dynamic_code_addr;
}
+/* Fill code buffer with arch-specific NOPs. */
+void
+mono_nacl_fill_code_buffer (guint8 *data, int size);
+
+#ifndef USE_JUMP_TABLES
const int kMaxPatchDepth = 32;
__thread unsigned char **patch_source_base = NULL;
__thread unsigned char **patch_dest_base = NULL;
__thread int patch_current_depth = -1;
__thread int allow_target_modification = 1;
-void
-nacl_allow_target_modification (int val)
-{
- allow_target_modification = val;
-}
-
static void
nacl_jit_check_init ()
{
patch_alloc_size = g_malloc (kMaxPatchDepth * sizeof(int));
}
}
+#endif
+void
+nacl_allow_target_modification (int val)
+{
+#ifndef USE_JUMP_TABLES
+ allow_target_modification = val;
+#endif /* USE_JUMP_TABLES */
+}
/* Given a patch target, modify the target such that patching will work when
* the code is copied to the data section.
void*
nacl_modify_patch_target (unsigned char *target)
{
+ /*
+ * There's no need in patch tricks for jumptables,
+ * as we always patch same jumptable.
+ */
+#ifndef USE_JUMP_TABLES
/* This seems like a bit of an ugly way to do this but the advantage
* is we don't have to worry about all the conditions in
* mono_resolve_patch_target, and it can be used by all the bare uses
int target_offset = target - db;
target = sb + target_offset;
}
+#endif
return target;
}
void*
nacl_inverse_modify_patch_target (unsigned char *target)
{
+ /*
+ * There's no need in patch tricks for jumptables,
+ * as we always patch same jumptable.
+ */
+#ifndef USE_JUMP_TABLES
unsigned char *sb;
unsigned char *db;
int target_offset;
target_offset = target - sb;
target = db + target_offset;
+#endif
return target;
}
#endif
}
cman->hash = g_hash_table_new (NULL, NULL);
+# ifndef USE_JUMP_TABLES
if (patch_source_base == NULL) {
patch_source_base = g_malloc (kMaxPatchDepth * sizeof(unsigned char *));
patch_dest_base = g_malloc (kMaxPatchDepth * sizeof(unsigned char *));
patch_alloc_size = g_malloc (kMaxPatchDepth * sizeof(int));
}
+# endif
#endif
return cman;
}
/* Insert pointer to code space in hash, keyed by buffer ptr */
g_hash_table_insert (cman->hash, temp_ptr, code_ptr);
+#ifndef USE_JUMP_TABLES
nacl_jit_check_init ();
patch_current_depth++;
patch_dest_base[patch_current_depth] = code_ptr;
patch_alloc_size[patch_current_depth] = size;
g_assert (patch_current_depth < kMaxPatchDepth);
+#endif
+
return temp_ptr;
#endif
}
#else
unsigned char *code;
int status;
- g_assert (newsize <= size);
+ g_assert (NACL_BUNDLE_ALIGN_UP(newsize) <= size);
code = g_hash_table_lookup (cman->hash, data);
g_assert (code != NULL);
- /* Pad space after code with HLTs */
- /* TODO: this is x86/amd64 specific */
- while (newsize & kNaClBundleMask) {
- *((char *)data + newsize) = 0xf4;
- newsize++;
- }
+ mono_nacl_fill_code_buffer ((uint8_t*)data + newsize, size - newsize);
+ newsize = NACL_BUNDLE_ALIGN_UP(newsize);
+ g_assert ((GPOINTER_TO_UINT (data) & kNaClBundleMask) == 0);
+ g_assert ((newsize & kNaClBundleMask) == 0);
status = nacl_dyncode_create (code, data, newsize);
if (status != 0) {
unsigned char *codep;
g_assert_not_reached ();
}
g_hash_table_remove (cman->hash, data);
+# ifndef USE_JUMP_TABLES
g_assert (data == patch_source_base[patch_current_depth]);
g_assert (code == patch_dest_base[patch_current_depth]);
patch_current_depth--;
g_assert (patch_current_depth >= -1);
+# endif
free (data);
#endif
}
return size;
}
+#ifdef __native_client_codegen__
+# if defined(TARGET_ARM)
+/* Fill empty space with UDF instruction used as halt on ARM. */
+void
+mono_nacl_fill_code_buffer (guint8 *data, int size)
+{
+ guint32* data32 = (guint32*)data;
+ int i;
+ g_assert(size % 4 == 0);
+ for (i = 0; i < size / 4; i++)
+ data32[i] = 0xE7FEDEFF;
+}
+# elif (defined(TARGET_X86) || defined(TARGET_AMD64))
+/* Fill empty space with HLT instruction */
+void
+mono_nacl_fill_code_buffer(guint8 *data, int size)
+{
+ memset (data, 0xf4, size);
+}
+# else
+# error "Not ported"
+# endif
+#endif
#if defined( __native_client_codegen__ ) && defined( __native_client__ )
+#ifdef __arm__
+#define kNaClBundleSize 16
+#else
#define kNaClBundleSize 32
+#endif
#define kNaClBundleMask (kNaClBundleSize-1)
+#ifndef USE_JUMP_TABLES
extern __thread unsigned char **patch_source_base;
extern __thread unsigned char **patch_dest_base;
extern __thread int patch_current_depth;
+#endif
int nacl_is_code_address (void *target);
void* nacl_code_manager_get_code_dest (MonoCodeManager *cman, void *data);
#endif /* _MSC_VER */
-#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && HAVE_VISIBILITY_HIDDEN
+#if !defined(_MSC_VER) && !defined(PLATFORM_SOLARIS) && !defined(_WIN32) && !defined(__CYGWIN__) && !defined(MONOTOUCH) && HAVE_VISIBILITY_HIDDEN
#define MONO_INTERNAL __attribute__ ((visibility ("hidden")))
#if MONO_LLVM_LOADED
#define MONO_LLVM_INTERNAL
static inline void mono_memory_barrier (void)
{
#ifdef HAVE_ARMV6
+#ifdef __native_client__
+ /* NaCl requires ARMv7 CPUs. */
+ __asm__ __volatile__("dsb" : : : "memory");
+#else
__asm__ __volatile__ ("mcr p15, 0, %0, c7, c10, 5" : : "r" (0) : "memory");
#endif
+#endif
}
static inline void mono_memory_read_barrier (void)
if (!use_shared_area) {
if (g_getenv ("MONO_DISABLE_SHARED_AREA"))
use_shared_area = -1;
- use_shared_area = 1;
+ else
+ use_shared_area = 1;
}
return use_shared_area == -1;
}
#include <errno.h>
#include <assert.h>
#include <sys/time.h>
+#include <mono/utils/mono-memory-model.h>
#include "mono-mutex.h"
#if defined(__APPLE__)
#define _DARWIN_C_SOURCE
#include <pthread_spis.h>
+#include <dlfcn.h>
#endif
#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
#if defined(__APPLE__)
int res;
pthread_mutexattr_t attr;
+ static gboolean inited;
+ static int (*setpolicy_np) (pthread_mutexattr_t *, int);
+
+ if (!inited) {
+ setpolicy_np = dlsym (RTLD_NEXT, "pthread_mutexattr_setpolicy_np");
+ mono_atomic_store_release (&inited, TRUE);
+ }
pthread_mutexattr_init (&attr);
pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
- pthread_mutexattr_setpolicy_np (&attr, _PTHREAD_MUTEX_POLICY_FIRSTFIT);
+ if (setpolicy_np)
+ setpolicy_np (&attr, _PTHREAD_MUTEX_POLICY_FIRSTFIT);
res = pthread_mutex_init (mutex, &attr);
pthread_mutexattr_destroy (&attr);
#include "mono-poll.h"
#include <errno.h>
+#ifdef DISABLE_SOCKETS
+#include <glib.h>
+
+int
+mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout)
+{
+ g_assert_not_reached ();
+ return -1;
+}
+#else
+
#if defined(HAVE_POLL) && !defined(__APPLE__)
int
mono_poll (mono_pollfd *ufds, unsigned int nfds, int timeout)
#endif
+#endif /* #ifndef DISABLE_SOCKETS */
ret = t_info.virtual_size;
else if (strcmp (item, "Threads") == 0)
ret = th_count;
+ else
+ ret = 0;
mach_port_deallocate (mach_task_self (), task);
# ifdef USE_MACH_SEMA
# define TIMESPEC mach_timespec_t
# define WAIT_BLOCK(a,b) semaphore_timedwait (*(a), *(b))
+# elif defined(__native_client__) && defined(USE_NEWLIB)
+# define TIMESPEC struct timespec
+# define WAIT_BLOCK(a, b) sem_trywait(a)
# elif defined(__OpenBSD__)
# define TIMESPEC struct timespec
# define WAIT_BLOCK(a) sem_trywait(a)
#include <errno.h>
+#if defined(__MACH__)
+#include <mono/utils/mach-support.h>
+#endif
+
#define THREADS_DEBUG(...)
//#define THREADS_DEBUG(...) g_message(__VA_ARGS__)
mono_thread_smr_init ();
mono_threads_init_platform ();
+#if defined(__MACH__)
+ mono_mach_init (thread_info_key);
+#endif
+
mono_threads_inited = TRUE;
g_assert (sizeof (MonoNativeThreadId) <= sizeof (uintptr_t));
* Copyright (C) 2004-2006 Jonathan Pryor
*/
+#include <config.h>
+
#define _XOPEN_SOURCE 600
#ifdef PLATFORM_MACOSX
* Copyright (C) 2004-2006 Jonathan Pryor
*/
+#include <config.h>
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif /* ndef _GNU_SOURCE */