Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac3
-rw-r--r--mcs/.gitignore4
-rw-r--r--mcs/build/config-default.make2
-rw-r--r--mcs/build/gensources.sh18
-rw-r--r--mcs/build/library.make12
-rw-r--r--mcs/build/profiles/mobile_static.make19
-rw-r--r--mcs/build/rules.make73
-rw-r--r--mcs/build/tests.make51
-rw-r--r--mcs/class/Facades/Makefile3
-rw-r--r--mcs/class/I18N/Makefile2
-rw-r--r--mcs/class/Makefile2
l---------mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config (renamed from mcs/class/System.Configuration/System.Configuration_test_net_4_x.dll.config)0
-rw-r--r--mcs/class/System.Core/mobile_static_System.Core.dll.sources17
-rw-r--r--mcs/class/System.Core/mobile_static_System.Core_test.dll.excludes1
-rw-r--r--mcs/class/System.Core/mobile_static_System.Core_test.dll.sources1
-rw-r--r--mcs/class/System.Data/mobile_static_System.Data_test.dll.excludes18
-rw-r--r--mcs/class/System.Data/mobile_static_System.Data_test.dll.sources1
-rw-r--r--mcs/class/System.Net.Http/System.Net.Http/HttpResponseMessage.cs2
-rw-r--r--mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs8
-rw-r--r--mcs/class/System.Runtime.Serialization/Makefile4
-rw-r--r--mcs/class/System.ServiceModel.Internals/monotouch_watch_System.ServiceModel.Internals.dll.sources1
-rw-r--r--mcs/class/System.Web.DynamicData/Test/WebPages/web.config.4.x4
-rw-r--r--mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs2
-rw-r--r--mcs/class/System.Web.Extensions/Test/resources/profile.config.4.x2
-rw-r--r--mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.excludes8
-rw-r--r--mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.sources1
-rw-r--r--mcs/class/System.Web/Assembly/AssemblyInfo.cs2
-rw-r--r--mcs/class/System.Web/Documentation/en/index.xml2
-rw-r--r--mcs/class/System.Web/System.Web/HeadersCollection.cs24
-rw-r--r--mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs4
-rw-r--r--mcs/class/System.Web/Test/System.Web/AppBrowsersTest.cs2
-rw-r--r--mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs24
-rwxr-xr-xmcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config2
-rw-r--r--mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.02
-rw-r--r--mcs/class/System.Web/Test/mainsoft/NunitWebResources/adapters.browser6
-rw-r--r--mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs11
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs7
-rw-r--r--mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs11
-rwxr-xr-xmcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs4
-rwxr-xr-xmcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs2
-rwxr-xr-xmcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs2
-rw-r--r--mcs/class/System/System.Net.Configuration/SmtpSection.cs6
-rw-r--r--mcs/class/System/System.Net/HttpConnection.cs2
-rw-r--r--mcs/class/System/System.Net/HttpListenerResponse.cs113
-rw-r--r--mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs2
-rwxr-xr-xmcs/class/System/Test/System.Net.Sockets/SocketTest.cs9
-rw-r--r--mcs/class/System/mobile_static_System_test.dll.excludes190
-rw-r--r--mcs/class/System/mobile_static_System_test.dll.sources1
-rw-r--r--mcs/class/corlib/Makefile18
-rwxr-xr-xmcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs4
-rw-r--r--mcs/class/corlib/Test/System.IO/DirectoryTest.cs4
-rw-r--r--mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs23
-rw-r--r--mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs12
-rw-r--r--mcs/class/corlib/Test/System.Reflection/ModuleTest.cs6
-rw-r--r--mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs4
-rw-r--r--mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs3
-rw-r--r--mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs2
-rw-r--r--mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs3
-rw-r--r--mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs3
-rw-r--r--mcs/class/corlib/Test/System/ActivatorTest.cs6
-rw-r--r--mcs/class/corlib/Test/System/AttributeTest.cs4
-rw-r--r--mcs/class/corlib/Test/System/DelegateTest.cs20
-rw-r--r--mcs/class/corlib/Test/System/TimeZoneTest.cs5
-rw-r--r--mcs/class/corlib/Test/System/TypeTest.cs20
-rw-r--r--mcs/class/corlib/corlib_test.dll.sources10
-rw-r--r--mcs/class/corlib/mobile_static_corlib_test.dll.excludes131
-rw-r--r--mcs/class/corlib/mobile_static_corlib_test.dll.sources1
-rw-r--r--mcs/class/reference-assemblies/Makefile18
-rw-r--r--mcs/mcs/dynamic.cs147
-rw-r--r--mcs/mcs/ecore.cs3
-rw-r--r--mcs/mcs/expression.cs17
-rw-r--r--mcs/tests/dtest-null-operator-01.cs57
-rw-r--r--mcs/tests/test-null-operator-23.cs20
-rw-r--r--mcs/tests/ver-il-net_4_x.xml39
-rw-r--r--mcs/tools/corcompare/Util.cs107
-rw-r--r--mcs/tools/corcompare/WellFormedXmlWriter.cs5
-rw-r--r--mcs/tools/corcompare/mono-api-html/ApiChange.cs16
-rw-r--r--mcs/tools/corcompare/mono-api-html/ApiDiff.cs86
-rw-r--r--mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs2
-rw-r--r--mcs/tools/corcompare/mono-api-html/ClassComparer.cs24
-rw-r--r--mcs/tools/corcompare/mono-api-html/Comparer.cs4
-rw-r--r--mcs/tools/corcompare/mono-api-html/FieldComparer.cs5
-rw-r--r--mcs/tools/corcompare/mono-api-html/MemberComparer.cs41
-rw-r--r--mcs/tools/corcompare/mono-api-html/MethodComparer.cs11
-rw-r--r--mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs16
-rw-r--r--mcs/tools/corcompare/mono-api-html/mono-api-html.csproj1
-rw-r--r--mcs/tools/corcompare/mono-api-info.cs665
-rw-r--r--mcs/tools/nunit-lite/Makefile2
-rw-r--r--mcs/tools/nunit-lite/nunit-lite-console/Makefile4
-rw-r--r--mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config6
-rw-r--r--mcs/tools/xbuild/frameworks/net_2.0.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_3.0.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_3.5.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_4.0.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_4.0_client.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_4.5.1.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_4.5.2.xml2
-rw-r--r--mcs/tools/xbuild/frameworks/net_4.5.xml2
-rwxr-xr-xmono/dis/dump.c15
-rwxr-xr-xmono/dis/get.c49
-rw-r--r--mono/metadata/attach.c6
-rw-r--r--mono/metadata/cominterop.c16
-rw-r--r--mono/metadata/cominterop.h3
-rw-r--r--mono/metadata/coree.c12
-rw-r--r--mono/metadata/debug-helpers.c7
-rw-r--r--mono/metadata/loader.c50
-rw-r--r--mono/metadata/loader.h6
-rw-r--r--mono/metadata/marshal.c5
-rw-r--r--mono/metadata/metadata-verify.c8
-rw-r--r--mono/metadata/object-internals.h14
-rw-r--r--mono/metadata/object.c64
-rw-r--r--mono/metadata/reflection.c6
-rw-r--r--mono/metadata/remoting.c2
-rw-r--r--mono/mini/aot-compiler.c4
-rw-r--r--mono/mini/aot-runtime.c75
-rw-r--r--mono/mini/debugger-agent.c5
-rw-r--r--mono/mini/decompose.c44
-rw-r--r--mono/mini/driver.c33
-rw-r--r--mono/mini/dwarfwriter.c10
-rw-r--r--mono/mini/exceptions-s390x.c14
-rw-r--r--mono/mini/jit-icalls.c101
-rw-r--r--mono/mini/local-propagation.c294
-rw-r--r--mono/mini/method-to-ir.c101
-rw-r--r--mono/mini/mini-amd64.c6
-rw-r--r--mono/mini/mini-generic-sharing.c67
-rw-r--r--mono/mini/mini-runtime.c90
-rw-r--r--mono/mini/mini-s390x.c33
-rw-r--r--mono/mini/mini-trampolines.c108
-rw-r--r--mono/mini/mini-x86.c3
-rw-r--r--mono/mini/mini.c121
-rw-r--r--mono/mini/mini.h9
-rw-r--r--mono/mini/seq-points.c54
-rw-r--r--mono/mini/tramp-s390x.c15
-rwxr-xr-xmono/profiler/ptestrunner.pl8
-rw-r--r--mono/utils/mono-error-internals.h4
-rw-r--r--mono/utils/mono-error.c5
-rw-r--r--mono/utils/mono-publib.h16
144 files changed, 2670 insertions, 1105 deletions
diff --git a/configure.ac b/configure.ac
index 600ad4c6d28..33c4d28a82c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3651,6 +3651,9 @@ AC_SUBST(CFLAGS)
AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)
+#This must always be defined when building the runtime
+AC_DEFINE(MONO_INSIDE_RUNTIME,1, [Disable banned functions from being used by the runtime])
+
mono_build_root=`pwd`
AC_SUBST(mono_build_root)
diff --git a/mcs/.gitignore b/mcs/.gitignore
index ee0bcdccdd8..cee481c8137 100644
--- a/mcs/.gitignore
+++ b/mcs/.gitignore
@@ -3,8 +3,8 @@
*.dll
*.pidb
*.userprefs
-*_test_*.dll.config
-*_test_*.xml
+*_test.dll.config
+*_test.xml
*.o
*.resources
TestResult-*.log
diff --git a/mcs/build/config-default.make b/mcs/build/config-default.make
index 124bb2a3f81..8dcbbdc628d 100644
--- a/mcs/build/config-default.make
+++ b/mcs/build/config-default.make
@@ -23,7 +23,7 @@ mono_libdir = $(exec_prefix)/lib
sysconfdir = $(prefix)/etc
#RUNTIME = mono
RUNTIME = false
-TEST_RUNTIME = MONO_PATH="$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
+TEST_RUNTIME = MONO_PATH="./:$(topdir)/class/lib/$(PROFILE)$(PLATFORM_PATH_SEPARATOR)$(TEST_MONO_PATH)$(PLATFORM_PATH_SEPARATOR)$$MONO_PATH" $(RUNTIME) --debug
# In case you want to add MCS_FLAGS, this lets you not have to
# keep track of the default value
diff --git a/mcs/build/gensources.sh b/mcs/build/gensources.sh
index db7bf638bed..2eb4995bdd8 100644
--- a/mcs/build/gensources.sh
+++ b/mcs/build/gensources.sh
@@ -54,10 +54,22 @@ if test -n "$extexcfile"; then
fi
if test -f $outfile.exc; then
+ # So what we're doing below with uniq -u is that we take
+ # lines that have not been duplicated. This computes the
+ # symmetric difference between the files. This is not
+ # what we want. If a file is in the excludes but not in
+ # the sources, we want that file not to show up. By duplicating the
+ # excludes, we ensure that we won't end up in this failure state.
sort -u $outfile.exc > $outfile.exc_s
- rm -f $outfile.exc
- sort -m $outfile.inc_s $outfile.exc_s | uniq -u > $outfile
- rm -f $outfile.inc_s $outfile.exc_s
+
+ # Duplicate excludes
+ cat $outfile.exc_s >> $outfile.exc_s_dup
+ cat $outfile.exc_s >> $outfile.exc_s_dup
+
+ rm -f $outfile.exc $outfile.exc_s
+
+ cat $outfile.inc_s $outfile.exc_s_dup | sort | uniq -u > $outfile
+ rm -f $outfile.inc_s $outfile.exc_s_dup
else
mv $outfile.inc_s $outfile
fi
diff --git a/mcs/build/library.make b/mcs/build/library.make
index c9c01246717..5954ba2e316 100644
--- a/mcs/build/library.make
+++ b/mcs/build/library.make
@@ -295,17 +295,13 @@ library_CLEAN_FILES += $(PROFILE)_aot.log
ifdef PLATFORM_AOT_SUFFIX
Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] $(notdir $(@))";)
-$(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
- $(Q_AOT) MONO_PATH='$(the_libdir)' > $(PROFILE)_aot.log 2>&1 $(RUNTIME) --aot=bind-to-runtime-version --debug $(the_lib)
-endif
-
-ifdef ENABLE_AOT
-ifneq (,$(filter $(AOT_IN_PROFILES), $(PROFILE)))
-all-local: $(the_lib)$(PLATFORM_AOT_SUFFIX)
+$(the_lib)$(PLATFORM_AOT_SUFFIX): $(the_lib)
+ $(Q_AOT) MONO_PATH='$(the_libdir_base)' > $(PROFILE)_$(LIBRARY_NAME)_aot.log 2>&1 $(RUNTIME) $(AOT_BUILD_FLAGS) --debug $(the_lib)
+all-local-aot: $(the_lib)$(PLATFORM_AOT_SUFFIX)
endif
-endif
+
makefrag = $(depsdir)/$(PROFILE)_$(LIBRARY_SUBDIR)_$(LIBRARY).makefrag
library_CLEAN_FILES += $(makefrag)
diff --git a/mcs/build/profiles/mobile_static.make b/mcs/build/profiles/mobile_static.make
index 86d5a747949..0c3c8125cfd 100644
--- a/mcs/build/profiles/mobile_static.make
+++ b/mcs/build/profiles/mobile_static.make
@@ -39,3 +39,22 @@ NUNIT_LITE = yes
NO_INSTALL = yes
MOBILE_STATIC = yes
MOBILE_PROFILE = yes
+NO_VTS_TEST = yes
+
+# Note need for trailing comma. If you add, keep it
+PROFILE_TEST_HARNESS_EXCLUDES = MobileNotWorking,
+
+ifndef MONO_DISABLE_GSHAREDVT
+GSHAREDVT_FLAG = -O=gsharedvt
+endif
+
+ifneq ($(MONO_LLVMONLY),)
+AOT_BUILD_FLAGS_PREFIX = --aot=llvmonly,
+AOT_RUN_FLAGS = --llvmonly
+else
+AOT_BUILD_FLAGS_PREFIX = $(GSHAREDVT_FLAG) --aot=full,
+AOT_RUN_FLAGS = --full-aot
+endif
+
+ALWAYS_AOT = yes
+
diff --git a/mcs/build/rules.make b/mcs/build/rules.make
index 88170948f67..b79132991eb 100644
--- a/mcs/build/rules.make
+++ b/mcs/build/rules.make
@@ -75,6 +75,7 @@ default: all
include $(topdir)/build/config-default.make
-include $(topdir)/build/pre-config.make
+-include $(topdir)/build/config.make
# Default PLATFORM and PROFILE if they're not already defined.
@@ -112,7 +113,6 @@ PROFILE = $(DEFAULT_PROFILE)
endif
include $(topdir)/build/profiles/$(PROFILE).make
--include $(topdir)/build/config.make
# If the profile is using nunit-lite, use it
ifdef NUNIT_LITE
@@ -122,14 +122,70 @@ endif
# Make sure propagates
export TEST_HARNESS
+# If the profile is using nunit-lite, use it
+ifdef NUNIT_LITE
+TEST_HARNESS=$(topdir)/class/lib/$(PROFILE)/nunit-lite-console.exe
+endif
+
+# Make sure propagates
+export TEST_HARNESS
+
+# start aot config
+
+# We set the prefix of the aot build flags
+# in the profile. This determines the aot type,
+# whether it be llvmonly or full. To this we append the
+# options which do not change between them, the INVARIANT_AOT_OPTIONS
+ifndef AOT_BUILD_FLAGS_PREFIX
+AOT_BUILD_FLAGS_PREFIX = --aot=
+endif
+
+# Set the options for building and running AOT
+# The trampoline numbers are provisional, they are what is required
+# to run the corlib test suite. They should be considered a lower bound.
+INVARIANT_AOT_OPTIONS=nimt-trampolines=900,ntrampolines=8000
+
+ifndef MONO_DISABLE_GSHAREDVT
+INVARIANT_AOT_OPTIONS:=$(INVARIANT_AOT_OPTIONS),ngsharedvt-trampolines=900
+endif
+
+AOT_BUILD_FLAGS = $(AOT_BUILD_FLAGS_PREFIX)$(INVARIANT_AOT_OPTIONS)
+
+# end AOT config
+
ifdef BCL_OPTIMIZE
PROFILE_MCS_FLAGS += -optimize
endif
+# Design:
+# Problem: We want to be able to build aot
+# assemblies as part of the build system.
+#
+# For this to be done safely, we really need two passes. This
+# ensures that all of the .dlls are compiled before trying to
+# aot them. Because we want this to be the
+# default target for some profiles(mobile_static) we have a
+# two-level build system. The do-all-aot target is what
+# gets invoked at the top-level when someone tries to build with aot.
+# It will invoke the do-all target, and will set TOP_LEVEL_DO for this
+# recursive make call in order to prevent this recursive call from trying
+# to build aot in each of the subdirs. After this is done, we will aot
+# everything that our building produced by aoting everything in
+# mcs/class/lib/$(PROFILE)/
+ifndef TOP_LEVEL_DO
+
+ifdef ALWAYS_AOT
+TOP_LEVEL_DO = do-all-aot
+else
+TOP_LEVEL_DO = do-all
+endif # ALWAYS_AOT
+
+endif # !TOP_LEVEL_DO
+
ifdef OVERRIDE_TARGET_ALL
all: all.override
else
-all: do-all
+all: $(TOP_LEVEL_DO)
endif
ifdef NO_INSTALL
@@ -143,6 +199,19 @@ STD_TARGETS = test run-test run-test-ondotnet clean install uninstall doc-update
$(STD_TARGETS): %: do-%
+ifdef PLATFORM_AOT_SUFFIX
+Q_AOT=$(if $(V),,@echo "AOT [$(PROFILE)] AOT All Assemblies";)
+LIST_ALL_PROFILE_ASSEMBLIES = find . | grep -E '(dll|exe)$$' | grep -v -E 'bare|plaincore|secxml'
+COMPILE_ALL_PROFILE_ASSEMBLIES = $(LIST_ALL_PROFILE_ASSEMBLIES) | MONO_PATH="./" xargs -I '{}' $(RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) '{}'
+
+do-all-aot:
+ $(MAKE) do-all TOP_LEVEL_DO=do-all
+ $(MAKE) aot-all-profile
+
+aot-all-profile:
+ $(Q_AOT) cd $(topdir)/class/lib/$(PROFILE)/ && $(COMPILE_ALL_PROFILE_ASSEMBLIES) &> $(PROFILE)-aot.log
+endif
+
do-run-test:
ok=:; $(MAKE) run-test-recursive || ok=false; $(MAKE) run-test-local || ok=false; $$ok
diff --git a/mcs/build/tests.make b/mcs/build/tests.make
index f44e0574c96..e8d52d00332 100644
--- a/mcs/build/tests.make
+++ b/mcs/build/tests.make
@@ -29,8 +29,15 @@ test_nunit_dep = $(test_nunit_lib:%=$(topdir)/class/lib/$(PROFILE)/%)
test_nunit_ref = $(test_nunit_dep:%=-r:%)
tests_CLEAN_FILES += TestResult*.xml
-test_lib = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test_$(PROFILE).dll)
+test_sourcefile = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
+
+ifeq ($(wildcard $(test_sourcefile)),)
test_sourcefile = $(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll.sources)
+endif
+
+test_lib = $(PROFILE)_$(ASSEMBLY:$(ASSEMBLY_EXT)=_test.dll)
+test_sourcefile_excludes = $(test_lib).excludes
+
test_pdb = $(test_lib:.dll=.pdb)
test_response = $(depsdir)/$(test_lib).response
test_makefrag = $(depsdir)/$(test_lib).makefrag
@@ -41,7 +48,9 @@ ifndef HAVE_CS_TESTS
HAVE_CS_TESTS := $(wildcard $(test_sourcefile))
endif
-endif
+HAVE_SOURCE_EXCLUDES := $(wildcard $(test_sourcefile_excludes))
+
+endif # !NO_TEST
ifndef NO_TEST
$(test_nunit_dep): $(topdir)/build/deps/nunit-$(PROFILE).stamp
@@ -72,8 +81,18 @@ test-local: $(test_assemblies)
run-test-local: run-test-lib
run-test-ondotnet-local: run-test-ondotnet-lib
-TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)NotWorking,ValueAdd,CAS,InetAccess
-TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
+TEST_HARNESS_EXCLUDES = -exclude=$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotWorking,ValueAdd,CAS,InetAccess
+TEST_HARNESS_EXCLUDES_ONDOTNET = /exclude:$(PLATFORM_TEST_HARNESS_EXCLUDES)$(PROFILE_TEST_HARNESS_EXCLUDES)NotDotNet,CAS
+
+ifdef NUNIT_LITE
+NOSHADOW_FLAG =
+NUNIT_XML_FLAG = -format:nunit2 -result:
+OUTPUT_FILE_FLAG=-out
+else
+OUTPUT_FILE_FLAG=-output
+NOSHADOW_FLAG = -noshadow
+NUNIT_XML_FLAG = -xml=
+endif
ifdef NUNIT_LITE
NOSHADOW_FLAG =
@@ -105,10 +124,19 @@ ifdef TESTNAME
TESTNAME_ARG = -run=MonoTests.$(TESTNAME)
endif
+ifdef ALWAYS_AOT
+test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp
+ PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_BUILD_FLAGS) $(test_assemblies)
+
+else
+test-local-aot-compile: $(topdir)/build/deps/nunit-$(PROFILE).stamp
+
+endif # ALWAYS_AOT
+
## FIXME: i18n problem in the 'sed' command below
-run-test-lib: test-local
+run-test-lib: test-local test-local-aot-compile
ok=:; \
- PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) $(NUNIT_XML_FLAG)TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
+ PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" MONO_REGISTRY_PATH="$(HOME)/.mono/registry" MONO_TESTS_IN_PROGRESS="yes" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(AOT_RUN_FLAGS) $(TEST_HARNESS) $(test_assemblies) $(NOSHADOW_FLAG) $(TEST_HARNESS_FLAGS) $(LOCAL_TEST_HARNESS_FLAGS) $(TEST_HARNESS_EXCLUDES) $(TEST_HARNESS_OUTPUT) $(NUNIT_XML_FLAG)TestResult-$(PROFILE).xml $(FIXTURE_ARG) $(TESTNAME_ARG)|| ok=false; \
if [ ! -f "TestResult-$(PROFILE).xml" ]; then echo "<?xml version='1.0' encoding='utf-8'?><test-results failures='1' total='1' not-run='0' name='bcl-tests' date='$$(date +%F)' time='$$(date +%T)'><test-suite name='$(strip $(test_assemblies))' success='False' time='0'><results><test-case name='crash' executed='True' success='False' time='0'><failure><message>The test runner didn't produce a test result XML, probably due to a crash of the runtime. Check the log for more details.</message><stack-trace></stack-trace></failure></test-case></results></test-suite></test-results>" > TestResult-$(PROFILE).xml; fi; \
$(TEST_HARNESS_POSTPROC) ; $$ok
@@ -133,9 +161,16 @@ ifdef HAVE_CS_TESTS
$(test_lib): $(the_assembly) $(test_response) $(test_nunit_dep)
$(TEST_COMPILE) $(LIBRARY_FLAGS) -target:library -out:$@ $(test_flags) $(LOCAL_TEST_COMPILER_ONDOTNET_FLAGS) @$(test_response)
-$(test_response): $(test_sourcefile)
+test_response_preprocessed = $(test_response)_preprocessed
+
+# This handles .excludes/.sources pairs, as well as resolving the
+# includes that occur in .sources files
+$(test_response_preprocessed): $(test_sourcefile)
+ $(SHELL) $(topdir)/build/gensources.sh $@ '$(test_sourcefile)' '$(test_sourcefile_excludes)'
+
+$(test_response): $(test_response_preprocessed)
# @echo Creating $@ ...
- @sed -e '/^$$/d' -e 's,^,Test/,' $(test_sourcefile) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
+ @sed -e '/^$$/d' -e 's,^,Test/,' $(test_response_preprocessed) | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
$(test_makefrag): $(test_response)
# @echo Creating $@ ...
diff --git a/mcs/class/Facades/Makefile b/mcs/class/Facades/Makefile
index 2f8847d707a..12f045eebd8 100644
--- a/mcs/class/Facades/Makefile
+++ b/mcs/class/Facades/Makefile
@@ -38,3 +38,6 @@ doc-update-recursive:
@echo "do not recurse the Facades folder"
System System.Core System.ComponentModel.DataAnnotations System.Numerics System.Runtime.Serialization System.XML System.ComponentModel.Composition System.ServiceModel System.Xml.Linq:
+
+all-local-aot:
+
diff --git a/mcs/class/I18N/Makefile b/mcs/class/I18N/Makefile
index d6fa41fe65b..b7d4788608e 100644
--- a/mcs/class/I18N/Makefile
+++ b/mcs/class/I18N/Makefile
@@ -12,6 +12,6 @@ DISTFILES = \
tools/ucm2cp.c \
tools/uni2tab.c
-all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local:
+all-local install-local clean-local test-local run-test-local run-test-ondotnet-local uninstall-local doc-update-local csproj-local all-local-aot:
dist-local: dist-default
diff --git a/mcs/class/Makefile b/mcs/class/Makefile
index a0dd126efac..60048068cf2 100644
--- a/mcs/class/Makefile
+++ b/mcs/class/Makefile
@@ -334,6 +334,8 @@ DISTFILES = \
all-local $(STD_TARGETS:=-local):
@:
+all-local-aot:
+
# Files needed to bootstrap C# compiler
basic_files = basic.exe mscorlib.dll System.dll System.Xml.dll Mono.Security.dll System.Core.dll System.Security.dll System.Configuration.dll
monolite_files = $(basic_files:%=lib/monolite/%)
diff --git a/mcs/class/System.Configuration/System.Configuration_test_net_4_x.dll.config b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config
index 6f31b34dcaa..6f31b34dcaa 120000
--- a/mcs/class/System.Configuration/System.Configuration_test_net_4_x.dll.config
+++ b/mcs/class/System.Configuration/net_4_x_System.Configuration_test.dll.config
diff --git a/mcs/class/System.Core/mobile_static_System.Core.dll.sources b/mcs/class/System.Core/mobile_static_System.Core.dll.sources
index 7d32d44a88b..832b60883c7 100644
--- a/mcs/class/System.Core/mobile_static_System.Core.dll.sources
+++ b/mcs/class/System.Core/mobile_static_System.Core.dll.sources
@@ -1,2 +1,19 @@
#include common_System.Core.dll.sources
#include interpreter_System.Core.dll.sources
+
+System.Security.Cryptography/AesCryptoServiceProvider.cs
+System.Security.Cryptography/AesTransform.cs
+System.Security.Cryptography/CngAlgorithm.cs
+System.Security.Cryptography/CngAlgorithmGroup.cs
+System.Security.Cryptography/MD5Cng.cs
+System.Security.Cryptography/SHA1Cng.cs
+System.Security.Cryptography/SHA256Cng.cs
+System.Security.Cryptography/SHA256CryptoServiceProvider.cs
+System.Security.Cryptography/SHA384Cng.cs
+System.Security.Cryptography/SHA384CryptoServiceProvider.cs
+System.Security.Cryptography/SHA512Cng.cs
+System.Security.Cryptography/SHA512CryptoServiceProvider.cs
+
+../../../external/referencesource/System.Core/System/Security/Cryptography/AesManaged.cs
+../../../external/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellman.cs
+../../../external/referencesource/System.Core/System/Security/Cryptography/ECKeyXmlFormat.cs
diff --git a/mcs/class/System.Core/mobile_static_System.Core_test.dll.excludes b/mcs/class/System.Core/mobile_static_System.Core_test.dll.excludes
new file mode 100644
index 00000000000..f98bf051bef
--- /dev/null
+++ b/mcs/class/System.Core/mobile_static_System.Core_test.dll.excludes
@@ -0,0 +1 @@
+System.IO.Pipes/PipeSecurityTest.cs
diff --git a/mcs/class/System.Core/mobile_static_System.Core_test.dll.sources b/mcs/class/System.Core/mobile_static_System.Core_test.dll.sources
new file mode 100644
index 00000000000..33e2a105847
--- /dev/null
+++ b/mcs/class/System.Core/mobile_static_System.Core_test.dll.sources
@@ -0,0 +1 @@
+#include System.Core_test.dll.sources
diff --git a/mcs/class/System.Data/mobile_static_System.Data_test.dll.excludes b/mcs/class/System.Data/mobile_static_System.Data_test.dll.excludes
new file mode 100644
index 00000000000..0022a9e9f1b
--- /dev/null
+++ b/mcs/class/System.Data/mobile_static_System.Data_test.dll.excludes
@@ -0,0 +1,18 @@
+System.Data.Odbc/OdbcCommandBuilderTest.cs
+System.Data.Odbc/OdbcCommandTest.cs
+System.Data.Odbc/OdbcConnectionStringBuilderTest.cs
+System.Data.Odbc/OdbcConnectionTest.cs
+System.Data.Odbc/OdbcDataAdapterTest.cs
+System.Data.Odbc/OdbcDataReaderTest.cs
+System.Data.Odbc/OdbcMetaDataCollectionNamesTest.cs
+System.Data.Odbc/OdbcParameterCollectionTest.cs
+System.Data.Odbc/OdbcParameterTest.cs
+System.Data.Odbc/OdbcPermissionAttributeTest.cs
+System.Data.Odbc/OdbcPermissionTest.cs
+System.Data.OleDb/OleDbCommandTest.cs
+System.Data.OleDb/OleDbConnectionTest.cs
+System.Data.OleDb/OleDbDataAdapterTest.cs
+System.Data.OleDb/OleDbMetaDataCollectionNamesTest.cs
+System.Data.OleDb/OleDbParameterCollectionTest.cs
+System.Data.OleDb/OleDbPermissionAttributeTest.cs
+System.Data.OleDb/OleDbPermissionTest.cs
diff --git a/mcs/class/System.Data/mobile_static_System.Data_test.dll.sources b/mcs/class/System.Data/mobile_static_System.Data_test.dll.sources
new file mode 100644
index 00000000000..310b8c2fb3d
--- /dev/null
+++ b/mcs/class/System.Data/mobile_static_System.Data_test.dll.sources
@@ -0,0 +1 @@
+#include System.Data_test.dll.sources
diff --git a/mcs/class/System.Net.Http/System.Net.Http/HttpResponseMessage.cs b/mcs/class/System.Net.Http/System.Net.Http/HttpResponseMessage.cs
index bf39da68917..25c9743fbc7 100644
--- a/mcs/class/System.Net.Http/System.Net.Http/HttpResponseMessage.cs
+++ b/mcs/class/System.Net.Http/System.Net.Http/HttpResponseMessage.cs
@@ -66,7 +66,7 @@ namespace System.Net.Http
public string ReasonPhrase {
get {
- return reasonPhrase ?? HttpListenerResponse.GetStatusDescription ((int) statusCode);
+ return reasonPhrase ?? HttpListenerResponseHelper.GetStatusDescription ((int) statusCode);
}
set {
reasonPhrase = value;
diff --git a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs
index c82729741e3..dada449fb86 100644
--- a/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs
+++ b/mcs/class/System.Runtime.Caching/Test/System.Runtime.Caching/MemoryCacheTest.cs
@@ -844,7 +844,7 @@ namespace MonoTests.System.Runtime.Caching
};
cip.AbsoluteExpiration = DateTimeOffset.Now.AddMilliseconds (50);
mc.Set ("key", "value", cip);
- Thread.Sleep (100);
+ Thread.Sleep (500);
Assert.IsFalse (expired, "#A1");
object value = mc.Get ("key");
@@ -892,7 +892,7 @@ namespace MonoTests.System.Runtime.Caching
cip = new CacheItemPolicy ();
cip.RemovedCallback = removedCb;
- cip.AbsoluteExpiration = DateTimeOffset.Now.AddMilliseconds (sleepPeriod + 100);
+ cip.AbsoluteExpiration = DateTimeOffset.Now.AddMilliseconds (sleepPeriod + 500);
mc.Set ("key4", "value4", cip);
Thread.Sleep (sleepPeriod);
@@ -930,7 +930,7 @@ namespace MonoTests.System.Runtime.Caching
};
mc.Set ("key4", "value4", cip);
- Thread.Sleep (100);
+ Thread.Sleep (500);
enumerator = ((IEnumerable) mc).GetEnumerator ();
int count = 0;
@@ -949,7 +949,7 @@ namespace MonoTests.System.Runtime.Caching
};
mc.Set ("key5", "value5", cip);
- Thread.Sleep (100);
+ Thread.Sleep (500);
enumerator2 = mc.DoGetEnumerator ();
count = 0;
diff --git a/mcs/class/System.Runtime.Serialization/Makefile b/mcs/class/System.Runtime.Serialization/Makefile
index 11daea61179..21d8e716a39 100644
--- a/mcs/class/System.Runtime.Serialization/Makefile
+++ b/mcs/class/System.Runtime.Serialization/Makefile
@@ -19,6 +19,10 @@ else
LIB_MCS_FLAGS += /d:NO_CONFIGURATION /d:NO_SECURITY_ATTRIBUTES /d:NO_CODEDOM /d:NO_DESKTOP_SECURITY
endif
+ifdef XAMMAC_4_5
+LIB_MCS_FLAGS += /d:NO_CONFIGURATION
+endif
+
TEST_RESOURCE_FILES = \
Test/Resources/WSDL/collections.wsdl \
Test/Resources/WSDL/custom-collections.wsdl
diff --git a/mcs/class/System.ServiceModel.Internals/monotouch_watch_System.ServiceModel.Internals.dll.sources b/mcs/class/System.ServiceModel.Internals/monotouch_watch_System.ServiceModel.Internals.dll.sources
new file mode 100644
index 00000000000..12c950cb283
--- /dev/null
+++ b/mcs/class/System.ServiceModel.Internals/monotouch_watch_System.ServiceModel.Internals.dll.sources
@@ -0,0 +1 @@
+#include monotouch_System.ServiceModel.Internals.dll.sources \ No newline at end of file
diff --git a/mcs/class/System.Web.DynamicData/Test/WebPages/web.config.4.x b/mcs/class/System.Web.DynamicData/Test/WebPages/web.config.4.x
index 11c789d906b..79ce9adc67f 100644
--- a/mcs/class/System.Web.DynamicData/Test/WebPages/web.config.4.x
+++ b/mcs/class/System.Web.DynamicData/Test/WebPages/web.config.4.x
@@ -68,8 +68,8 @@
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.DynamicData" assembly="System.Web.DynamicData, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add tagPrefix="test" namespace="MonoTests.DataSource" assembly="System.Web.DynamicData_test_net_4_x"/>
- <add tagPrefix="test" namespace="MonoTests.Common" assembly="System.Web.DynamicData_test_net_4_x"/>
+ <add tagPrefix="test" namespace="MonoTests.DataSource" assembly="net_4_x_System.Web.DynamicData_test"/>
+ <add tagPrefix="test" namespace="MonoTests.Common" assembly="net_4_x_System.Web.DynamicData_test"/>
</controls>
</pages>
<httpHandlers>
diff --git a/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs b/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs
index c8bb51a7799..8dc9e38c43b 100644
--- a/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs
+++ b/mcs/class/System.Web.Extensions/Test/System.Web.Script.Serialization/JavaScriptSerializerTest.cs
@@ -431,7 +431,7 @@ namespace MonoTests.System.Web.Script.Serialization
public void TestDeserializeTypeResolver ()
{
#if NET_4_6
- string expected = "{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+X, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"z\":8,\"ch\":\"v\",\"ch_null\":null,\"str\":\"vwF59g\",\"b\":253,\"sb\":-48,\"sh\":-32740,\"ush\":65511,\"i\":-234235453,\"ui\":4294733061,\"l\":-9223372036854775780,\"ul\":18446744073709551612,\"f\":NaN,\"f1\":-Infinity,\"f2\":Infinity,\"f3\":-3.40282347E+38,\"f4\":3.40282347E+38,\"d\":NaN,\"d1\":-Infinity,\"d2\":Infinity,\"d3\":-1.7976931348623157E+308,\"d4\":1.7976931348623157E+308,\"de\":-1,\"de1\":0,\"de2\":1,\"de3\":-79228162514264337593543950335,\"de4\":79228162514264337593543950335,\"g\":\"000000ea-0002-0162-0102-030405060708\",\"nb\":null,\"dbn\":null,\"uri\":\"http://kostat@mainsoft/adfasdf/asdfasdf.aspx/asda/ads?a=b&c=d\",\"hash\":{\"mykey\":{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}},\"point\":{\"__type\":\"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\",\"IsEmpty\":false,\"X\":150,\"Y\":150},\"MyEnum\":[1,10,345],\"MyEnum1\":[1,10,345],\"AA\":5,\"AA1\":[{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10},{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}],\"BB\":18446744073709551610,\"YY\":[{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10},{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, System.Web.Extensions_test_net_4_x, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}]}";
+ string expected = "{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+X, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"z\":8,\"ch\":\"v\",\"ch_null\":null,\"str\":\"vwF59g\",\"b\":253,\"sb\":-48,\"sh\":-32740,\"ush\":65511,\"i\":-234235453,\"ui\":4294733061,\"l\":-9223372036854775780,\"ul\":18446744073709551612,\"f\":NaN,\"f1\":-Infinity,\"f2\":Infinity,\"f3\":-3.40282347E+38,\"f4\":3.40282347E+38,\"d\":NaN,\"d1\":-Infinity,\"d2\":Infinity,\"d3\":-1.7976931348623157E+308,\"d4\":1.7976931348623157E+308,\"de\":-1,\"de1\":0,\"de2\":1,\"de3\":-79228162514264337593543950335,\"de4\":79228162514264337593543950335,\"g\":\"000000ea-0002-0162-0102-030405060708\",\"nb\":null,\"dbn\":null,\"uri\":\"http://kostat@mainsoft/adfasdf/asdfasdf.aspx/asda/ads?a=b&c=d\",\"hash\":{\"mykey\":{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}},\"point\":{\"__type\":\"System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a\",\"IsEmpty\":false,\"X\":150,\"Y\":150},\"MyEnum\":[1,10,345],\"MyEnum1\":[1,10,345],\"AA\":5,\"AA1\":[{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10},{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}],\"BB\":18446744073709551610,\"YY\":[{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10},{\"__type\":\"MonoTests.System.Web.Script.Serialization.JavaScriptSerializerTest+Y, net_4_x_System.Web.Extensions_test, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35\",\"BB\":10}]}";
#else
#error "Unknown profile"
#endif
diff --git a/mcs/class/System.Web.Extensions/Test/resources/profile.config.4.x b/mcs/class/System.Web.Extensions/Test/resources/profile.config.4.x
index 126cacca577..baa65c84cbf 100644
--- a/mcs/class/System.Web.Extensions/Test/resources/profile.config.4.x
+++ b/mcs/class/System.Web.Extensions/Test/resources/profile.config.4.x
@@ -3,6 +3,6 @@
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
- <add tagPrefix="t" namespace="MonoTests.System.Web.UI.WebControls" assembly="System.Web.Extensions_test_net_4_x"/>
+ <add tagPrefix="t" namespace="MonoTests.System.Web.UI.WebControls" assembly="net_4_x_System.Web.Extensions_test"/>
</controls>
</pages>
diff --git a/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.excludes b/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.excludes
new file mode 100644
index 00000000000..645326dff9a
--- /dev/null
+++ b/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.excludes
@@ -0,0 +1,8 @@
+System.Web.Services/Test/System.Web.Services.Configuration/DiagnosticsElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/ProtocolElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/SoapEnvelopeProcessingElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/SoapExtensionTypeElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/TypeElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/WsdlHelpGeneratorElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/WsiProfilesElementTest.cs
+System.Web.Services/Test/System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
diff --git a/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.sources b/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.sources
new file mode 100644
index 00000000000..915ba6cbbec
--- /dev/null
+++ b/mcs/class/System.Web.Services/mobile_static_System.Web.Services_test.dll.sources
@@ -0,0 +1 @@
+#include System.Web.Services_test.dll.sources
diff --git a/mcs/class/System.Web/Assembly/AssemblyInfo.cs b/mcs/class/System.Web/Assembly/AssemblyInfo.cs
index 67619f02097..72eb774c611 100644
--- a/mcs/class/System.Web/Assembly/AssemblyInfo.cs
+++ b/mcs/class/System.Web/Assembly/AssemblyInfo.cs
@@ -85,7 +85,7 @@ using System.Web.UI;
#endif
[assembly: InternalsVisibleTo ("SystemWebTestShim, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
-[assembly: InternalsVisibleTo ("System.Web_test_net_4_x, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
+[assembly: InternalsVisibleTo ("net_4_x_System.Web_test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
// Resources
[assembly: WebResource ("TreeView_noexpand.gif", "image/gif")]
diff --git a/mcs/class/System.Web/Documentation/en/index.xml b/mcs/class/System.Web/Documentation/en/index.xml
index 9990989b927..610e3c3c1cf 100644
--- a/mcs/class/System.Web/Documentation/en/index.xml
+++ b/mcs/class/System.Web/Documentation/en/index.xml
@@ -135,7 +135,7 @@
<AttributeName>System.Web.UI.WebResource("TreeView_noexpand.gif", "image/gif")</AttributeName>
</Attribute>
<Attribute>
- <AttributeName>System.Runtime.CompilerServices.InternalsVisibleTo("System.Web_test_net_2_0, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")</AttributeName>
+ <AttributeName>System.Runtime.CompilerServices.InternalsVisibleTo("net_4_x_System.Web_test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")</AttributeName>
</Attribute>
<Attribute>
<AttributeName>System.Runtime.CompilerServices.InternalsVisibleTo("System.Web.Extensions, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")</AttributeName>
diff --git a/mcs/class/System.Web/System.Web/HeadersCollection.cs b/mcs/class/System.Web/System.Web/HeadersCollection.cs
index b2a1c73b7fc..fe2cf558afa 100644
--- a/mcs/class/System.Web/System.Web/HeadersCollection.cs
+++ b/mcs/class/System.Web/System.Web/HeadersCollection.cs
@@ -39,6 +39,30 @@ namespace System.Web
{
}
+ public override void Add (string name, string value)
+ {
+ if (IsReadOnly)
+ throw new PlatformNotSupportedException ();
+
+ base.Set (name, value);
+ }
+
+ public override void Set (string name, string value)
+ {
+ if (IsReadOnly)
+ throw new PlatformNotSupportedException ();
+
+ base.Set (name, value);
+ }
+
+ public override void Remove (string name)
+ {
+ if (IsReadOnly)
+ throw new PlatformNotSupportedException ();
+
+ base.Remove (name);
+ }
+
protected override void InsertInfo()
{
HttpWorkerRequest worker_request = _request.WorkerRequest;
diff --git a/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs
index 604b418f5e2..9c36368ba7d 100644
--- a/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs
+++ b/mcs/class/System.Web/Test/System.Web.Caching/OutputCacheTest.cs
@@ -135,8 +135,8 @@ namespace MonoTests.System.Web.Caching
#else
static readonly byte[] memoryResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4D,0x65,0x6D,0x6F,0x72,0x79,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x2,0x0,0x0,0x0,0x17,0x3C,0x42,0x75,0x66,0x66,0x65,0x72,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x17,0x3C,0x4C,0x65,0x6E,0x67,0x74,0x68,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x7,0x0,0x2,0x9,0x2,0x0,0x0,0x0,0x9,0x3,0x0,0x0,0x0,0xC,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xF,0x3,0x0,0x0,0x0,0xC,0x0,0x0,0x0,0x2,0x45,0x6E,0x63,0x6F,0x64,0x65,0x64,0x20,0x64,0x61,0x74,0x61,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
static readonly byte[] fileResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x26,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x46,0x69,0x6C,0x65,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x17,0x3C,0x4C,0x65,0x6E,0x67,0x74,0x68,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x17,0x3C,0x4F,0x66,0x66,0x73,0x65,0x74,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x15,0x3C,0x50,0x61,0x74,0x68,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x0,0x0,0x1,0x9,0x9,0x2,0x0,0x0,0x0,0xD2,0x4,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x11,0x2F,0x70,0x61,0x74,0x68,0x2F,0x74,0x6F,0x2F,0x66,0x69,0x6C,0x65,0x2E,0x74,0x78,0x74,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
- static readonly byte[] substitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x3,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x78,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x19,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x7,0x6D,0x65,0x74,0x68,0x6F,0x64,0x30,0x3,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x9,0x6,0x0,0x0,0x0,0x9,0x7,0x0,0x0,0x0,0x4,0x6,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0x8,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0x9,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0xA,0x6,0xA,0x0,0x0,0x0,0x5A,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x78,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xB,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x9,0x4,0x0,0x0,0x0,0xA,0x4,0x7,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x7,0x0,0x0,0x0,0x4,0x4E,0x61,0x6D,0x65,0xC,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x4E,0x61,0x6D,0x65,0x9,0x43,0x6C,0x61,0x73,0x73,0x4E,0x61,0x6D,0x65,0x9,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0xA,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0x32,0xA,0x4D,0x65,0x6D,0x62,0x65,0x72,0x54,0x79,0x70,0x65,0x10,0x47,0x65,0x6E,0x65,0x72,0x69,0x63,0x41,0x72,0x67,0x75,0x6D,0x65,0x6E,0x74,0x73,0x1,0x1,0x1,0x1,0x1,0x0,0x3,0x8,0xD,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x54,0x79,0x70,0x65,0x5B,0x5D,0x9,0x4,0x0,0x0,0x0,0x9,0xA,0x0,0x0,0x0,0x9,0xB,0x0,0x0,0x0,0x6,0xF,0x0,0x0,0x0,0x3F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x6,0x10,0x0,0x0,0x0,0x3F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x8,0x0,0x0,0x0,0xA,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
- static readonly byte[] badSubstitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x3,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x78,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x1C,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0xC,0x6,0x0,0x0,0x0,0x5A,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x78,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x3,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x7,0x6D,0x65,0x74,0x68,0x6F,0x64,0x30,0x3,0x4,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x6,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x9,0x7,0x0,0x0,0x0,0x9,0x8,0x0,0x0,0x0,0x9,0x9,0x0,0x0,0x0,0x4,0x7,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0xA,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0xB,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x6,0xC,0x0,0x0,0x0,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x6,0xD,0x0,0x0,0x0,0x5A,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x5F,0x74,0x65,0x73,0x74,0x5F,0x6E,0x65,0x74,0x5F,0x34,0x5F,0x78,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xE,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x9,0x4,0x0,0x0,0x0,0xA,0x5,0x8,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x4,0x9,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x7,0x0,0x0,0x0,0x4,0x4E,0x61,0x6D,0x65,0xC,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x4E,0x61,0x6D,0x65,0x9,0x43,0x6C,0x61,0x73,0x73,0x4E,0x61,0x6D,0x65,0x9,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0xA,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0x32,0xA,0x4D,0x65,0x6D,0x62,0x65,0x72,0x54,0x79,0x70,0x65,0x10,0x47,0x65,0x6E,0x65,0x72,0x69,0x63,0x41,0x72,0x67,0x75,0x6D,0x65,0x6E,0x74,0x73,0x1,0x1,0x1,0x1,0x1,0x0,0x3,0x8,0xD,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x54,0x79,0x70,0x65,0x5B,0x5D,0x9,0x4,0x0,0x0,0x0,0x9,0xD,0x0,0x0,0x0,0x9,0xE,0x0,0x0,0x0,0x6,0x12,0x0,0x0,0x0,0x42,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x6,0x13,0x0,0x0,0x0,0x42,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x8,0x0,0x0,0x0,0xA,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+ static readonly byte[] substitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x3,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x6e,0x65,0x74,0x5f,0x34,0x5f,0x78,0x5f,0x53,0x79,0x73,0x74,0x65,0x6d,0x2e,0x57,0x65,0x62,0x5f,0x74,0x65,0x73,0x74,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x19,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x7,0x6D,0x65,0x74,0x68,0x6F,0x64,0x30,0x3,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x9,0x6,0x0,0x0,0x0,0x9,0x7,0x0,0x0,0x0,0x4,0x6,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0x8,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0x9,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0xA,0x6,0xA,0x0,0x0,0x0,0x5A,0x6e,0x65,0x74,0x5f,0x34,0x5f,0x78,0x5f,0x53,0x79,0x73,0x74,0x65,0x6d,0x2e,0x57,0x65,0x62,0x5f,0x74,0x65,0x73,0x74,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xB,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x9,0x4,0x0,0x0,0x0,0xA,0x4,0x7,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x7,0x0,0x0,0x0,0x4,0x4E,0x61,0x6D,0x65,0xC,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x4E,0x61,0x6D,0x65,0x9,0x43,0x6C,0x61,0x73,0x73,0x4E,0x61,0x6D,0x65,0x9,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0xA,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0x32,0xA,0x4D,0x65,0x6D,0x62,0x65,0x72,0x54,0x79,0x70,0x65,0x10,0x47,0x65,0x6E,0x65,0x72,0x69,0x63,0x41,0x72,0x67,0x75,0x6D,0x65,0x6E,0x74,0x73,0x1,0x1,0x1,0x1,0x1,0x0,0x3,0x8,0xD,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x54,0x79,0x70,0x65,0x5B,0x5D,0x9,0x4,0x0,0x0,0x0,0x9,0xA,0x0,0x0,0x0,0x9,0xB,0x0,0x0,0x0,0x6,0xF,0x0,0x0,0x0,0x3F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x6,0x10,0x0,0x0,0x0,0x3F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x8,0x0,0x0,0x0,0xA,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
+ static readonly byte[] badSubstitutionResponseElement = {0x0,0x1,0x0,0x0,0x0,0xFF,0xFF,0xFF,0xFF,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0xC,0x2,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x5,0x1,0x0,0x0,0x0,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x45,0x6C,0x65,0x6D,0x65,0x6E,0x74,0x3,0x0,0x0,0x0,0x8,0x74,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0x19,0x3C,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x3E,0x6B,0x5F,0x5F,0x42,0x61,0x63,0x6B,0x69,0x6E,0x67,0x46,0x69,0x65,0x6C,0x64,0x1,0x1,0x3,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2,0x0,0x0,0x0,0x6,0x3,0x0,0x0,0x0,0x88,0x1,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x2C,0x20,0x6e,0x65,0x74,0x5f,0x34,0x5f,0x78,0x5f,0x53,0x79,0x73,0x74,0x65,0x6d,0x2e,0x57,0x65,0x62,0x5f,0x74,0x65,0x73,0x74,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0x4,0x0,0x0,0x0,0x1C,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x9,0x5,0x0,0x0,0x0,0xC,0x6,0x0,0x0,0x0,0x5A,0x6e,0x65,0x74,0x5f,0x34,0x5f,0x78,0x5f,0x53,0x79,0x73,0x74,0x65,0x6d,0x2e,0x57,0x65,0x62,0x5f,0x74,0x65,0x73,0x74,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x4,0x5,0x0,0x0,0x0,0x22,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x3,0x0,0x0,0x0,0x8,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x7,0x6D,0x65,0x74,0x68,0x6F,0x64,0x30,0x3,0x4,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x6,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x9,0x7,0x0,0x0,0x0,0x9,0x8,0x0,0x0,0x0,0x9,0x9,0x0,0x0,0x0,0x4,0x7,0x0,0x0,0x0,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x7,0x0,0x0,0x0,0x4,0x74,0x79,0x70,0x65,0x8,0x61,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x6,0x74,0x61,0x72,0x67,0x65,0x74,0x12,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0xE,0x74,0x61,0x72,0x67,0x65,0x74,0x54,0x79,0x70,0x65,0x4E,0x61,0x6D,0x65,0xA,0x6D,0x65,0x74,0x68,0x6F,0x64,0x4E,0x61,0x6D,0x65,0xD,0x64,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x1,0x1,0x2,0x1,0x1,0x1,0x3,0x30,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x2B,0x44,0x65,0x6C,0x65,0x67,0x61,0x74,0x65,0x45,0x6E,0x74,0x72,0x79,0x6,0xA,0x0,0x0,0x0,0x2B,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x52,0x65,0x73,0x70,0x6F,0x6E,0x73,0x65,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x6,0xB,0x0,0x0,0x0,0x4D,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x34,0x2E,0x30,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x62,0x30,0x33,0x66,0x35,0x66,0x37,0x66,0x31,0x31,0x64,0x35,0x30,0x61,0x33,0x61,0x6,0xC,0x0,0x0,0x0,0x7,0x74,0x61,0x72,0x67,0x65,0x74,0x30,0x6,0xD,0x0,0x0,0x0,0x5A,0x6e,0x65,0x74,0x5f,0x34,0x5f,0x78,0x5f,0x53,0x79,0x73,0x74,0x65,0x6d,0x2e,0x57,0x65,0x62,0x5f,0x74,0x65,0x73,0x74,0x2C,0x20,0x56,0x65,0x72,0x73,0x69,0x6F,0x6E,0x3D,0x31,0x2E,0x33,0x2E,0x30,0x2E,0x30,0x2C,0x20,0x43,0x75,0x6C,0x74,0x75,0x72,0x65,0x3D,0x6E,0x65,0x75,0x74,0x72,0x61,0x6C,0x2C,0x20,0x50,0x75,0x62,0x6C,0x69,0x63,0x4B,0x65,0x79,0x54,0x6F,0x6B,0x65,0x6E,0x3D,0x33,0x31,0x62,0x66,0x33,0x38,0x35,0x36,0x61,0x64,0x33,0x36,0x34,0x65,0x33,0x35,0x6,0xE,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x9,0x4,0x0,0x0,0x0,0xA,0x5,0x8,0x0,0x0,0x0,0x2C,0x4D,0x6F,0x6E,0x6F,0x54,0x65,0x73,0x74,0x73,0x2E,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x43,0x61,0x63,0x68,0x69,0x6E,0x67,0x2E,0x4F,0x75,0x74,0x70,0x75,0x74,0x43,0x61,0x63,0x68,0x65,0x54,0x65,0x73,0x74,0x0,0x0,0x0,0x0,0x6,0x0,0x0,0x0,0x4,0x9,0x0,0x0,0x0,0x2F,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x52,0x65,0x66,0x6C,0x65,0x63,0x74,0x69,0x6F,0x6E,0x2E,0x4D,0x65,0x6D,0x62,0x65,0x72,0x49,0x6E,0x66,0x6F,0x53,0x65,0x72,0x69,0x61,0x6C,0x69,0x7A,0x61,0x74,0x69,0x6F,0x6E,0x48,0x6F,0x6C,0x64,0x65,0x72,0x7,0x0,0x0,0x0,0x4,0x4E,0x61,0x6D,0x65,0xC,0x41,0x73,0x73,0x65,0x6D,0x62,0x6C,0x79,0x4E,0x61,0x6D,0x65,0x9,0x43,0x6C,0x61,0x73,0x73,0x4E,0x61,0x6D,0x65,0x9,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0xA,0x53,0x69,0x67,0x6E,0x61,0x74,0x75,0x72,0x65,0x32,0xA,0x4D,0x65,0x6D,0x62,0x65,0x72,0x54,0x79,0x70,0x65,0x10,0x47,0x65,0x6E,0x65,0x72,0x69,0x63,0x41,0x72,0x67,0x75,0x6D,0x65,0x6E,0x74,0x73,0x1,0x1,0x1,0x1,0x1,0x0,0x3,0x8,0xD,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x54,0x79,0x70,0x65,0x5B,0x5D,0x9,0x4,0x0,0x0,0x0,0x9,0xD,0x0,0x0,0x0,0x9,0xE,0x0,0x0,0x0,0x6,0x12,0x0,0x0,0x0,0x42,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x6,0x13,0x0,0x0,0x0,0x42,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x53,0x74,0x72,0x69,0x6E,0x67,0x20,0x44,0x75,0x6D,0x6D,0x79,0x42,0x61,0x64,0x53,0x75,0x62,0x73,0x74,0x69,0x74,0x75,0x74,0x69,0x6F,0x6E,0x43,0x61,0x6C,0x6C,0x62,0x61,0x63,0x6B,0x28,0x53,0x79,0x73,0x74,0x65,0x6D,0x2E,0x57,0x65,0x62,0x2E,0x48,0x74,0x74,0x70,0x43,0x6F,0x6E,0x74,0x65,0x78,0x74,0x29,0x8,0x0,0x0,0x0,0xA,0xB,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0};
#endif
static readonly object[] serializeObjects = {
diff --git a/mcs/class/System.Web/Test/System.Web/AppBrowsersTest.cs b/mcs/class/System.Web/Test/System.Web/AppBrowsersTest.cs
index a0241b7a65c..868d0115acd 100644
--- a/mcs/class/System.Web/Test/System.Web/AppBrowsersTest.cs
+++ b/mcs/class/System.Web/Test/System.Web/AppBrowsersTest.cs
@@ -39,7 +39,7 @@ using System.Threading;
namespace MonoTests.System.Web
{
[TestFixture]
- [Ignore ("adapters.browser depends on System.Web_test_net_2_0.dll")]
+ [Ignore ("adapters.browser depends on net_4_x_System.Web_test.dll")]
public class AppBrowsersTest
{
[TestFixtureSetUp]
diff --git a/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
index 9ee9ebe1a1e..15d1f137a0a 100644
--- a/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
+++ b/mcs/class/System.Web/Test/System.Web/HttpRequestTest.cs
@@ -254,6 +254,30 @@ namespace MonoTests.System.Web {
{
HttpContext.Current.Request.MapPath ("Web.config", "something", false);
}
+
+ [Test]
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+ public void ReadOnlyHeadersAdd ()
+ {
+ var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
+ r.Headers.Add ("a","a");
+ }
+
+ [Test]
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+ public void ReadOnlyHeadersSet ()
+ {
+ var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
+ r.Headers.Set ("a","a");
+ }
+
+ [Test]
+ [ExpectedException (typeof (PlatformNotSupportedException))]
+ public void ReadOnlyHeadersRemove ()
+ {
+ var r = new HttpRequest ("file", "http://www.gnome.org", "key=value&key2=value%32second");
+ r.Headers.Remove ("a");
+ }
}
[TestFixture]
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config
index 069cb11642b..fab29b2d0c5 100755
--- a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config
@@ -10,7 +10,7 @@
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
- <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_2_0" />
+ <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, net_4_x_System.Web_test" />
</sectionGroup>
</configSections>
<appSettings>
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0 b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0
index db81e2e19de..14b2f4d2d85 100644
--- a/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Web.mono.config.4.0
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
- <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, System.Web_test_net_4_0" />
+ <section name="CustomTags" restartOnExternalChanges="false" type="MonoTests.SystemWeb.Framework.CustomSection, net_4_x_System.Web_test" />
</configSections>
<appSettings>
<add key="strvalue" value="str" />
diff --git a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/adapters.browser b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/adapters.browser
index e289c1b993d..120365147c8 100644
--- a/mcs/class/System.Web/Test/mainsoft/NunitWebResources/adapters.browser
+++ b/mcs/class/System.Web/Test/mainsoft/NunitWebResources/adapters.browser
@@ -7,10 +7,10 @@
<capture>
<userAgent match="^(?'refuacapturename'.*)$" />
</capture>
- <controlAdapters markupTextWriterType="MonoTests.System.Web.CustomHtmlTextWriter, System.Web_test_net_2_0">
+ <controlAdapters markupTextWriterType="MonoTests.System.Web.CustomHtmlTextWriter, net_4_x_System.Web_test">
<adapter
- controlType="MonoTests.System.Web.UI.Customadaptercontrol, System.Web_test_net_2_0"
- adapterType="MonoTests.System.Web.UI.Customadapter, System.Web_test_net_2_0"
+ controlType="MonoTests.System.Web.UI.Customadaptercontrol, net_4_x_System.Web_test"
+ adapterType="MonoTests.System.Web.UI.Customadapter, net_4_x_System.Web_test"
/>
</controlAdapters>
<capabilities>
diff --git a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
index aded011e986..f70bd99464b 100644
--- a/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
+++ b/mcs/class/System.XML/System.Xml.Serialization/XmlTypeMapping.cs
@@ -646,8 +646,15 @@ namespace System.Xml.Serialization
{
if (memberValue == null) return null;
Type type = memberValue.GetType();
- foreach (XmlTypeMapElementInfo elem in _itemInfo)
- if (elem.TypeData.Type == type) return elem;
+ XmlTypeMapElementInfo bestMatch = null;
+ foreach (XmlTypeMapElementInfo elem in _itemInfo) {
+ if (elem.TypeData.Type == type)
+ return elem;
+ if (elem.TypeData.Type.IsAssignableFrom (type) &&
+ (bestMatch == null || elem.TypeData.Type.IsAssignableFrom (bestMatch.TypeData.Type)))
+ bestMatch = elem;
+ }
+ return bestMatch;
}
return null;
}
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
index 597acd1df54..116bbe323ad 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTestClasses.cs
@@ -711,6 +711,13 @@ namespace MonoTests.System.Xml.TestClasses
public object data;
}
+ public class SubclassTestList
+ {
+ [XmlElement ("a", typeof (SimpleClass))]
+ [XmlElement ("b", typeof (SubclassTestBase))]
+ public List<object> Items;
+ }
+
public class DictionaryWithIndexer : DictionaryBase
{
public TimeSpan this[int index]
diff --git a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
index 4e51eceae03..bdd08aa7c69 100644
--- a/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
+++ b/mcs/class/System.XML/Test/System.Xml.Serialization/XmlSerializerTests.cs
@@ -1939,6 +1939,17 @@ namespace MonoTests.System.XmlSerialization
Assert.AreEqual (Infoset (res), WriterText);
}
+ [Test] // Covers #36829
+ public void TestSubclassElementList ()
+ {
+ var o = new SubclassTestList () { Items = new List<object> () { new SubclassTestSub () } };
+ Serialize (o);
+
+ string res = "<SubclassTestList xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>";
+ res += "<b xsi:type=\"SubclassTestSub\"/></SubclassTestList>";
+ Assert.AreEqual (Infoset (res), WriterText);
+ }
+
[Test]
[ExpectedException (typeof (InvalidOperationException))]
public void TestArrayAttributeWithWrongDataType ()
diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs
index 73dcf6f927d..1aadbebcbb4 100755
--- a/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs
+++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlObjectWriterTest.cs
@@ -719,7 +719,7 @@ namespace MonoTests.System.Xaml
XamlServices.Transform (new XamlObjectReader (obj), xxw);
Console.Error.WriteLine (sw);
*/
- var xml = "<TestClass3 xmlns='clr-namespace:MonoTests.System.Xaml;assembly=System.Xaml_test_net_4_0' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><TestClass3.Nested><TestClass3 Nested='{x:Null}' /></TestClass3.Nested></TestClass3>".Replace ("net_4_0", ver);
+ var xml = "<TestClass3 xmlns='clr-namespace:MonoTests.System.Xaml;assembly=System.Xaml_test_net_4_0' xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'><TestClass3.Nested><TestClass3 Nested='{x:Null}' /></TestClass3.Nested></TestClass3>".Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test");
var settings = new XamlObjectWriterSettings ();
bool invoked = false;
settings.XamlSetValueHandler = (sender, e) => {
@@ -835,7 +835,7 @@ namespace MonoTests.System.Xaml
XamlReader GetReader (string filename)
{
const string ver = "net_4_x";
- string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("net_4_0", ver);
+ string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test");
return new XamlXmlReader (XmlReader.Create (new StringReader (xml)));
}
diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs
index 70b26b87c5a..85a4a59e286 100755
--- a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs
+++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlReaderTest.cs
@@ -46,7 +46,7 @@ namespace MonoTests.System.Xaml
XamlReader GetReader (string filename)
{
const string ver = "net_4_x";
- string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("net_4_0", ver);
+ string xml = File.ReadAllText (Path.Combine ("Test/XmlFiles", filename)).Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test");
return new XamlXmlReader (XmlReader.Create (new StringReader (xml)));
}
diff --git a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs
index eaf0f28c257..e46771c9b31 100755
--- a/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs
+++ b/mcs/class/System.Xaml/Test/System.Xaml/XamlXmlWriterTest.cs
@@ -637,7 +637,7 @@ namespace MonoTests.System.Xaml
string ReadXml (string name)
{
string ver = "net_4_x";
- return File.ReadAllText ("Test/XmlFiles/" + name).Trim ().Replace (">\n", ">\r\n").Replace ("net_4_0", ver).Replace ("\r\n", Environment.NewLine);
+ return File.ReadAllText ("Test/XmlFiles/" + name).Trim ().Replace (">\n", ">\r\n").Replace ("System.Xaml_test_net_4_0", ver + "_System.Xaml_test").Replace ("\r\n", Environment.NewLine);
}
[Test]
diff --git a/mcs/class/System/System.Net.Configuration/SmtpSection.cs b/mcs/class/System/System.Net.Configuration/SmtpSection.cs
index 9d5f74bd0c1..705dc920d57 100644
--- a/mcs/class/System/System.Net.Configuration/SmtpSection.cs
+++ b/mcs/class/System/System.Net.Configuration/SmtpSection.cs
@@ -44,6 +44,12 @@ namespace System.Net.Configuration {
set { base ["deliveryMethod"] = value; }
}
+ [ConfigurationProperty ("deliveryFormat", DefaultValue = SmtpDeliveryFormat.SevenBit)]
+ public SmtpDeliveryFormat DeliveryFormat {
+ get { return (SmtpDeliveryFormat) base ["deliveryFormat"]; }
+ set { base ["deliveryFormat"] = value; }
+ }
+
[ConfigurationProperty ("from")]
public string From {
get { return (string) base ["from"]; }
diff --git a/mcs/class/System/System.Net/HttpConnection.cs b/mcs/class/System/System.Net/HttpConnection.cs
index 2be693f5b16..885eaf3ea3d 100644
--- a/mcs/class/System/System.Net/HttpConnection.cs
+++ b/mcs/class/System/System.Net/HttpConnection.cs
@@ -397,7 +397,7 @@ namespace System.Net {
HttpListenerResponse response = context.Response;
response.StatusCode = status;
response.ContentType = "text/html";
- string description = HttpListenerResponse.GetStatusDescription (status);
+ string description = HttpListenerResponseHelper.GetStatusDescription (status);
string str;
if (msg != null)
str = String.Format ("<h1>{0} ({1})</h1>", description, msg);
diff --git a/mcs/class/System/System.Net/HttpListenerResponse.cs b/mcs/class/System/System.Net/HttpListenerResponse.cs
index dcc553036e1..807c9dd393a 100644
--- a/mcs/class/System/System.Net/HttpListenerResponse.cs
+++ b/mcs/class/System/System.Net/HttpListenerResponse.cs
@@ -218,63 +218,10 @@ namespace System.Net {
if (value < 100 || value > 999)
throw new ProtocolViolationException ("StatusCode must be between 100 and 999.");
status_code = value;
- status_description = GetStatusDescription (value);
+ status_description = HttpListenerResponseHelper.GetStatusDescription (value);
}
}
- internal static string GetStatusDescription (int code)
- {
- switch (code){
- case 100: return "Continue";
- case 101: return "Switching Protocols";
- case 102: return "Processing";
- case 200: return "OK";
- case 201: return "Created";
- case 202: return "Accepted";
- case 203: return "Non-Authoritative Information";
- case 204: return "No Content";
- case 205: return "Reset Content";
- case 206: return "Partial Content";
- case 207: return "Multi-Status";
- case 300: return "Multiple Choices";
- case 301: return "Moved Permanently";
- case 302: return "Found";
- case 303: return "See Other";
- case 304: return "Not Modified";
- case 305: return "Use Proxy";
- case 307: return "Temporary Redirect";
- case 400: return "Bad Request";
- case 401: return "Unauthorized";
- case 402: return "Payment Required";
- case 403: return "Forbidden";
- case 404: return "Not Found";
- case 405: return "Method Not Allowed";
- case 406: return "Not Acceptable";
- case 407: return "Proxy Authentication Required";
- case 408: return "Request Timeout";
- case 409: return "Conflict";
- case 410: return "Gone";
- case 411: return "Length Required";
- case 412: return "Precondition Failed";
- case 413: return "Request Entity Too Large";
- case 414: return "Request-Uri Too Long";
- case 415: return "Unsupported Media Type";
- case 416: return "Requested Range Not Satisfiable";
- case 417: return "Expectation Failed";
- case 422: return "Unprocessable Entity";
- case 423: return "Locked";
- case 424: return "Failed Dependency";
- case 500: return "Internal Server Error";
- case 501: return "Not Implemented";
- case 502: return "Bad Gateway";
- case 503: return "Service Unavailable";
- case 504: return "Gateway Timeout";
- case 505: return "Http Version Not Supported";
- case 507: return "Insufficient Storage";
- }
- return "";
- }
-
public string StatusDescription {
get { return status_description; }
set {
@@ -552,6 +499,64 @@ namespace System.Net {
cookies.Add (cookie);
}
}
+
+ // do not inline into HttpListenerResponse as this recursively brings everything that's
+ // reachable by IDisposable.Dispose (and that's quite a lot in this case).
+ static class HttpListenerResponseHelper {
+
+ internal static string GetStatusDescription (int code)
+ {
+ switch (code){
+ case 100: return "Continue";
+ case 101: return "Switching Protocols";
+ case 102: return "Processing";
+ case 200: return "OK";
+ case 201: return "Created";
+ case 202: return "Accepted";
+ case 203: return "Non-Authoritative Information";
+ case 204: return "No Content";
+ case 205: return "Reset Content";
+ case 206: return "Partial Content";
+ case 207: return "Multi-Status";
+ case 300: return "Multiple Choices";
+ case 301: return "Moved Permanently";
+ case 302: return "Found";
+ case 303: return "See Other";
+ case 304: return "Not Modified";
+ case 305: return "Use Proxy";
+ case 307: return "Temporary Redirect";
+ case 400: return "Bad Request";
+ case 401: return "Unauthorized";
+ case 402: return "Payment Required";
+ case 403: return "Forbidden";
+ case 404: return "Not Found";
+ case 405: return "Method Not Allowed";
+ case 406: return "Not Acceptable";
+ case 407: return "Proxy Authentication Required";
+ case 408: return "Request Timeout";
+ case 409: return "Conflict";
+ case 410: return "Gone";
+ case 411: return "Length Required";
+ case 412: return "Precondition Failed";
+ case 413: return "Request Entity Too Large";
+ case 414: return "Request-Uri Too Long";
+ case 415: return "Unsupported Media Type";
+ case 416: return "Requested Range Not Satisfiable";
+ case 417: return "Expectation Failed";
+ case 422: return "Unprocessable Entity";
+ case 423: return "Locked";
+ case 424: return "Failed Dependency";
+ case 500: return "Internal Server Error";
+ case 501: return "Not Implemented";
+ case 502: return "Bad Gateway";
+ case 503: return "Service Unavailable";
+ case 504: return "Gateway Timeout";
+ case 505: return "Http Version Not Supported";
+ case 507: return "Insufficient Storage";
+ }
+ return "";
+ }
+ }
}
#endif
diff --git a/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs b/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
index 7842d5c3fe8..7b0b3ac8152 100644
--- a/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
+++ b/mcs/class/System/Test/System.Configuration/ApplicationSettingsBaseTest.cs
@@ -284,7 +284,7 @@ namespace MonoTests.System.Configuration {
[Test]
public void TestSettings2_Properties ()
{
- string expected = "MonoTests.System.Configuration.ProviderPoker, System_test_net_4_x, Version=0.0.0.0";
+ string expected = "MonoTests.System.Configuration.ProviderPoker, net_4_x_System_test, Version=0.0.0.0";
Assert.AreEqual (expected, new SettingsProviderAttribute (typeof (ProviderPoker)).ProviderTypeName.Substring (0, expected.Length), "#1");
TestSettings2 settings = new TestSettings2 ();
diff --git a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
index c6ca3ef5b2d..a0e19d4f2d1 100755
--- a/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
+++ b/mcs/class/System/Test/System.Net.Sockets/SocketTest.cs
@@ -4361,16 +4361,19 @@ namespace MonoTests.System.Net.Sockets
var ep = server.LocalEndPoint as IPEndPoint;
+ BCCalledBack.Reset ();
var ar1 = client.BeginConnect (ep, BCCallback, client);
- client.EndConnect (ar1);
+ Assert.IsTrue (BCCalledBack.WaitOne (10000), "#1");
client.Disconnect (true);
+ BCCalledBack.Reset ();
var ar2 = client.BeginConnect (IPAddress.Loopback, ep.Port, BCCallback, client);
- client.EndConnect (ar2);
+ Assert.IsTrue (BCCalledBack.WaitOne (10000), "#2");
client.Disconnect (true);
+ BCCalledBack.Reset ();
var ar3 = client.BeginConnect (new [] {IPAddress.Loopback}, ep.Port, BCCallback, client);
- client.EndConnect (ar3);
+ Assert.IsTrue (BCCalledBack.WaitOne (10000), "#2");
client.Disconnect (true);
}
}
diff --git a/mcs/class/System/mobile_static_System_test.dll.excludes b/mcs/class/System/mobile_static_System_test.dll.excludes
new file mode 100644
index 00000000000..8f84347cde9
--- /dev/null
+++ b/mcs/class/System/mobile_static_System_test.dll.excludes
@@ -0,0 +1,190 @@
+Microsoft.CSharp/CodeGeneratorFromCompileUnitTest.cs
+Microsoft.CSharp/CodeGeneratorFromExpressionTest.cs
+Microsoft.CSharp/CodeGeneratorFromNamespaceTest.cs
+Microsoft.CSharp/CodeGeneratorFromStatementTest.cs
+Microsoft.CSharp/CodeGeneratorFromTypeTest.cs
+Microsoft.CSharp/CodeGeneratorIdentifierTest.cs
+Microsoft.CSharp/CodeGeneratorTestBase.cs
+Microsoft.CSharp/CodeGeneratorTypeOutputTest.cs
+Microsoft.CSharp/CSharpCodeProviderCas.cs
+Microsoft.CSharp/CSharpCodeProviderTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromBinaryOperatorTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromCompileUnitTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromExpressionTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromNamespaceTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromStatementTest.cs
+Microsoft.VisualBasic/CodeGeneratorFromTypeTest.cs
+Microsoft.VisualBasic/CodeGeneratorTestBase.cs
+Microsoft.VisualBasic/VBCodeProviderCas.cs
+Microsoft.VisualBasic/VBCodeProviderTest.cs
+System.CodeDom/CodeArgumentReferenceExpressionCas.cs
+System.CodeDom/CodeArgumentReferenceExpressionTest.cs
+System.CodeDom/CodeArrayCreateExpressionCas.cs
+System.CodeDom/CodeArrayCreateExpressionTest.cs
+System.CodeDom/CodeArrayIndexerExpressionCas.cs
+System.CodeDom/CodeAssignStatementCas.cs
+System.CodeDom/CodeAttachEventStatementCas.cs
+System.CodeDom/CodeAttachEventStatementTest.cs
+System.CodeDom/CodeAttributeArgumentCas.cs
+System.CodeDom/CodeAttributeArgumentCollectionCas.cs
+System.CodeDom/CodeAttributeArgumentCollectionTest.cs
+System.CodeDom/CodeAttributeArgumentTest.cs
+System.CodeDom/CodeAttributeDeclarationCas.cs
+System.CodeDom/CodeAttributeDeclarationCollectionCas.cs
+System.CodeDom/CodeAttributeDeclarationCollectionTest.cs
+System.CodeDom/CodeAttributeDeclarationTest.cs
+System.CodeDom/CodeBaseReferenceExpressionCas.cs
+System.CodeDom/CodeBinaryOperatorExpressionCas.cs
+System.CodeDom/CodeCastExpressionCas.cs
+System.CodeDom/CodeCastExpressionTest.cs
+System.CodeDom/CodeCatchClauseCas.cs
+System.CodeDom/CodeCatchClauseCollectionCas.cs
+System.CodeDom/CodeCatchClauseCollectionTest.cs
+System.CodeDom/CodeCatchClauseTest.cs
+System.CodeDom/CodeChecksumPragmaCas.cs
+System.CodeDom/CodeChecksumPragmaTest.cs
+System.CodeDom/CodeCommentStatementCas.cs
+System.CodeDom/CodeCommentStatementCollectionCas.cs
+System.CodeDom/CodeCommentStatementCollectionTest.cs
+System.CodeDom/CodeCompileUnitCas.cs
+System.CodeDom/CodeConditionStatementCas.cs
+System.CodeDom/CodeConstructorCas.cs
+System.CodeDom/CodeConstructorTest.cs
+System.CodeDom/CodeDefaultValueExpressionCas.cs
+System.CodeDom/CodeDefaultValueExpressionTest.cs
+System.CodeDom/CodeDelegateCreateExpressionCas.cs
+System.CodeDom/CodeDelegateCreateExpressionTest.cs
+System.CodeDom/CodeDelegateInvokeExpressionCas.cs
+System.CodeDom/CodeDirectionExpressionCas.cs
+System.CodeDom/CodeDirectiveCas.cs
+System.CodeDom/CodeDirectiveCollectionCas.cs
+System.CodeDom/CodeDirectiveCollectionTest.cs
+System.CodeDom/CodeEntryPointMethodCas.cs
+System.CodeDom/CodeEventReferenceExpressionCas.cs
+System.CodeDom/CodeEventReferenceExpressionTest.cs
+System.CodeDom/CodeExpressionCas.cs
+System.CodeDom/CodeExpressionCollectionCas.cs
+System.CodeDom/CodeExpressionCollectionTest.cs
+System.CodeDom/CodeExpressionStatementCas.cs
+System.CodeDom/CodeFieldReferenceExpressionCas.cs
+System.CodeDom/CodeGotoStatementCas.cs
+System.CodeDom/CodeGotoStatementTest.cs
+System.CodeDom/CodeIndexerExpressionCas.cs
+System.CodeDom/CodeIterationStatementCas.cs
+System.CodeDom/CodeLabeledStatementTest.cs
+System.CodeDom/CodeLinePragmaCas.cs
+System.CodeDom/CodeLinePragmaTest.cs
+System.CodeDom/CodeMemberEventCas.cs
+System.CodeDom/CodeMemberFieldCas.cs
+System.CodeDom/CodeMemberFieldTest.cs
+System.CodeDom/CodeMemberMethodCas.cs
+System.CodeDom/CodeMemberMethodTest.cs
+System.CodeDom/CodeMemberPropertyCas.cs
+System.CodeDom/CodeMemberPropertyTest.cs
+System.CodeDom/CodeMethodInvokeExpressionCas.cs
+System.CodeDom/CodeMethodInvokeExpressionTest.cs
+System.CodeDom/CodeMethodReferenceExpressionCas.cs
+System.CodeDom/CodeMethodReferenceExpressionTest.cs
+System.CodeDom/CodeMethodReturnStatementCas.cs
+System.CodeDom/CodeNamespaceCas.cs
+System.CodeDom/CodeNamespaceCollectionCas.cs
+System.CodeDom/CodeNamespaceCollectionTest.cs
+System.CodeDom/CodeNamespaceImportCas.cs
+System.CodeDom/CodeNamespaceImportCollectionCas.cs
+System.CodeDom/CodeNamespaceImportCollectionTest.cs
+System.CodeDom/CodeNamespaceImportTest.cs
+System.CodeDom/CodeNamespaceTest.cs
+System.CodeDom/CodeObjectCas.cs
+System.CodeDom/CodeObjectCreateExpressionCas.cs
+System.CodeDom/CodeObjectCreateExpressionTest.cs
+System.CodeDom/CodeParameterDeclarationExpressionCas.cs
+System.CodeDom/CodeParameterDeclarationExpressionCollectionCas.cs
+System.CodeDom/CodeParameterDeclarationExpressionCollectionTest.cs
+System.CodeDom/CodeParameterDeclarationExpressionTest.cs
+System.CodeDom/CodePrimitiveExpressionCas.cs
+System.CodeDom/CodePropertyReferenceExpressionCas.cs
+System.CodeDom/CodePropertyReferenceExpressionTest.cs
+System.CodeDom/CodePropertySetValueReferenceExpressionCas.cs
+System.CodeDom/CodeRegionDirectiveCas.cs
+System.CodeDom/CodeRegionDirectiveTest.cs
+System.CodeDom/CodeRemoveEventStatementCas.cs
+System.CodeDom/CodeRemoveEventStatementTest.cs
+System.CodeDom/CodeSnippetCompileUnitCas.cs
+System.CodeDom/CodeSnippetCompileUnitTest.cs
+System.CodeDom/CodeSnippetExpressionCas.cs
+System.CodeDom/CodeSnippetExpressionTest.cs
+System.CodeDom/CodeSnippetStatementCas.cs
+System.CodeDom/CodeSnippetStatementTest.cs
+System.CodeDom/CodeSnippetTypeMemberCas.cs
+System.CodeDom/CodeSnippetTypeMemberTest.cs
+System.CodeDom/CodeStatementCas.cs
+System.CodeDom/CodeStatementCollectionCas.cs
+System.CodeDom/CodeStatementCollectionTest.cs
+System.CodeDom/CodeThisReferenceExpressionCas.cs
+System.CodeDom/CodeThrowExceptionStatementCas.cs
+System.CodeDom/CodeTryCatchFinallyStatementCas.cs
+System.CodeDom/CodeTypeConstructorCas.cs
+System.CodeDom/CodeTypeConstructorTest.cs
+System.CodeDom/CodeTypeDeclarationCas.cs
+System.CodeDom/CodeTypeDeclarationCollectionCas.cs
+System.CodeDom/CodeTypeDeclarationCollectionTest.cs
+System.CodeDom/CodeTypeDelegateCas.cs
+System.CodeDom/CodeTypeDelegateTest.cs
+System.CodeDom/CodeTypeMemberCas.cs
+System.CodeDom/CodeTypeMemberCollectionCas.cs
+System.CodeDom/CodeTypeMemberCollectionTest.cs
+System.CodeDom/CodeTypeOfExpressionCas.cs
+System.CodeDom/CodeTypeOfExpressionTest.cs
+System.CodeDom/CodeTypeParameterCas.cs
+System.CodeDom/CodeTypeParameterCollectionTest.cs
+System.CodeDom/CodeTypeParameterTest.cs
+System.CodeDom/CodeTypeReferenceCas.cs
+System.CodeDom/CodeTypeReferenceCollectionCas.cs
+System.CodeDom/CodeTypeReferenceCollectionTest.cs
+System.CodeDom/CodeTypeReferenceExpressionCas.cs
+System.CodeDom/CodeTypeReferenceExpressionTest.cs
+System.CodeDom/CodeTypeReferenceTest.cs
+System.CodeDom/CodeVariableDeclarationStatementCas.cs
+System.CodeDom/CodeVariableDeclarationStatementTest.cs
+System.CodeDom/CodeVariableReferenceExpressionCas.cs
+System.CodeDom/CodeVariableReferenceExpressionTest.cs
+System.CodeDom.Compiler/CodeCompilerCas.cs
+System.CodeDom.Compiler/CodeDomProviderCas.cs
+System.CodeDom.Compiler/CodeGeneratorCas.cs
+System.CodeDom.Compiler/CodeGeneratorFromTypeTestBase.cs
+System.CodeDom.Compiler/CodeGeneratorGenerateFromCompileUnitTest.cs
+System.CodeDom.Compiler/CodeGeneratorOptionsCas.cs
+System.CodeDom.Compiler/CodeGeneratorOptionsTest.cs
+System.CodeDom.Compiler/CodeGeneratorTest.cs
+System.CodeDom.Compiler/CodeGeneratorTestBase.cs
+System.CodeDom.Compiler/CodeParserCas.cs
+System.CodeDom.Compiler/CompilerErrorCas.cs
+System.CodeDom.Compiler/CompilerErrorCollectionCas.cs
+System.CodeDom.Compiler/CompilerInfoCas.cs
+System.CodeDom.Compiler/CompilerParametersCas.cs
+System.CodeDom.Compiler/CompilerResultsCas.cs
+System.CodeDom.Compiler/ExecutorCas.cs
+System.CodeDom.Compiler/ExecutorTest.cs
+System.CodeDom.Compiler/GeneratedCodeAttributeCas.cs
+System.CodeDom.Compiler/GeneratedCodeAttributeTest.cs
+System.CodeDom.Compiler/IndentedTextWriterCas.cs
+System.CodeDom.Compiler/IndentedTextWriterTest.cs
+System.CodeDom.Compiler/TempFileCollectionCas.cs
+System.CodeDom.Compiler/TempFileCollectionTest.cs
+System.Configuration/ApplicationSettingsBaseTest.cs
+System.Configuration/ConfigurationExceptionTest.cs
+System.Configuration/ConfigXmlDocumentTest.cs
+System.Configuration/LocalFileSettingsProviderTest.cs
+System.Configuration/SettingElementTest.cs
+System.Configuration/SettingsBaseTest.cs
+System.Configuration/SettingsPropertyCollectionTest.cs
+System.Configuration/SettingsPropertyTest.cs
+System.Configuration/SettingsPropertyValueCollectionTest.cs
+System.Configuration/SettingsPropertyValueTest.cs
+System.Configuration.Provider
+System.Configuration.Provider/ProviderBaseTest.cs
+System.IO.Ports/SerialPortTest.cs
+System.Web/AspNetHostingPermissionAttributeCas.cs
+System.Web/AspNetHostingPermissionAttributeTest.cs
+System.Web/AspNetHostingPermissionCas.cs
+System.Web/AspNetHostingPermissionTest.cs
diff --git a/mcs/class/System/mobile_static_System_test.dll.sources b/mcs/class/System/mobile_static_System_test.dll.sources
new file mode 100644
index 00000000000..3944a95be6a
--- /dev/null
+++ b/mcs/class/System/mobile_static_System_test.dll.sources
@@ -0,0 +1 @@
+#include System_test.dll.sources
diff --git a/mcs/class/corlib/Makefile b/mcs/class/corlib/Makefile
index 4e557d1ee29..9fc807acc27 100644
--- a/mcs/class/corlib/Makefile
+++ b/mcs/class/corlib/Makefile
@@ -60,8 +60,14 @@ WARNING_ABOUT_DISABLED_WARNING=1635
LOCAL_MCS_FLAGS = -unsafe -nostdlib -nowarn:612,618,$(WARNING_ABOUT_DISABLED_WARNING) -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC $(REFERENCE_SOURCES_FLAGS)
DEFAULT_REFERENCES =
+ifdef MOBILE_STATIC
+CORLIB_MONO_POSIX_REF =
+else
+CORLIB_MONO_POSIX_REF = -r:Mono.Posix.dll
+endif
+
# System.IO/DirectoryInfoTest.cs needs Mono.Posix
-TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll \
+TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll \
-define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%)
EXTRA_DISTFILES = \
@@ -168,9 +174,17 @@ run-test-vts: test-vts
@echo Running vts tests...
PATH="$(TEST_RUNTIME_WRAPPERS_PATH):$(PATH)" $(TEST_RUNTIME) $(RUNTIME_FLAGS) $(TEST_HARNESS) $(NOSHADOW_FLAG) \
$(vtsdir)/$(PROFILE)_TestLib/BinarySerializationOverVersions.exe
-ifndef NO_TEST
+
+ifdef NO_TEST
+NO_VTS_TEST = yes
+endif
+
+ifndef NO_VTS_TEST
test: test-vts
run-test: run-test-vts
+else
+test:
+run-test:
endif
EXTRA_DISTFILES += \
diff --git a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs
index b9cc49f1464..92826796908 100755
--- a/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs
+++ b/mcs/class/corlib/System.Security.Cryptography/CryptoConfig.fullaot.cs
@@ -169,7 +169,11 @@ namespace System.Security.Cryptography {
name = "System.Security.Cryptography.X509Certificates.X509Chain, System";
break;
case "aes":
+#if MOBILE_STATIC
+ name = "System.Security.Cryptography.AesCryptoServiceProvider, System.Core";
+#else
name = "System.Security.Cryptography.AesManaged, System.Core";
+#endif
break;
}
diff --git a/mcs/class/corlib/Test/System.IO/DirectoryTest.cs b/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
index 64ee5872b83..b17cfd62c55 100644
--- a/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
+++ b/mcs/class/corlib/Test/System.IO/DirectoryTest.cs
@@ -17,7 +17,7 @@ using System.IO;
using System.Text;
using System.Threading;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using Mono.Unix;
#endif
using NUnit.Framework;
@@ -47,7 +47,7 @@ public class DirectoryTest
if (Directory.Exists (TempFolder))
Directory.Delete (TempFolder, true);
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test] //BXC #12461
public void EnumerateFilesListSymlinks ()
{
diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs
index b88423a68f3..77e8e6df1af 100644
--- a/mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/AssemblyAlgorithmIdAttributeTest.cs
@@ -5,7 +5,7 @@
// (C) 2004 Ximian, Inc. http://www.ximian.com
//
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System;
using System.Threading;
diff --git a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
index 7d561f4f9e5..de8f4bdbca5 100644
--- a/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/AssemblyTest.cs
@@ -37,7 +37,7 @@ using System.Configuration.Assemblies;
using System.Globalization;
using System.IO;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Threading;
@@ -197,7 +197,7 @@ namespace MonoTests.System.Reflection
#endif
}
-#if !MONOTOUCH // Reflection.Emit is not supported.
+#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
[Test]
[Category("AndroidNotWorking")] // Missing Mono.CompilerServices.SymbolWriter
public void GetModules_MissingFile ()
@@ -249,7 +249,7 @@ namespace MonoTests.System.Reflection
public void Corlib_test ()
{
Assembly corlib_test = Assembly.GetExecutingAssembly ();
-#if MONODROID
+#if MONODROID || MOBILE_STATIC
Assert.IsNull (corlib_test.EntryPoint, "EntryPoint");
Assert.IsNull (corlib_test.Evidence, "Evidence");
#elif MOBILE
@@ -457,7 +457,18 @@ namespace MonoTests.System.Reflection
[Test]
public void LoadWithPartialName ()
{
- string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "corlib_test_net_4_x", "corlib_plattest", "mscorlibtests", "BclTests" };
+// FIXME?
+// So the problem here is that if we load an assembly
+// in a fully aot mode and then cannot load the
+// dylib, we will assert. This test is incompatible
+// with the semantics of aot'ed assembly loading, as
+// aot may assert when loading. This assumes that it's
+// safe to greedly load everything.
+#if MOBILE_STATIC
+ string [] names = { "mobile_static_corlib_test" };
+#else
+ string [] names = { "corlib_test_net_1_1", "corlib_test_net_2_0", "corlib_test_net_4_0", "corlib_test_net_4_5", "net_4_x_corlib_test", "corlib_plattest", "mscorlibtests", "BclTests" };
+#endif
foreach (string s in names)
if (Assembly.LoadWithPartialName (s) != null)
@@ -502,7 +513,7 @@ namespace MonoTests.System.Reflection
}
}
-#if !MONOTOUCH // Reflection.Emit is not supported.
+#if !MONOTOUCH && !MOBILE_STATIC // Reflection.Emit is not supported.
[Test]
public void Location_Empty() {
string assemblyFileName = Path.Combine (
@@ -1175,7 +1186,7 @@ namespace MonoTests.System.Reflection
Assert.AreEqual ("MonoModule", module.GetType ().Name, "#2");
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
Assert.AreEqual ("mscorlib.dll", module.Name, "#3");
#endif
Assert.IsFalse (module.IsResource (), "#4");
diff --git a/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs
index 410c4c239a0..f06debd8ebb 100644
--- a/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/FieldInfoTest.cs
@@ -31,7 +31,7 @@
using System;
using System.Threading;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
diff --git a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
index 17ddddd3e04..53617c4e70f 100644
--- a/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/MethodInfoTest.cs
@@ -33,7 +33,7 @@ using NUnit.Framework;
using System;
using System.Threading;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -54,7 +54,7 @@ namespace MonoTests.System.Reflection
[TestFixture]
public class MethodInfoTest
{
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
// use an existing symbol - so we can build without dlsym. It does not matter that the signature does not match for the test
[DllImport ("libc", EntryPoint="readlink", CharSet=CharSet.Unicode, ExactSpelling=false, PreserveSig=true, SetLastError=true, BestFitMapping=true, ThrowOnUnmappableChar=true)]
#else
@@ -115,7 +115,7 @@ namespace MonoTests.System.Reflection
DllImportAttribute attr = (DllImportAttribute)((t.GetMethod ("dllImportMethod").GetCustomAttributes (typeof (DllImportAttribute), true)) [0]);
Assert.AreEqual (CallingConvention.Winapi, attr.CallingConvention, "#1");
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
Assert.AreEqual ("readlink", attr.EntryPoint, "#2");
Assert.AreEqual ("libc", attr.Value, "#3");
#else
@@ -397,7 +397,7 @@ namespace MonoTests.System.Reflection
[Test]
public void GetMethodBody ()
{
-#if MONOTOUCH && !DEBUG
+#if (MONOTOUCH || MOBILE_STATIC) && !DEBUG
Assert.Ignore ("Release app (on devices) are stripped of (managed) IL so this test would fail");
#endif
MethodBody mb = typeof (MethodInfoTest).GetMethod ("locals_method").GetMethodBody ();
@@ -600,7 +600,7 @@ namespace MonoTests.System.Reflection
} catch (InvalidOperationException ex) {
}
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
public TFoo SimpleGenericMethod2<TFoo, TBar> () { return default (TFoo); }
/*Test for the uggly broken behavior of SRE.*/
[Test]
@@ -854,7 +854,7 @@ namespace MonoTests.System.Reflection
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
class GenericClass<T>
{
public void Method ()
diff --git a/mcs/class/corlib/Test/System.Reflection/ModuleTest.cs b/mcs/class/corlib/Test/System.Reflection/ModuleTest.cs
index 04c941a9526..c93fecfa422 100644
--- a/mcs/class/corlib/Test/System.Reflection/ModuleTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/ModuleTest.cs
@@ -10,7 +10,7 @@
using System;
using System.Threading;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.Serialization;
@@ -93,7 +93,7 @@ public class ModuleTest
}
// Some of these tests overlap with the tests for ModuleBuilder
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[Category("NotDotNet")] // path length can cause suprious failures
public void TestGlobalData () {
@@ -328,7 +328,7 @@ public class ModuleTest
Module m = typeof (ModuleTest).Module;
m.GetObjectData (null, new StreamingContext (StreamingContextStates.All));
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[Category ("AndroidNotWorking")] // Mono.CompilerServices.SymbolWriter not available for Xamarin.Android
public void GetTypes ()
diff --git a/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs b/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
index 9db8bda20fd..d31b99fa495 100644
--- a/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/MonoGenericClassTest.cs
@@ -7,7 +7,7 @@
// Copyright 2011 Xamarin Inc (http://www.xamarin.com).
//
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System;
using System.Collections;
diff --git a/mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs b/mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs
index dd38e16b7e5..2fe870111ca 100644
--- a/mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/PropertyInfoTest.cs
@@ -31,7 +31,7 @@ using System;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Threading;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.IO;
@@ -355,7 +355,7 @@ namespace MonoTests.System.Reflection
get { return 99; }
}
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void ConstantValue () {
/*This test looks scary because we can't generate a default value with C# */
diff --git a/mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs b/mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs
index c1fc39a59c3..6c6cb45a406 100644
--- a/mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/TypeDelegatorTest.cs
@@ -28,7 +28,7 @@
using System;
using System.Threading;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
diff --git a/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs b/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs
index 3dcb3ae2480..fcf64a19300 100644
--- a/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs
+++ b/mcs/class/corlib/Test/System.Reflection/VisibilityTest.cs
@@ -24,7 +24,7 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System;
using System.Linq;
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTest.cs
index d6216f73dbe..42abe682ac8 100644
--- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTest.cs
@@ -38,7 +38,7 @@ namespace MonoTests.System.Runtime.CompilerServices
[TestFixture]
public class AsyncTaskMethodBuilderTest
{
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
// For some reason MT excludes CallContext handling
[Test]
diff --git a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
index 69ba983eeac..57b1d2c2764 100644
--- a/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.CompilerServices/TaskAwaiterTest.cs
@@ -248,6 +248,7 @@ namespace MonoTests.System.Runtime.CompilerServices
return res.Result;
}
+#if !MOBILE_STATIC
[Test]
public void FinishedTaskOnCompleted ()
{
@@ -272,6 +273,8 @@ namespace MonoTests.System.Runtime.CompilerServices
Assert.AreEqual (Thread.CurrentThread.IsBackground, mres2.WaitOne (2000), "#2");;
}
+#endif
+
[Test]
public void CompletionOnSameCustomSynchronizationContext ()
{
diff --git a/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs b/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
index 27c77f182c9..1c7cb95ad32 100644
--- a/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.InteropServices/GCHandleTest.cs
@@ -128,7 +128,7 @@ namespace MonoTests.System.Runtime.InteropServices
gch.Free ();
}
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[Category("MobileNotWorking")] // SIGSEGV, probably on AppDomain.Unload
public void WeakHandleWorksOnNonRootDomain ()
diff --git a/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs b/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs
index e15cb30a839..55e95b91231 100644
--- a/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs
+++ b/mcs/class/corlib/Test/System.Runtime.Serialization/SerializationTest.cs
@@ -43,7 +43,7 @@ namespace MonoTests.System.Runtime.Serialization
}
#endif
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void DelegateSerializationTest ()
{
diff --git a/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs b/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs
index 8d20e6f091e..e93744c0fd8 100644
--- a/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs
+++ b/mcs/class/corlib/Test/System.Security.Cryptography/AesCfbTest.cs
@@ -44,6 +44,7 @@ namespace MonoTests.System.Security.Cryptography {
[Test]
[Category ("AndroidNotWorking")] // Exception is thrown: CryptographicException : Bad PKCS7 padding. Invalid length 236.
+ [Category ("MobileNotWorking")] // On mobile_static, above exception is thrown as well
public void Roundtrip ()
{
// that will return a AesCryptoServiceProvider
@@ -283,4 +284,4 @@ namespace MonoTests.System.Security.Cryptography {
{ -2130705088, "23-28-F4-38-74-11-EA-D8-8A-E6-AB-F8-FD-8C-8B-19" },
};
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs b/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs
index aefa9ab4108..87b6d3e662f 100644
--- a/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs
+++ b/mcs/class/corlib/Test/System.Threading/ThreadLocalTests.cs
@@ -193,6 +193,7 @@ namespace MonoTests.System.Threading
}
[Test]
+ [Category ("NotWorking")] // Finalizers aren't guaranteed
public void DisposeOnThreadExit ()
{
var threadLocal = new ThreadLocal<SetMreOnFinalize>();
@@ -210,7 +211,7 @@ namespace MonoTests.System.Threading
}, 500);
if (!mres.IsSet)
- Assert.Fail ();
+ Assert.Fail ("Finalizer didn't run after thread termination");
}
}
}
diff --git a/mcs/class/corlib/Test/System/ActivatorTest.cs b/mcs/class/corlib/Test/System/ActivatorTest.cs
index a2bf6ab3d32..74661fd6f7e 100644
--- a/mcs/class/corlib/Test/System/ActivatorTest.cs
+++ b/mcs/class/corlib/Test/System/ActivatorTest.cs
@@ -13,7 +13,7 @@ using System;
using System.Globalization;
using System.IO;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -311,7 +311,7 @@ namespace MonoTests.System {
Assert.AreEqual (7, objCOMTest.Id, "#A05");
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[ExpectedException (typeof (MissingMethodException))]
public void CreateInstance_TypeBuilder ()
@@ -513,7 +513,7 @@ namespace MonoTests.System {
null, null);
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void CreateInstanceCustomDomain ()
{
diff --git a/mcs/class/corlib/Test/System/AttributeTest.cs b/mcs/class/corlib/Test/System/AttributeTest.cs
index 53a8af742b8..d609c188831 100644
--- a/mcs/class/corlib/Test/System/AttributeTest.cs
+++ b/mcs/class/corlib/Test/System/AttributeTest.cs
@@ -12,7 +12,7 @@
using System;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -846,7 +846,7 @@ namespace MonoTests.System
Assert.IsTrue (custom [2].GetType () == typeof (SerializableAttribute));
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void GetCustomAttributeOnNewSreTypes ()
{
diff --git a/mcs/class/corlib/Test/System/DelegateTest.cs b/mcs/class/corlib/Test/System/DelegateTest.cs
index 2458b9831a6..0d164f57272 100644
--- a/mcs/class/corlib/Test/System/DelegateTest.cs
+++ b/mcs/class/corlib/Test/System/DelegateTest.cs
@@ -5,7 +5,7 @@
using System;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Threading;
@@ -26,7 +26,7 @@ namespace MonoTests.System
[Test] //See bug #372406
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void CreateDelegate1_Method_Private_Instance ()
@@ -64,7 +64,7 @@ namespace MonoTests.System
}
[Test] // CreateDelegate (Type, MethodInfo)
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void CreateDelegate1_Method_Instance ()
@@ -925,7 +925,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void Virtual ()
@@ -956,7 +956,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #14163
#endif
public void NullTarget_Instance ()
@@ -1021,7 +1021,7 @@ namespace MonoTests.System
}
[Test] // #617161
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceStaticMethod ()
@@ -1045,7 +1045,7 @@ namespace MonoTests.System
}
[Test] // #475962
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")] // #10539
#endif
public void ClosedOverNullReferenceInstanceMethod ()
@@ -1079,7 +1079,7 @@ namespace MonoTests.System
delegate int ByRefDelegate (ref FooStruct s, int a, int b, int c, int d);
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[Category ("NotWorking")]
#endif
[Test]
@@ -1279,7 +1279,7 @@ namespace MonoTests.System
{
string retarg (string s);
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void CreateDelegateWithLdFtnAndAbstractMethod ()
{
@@ -1388,7 +1388,7 @@ namespace MonoTests.System
Assert.IsTrue (d (0, 0));
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
public static void DynInvokeWithClosedFirstArg (object a, object b)
{
}
diff --git a/mcs/class/corlib/Test/System/TimeZoneTest.cs b/mcs/class/corlib/Test/System/TimeZoneTest.cs
index 19e2cb5c49d..358298f91e5 100644
--- a/mcs/class/corlib/Test/System/TimeZoneTest.cs
+++ b/mcs/class/corlib/Test/System/TimeZoneTest.cs
@@ -349,12 +349,15 @@ public class TimeZoneTest {
// now it fails on Snow Leopard the same way (incomplete data) with iOS5 simulator (OS update ?)
// but it *never*ever* failed on devices
incomplete_data_on_simulator_only_bug = true;
+#if XAMCORE_2_0 || MONOTOUCH
+
#if XAMCORE_2_0
if (ObjCRuntime.Runtime.Arch == ObjCRuntime.Arch.SIMULATOR)
-#else
+#elif MONOTOUCH
if (MonoTouch.ObjCRuntime.Runtime.Arch == MonoTouch.ObjCRuntime.Arch.SIMULATOR)
#endif
Assert.Ignore ("known to fail on some iOS simulator versions - see source comments");
+#endif // XAMCORE_2_0 || MONOTOUCH
}
}
#endif
diff --git a/mcs/class/corlib/Test/System/TypeTest.cs b/mcs/class/corlib/Test/System/TypeTest.cs
index 19dbff4804c..4279cee8ec9 100644
--- a/mcs/class/corlib/Test/System/TypeTest.cs
+++ b/mcs/class/corlib/Test/System/TypeTest.cs
@@ -16,7 +16,7 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
using System.Reflection.Emit;
#endif
using System.Runtime.InteropServices;
@@ -261,7 +261,7 @@ namespace MonoTests.System
[TestFixture]
public class TypeTest
{
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
private ModuleBuilder module;
#endif
const string ASSEMBLY_NAME = "MonoTests.System.TypeTest";
@@ -272,7 +272,7 @@ namespace MonoTests.System
{
AssemblyName assemblyName = new AssemblyName ();
assemblyName.Name = ASSEMBLY_NAME;
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
var assembly = AppDomain.CurrentDomain.DefineDynamicAssembly (
assemblyName, AssemblyBuilderAccess.RunAndSave, Path.GetTempPath ());
module = assembly.DefineDynamicModule ("module1");
@@ -3091,7 +3091,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[ExpectedException (typeof (NotSupportedException))]
#endif
public void MakeGenericType_UserDefinedType ()
@@ -3108,7 +3108,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[ExpectedException (typeof (NotSupportedException))]
#endif
public void MakeGenericType_NestedUserDefinedType ()
@@ -3125,7 +3125,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[ExpectedException (typeof (NotSupportedException))]
#endif
public void TestMakeGenericType_UserDefinedType_DotNet20SP1 ()
@@ -3138,7 +3138,7 @@ namespace MonoTests.System
}
[Test]
-#if MONOTOUCH
+#if MONOTOUCH || MOBILE_STATIC
[ExpectedException (typeof (NotSupportedException))]
#endif
public void MakeGenericType_BadUserType ()
@@ -3274,7 +3274,7 @@ namespace MonoTests.System
Assert.AreEqual (t1, t2);
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void SpaceAfterComma () {
string strType = "System.Collections.Generic.Dictionary`2[[System.Int32,mscorlib], [System.String,mscorlib]],mscorlib";
@@ -3282,7 +3282,7 @@ namespace MonoTests.System
}
#endif
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
public void Bug506757 ()
{
@@ -4152,7 +4152,7 @@ namespace MonoTests.System
Assert.AreEqual (Type.GetType ("MonoTests.System.Foo`1[System.Int32"), null, "#15");
}
-#if !MONOTOUCH
+#if !MONOTOUCH && !MOBILE_STATIC
[Test]
[Category ("AndroidNotWorking")] // requires symbol writer
public void FullNameGetTypeParseEscapeRoundtrip () // bug #26384
diff --git a/mcs/class/corlib/corlib_test.dll.sources b/mcs/class/corlib/corlib_test.dll.sources
index 70454d6e5ec..b7cf0d04b3a 100644
--- a/mcs/class/corlib/corlib_test.dll.sources
+++ b/mcs/class/corlib/corlib_test.dll.sources
@@ -355,17 +355,17 @@ System.Security.Policy/ApplicationSecurityManagerTest.cs
System.Security.Policy/ApplicationTrustTest.cs
System.Security.Policy/CodeGroupTest.cs
System.Security.Policy/EvidenceTest.cs
-System.Security.Policy/FileCodeGroupTest.cs
+System.Security.Policy/FileCodeGroupTest.cs
System.Security.Policy/FirstMatchCodeGroupTest.cs
System.Security.Policy/GacMembershipConditionTest.cs
System.Security.Policy/GacTest.cs
System.Security.Policy/HashMembershipConditionTest.cs
System.Security.Policy/HashTest.cs
System.Security.Policy/IBuiltInEvidenceTest.cs
-System.Security.Policy/NetCodeGroupTest.cs
-System.Security.Policy/PermissionRequestEvidenceTest.cs
-System.Security.Policy/PolicyLevelTest.cs
-System.Security.Policy/PolicyStatementTest.cs
+System.Security.Policy/NetCodeGroupTest.cs
+System.Security.Policy/PermissionRequestEvidenceTest.cs
+System.Security.Policy/PolicyLevelTest.cs
+System.Security.Policy/PolicyStatementTest.cs
System.Security.Policy/PublisherMembershipConditionTest.cs
System.Security.Policy/PublisherTest.cs
System.Security.Policy/SiteMembershipConditionTest.cs
diff --git a/mcs/class/corlib/mobile_static_corlib_test.dll.excludes b/mcs/class/corlib/mobile_static_corlib_test.dll.excludes
new file mode 100644
index 00000000000..eb17a105b75
--- /dev/null
+++ b/mcs/class/corlib/mobile_static_corlib_test.dll.excludes
@@ -0,0 +1,131 @@
+Microsoft.Win32/RegistryKeyTest.cs
+System.Diagnostics.Contracts/ContractAssertTest.cs
+System.Diagnostics.Contracts/ContractAssumeTest.cs
+System.Diagnostics.Contracts/ContractCollectionMethodsTest.cs
+System.Diagnostics.Contracts/ContractHelperTest.cs
+System.Diagnostics.Contracts/ContractMarkerMethodsTest.cs
+System.Diagnostics.Contracts/ContractMustUseRewriterTest.cs
+System.Diagnostics.Contracts/Helpers/RunAgainstReferenceAttribute.cs
+System.Diagnostics.Contracts/Helpers/TestContractBase.cs
+System.Reflection.Emit/AssemblyBuilderAccessTest.cs
+System.Reflection.Emit/AssemblyBuilderTest.cs
+System.Reflection.Emit/ConstructorBuilderTest.cs
+System.Reflection.Emit/ConstructorOnTypeBuilderInstTest.cs
+System.Reflection.Emit/CustomAttributeBuilderTest.cs
+System.Reflection.Emit/DerivedTypesTest.cs
+System.Reflection.Emit/DynamicILInfoTest.cs
+System.Reflection.Emit/DynamicMethodTest.cs
+System.Reflection.Emit/EnumBuilderTest.cs
+System.Reflection.Emit/EventBuilderTest.cs
+System.Reflection.Emit/FieldBuilderTest.cs
+System.Reflection.Emit/GenericTypeParameterBuilderTest.cs
+System.Reflection.Emit/ILGeneratorTest.cs
+System.Reflection.Emit/MethodBuilderTest.cs
+System.Reflection.Emit/MethodBuilderTestIL.cs
+System.Reflection.Emit/MethodOnTypeBuilderInstTest.cs
+System.Reflection.Emit/MethodRentalCas.cs
+System.Reflection.Emit/MethodRentalTest.cs
+System.Reflection.Emit/ModuleBuilderTest.cs
+System.Reflection.Emit/ParameterBuilderTest.cs
+System.Reflection.Emit/PropertyBuilderTest.cs
+System.Reflection.Emit/SignatureHelperTest.cs
+System.Reflection.Emit/TypeBuilderTest.cs
+System.Runtime.Remoting/ContextTest.cs
+System.Runtime.Remoting/RemotingConfigurationTest.cs
+System.Runtime.Remoting/RemotingServicesTest.cs
+System.Runtime.Remoting/SoapServicesTest.cs
+System.Runtime.Remoting/SynchronizationAttributeTest.cs
+System.Runtime.Remoting.Channels/ChannelServicesTest.cs
+System.Runtime.Remoting.Contexts/SynchronizationAttributeTest.cs
+System.Runtime.Remoting.Messaging/CallContextTest.cs
+System.Runtime.Remoting.Metadata.W3cXsd2001/SoapHexBinaryTest.cs
+System.Security.AccessControl/AuthorizationRuleTest.cs
+System.Security.AccessControl/CommonAceTest.cs
+System.Security.AccessControl/CommonAclTest.cs
+System.Security.AccessControl/CommonObjectSecurityTest.cs
+System.Security.AccessControl/CommonSecurityDescriptorTest.cs
+System.Security.AccessControl/CryptoKeyAccessRuleTest.cs
+System.Security.AccessControl/DirectoryObjectSecurityTest.cs
+System.Security.AccessControl/DirectorySecurityTest.cs
+System.Security.AccessControl/DiscretionaryAclTest.cs
+System.Security.AccessControl/EventWaitHandleSecurityTest.cs
+System.Security.AccessControl/FileSecurityTest.cs
+System.Security.AccessControl/MutexAccessRuleTest.cs
+System.Security.AccessControl/MutexSecurityTest.cs
+System.Security.AccessControl/ObjectAceTest.cs
+System.Security.AccessControl/ObjectSecurity_TTest.cs
+System.Security.AccessControl/ObjectSecurityTest.cs
+System.Security.AccessControl/RawAclTest.cs
+System.Security.AccessControl/RawSecurityDescriptorTest.cs
+System.Security.AccessControl/RegistrySecurityTest.cs
+System.Security.AccessControl/SystemAclTest.cs
+System.Security.Permissions/CodeAccessSecurityAttributeTest.cs
+System.Security.Permissions/EnvironmentPermissionAttributeTest.cs
+System.Security.Permissions/EnvironmentPermissionTest.cs
+System.Security.Permissions/FileDialogPermissionAttributeTest.cs
+System.Security.Permissions/FileDialogPermissionTest.cs
+System.Security.Permissions/FileIOPermissionAttributeTest.cs
+System.Security.Permissions/FileIOPermissionTest.cs
+System.Security.Permissions/GacIdentityPermissionAttributeTest.cs
+System.Security.Permissions/GacIdentityPermissionTest.cs
+System.Security.Permissions/HostProtectionAttributeTest.cs
+System.Security.Permissions/IBuiltInPermissionTest.cs
+System.Security.Permissions/IsolatedStorageFilePermissionAttributeTest.cs
+System.Security.Permissions/IsolatedStorageFilePermissionTest.cs
+System.Security.Permissions/IsolatedStoragePermissionAttributeTest.cs
+System.Security.Permissions/KeyContainerPermissionAttributeTest.cs
+System.Security.Permissions/PermissionSetAttributeTest.cs
+System.Security.Permissions/PrincipalPermissionAttributeTest.cs
+System.Security.Permissions/PrincipalPermissionTest.cs
+System.Security.Permissions/PublisherIdentityPermissionAttributeTest.cs
+System.Security.Permissions/PublisherIdentityPermissionTest.cs
+System.Security.Permissions/ReflectionPermissionAttributeTest.cs
+System.Security.Permissions/ReflectionPermissionTest.cs
+System.Security.Permissions/RegistryPermissionAttributeTest.cs
+System.Security.Permissions/RegistryPermissionTest.cs
+System.Security.Permissions/SecurityAttributeTest.cs
+System.Security.Permissions/SecurityPermissionAttributeTest.cs
+System.Security.Permissions/SecurityPermissionTest.cs
+System.Security.Permissions/SiteIdentityPermissionAttributeTest.cs
+System.Security.Permissions/SiteIdentityPermissionTest.cs
+System.Security.Permissions/StrongNameIdentityPermissionAttributeTest.cs
+System.Security.Permissions/StrongNameIdentityPermissionTest.cs
+System.Security.Permissions/StrongNamePublicKeyBlobTest.cs
+System.Security.Permissions/UIPermissionAttributeTest.cs
+System.Security.Permissions/UIPermissionTest.cs
+System.Security.Permissions/UrlIdentityPermissionAttributeTest.cs
+System.Security.Permissions/UrlIdentityPermissionTest.cs
+System.Security.Permissions/ZoneIdentityPermissionAttributeTest.cs
+System.Security.Permissions/ZoneIdentityPermissionTest.cs
+System.Security.Policy/AllMembershipConditionTest.cs
+System.Security.Policy/ApplicationDirectoryMembershipConditionTest.cs
+System.Security.Policy/ApplicationDirectoryTest.cs
+System.Security.Policy/ApplicationMembershipConditionTest.cs
+System.Security.Policy/ApplicationSecurityManagerCas.cs
+System.Security.Policy/ApplicationSecurityManagerTest.cs
+System.Security.Policy/ApplicationTrustTest.cs
+System.Security.Policy/CodeGroupTest.cs
+System.Security.Policy/DomainApplicationMembershipConditionTest.cs
+System.Security.Policy/EvidenceTest.cs
+System.Security.Policy/FileCodeGroupTest.cs
+System.Security.Policy/FirstMatchCodeGroupTest.cs
+System.Security.Policy/GacMembershipConditionTest.cs
+System.Security.Policy/GacTest.cs
+System.Security.Policy/HashMembershipConditionTest.cs
+System.Security.Policy/HashTest.cs
+System.Security.Policy/IBuiltInEvidenceTest.cs
+System.Security.Policy/NetCodeGroupTest.cs
+System.Security.Policy/PermissionRequestEvidenceTest.cs
+System.Security.Policy/PolicyLevelTest.cs
+System.Security.Policy/PolicyStatementTest.cs
+System.Security.Policy/PublisherMembershipConditionTest.cs
+System.Security.Policy/PublisherTest.cs
+System.Security.Policy/SiteMembershipConditionTest.cs
+System.Security.Policy/SiteTest.cs
+System.Security.Policy/StrongNameMembershipConditionTest.cs
+System.Security.Policy/StrongNameTest.cs
+System.Security.Policy/UnionCodeGroupTest.cs
+System.Security.Policy/UrlMembershipConditionTest.cs
+System.Security.Policy/UrlTest.cs
+System.Security.Policy/ZoneMembershipConditionTest.cs
+System.Security.Policy/ZoneTest.cs
diff --git a/mcs/class/corlib/mobile_static_corlib_test.dll.sources b/mcs/class/corlib/mobile_static_corlib_test.dll.sources
new file mode 100644
index 00000000000..011effe162c
--- /dev/null
+++ b/mcs/class/corlib/mobile_static_corlib_test.dll.sources
@@ -0,0 +1 @@
+#include corlib_test.dll.sources
diff --git a/mcs/class/reference-assemblies/Makefile b/mcs/class/reference-assemblies/Makefile
index e4b660ba5df..20ff20005ca 100644
--- a/mcs/class/reference-assemblies/Makefile
+++ b/mcs/class/reference-assemblies/Makefile
@@ -4,16 +4,18 @@ include ../../build/rules.make
all-local:
-PROFILE_DIR=$(DESTDIR)$(mono_libdir)/mono/
+PROFILE_DIR=$(DESTDIR)$(mono_libdir)/mono
install-local:
- $(MKINSTALLDIRS) $(PROFILE_DIR)/2.0
- $(MKINSTALLDIRS) $(PROFILE_DIR)/3.5
- $(MKINSTALLDIRS) $(PROFILE_DIR)/4.0
- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/* $(PROFILE_DIR)/2.0
- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/* $(PROFILE_DIR)/3.5
- $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.0/* $(PROFILE_DIR)/4.0
+ $(MKINSTALLDIRS) $(PROFILE_DIR)/2.0-api
+ $(MKINSTALLDIRS) $(PROFILE_DIR)/3.5-api
+ $(MKINSTALLDIRS) $(PROFILE_DIR)/4.0-api
+ $(MKINSTALLDIRS) $(PROFILE_DIR)/4.5-api
+ $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v2.0/* $(PROFILE_DIR)/2.0-api
+ $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v3.5/* $(PROFILE_DIR)/3.5-api
+ $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.0/* $(PROFILE_DIR)/4.0-api
+ $(INSTALL_LIB) ../../../external/binary-reference-assemblies/v4.5/* $(PROFILE_DIR)/4.5-api
-DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.0/*) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*) Makefile
+DISTFILES = $(wildcard ../../../external/binary-reference-assemblies/v4.5/*) $(wildcard ../../../external/binary-reference-assemblies/v4.0/*) $(wildcard ../../../external/binary-reference-assemblies/v3.5/*) $(wildcard ../../../external/binary-reference-assemblies/v2.0/*) Makefile
dist-local: dist-default
diff --git a/mcs/mcs/dynamic.cs b/mcs/mcs/dynamic.cs
index 3b2a5b4b18d..09d78302854 100644
--- a/mcs/mcs/dynamic.cs
+++ b/mcs/mcs/dynamic.cs
@@ -13,6 +13,11 @@ using System;
using System.Linq;
using SLE = System.Linq.Expressions;
using System.Dynamic;
+#if STATIC
+using IKVM.Reflection.Emit;
+#else
+using System.Reflection.Emit;
+#endif
namespace Mono.CSharp
{
@@ -314,6 +319,50 @@ namespace Mono.CSharp
EmitCall (ec, binder_expr, arguments, true);
}
+ protected void EmitConditionalAccess (EmitContext ec)
+ {
+ var a_expr = arguments [0].Expr;
+
+ var des = a_expr as DynamicExpressionStatement;
+ if (des != null) {
+ des.EmitConditionalAccess (ec);
+ }
+
+ if (HasConditionalAccess ()) {
+ var NullOperatorLabel = ec.DefineLabel ();
+
+ if (ExpressionAnalyzer.IsInexpensiveLoad (a_expr)) {
+ a_expr.Emit (ec);
+ } else {
+ var lt = new LocalTemporary (a_expr.Type);
+ lt.EmitAssign (ec, a_expr, true, false);
+
+ Arguments [0].Expr = lt;
+ }
+
+ ec.Emit (OpCodes.Brtrue_S, NullOperatorLabel);
+
+ if (!ec.ConditionalAccess.Statement) {
+ if (ec.ConditionalAccess.Type.IsNullableType)
+ Nullable.LiftedNull.Create (ec.ConditionalAccess.Type, Location.Null).Emit (ec);
+ else
+ ec.EmitNull ();
+ }
+
+ ec.Emit (OpCodes.Br, ec.ConditionalAccess.EndLabel);
+ ec.MarkLabel (NullOperatorLabel);
+
+ return;
+ }
+
+ if (a_expr.HasConditionalAccess ()) {
+ var lt = new LocalTemporary (a_expr.Type);
+ lt.EmitAssign (ec, a_expr, false, false);
+
+ Arguments [0].Expr = lt;
+ }
+ }
+
protected void EmitCall (EmitContext ec, Expression binder, Arguments arguments, bool isStatement)
{
//
@@ -502,6 +551,24 @@ namespace Mono.CSharp
StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (instanceAccessExprType, "Create"), args)));
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
+
+ var conditionalAccessReceiver = IsConditionalAccessReceiver;
+ var ca = ec.ConditionalAccess;
+
+ if (conditionalAccessReceiver) {
+ ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ()) {
+ Statement = isStatement
+ };
+
+ //
+ // Emit conditional access expressions before dynamic call
+ // is initialized. It pushes site_field_expr on stack before
+ // the actual instance argument is emited which would cause
+ // jump from non-empty stack.
+ //
+ EmitConditionalAccess (ec);
+ }
+
if (s.Resolve (bc)) {
Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc)), s, loc);
init.Emit (ec);
@@ -526,9 +593,15 @@ namespace Mono.CSharp
}
}
- Expression target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
- if (target != null)
+ var target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, false, loc).Resolve (bc);
+ if (target != null) {
target.Emit (ec);
+ }
+
+ if (conditionalAccessReceiver) {
+ ec.CloseConditionalAccess (!isStatement && type.IsNullableType ? type : null);
+ ec.ConditionalAccess = ca;
+ }
}
}
@@ -547,6 +620,12 @@ namespace Mono.CSharp
{
return new MemberAccess (new TypeExpression (binder_type, loc), name, loc);
}
+
+ protected virtual bool IsConditionalAccessReceiver {
+ get {
+ return false;
+ }
+ }
}
//
@@ -671,14 +750,18 @@ namespace Mono.CSharp
class DynamicIndexBinder : DynamicMemberAssignable
{
bool can_be_mutator;
+ readonly bool conditional_access_receiver;
+ readonly bool conditional_access;
- public DynamicIndexBinder (Arguments args, Location loc)
+ public DynamicIndexBinder (Arguments args, bool conditionalAccessReceiver, bool conditionalAccess, Location loc)
: base (args, loc)
{
+ this.conditional_access_receiver = conditionalAccessReceiver;
+ this.conditional_access = conditionalAccess;
}
public DynamicIndexBinder (CSharpBinderFlags flags, Arguments args, Location loc)
- : this (args, loc)
+ : this (args, false, false, loc)
{
base.flags = flags;
}
@@ -732,22 +815,35 @@ namespace Mono.CSharp
setter_args.Add (new Argument (rhs));
return setter_args;
}
+
+ protected override bool IsConditionalAccessReceiver {
+ get {
+ return conditional_access_receiver;
+ }
+ }
+
+ public override bool HasConditionalAccess ()
+ {
+ return conditional_access;
+ }
}
class DynamicInvocation : DynamicExpressionStatement, IDynamicBinder
{
readonly ATypeNameExpression member;
+ readonly bool conditional_access_receiver;
- public DynamicInvocation (ATypeNameExpression member, Arguments args, Location loc)
+ public DynamicInvocation (ATypeNameExpression member, Arguments args, bool conditionalAccessReceiver, Location loc)
: base (null, args, loc)
{
base.binder = this;
this.member = member;
+ this.conditional_access_receiver = conditionalAccessReceiver;
}
public static DynamicInvocation CreateSpecialNameInvoke (ATypeNameExpression member, Arguments args, Location loc)
{
- return new DynamicInvocation (member, args, loc) {
+ return new DynamicInvocation (member, args, false, loc) {
flags = CSharpBinderFlags.InvokeSpecialName
};
}
@@ -805,11 +901,36 @@ namespace Mono.CSharp
flags |= CSharpBinderFlags.ResultDiscarded;
base.EmitStatement (ec);
}
+
+ protected override bool IsConditionalAccessReceiver {
+ get {
+ return conditional_access_receiver;
+ }
+ }
+
+ public override bool HasConditionalAccess ()
+ {
+ return member is ConditionalMemberAccess;
+ }
+ }
+
+ class DynamicConditionalMemberBinder : DynamicMemberBinder
+ {
+ public DynamicConditionalMemberBinder (string name, Arguments args, Location loc)
+ : base (name, args, loc)
+ {
+ }
+
+ public override bool HasConditionalAccess ()
+ {
+ return true;
+ }
}
class DynamicMemberBinder : DynamicMemberAssignable
{
readonly string name;
+ bool conditionalAccessReceiver;
public DynamicMemberBinder (string name, Arguments args, Location loc)
: base (args, loc)
@@ -835,6 +956,20 @@ namespace Mono.CSharp
isSet |= (flags & CSharpBinderFlags.ValueFromCompoundAssignment) != 0;
return new Invocation (GetBinder (isSet ? "SetMember" : "GetMember", loc), binder_args);
}
+
+ protected override Expression DoResolve (ResolveContext rc)
+ {
+ if (!rc.HasSet (ResolveContext.Options.DontSetConditionalAccessReceiver))
+ conditionalAccessReceiver = HasConditionalAccess () || Arguments [0].Expr.HasConditionalAccess ();
+
+ return base.DoResolve (rc);
+ }
+
+ protected override bool IsConditionalAccessReceiver {
+ get {
+ return conditionalAccessReceiver;
+ }
+ }
}
//
diff --git a/mcs/mcs/ecore.cs b/mcs/mcs/ecore.cs
index b74da01e65c..52da19a1b97 100644
--- a/mcs/mcs/ecore.cs
+++ b/mcs/mcs/ecore.cs
@@ -6537,6 +6537,8 @@ namespace Mono.CSharp {
ec.Emit (OpCodes.Ldsfld, spec);
} else {
+ var ca = ec.ConditionalAccess;
+
if (!prepared) {
if (conditional_access_receiver)
ec.ConditionalAccess = new ConditionalAccessContext (type, ec.DefineLabel ());
@@ -6562,6 +6564,7 @@ namespace Mono.CSharp {
if (conditional_access_receiver) {
ec.CloseConditionalAccess (type.IsNullableType && type != spec.MemberType ? type : null);
+ ec.ConditionalAccess = ca;
}
}
diff --git a/mcs/mcs/expression.cs b/mcs/mcs/expression.cs
index 5a21804888e..c5139d57f67 100644
--- a/mcs/mcs/expression.cs
+++ b/mcs/mcs/expression.cs
@@ -110,8 +110,9 @@ namespace Mono.CSharp
protected override Expression DoResolve (ResolveContext rc)
{
Expression res = null;
-
- res = expr.Resolve (rc);
+ using (rc.With (ResolveContext.Options.DontSetConditionalAccessReceiver, false)) {
+ res = expr.Resolve (rc);
+ }
var constant = res as Constant;
if (constant != null && constant.IsLiteral) {
@@ -7180,7 +7181,7 @@ namespace Mono.CSharp
}
}
- return new DynamicInvocation (expr as ATypeNameExpression, args, loc).Resolve (ec);
+ return new DynamicInvocation (expr as ATypeNameExpression, args, conditional_access_receiver, loc).Resolve (ec);
}
protected virtual MethodGroupExpr DoResolveOverload (ResolveContext ec)
@@ -9718,6 +9719,8 @@ namespace Mono.CSharp
return retval;
}
+ var cma = this as ConditionalMemberAccess;
+
MemberExpr me;
TypeSpec expr_type = expr.Type;
if (expr_type.BuiltinType == BuiltinTypeSpec.Type.Dynamic) {
@@ -9727,10 +9730,13 @@ namespace Mono.CSharp
Arguments args = new Arguments (1);
args.Add (new Argument (expr));
+
+ if (cma != null)
+ return new DynamicConditionalMemberBinder (Name, args, loc);
+
return new DynamicMemberBinder (Name, args, loc);
}
- var cma = this as ConditionalMemberAccess;
if (cma != null) {
if (!IsNullPropagatingValid (expr.Type)) {
expr.Error_OperatorCannotBeApplied (rc, loc, "?", expr.Type);
@@ -10861,7 +10867,7 @@ namespace Mono.CSharp
args.AddRange (arguments);
best_candidate = null;
- return new DynamicIndexBinder (args, loc);
+ return new DynamicIndexBinder (args, conditional_access_receiver, ConditionalAccess, loc);
}
//
@@ -11669,7 +11675,6 @@ namespace Mono.CSharp
args.Add (new Argument (rc.CurrentInitializerVariable));
target = new DynamicMemberBinder (Name, args, loc);
} else {
-
var member = MemberLookup (rc, false, t, Name, 0, MemberLookupRestrictions.ExactArity, loc);
if (member == null) {
member = Expression.MemberLookup (rc, true, t, Name, 0, MemberLookupRestrictions.ExactArity, loc);
diff --git a/mcs/tests/dtest-null-operator-01.cs b/mcs/tests/dtest-null-operator-01.cs
new file mode 100644
index 00000000000..de6013ca044
--- /dev/null
+++ b/mcs/tests/dtest-null-operator-01.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+
+class X
+{
+ public string Prop;
+ public A A = new A ();
+}
+
+class A
+{
+ public string B;
+}
+
+class MainClass
+{
+ static void NullCheckTest ()
+ {
+ dynamic dyn = null;
+ dynamic res;
+
+ res = dyn?.ToString ();
+ res = dyn?.GetHashCode ();
+ res = dyn?.DD.Length?.GetHashCode ();
+
+ dyn?.ToString ();
+
+ res = dyn?.Prop;
+ res = dyn?.Prop?.Prop2;
+ res = dyn?[0];
+ }
+
+ static void Test_1 ()
+ {
+ dynamic dyn = new X ();
+ dynamic res;
+
+ res = dyn.Prop?.Length;
+ res = dyn.A.B?.C.D?.E.F;
+ }
+
+ static dynamic Test_2 (IEnumerable<dynamic> collection)
+ {
+ return collection?.FirstOrDefault ().Length;
+ }
+
+ public static void Main ()
+ {
+ NullCheckTest ();
+
+ Test_1 ();
+ Test_2 (null);
+ }
+}
+
+ \ No newline at end of file
diff --git a/mcs/tests/test-null-operator-23.cs b/mcs/tests/test-null-operator-23.cs
new file mode 100644
index 00000000000..558328a6ebf
--- /dev/null
+++ b/mcs/tests/test-null-operator-23.cs
@@ -0,0 +1,20 @@
+using System;
+
+public class X
+{
+ string field;
+
+ public static int Main ()
+ {
+ X x = null;
+
+ try {
+ var res = (x?.field).ToString()?.Length;
+ return 1;
+ } catch (NullReferenceException) {
+
+ }
+
+ return 0;
+ }
+} \ No newline at end of file
diff --git a/mcs/tests/ver-il-net_4_x.xml b/mcs/tests/ver-il-net_4_x.xml
index 7cda6f85b7d..dcd5f610003 100644
--- a/mcs/tests/ver-il-net_4_x.xml
+++ b/mcs/tests/ver-il-net_4_x.xml
@@ -3468,6 +3468,35 @@
</method>
</type>
</test>
+ <test name="dtest-null-operator-01.cs">
+ <type name="X">
+ <method name="Void .ctor()" attrs="6278">
+ <size>18</size>
+ </method>
+ </type>
+ <type name="A">
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="MainClass">
+ <method name="Void NullCheckTest()" attrs="145">
+ <size>890</size>
+ </method>
+ <method name="Void Test_1()" attrs="145">
+ <size>672</size>
+ </method>
+ <method name="System.Object Test_2(System.Collections.Generic.IEnumerable`1[System.Object])" attrs="145">
+ <size>103</size>
+ </method>
+ <method name="Void Main()" attrs="150">
+ <size>19</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="dtest-optional-01.cs">
<type name="G`1[T]">
<method name="System.Object M1(T)" attrs="134">
@@ -69704,6 +69733,16 @@
</method>
</type>
</test>
+ <test name="test-null-operator-23.cs">
+ <type name="X">
+ <method name="Int32 Main()" attrs="150">
+ <size>77</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="test-partial-01.cs">
<type name="Foo.Hello">
<method name="Void .ctor()" attrs="6278">
diff --git a/mcs/tools/corcompare/Util.cs b/mcs/tools/corcompare/Util.cs
index 782280535dd..fa643ed20f8 100644
--- a/mcs/tools/corcompare/Util.cs
+++ b/mcs/tools/corcompare/Util.cs
@@ -83,5 +83,112 @@ namespace CorCompare {
{
return att.AttributeType.Resolve ();
}
+
+ static bool IsOverride (MethodDefinition method)
+ {
+ return method.IsVirtual && !method.IsNewSlot;
+ }
+
+ public static MethodDefinition GetBaseMethodInTypeHierarchy (MethodDefinition method)
+ {
+ if (!IsOverride (method))
+ return method;
+
+ var @base = GetBaseType (method.DeclaringType);
+ while (@base != null) {
+ MethodDefinition base_method = TryMatchMethod (@base.Resolve (), method);
+ if (base_method != null)
+ return GetBaseMethodInTypeHierarchy (base_method) ?? base_method;
+
+ @base = GetBaseType (@base);
+ }
+
+ return method;
+ }
+
+ static MethodDefinition TryMatchMethod (TypeDefinition type, MethodDefinition method)
+ {
+ if (!type.HasMethods)
+ return null;
+
+ foreach (MethodDefinition candidate in type.Methods)
+ if (MethodMatch (candidate, method))
+ return candidate;
+
+ return null;
+ }
+
+ static bool MethodMatch (MethodDefinition candidate, MethodDefinition method)
+ {
+ if (!candidate.IsVirtual)
+ return false;
+
+ if (candidate.Name != method.Name)
+ return false;
+
+ if (!TypeMatch (candidate.ReturnType, method.ReturnType))
+ return false;
+
+ if (candidate.Parameters.Count != method.Parameters.Count)
+ return false;
+
+ for (int i = 0; i < candidate.Parameters.Count; i++)
+ if (!TypeMatch (candidate.Parameters [i].ParameterType, method.Parameters [i].ParameterType))
+ return false;
+
+ return true;
+ }
+
+ public static bool TypeMatch (IModifierType a, IModifierType b)
+ {
+ if (!TypeMatch (a.ModifierType, b.ModifierType))
+ return false;
+
+ return TypeMatch (a.ElementType, b.ElementType);
+ }
+
+ public static bool TypeMatch (TypeSpecification a, TypeSpecification b)
+ {
+ if (a is GenericInstanceType)
+ return TypeMatch ((GenericInstanceType) a, (GenericInstanceType) b);
+
+ if (a is IModifierType)
+ return TypeMatch ((IModifierType) a, (IModifierType) b);
+
+ return TypeMatch (a.ElementType, b.ElementType);
+ }
+
+ public static bool TypeMatch (GenericInstanceType a, GenericInstanceType b)
+ {
+ if (!TypeMatch (a.ElementType, b.ElementType))
+ return false;
+
+ if (a.GenericArguments.Count != b.GenericArguments.Count)
+ return false;
+
+ if (a.GenericArguments.Count == 0)
+ return true;
+
+ for (int i = 0; i < a.GenericArguments.Count; i++)
+ if (!TypeMatch (a.GenericArguments [i], b.GenericArguments [i]))
+ return false;
+
+ return true;
+ }
+
+ public static bool TypeMatch (TypeReference a, TypeReference b)
+ {
+ if (a is GenericParameter)
+ return true;
+
+ if (a is TypeSpecification || b is TypeSpecification) {
+ if (a.GetType () != b.GetType ())
+ return false;
+
+ return TypeMatch ((TypeSpecification) a, (TypeSpecification) b);
+ }
+
+ return a.FullName == b.FullName;
+ }
}
}
diff --git a/mcs/tools/corcompare/WellFormedXmlWriter.cs b/mcs/tools/corcompare/WellFormedXmlWriter.cs
index 334c57fab33..8f663c657c1 100644
--- a/mcs/tools/corcompare/WellFormedXmlWriter.cs
+++ b/mcs/tools/corcompare/WellFormedXmlWriter.cs
@@ -15,11 +15,6 @@ namespace CorCompare {
public class WellFormedXmlWriter : DefaultXmlWriter
{
- public static bool IsValid (int ch)
- {
- return !IsInvalid (ch);
- }
-
public static bool IsInvalid (int ch)
{
switch (ch) {
diff --git a/mcs/tools/corcompare/mono-api-html/ApiChange.cs b/mcs/tools/corcompare/mono-api-html/ApiChange.cs
index 72e905b8c58..1d902cacfad 100644
--- a/mcs/tools/corcompare/mono-api-html/ApiChange.cs
+++ b/mcs/tools/corcompare/mono-api-html/ApiChange.cs
@@ -21,15 +21,9 @@ namespace Xamarin.ApiDiff
public ApiChange AppendAdded (string text, bool breaking = false)
{
- if (breaking)
- Member.Append ("<span style='text-decoration: underline'>");
- if (State.Colorize)
- Member.Append ("<span style='color:green'>");
+ Member.Append ("<span class='added ").Append (breaking ? "added-breaking-inline" : string.Empty).Append ("'>");
Member.Append (text);
- if (State.Colorize)
- Member.Append ("</span>");
- if (breaking)
- Member.Append ("</span>");
+ Member.Append ("</span>");
Breaking |= breaking;
AnyChange = true;
return this;
@@ -37,12 +31,8 @@ namespace Xamarin.ApiDiff
public ApiChange AppendRemoved (string text, bool breaking = true)
{
- Member.Append ("<span style='text-decoration: line-through'>");
- if (State.Colorize && breaking)
- Member.Append ("<span style='color:red'>");
+ Member.Append ("<span class='removed removed-inline ").Append (breaking ? "removed-breaking-inline" : string.Empty).Append ("'>");
Member.Append (text);
- if (State.Colorize && breaking)
- Member.Append ("</span>");
Member.Append ("</span>");
Breaking |= breaking;
AnyChange = true;
diff --git a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs b/mcs/tools/corcompare/mono-api-html/ApiDiff.cs
index 69454e1184c..8fe27844852 100644
--- a/mcs/tools/corcompare/mono-api-html/ApiDiff.cs
+++ b/mcs/tools/corcompare/mono-api-html/ApiDiff.cs
@@ -168,12 +168,98 @@ namespace Xamarin.ApiDiff {
}
if (diffHtml.Length > 0) {
using (var file = new StreamWriter (diff)) {
+ file.WriteLine ("<div>");
+ if (State.Colorize) {
+ file.WriteLine ("<style scoped>");
+ file.WriteLine ("\t.obsolete { color: gray; }");
+ file.WriteLine ("\t.added { color: green; }");
+ file.WriteLine ("\t.removed-inline { text-decoration: line-through; }");
+ file.WriteLine ("\t.removed-breaking-inline { color: red;}");
+ file.WriteLine ("\t.added-breaking-inline { text-decoration: underline; }");
+ file.WriteLine ("\t.nonbreaking { color: black; }");
+ file.WriteLine ("\t.breaking { color: red; }");
+ file.WriteLine ("</style>");
+ }
+ file.WriteLine (
+@"<script type=""text/javascript"">
+ // Only some elements have 'data-is-[non-]breaking' attributes. Here we
+ // iterate over all descendents elements, and set 'data-is-[non-]breaking'
+ // depending on whether there are any descendents with that attribute.
+ function propagateDataAttribute (element)
+ {
+ if (element.hasAttribute ('data-is-propagated'))
+ return;
+
+ var i;
+ var any_breaking = element.hasAttribute ('data-is-breaking');
+ var any_non_breaking = element.hasAttribute ('data-is-non-breaking');
+ for (i = 0; i < element.children.length; i++) {
+ var el = element.children [i];
+ propagateDataAttribute (el);
+ any_breaking |= el.hasAttribute ('data-is-breaking');
+ any_non_breaking |= el.hasAttribute ('data-is-non-breaking');
+ }
+
+ if (any_breaking)
+ element.setAttribute ('data-is-breaking', null);
+ else if (any_non_breaking)
+ element.setAttribute ('data-is-non-breaking', null);
+ element.setAttribute ('data-is-propagated', null);
+ }
+
+ function hideNonBreakingChanges ()
+ {
+ var topNodes = document.querySelectorAll ('[data-is-topmost]');
+ var n;
+ var i;
+ for (n = 0; n < topNodes.length; n++) {
+ propagateDataAttribute (topNodes [n]);
+ var elements = topNodes [n].querySelectorAll ('[data-is-non-breaking]');
+ for (i = 0; i < elements.length; i++) {
+ var el = elements [i];
+ if (!el.hasAttribute ('data-original-display'))
+ el.setAttribute ('data-original-display', el.style.display);
+ el.style.display = 'none';
+ }
+ }
+
+ var links = document.getElementsByClassName ('hide-nonbreaking');
+ for (i = 0; i < links.length; i++)
+ links [i].style.display = 'none';
+ links = document.getElementsByClassName ('restore-nonbreaking');
+ for (i = 0; i < links.length; i++)
+ links [i].style.display = '';
+ }
+
+ function showNonBreakingChanges ()
+ {
+ var elements = document.querySelectorAll ('[data-original-display]');
+ var i;
+ for (i = 0; i < elements.length; i++) {
+ var el = elements [i];
+ el.style.display = el.getAttribute ('data-original-display');
+ }
+
+ var links = document.getElementsByClassName ('hide-nonbreaking');
+ for (i = 0; i < links.length; i++)
+ links [i].style.display = '';
+ links = document.getElementsByClassName ('restore-nonbreaking');
+ for (i = 0; i < links.length; i++)
+ links [i].style.display = 'none';
+ }
+</script>");
if (ac.SourceAssembly == ac.TargetAssembly) {
file.WriteLine ("<h1>{0}.dll</h1>", ac.SourceAssembly);
} else {
file.WriteLine ("<h1>{0}.dll vs {1}.dll</h1>", ac.SourceAssembly, ac.TargetAssembly);
}
+ file.WriteLine ("<a href='javascript: hideNonBreakingChanges (); ' class='hide-nonbreaking'>Hide non-breaking changes</a>");
+ file.WriteLine ("<a href='javascript: showNonBreakingChanges (); ' class='restore-nonbreaking' style='display: none;'>Show non-breaking changes</a>");
+ file.WriteLine ("<br/>");
+ file.WriteLine ("<div data-is-topmost>");
file.Write (diffHtml);
+ file.WriteLine ("</div> <!-- end topmost div -->");
+ file.WriteLine ("</div>");
}
}
} else {
diff --git a/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs b/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs
index ff5326d9c8b..adbd862eb92 100644
--- a/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/AssemblyComparer.cs
@@ -57,7 +57,7 @@ namespace Xamarin.ApiDiff {
State.Assembly = current.GetAttribute ("name");
}
- public override void Added (XElement target)
+ public override void Added (XElement target, bool wasParentAdded)
{
// one assembly per xml file
}
diff --git a/mcs/tools/corcompare/mono-api-html/ClassComparer.cs b/mcs/tools/corcompare/mono-api-html/ClassComparer.cs
index 761f87a5552..a3399fbef04 100644
--- a/mcs/tools/corcompare/mono-api-html/ClassComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/ClassComparer.cs
@@ -67,16 +67,18 @@ namespace Xamarin.ApiDiff {
Compare (s.Elements ("class"), t.Elements ("class"));
}
- public override void Added (XElement target)
+ public override void Added (XElement target, bool wasParentAdded)
{
string name = target.Attribute ("name").Value;
if (State.IgnoreNew.Any (re => re.IsMatch (name)))
return;
+ Output.WriteLine ("<div> <!-- start type {0} -->", name);
Output.WriteLine ("<h3>New Type {0}.{1}</h3>", State.Namespace, name);
- Output.WriteLine (State.Colorize ? "<pre style='color: green'>" : "<pre>");
+ Output.WriteLine ("<pre class='added' data-is-non-breaking>");
State.Indent = 0;
AddedInner (target);
Output.WriteLine ("</pre>");
+ Output.WriteLine ("</div> <!-- end type {0} -->", name);
}
public void AddedInner (XElement target)
@@ -149,7 +151,7 @@ namespace Xamarin.ApiDiff {
if (t != null) {
Indent ().WriteLine ("\t// constructors");
foreach (var ctor in t.Elements ("constructor"))
- ccomparer.Added (ctor);
+ ccomparer.Added (ctor, true);
}
t = target.Element ("fields");
@@ -159,28 +161,28 @@ namespace Xamarin.ApiDiff {
else
SetContext (target);
foreach (var field in t.Elements ("field"))
- fcomparer.Added (field);
+ fcomparer.Added (field, true);
}
t = target.Element ("properties");
if (t != null) {
Indent ().WriteLine ("\t// properties");
foreach (var property in t.Elements ("property"))
- pcomparer.Added (property);
+ pcomparer.Added (property, true);
}
t = target.Element ("events");
if (t != null) {
Indent ().WriteLine ("\t// events");
foreach (var evnt in t.Elements ("event"))
- ecomparer.Added (evnt);
+ ecomparer.Added (evnt, true);
}
t = target.Element ("methods");
if (t != null) {
Indent ().WriteLine ("\t// methods");
foreach (var method in t.Elements ("method"))
- mcomparer.Added (method);
+ mcomparer.Added (method, true);
}
t = target.Element ("classes");
@@ -226,17 +228,17 @@ namespace Xamarin.ApiDiff {
var s = (Output as StringWriter).ToString ();
State.Output = output;
if (s.Length > 0) {
+ var tn = GetTypeName (target);
+ Output.WriteLine ("<!-- start type {0} --> <div>", tn);
Output.WriteLine ("<h3>Type Changed: {0}.{1}</h3>", State.Namespace, GetTypeName (target));
Output.WriteLine (s);
+ Output.WriteLine ("</div> <!-- end type {0} -->", tn);
}
}
public override void Removed (XElement source)
{
- var style = string.Empty;
- if (State.Colorize)
- style = "style='color: red'";
- Output.Write ("<h3>Removed Type <span {0}>{1}.{2}</span></h3>", style, State.Namespace, GetTypeName (source));
+ Output.Write ("<h3>Removed Type <span class='breaking' data-is-breaking>{0}.{1}</span></h3>", State.Namespace, GetTypeName (source));
}
public virtual string GetTypeName (XElement type)
diff --git a/mcs/tools/corcompare/mono-api-html/Comparer.cs b/mcs/tools/corcompare/mono-api-html/Comparer.cs
index 8c692a03a9a..4210b9b95fb 100644
--- a/mcs/tools/corcompare/mono-api-html/Comparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/Comparer.cs
@@ -48,7 +48,7 @@ namespace Xamarin.ApiDiff {
return State.Output;
}
- public abstract void Added (XElement target);
+ public abstract void Added (XElement target, bool wasParentAdded);
public abstract void Modified (XElement source, XElement target, ApiChanges changes);
public abstract void Removed (XElement source);
@@ -90,7 +90,7 @@ namespace Xamarin.ApiDiff {
if (target != null) {
foreach (var item in target) {
SetContext (item);
- Added (item);
+ Added (item, false);
}
}
}
diff --git a/mcs/tools/corcompare/mono-api-html/FieldComparer.cs b/mcs/tools/corcompare/mono-api-html/FieldComparer.cs
index bb4f6c6b075..a2b0225b448 100644
--- a/mcs/tools/corcompare/mono-api-html/FieldComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/FieldComparer.cs
@@ -189,8 +189,9 @@ namespace Xamarin.ApiDiff {
{
first = true;
if (State.BaseType == "System.Enum") {
+ Output.WriteLine ("<div>");
Output.WriteLine ("<p>Added value{0}:</p>", list.Count () > 1 ? "s" : String.Empty);
- Output.WriteLine (State.Colorize ? "<pre style='color: green'>" : "<pre>");
+ Output.WriteLine ("<pre class='added' data-is-non-breaking>");
} else {
base.BeforeAdding (list);
}
@@ -201,7 +202,7 @@ namespace Xamarin.ApiDiff {
first = true;
if (State.BaseType == "System.Enum") {
Output.WriteLine ("<p>Removed value{0}:</p>", list.Count () > 1 ? "s" : String.Empty);
- Output.WriteLine (State.Colorize ? "<pre style='color: red'>" : "<pre>");
+ Output.WriteLine ("<pre class='removed' data-is-breaking>");
} else {
base.BeforeRemoving (list);
}
diff --git a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs
index dee528ebc7a..d12d86625c2 100644
--- a/mcs/tools/corcompare/mono-api-html/MemberComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/MemberComparer.cs
@@ -41,6 +41,11 @@ namespace Xamarin.ApiDiff {
public abstract string GroupName { get; }
public abstract string ElementName { get; }
+ protected virtual bool IsBreakingRemoval (XElement e)
+ {
+ return true;
+ }
+
public void Compare (XElement source, XElement target)
{
var s = source.Element (GroupName);
@@ -124,7 +129,7 @@ namespace Xamarin.ApiDiff {
BeforeAdding (elements);
a = true;
}
- Added (item);
+ Added (item, false);
}
if (a)
AfterAdding ();
@@ -136,8 +141,10 @@ namespace Xamarin.ApiDiff {
Output.WriteLine ("<p>{0}:</p>", changes.Key);
Output.WriteLine ("<pre>");
foreach (var element in changes.Value) {
+ Output.Write ("<div {0}>", element.Breaking ? "data-is-breaking" : "data-is-non-breaking");
foreach (var line in element.Member.ToString ().Split ('\n'))
Output.WriteLine ("\t{0}", line);
+ Output.Write ("</div>");
}
Output.WriteLine ("</pre>");
@@ -192,24 +199,28 @@ namespace Xamarin.ApiDiff {
public virtual void BeforeAdding (IEnumerable<XElement> list)
{
first = true;
+ Output.WriteLine ("<div>");
Output.WriteLine ("<p>Added {0}:</p>", list.Count () > 1 ? GroupName : ElementName);
-
- bool isInterface = list.Count () > 0 && IsInInterface (list.First ());
- Output.WriteLine (State.Colorize ? string.Format ("<pre style='color: {0}'>", isInterface ? "red" : "green") : "<pre>");
+ Output.WriteLine ("<pre>");
}
- public override void Added (XElement target)
+ public override void Added (XElement target, bool wasParentAdded)
{
var o = GetObsoleteMessage (target);
if (!first && (o.Length > 0))
Output.WriteLine ();
- Indent ().WriteLine ("\t{0}{1}", o, GetDescription (target));
+ Indent ();
+ bool isInterfaceBreakingChange = !wasParentAdded && IsInInterface (target);
+ Output.Write ("\t<span class='added added-{0} {1}' {2}>", ElementName, isInterfaceBreakingChange ? "breaking" : string.Empty, isInterfaceBreakingChange ? "data-is-breaking" : "data-is-non-breaking");
+ Output.Write ("{0}{1}", o, GetDescription (target));
+ Output.WriteLine ("</span>");
first = false;
}
public virtual void AfterAdding ()
{
- Output.WriteLine ("</pre>");;
+ Output.WriteLine ("</pre>");
+ Output.WriteLine ("</div>");
}
public override void Modified (XElement source, XElement target, ApiChanges change)
@@ -220,7 +231,7 @@ namespace Xamarin.ApiDiff {
{
first = true;
Output.WriteLine ("<p>Removed {0}:</p>\n", list.Count () > 1 ? GroupName : ElementName);
- Output.WriteLine (State.Colorize ? "<pre style='color: red'>" : "<pre>");
+ Output.WriteLine ("<pre>");
}
public override void Removed (XElement source)
@@ -228,7 +239,13 @@ namespace Xamarin.ApiDiff {
var o = GetObsoleteMessage (source);
if (!first && (o.Length > 0))
Output.WriteLine ();
- Indent ().WriteLine ("\t{0}{1}", o, GetDescription (source));
+
+ bool is_breaking = IsBreakingRemoval (source);
+
+ Indent ();
+ Output.Write ("\t<span class='removed removed-{0} {2}' {1}>", ElementName, is_breaking ? "data-is-breaking" : "data-is-non-breaking", is_breaking ? "breaking" : string.Empty);
+ Output.Write ("{0}{1}", o, GetDescription (source));
+ Output.WriteLine ("</span>");
first = false;
}
@@ -558,15 +575,13 @@ namespace Xamarin.ApiDiff {
return; // neither is obsolete
var change = new ApiChange ();
change.Header = "Obsoleted " + GroupName;
- if (State.Colorize)
- change.Append ("<span style='color:gray'>");
+ change.Append (string.Format ("<span class='obsolete obsolete-{0}' data-is-non-breaking>", ElementName));
change.Append ("[Obsolete (");
if (tgtObsolete != string.Empty)
change.Append ("\"").Append (tgtObsolete).Append ("\"");
change.Append (")]\n");
change.Append (GetDescription (target));
- if (State.Colorize)
- change.Append ("</span>");
+ change.Append ("</span>");
change.AnyChange = true;
changes.Add (source, target, change);
} else if (tgtObsolete == null) {
diff --git a/mcs/tools/corcompare/mono-api-html/MethodComparer.cs b/mcs/tools/corcompare/mono-api-html/MethodComparer.cs
index 1dffa17dfcc..4c893e757ec 100644
--- a/mcs/tools/corcompare/mono-api-html/MethodComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/MethodComparer.cs
@@ -26,6 +26,7 @@
using System;
using System.Linq;
+using System.Reflection;
using System.Xml.Linq;
namespace Xamarin.ApiDiff {
@@ -62,5 +63,15 @@ namespace Xamarin.ApiDiff {
return eGPs.Count () == sGPs.Count ();
}
}
+
+ protected override bool IsBreakingRemoval (XElement e)
+ {
+ // Removing virtual methods that override another method is not a breaking change.
+ var is_override = e.Attribute ("is-override");
+ if (is_override != null)
+ return is_override.Value != "true";
+
+ return true; // all other removals are breaking changes
+ }
}
} \ No newline at end of file
diff --git a/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs b/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs
index 258374c6b9d..063e34ecbf7 100644
--- a/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs
+++ b/mcs/tools/corcompare/mono-api-html/NamespaceComparer.cs
@@ -55,17 +55,19 @@ namespace Xamarin.ApiDiff {
State.Namespace = current.Attribute ("name").Value;
}
- public override void Added (XElement target)
+ public override void Added (XElement target, bool wasParentAdded)
{
string name = target.Attribute ("name").Value;
if (State.IgnoreNew.Any (re => re.IsMatch (name)))
return;
+ Output.WriteLine ("<!-- start namespace {0} --> <div> ", name);
Output.WriteLine ("<h2>New Namespace {0}</h2>", name);
Output.WriteLine ();
// list all new types
foreach (var addedType in target.Element ("classes").Elements ("class"))
- comparer.Added (addedType);
+ comparer.Added (addedType, true);
+ Output.WriteLine ("</div> <!-- end namespace {0} -->", name);
Output.WriteLine ();
}
@@ -78,18 +80,24 @@ namespace Xamarin.ApiDiff {
var s = Output.ToString ();
State.Output = output;
if (s.Length > 0) {
- Output.WriteLine ("<h2>Namespace {0}</h2>", target.Attribute ("name").Value);
+ var name = target.Attribute ("name").Value;
+ Output.WriteLine ("<!-- start namespace {0} --> <div> ", name);
+ Output.WriteLine ("<h2>Namespace {0}</h2>", name);
Output.WriteLine (s);
+ Output.WriteLine ("</div> <!-- end namespace {0} -->", name);
}
}
public override void Removed (XElement source)
{
- Output.WriteLine ("<h2>Removed Namespace {0}</h2>", source.Attribute ("name").Value);
+ var name = source.Attribute ("name").Value;
+ Output.WriteLine ("<!-- start namespace {0} --> <div>", name);
+ Output.WriteLine ("<h2>Removed Namespace {0}</h2>", name);
Output.WriteLine ();
// list all removed types
foreach (var removedType in source.Element ("classes").Elements ("class"))
comparer.Removed (removedType);
+ Output.WriteLine ("</div> <!-- end namespace {0} -->", name);
Output.WriteLine ();
}
}
diff --git a/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj b/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj
index 286a4d0192a..6ac0f241ade 100644
--- a/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj
+++ b/mcs/tools/corcompare/mono-api-html/mono-api-html.csproj
@@ -19,7 +19,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
- <Commandlineparameters>/Developer/MonoTouch/Source/monotouch/tools/apidiff/references/compat/monotouch.xml /Developer/MonoTouch/Source/monotouch/tools/apidiff/temp/compat/monotouch.xml -i INSObjectProtocol /tmp/diff.html</Commandlineparameters>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
diff --git a/mcs/tools/corcompare/mono-api-info.cs b/mcs/tools/corcompare/mono-api-info.cs
index c43437fe40d..8b1ad945095 100644
--- a/mcs/tools/corcompare/mono-api-info.cs
+++ b/mcs/tools/corcompare/mono-api-info.cs
@@ -31,6 +31,7 @@ namespace CorCompare
bool showHelp = false;
AbiMode = false;
FollowForwarders = false;
+ string output = null;
var acoll = new AssemblyCollection ();
@@ -52,6 +53,9 @@ namespace CorCompare
{ "r=",
"Read and register the file {ASSEMBLY}, and add the directory containing ASSEMBLY to the search path.",
v => TypeHelper.Resolver.ResolveFile (v) },
+ { "o=",
+ "The output file. If not specified the output will be written to stdout.",
+ v => output = v },
{ "h|?|help",
"Show this message and exit.",
v => showHelp = v != null },
@@ -89,14 +93,24 @@ namespace CorCompare
}
}
- XmlDocument doc = new XmlDocument ();
- acoll.Document = doc;
- acoll.DoOutput ();
-
- var writer = new WellFormedXmlWriter (new XmlTextWriter (Console.Out) { Formatting = Formatting.Indented });
- XmlNode decl = doc.CreateXmlDeclaration ("1.0", "utf-8", null);
- doc.InsertBefore (decl, doc.DocumentElement);
- doc.WriteTo (writer);
+ StreamWriter outputStream = null;
+ if (!string.IsNullOrEmpty (output))
+ outputStream = new StreamWriter (output);
+ try {
+ TextWriter outStream = outputStream ?? Console.Out;
+ var settings = new XmlWriterSettings ();
+ settings.Indent = true;
+ var textWriter = XmlWriter.Create (outStream, settings);
+ var writer = new WellFormedXmlWriter (textWriter);
+ writer.WriteStartDocument ();
+ acoll.Writer = writer;
+ acoll.DoOutput ();
+ writer.WriteEndDocument ();
+ writer.Flush ();
+ } finally {
+ if (outputStream != null)
+ outputStream.Dispose ();
+ }
return 0;
}
@@ -105,6 +119,7 @@ namespace CorCompare
}
public class Utils {
+ static char[] CharsToCleanup = new char[] { '<', '>', '/' };
public static string CleanupTypeName (TypeReference type)
{
@@ -113,13 +128,33 @@ namespace CorCompare
public static string CleanupTypeName (string t)
{
- return t.Replace ('<', '[').Replace ('>', ']').Replace ('/', '+');
+ if (t.IndexOfAny (CharsToCleanup) == -1)
+ return t;
+ var sb = new StringBuilder (t.Length);
+ for (int i = 0; i < t.Length; i++) {
+ var ch = t [i];
+ switch (ch) {
+ case '<':
+ sb.Append ('[');
+ break;
+ case '>':
+ sb.Append (']');
+ break;
+ case '/':
+ sb.Append ('+');
+ break;
+ default:
+ sb.Append (ch);
+ break;
+ }
+ }
+ return sb.ToString ();
}
}
class AssemblyCollection
{
- XmlDocument document;
+ XmlWriter writer;
List<AssemblyDefinition> assemblies = new List<AssemblyDefinition> ();
public AssemblyCollection ()
@@ -140,19 +175,19 @@ namespace CorCompare
public void DoOutput ()
{
- if (document == null)
+ if (writer == null)
throw new InvalidOperationException ("Document not set");
- XmlNode nassemblies = document.CreateElement ("assemblies", null);
- document.AppendChild (nassemblies);
+ writer.WriteStartElement ("assemblies");
foreach (AssemblyDefinition a in assemblies) {
- AssemblyData data = new AssemblyData (document, nassemblies, a);
+ AssemblyData data = new AssemblyData (writer, a);
data.DoOutput ();
}
+ writer.WriteEndElement ();
}
- public XmlDocument Document {
- set { document = value; }
+ public XmlWriter Writer {
+ set { writer = value; }
}
AssemblyDefinition LoadAssembly (string assembly)
@@ -171,22 +206,18 @@ namespace CorCompare
abstract class BaseData
{
- protected XmlDocument document;
- protected XmlNode parent;
+ protected XmlWriter writer;
- protected BaseData (XmlDocument doc, XmlNode parent)
+ protected BaseData (XmlWriter writer)
{
- this.document = doc;
- this.parent = parent;
+ this.writer = writer;
}
public abstract void DoOutput ();
- protected void AddAttribute (XmlNode node, string name, string value)
+ protected void AddAttribute (string name, string value)
{
- XmlAttribute attr = document.CreateAttribute (name);
- attr.Value = value;
- node.Attributes.Append (attr);
+ writer.WriteAttributeString (name, value);
}
}
@@ -194,38 +225,34 @@ namespace CorCompare
{
AssemblyDefinition ass;
- public TypeForwardedToData (XmlDocument document, XmlNode parent, AssemblyDefinition ass)
- : base (document, parent)
+ public TypeForwardedToData (XmlWriter writer, AssemblyDefinition ass)
+ : base (writer)
{
this.ass = ass;
}
public override void DoOutput ()
{
- XmlNode natts = parent.SelectSingleNode("attributes");
- if (natts == null) {
- natts = document.CreateElement ("attributes", null);
- parent.AppendChild (natts);
- }
-
foreach (ExportedType type in ass.MainModule.ExportedTypes) {
if (((uint)type.Attributes & 0x200000u) == 0)
continue;
- XmlNode node = document.CreateElement ("attribute");
- AddAttribute (node, "name", typeof (TypeForwardedToAttribute).FullName);
- XmlNode properties = node.AppendChild (document.CreateElement ("properties"));
- XmlNode property = properties.AppendChild (document.CreateElement ("property"));
- AddAttribute (property, "name", "Destination");
- AddAttribute (property, "value", Utils.CleanupTypeName (type.FullName));
- natts.AppendChild (node);
+ writer.WriteStartElement ("attribute");
+ AddAttribute ("name", typeof (TypeForwardedToAttribute).FullName);
+ writer.WriteStartElement ("properties");
+ writer.WriteStartElement ("property");
+ AddAttribute ("name", "Destination");
+ AddAttribute ("value", Utils.CleanupTypeName (type.FullName));
+ writer.WriteEndElement (); // properties
+ writer.WriteEndElement (); // properties
+ writer.WriteEndElement (); // attribute
}
}
- public static void OutputForwarders (XmlDocument document, XmlNode parent, AssemblyDefinition ass)
+ public static void OutputForwarders (XmlWriter writer, AssemblyDefinition ass)
{
- TypeForwardedToData tftd = new TypeForwardedToData (document, parent, ass);
+ TypeForwardedToData tftd = new TypeForwardedToData (writer, ass);
tftd.DoOutput ();
}
}
@@ -234,28 +261,23 @@ namespace CorCompare
{
AssemblyDefinition ass;
- public AssemblyData (XmlDocument document, XmlNode parent, AssemblyDefinition ass)
- : base (document, parent)
+ public AssemblyData (XmlWriter writer, AssemblyDefinition ass)
+ : base (writer)
{
this.ass = ass;
}
public override void DoOutput ()
{
- if (document == null)
+ if (writer == null)
throw new InvalidOperationException ("Document not set");
- XmlNode nassembly = document.CreateElement ("assembly", null);
+ writer.WriteStartElement ("assembly");
AssemblyNameDefinition aname = ass.Name;
- AddAttribute (nassembly, "name", aname.Name);
- AddAttribute (nassembly, "version", aname.Version.ToString ());
- parent.AppendChild (nassembly);
+ AddAttribute ("name", aname.Name);
+ AddAttribute ("version", aname.Version.ToString ());
- if (!Driver.FollowForwarders) {
- TypeForwardedToData.OutputForwarders (document, nassembly, ass);
- }
-
- AttributeData.OutputAttributes (document, nassembly, ass);
+ AttributeData.OutputAttributes (writer, ass);
var types = new List<TypeDefinition> ();
if (ass.MainModule.Types != null) {
@@ -273,17 +295,16 @@ namespace CorCompare
}
if (types.Count == 0) {
+ writer.WriteEndElement (); // assembly
return;
}
types.Sort (TypeReferenceComparer.Default);
- XmlNode nss = document.CreateElement ("namespaces", null);
- nassembly.AppendChild (nss);
+ writer.WriteStartElement ("namespaces");
string current_namespace = "$%&$&";
- XmlNode ns = null;
- XmlNode classes = null;
+ bool in_namespace = false;
foreach (TypeDefinition t in types) {
if (string.IsNullOrEmpty (t.Namespace))
continue;
@@ -296,16 +317,30 @@ namespace CorCompare
if (t.Namespace != current_namespace) {
current_namespace = t.Namespace;
- ns = document.CreateElement ("namespace", null);
- AddAttribute (ns, "name", current_namespace);
- nss.AppendChild (ns);
- classes = document.CreateElement ("classes", null);
- ns.AppendChild (classes);
+ if (in_namespace) {
+ writer.WriteEndElement (); // classes
+ writer.WriteEndElement (); // namespace
+ } else {
+ in_namespace = true;
+ }
+ writer.WriteStartElement ("namespace");
+ AddAttribute ("name", current_namespace);
+ writer.WriteStartElement ("classes");
}
- TypeData bd = new TypeData (document, classes, t);
+ TypeData bd = new TypeData (writer, t);
bd.DoOutput ();
+
+ }
+
+ if (in_namespace) {
+ writer.WriteEndElement (); // classes
+ writer.WriteEndElement (); // namespace
}
+
+ writer.WriteEndElement (); // namespaces
+
+ writer.WriteEndElement (); // assembly
}
}
@@ -313,31 +348,42 @@ namespace CorCompare
{
MemberReference [] members;
- public MemberData (XmlDocument document, XmlNode parent, MemberReference [] members)
- : base (document, parent)
+ public MemberData (XmlWriter writer, MemberReference [] members)
+ : base (writer)
{
this.members = members;
}
+ protected virtual ICustomAttributeProvider GetAdditionalCustomAttributeProvider (MemberReference member)
+ {
+ return null;
+ }
+
public override void DoOutput ()
{
- XmlNode mclass = document.CreateElement (ParentTag, null);
- parent.AppendChild (mclass);
+ writer.WriteStartElement (ParentTag);
foreach (MemberReference member in members) {
- XmlNode mnode = document.CreateElement (Tag, null);
- mclass.AppendChild (mnode);
- AddAttribute (mnode, "name", GetName (member));
+ writer.WriteStartElement (Tag);
+ AddAttribute ("name", GetName (member));
if (!NoMemberAttributes)
- AddAttribute (mnode, "attrib", GetMemberAttributes (member));
+ AddAttribute ("attrib", GetMemberAttributes (member));
+ AddExtraAttributes (member);
- AttributeData.OutputAttributes (document, mnode, (ICustomAttributeProvider) member);
+ AttributeData.OutputAttributes (writer, (ICustomAttributeProvider) member, GetAdditionalCustomAttributeProvider (member));
- AddExtraData (mnode, member);
+ AddExtraData (member);
+ writer.WriteEndElement (); // Tag
}
+
+ writer.WriteEndElement (); // ParentTag
}
- protected virtual void AddExtraData (XmlNode p, MemberReference memberDefenition)
+ protected virtual void AddExtraData (MemberReference memberDefenition)
+ {
+ }
+
+ protected virtual void AddExtraAttributes (MemberReference memberDefinition)
{
}
@@ -364,39 +410,42 @@ namespace CorCompare
get { return "NoTAG"; }
}
- public static void OutputGenericParameters (XmlDocument document, XmlNode nclass, IGenericParameterProvider provider)
+ public static void OutputGenericParameters (XmlWriter writer, IGenericParameterProvider provider)
{
if (provider.GenericParameters.Count == 0)
return;
var gparameters = provider.GenericParameters;
- XmlElement ngeneric = document.CreateElement ("generic-parameters");
- nclass.AppendChild (ngeneric);
+ writer.WriteStartElement ("generic-parameters");
foreach (GenericParameter gp in gparameters) {
- XmlElement nparam = document.CreateElement ("generic-parameter");
- nparam.SetAttribute ("name", gp.Name);
- nparam.SetAttribute ("attributes", ((int) gp.Attributes).ToString ());
-
- AttributeData.OutputAttributes (document, nparam, gp);
+ writer.WriteStartElement ("generic-parameter");
+ writer.WriteAttributeString ("name", gp.Name);
+ writer.WriteAttributeString ("attributes", ((int) gp.Attributes).ToString ());
- ngeneric.AppendChild (nparam);
+ AttributeData.OutputAttributes (writer, gp);
var constraints = gp.Constraints;
- if (constraints.Count == 0)
+ if (constraints.Count == 0) {
+ writer.WriteEndElement (); // generic-parameter
continue;
+ }
- XmlElement nconstraint = document.CreateElement ("generic-parameter-constraints");
+ writer.WriteStartElement ("generic-parameter-constraints");
foreach (TypeReference constraint in constraints) {
- XmlElement ncons = document.CreateElement ("generic-parameter-constraint");
- ncons.SetAttribute ("name", Utils.CleanupTypeName (constraint));
- nconstraint.AppendChild (ncons);
+ writer.WriteStartElement ("generic-parameter-constraint");
+ writer.WriteAttributeString ("name", Utils.CleanupTypeName (constraint));
+ writer.WriteEndElement (); // generic-parameter-constraint
}
- nparam.AppendChild (nconstraint);
+ writer.WriteEndElement (); // generic-parameter-constraints
+
+ writer.WriteEndElement (); // generic-parameter
}
+
+ writer.WriteEndElement (); // generic-parameters
}
}
@@ -404,112 +453,107 @@ namespace CorCompare
{
TypeDefinition type;
- public TypeData (XmlDocument document, XmlNode parent, TypeDefinition type)
- : base (document, parent, null)
+ public TypeData (XmlWriter writer, TypeDefinition type)
+ : base (writer, null)
{
this.type = type;
}
public override void DoOutput ()
{
- if (document == null)
+ if (writer == null)
throw new InvalidOperationException ("Document not set");
- XmlNode nclass = document.CreateElement ("class", null);
- AddAttribute (nclass, "name", type.Name);
+ writer.WriteStartElement ("class");
+ AddAttribute ("name", type.Name);
string classType = GetClassType (type);
- AddAttribute (nclass, "type", classType);
+ AddAttribute ("type", classType);
if (type.BaseType != null)
- AddAttribute (nclass, "base", Utils.CleanupTypeName (type.BaseType));
+ AddAttribute ("base", Utils.CleanupTypeName (type.BaseType));
if (type.IsSealed)
- AddAttribute (nclass, "sealed", "true");
+ AddAttribute ("sealed", "true");
if (type.IsAbstract)
- AddAttribute (nclass, "abstract", "true");
+ AddAttribute ("abstract", "true");
if ( (type.Attributes & TypeAttributes.Serializable) != 0 || type.IsEnum)
- AddAttribute (nclass, "serializable", "true");
+ AddAttribute ("serializable", "true");
string charSet = GetCharSet (type);
- AddAttribute (nclass, "charset", charSet);
+ AddAttribute ("charset", charSet);
string layout = GetLayout (type);
if (layout != null)
- AddAttribute (nclass, "layout", layout);
+ AddAttribute ("layout", layout);
if (type.PackingSize >= 0) {
- AddAttribute (nclass, "pack", type.PackingSize.ToString ());
+ AddAttribute ("pack", type.PackingSize.ToString ());
}
if (type.ClassSize >= 0) {
- AddAttribute (nclass, "size", type.ClassSize.ToString ());
+ AddAttribute ("size", type.ClassSize.ToString ());
}
- parent.AppendChild (nclass);
+ if (type.IsEnum) {
+ var value_type = GetEnumValueField (type);
+ if (value_type == null)
+ throw new NotSupportedException ();
- AttributeData.OutputAttributes (document, nclass, type);
+ AddAttribute ("enumtype", Utils.CleanupTypeName (value_type.FieldType));
+ }
- XmlNode ifaces = null;
+ AttributeData.OutputAttributes (writer, type);
- foreach (TypeReference iface in TypeHelper.GetInterfaces (type).OrderBy (s => s.FullName)) {
- if (!TypeHelper.IsPublic (iface))
- // we're only interested in public interfaces
- continue;
+ var ifaces = TypeHelper.GetInterfaces (type).
+ Where ((iface) => TypeHelper.IsPublic (iface)). // we're only interested in public interfaces
+ OrderBy (s => s.FullName, StringComparer.Ordinal);
- if (ifaces == null) {
- ifaces = document.CreateElement ("interfaces", null);
- nclass.AppendChild (ifaces);
+ if (ifaces.Any ()) {
+ writer.WriteStartElement ("interfaces");
+ foreach (TypeReference iface in ifaces) {
+ writer.WriteStartElement ("interface");
+ AddAttribute ("name", Utils.CleanupTypeName (iface));
+ writer.WriteEndElement (); // interface
}
-
- XmlNode iface_node = document.CreateElement ("interface", null);
- AddAttribute (iface_node, "name", Utils.CleanupTypeName (iface));
- ifaces.AppendChild (iface_node);
+ writer.WriteEndElement (); // interfaces
}
- MemberData.OutputGenericParameters (document, nclass, type);
+ MemberData.OutputGenericParameters (writer, type);
ArrayList members = new ArrayList ();
FieldDefinition [] fields = GetFields (type);
if (fields.Length > 0) {
Array.Sort (fields, MemberReferenceComparer.Default);
- FieldData fd = new FieldData (document, nclass, fields);
+ FieldData fd = new FieldData (writer, fields);
members.Add (fd);
}
- if (type.IsEnum) {
- var value_type = GetEnumValueField (type);
- if (value_type == null)
- throw new NotSupportedException ();
-
- AddAttribute (nclass, "enumtype", Utils.CleanupTypeName (value_type.FieldType));
- }
-
if (!Driver.AbiMode) {
MethodDefinition [] ctors = GetConstructors (type);
if (ctors.Length > 0) {
Array.Sort (ctors, MethodDefinitionComparer.Default);
- members.Add (new ConstructorData (document, nclass, ctors));
+ members.Add (new ConstructorData (writer, ctors));
}
PropertyDefinition[] properties = GetProperties (type);
if (properties.Length > 0) {
Array.Sort (properties, PropertyDefinitionComparer.Default);
- members.Add (new PropertyData (document, nclass, properties));
+ members.Add (new PropertyData (writer, properties));
}
EventDefinition [] events = GetEvents (type);
if (events.Length > 0) {
Array.Sort (events, MemberReferenceComparer.Default);
- members.Add (new EventData (document, nclass, events));
+ members.Add (new EventData (writer, events));
}
MethodDefinition [] methods = GetMethods (type);
if (methods.Length > 0) {
Array.Sort (methods, MethodDefinitionComparer.Default);
- members.Add (new MethodData (document, nclass, methods));
+ members.Add (new MethodData (writer, methods));
}
}
@@ -535,13 +579,15 @@ namespace CorCompare
var nestedArray = nested.ToArray ();
Array.Sort (nestedArray, TypeReferenceComparer.Default);
- XmlNode classes = document.CreateElement ("classes", null);
- nclass.AppendChild (classes);
+ writer.WriteStartElement ("classes");
foreach (TypeDefinition t in nestedArray) {
- TypeData td = new TypeData (document, classes, t);
+ TypeData td = new TypeData (writer, t);
td.DoOutput ();
}
+ writer.WriteEndElement (); // classes
}
+
+ writer.WriteEndElement (); // class
}
static FieldReference GetEnumValueField (TypeDefinition type)
@@ -674,7 +720,7 @@ namespace CorCompare
var methods = type.Methods;//type.GetMethods (flags);
foreach (MethodDefinition method in methods) {
- if (method.IsSpecialName && !method.Name.StartsWith ("op_"))
+ if (method.IsSpecialName && !method.Name.StartsWith ("op_", StringComparison.Ordinal))
continue;
// we're only interested in public or protected members
@@ -746,8 +792,8 @@ namespace CorCompare
class FieldData : MemberData
{
- public FieldData (XmlDocument document, XmlNode parent, FieldDefinition [] members)
- : base (document, parent, members)
+ public FieldData (XmlWriter writer, FieldDefinition [] members)
+ : base (writer, members)
{
}
@@ -763,11 +809,12 @@ namespace CorCompare
return ((int) field.Attributes).ToString (CultureInfo.InvariantCulture);
}
- protected override void AddExtraData (XmlNode p, MemberReference memberDefenition)
+ protected override void AddExtraAttributes (MemberReference memberDefinition)
{
- base.AddExtraData (p, memberDefenition);
- FieldDefinition field = (FieldDefinition) memberDefenition;
- AddAttribute (p, "fieldtype", Utils.CleanupTypeName (field.FieldType));
+ base.AddExtraAttributes (memberDefinition);
+
+ FieldDefinition field = (FieldDefinition) memberDefinition;
+ AddAttribute ("fieldtype", Utils.CleanupTypeName (field.FieldType));
if (field.IsLiteral) {
object value = field.Constant;//object value = field.GetValue (null);
@@ -779,11 +826,11 @@ namespace CorCompare
// stringValue = ((Enum) value).ToString ("D", CultureInfo.InvariantCulture);
//}
//else {
- stringValue = Convert.ToString (value, CultureInfo.InvariantCulture);
+ stringValue = Convert.ToString (value, CultureInfo.InvariantCulture);
//}
if (stringValue != null)
- AddAttribute (p, "value", stringValue);
+ AddAttribute ("value", stringValue);
}
}
@@ -798,8 +845,8 @@ namespace CorCompare
class PropertyData : MemberData
{
- public PropertyData (XmlDocument document, XmlNode parent, PropertyDefinition [] members)
- : base (document, parent, members)
+ public PropertyData (XmlWriter writer, PropertyDefinition [] members)
+ : base (writer, members)
{
}
@@ -809,15 +856,13 @@ namespace CorCompare
return prop.Name;
}
- protected override void AddExtraData (XmlNode p, MemberReference memberDefenition)
+ MethodDefinition [] GetMethods (PropertyDefinition prop, out bool haveParameters)
{
- base.AddExtraData (p, memberDefenition);
- PropertyDefinition prop = (PropertyDefinition) memberDefenition;
- AddAttribute (p, "ptype", Utils.CleanupTypeName (prop.PropertyType));
MethodDefinition _get = prop.GetMethod;
MethodDefinition _set = prop.SetMethod;
bool haveGet = (_get != null && TypeData.MustDocumentMethod(_get));
bool haveSet = (_set != null && TypeData.MustDocumentMethod(_set));
+ haveParameters = haveGet || (haveSet && _set.Parameters.Count > 1);
MethodDefinition [] methods;
if (haveGet && haveSet) {
@@ -828,16 +873,41 @@ namespace CorCompare
methods = new MethodDefinition [] { _set };
} else {
//odd
- return;
+ return null;
}
- if (haveGet || _set.Parameters.Count > 1) {
+ return methods;
+ }
+
+ protected override void AddExtraAttributes (MemberReference memberDefinition)
+ {
+ base.AddExtraAttributes (memberDefinition);
+
+ PropertyDefinition prop = (PropertyDefinition) memberDefinition;
+ AddAttribute ("ptype", Utils.CleanupTypeName (prop.PropertyType));
+
+ bool haveParameters;
+ MethodDefinition [] methods = GetMethods ((PropertyDefinition) memberDefinition, out haveParameters);
+
+ if (methods != null && haveParameters) {
string parms = Parameters.GetSignature (methods [0].Parameters);
if (!string.IsNullOrEmpty (parms))
- AddAttribute (p, "params", parms);
+ AddAttribute ("params", parms);
}
- MethodData data = new MethodData (document, p, methods);
+ }
+
+ protected override void AddExtraData (MemberReference memberDefenition)
+ {
+ base.AddExtraData (memberDefenition);
+
+ bool haveParameters;
+ MethodDefinition [] methods = GetMethods ((PropertyDefinition) memberDefenition, out haveParameters);
+
+ if (methods == null)
+ return;
+
+ MethodData data = new MethodData (writer, methods);
//data.NoMemberAttributes = true;
data.DoOutput ();
}
@@ -859,8 +929,8 @@ namespace CorCompare
class EventData : MemberData
{
- public EventData (XmlDocument document, XmlNode parent, EventDefinition [] members)
- : base (document, parent, members)
+ public EventData (XmlWriter writer, EventDefinition [] members)
+ : base (writer, members)
{
}
@@ -876,11 +946,12 @@ namespace CorCompare
return ((int) evt.Attributes).ToString (CultureInfo.InvariantCulture);
}
- protected override void AddExtraData (XmlNode p, MemberReference memberDefenition)
+ protected override void AddExtraAttributes (MemberReference memberDefinition)
{
- base.AddExtraData (p, memberDefenition);
- EventDefinition evt = (EventDefinition) memberDefenition;
- AddAttribute (p, "eventtype", Utils.CleanupTypeName (evt.EventType));
+ base.AddExtraAttributes (memberDefinition);
+
+ EventDefinition evt = (EventDefinition) memberDefinition;
+ AddAttribute ("eventtype", Utils.CleanupTypeName (evt.EventType));
}
public override string ParentTag {
@@ -896,8 +967,8 @@ namespace CorCompare
{
bool noAtts;
- public MethodData (XmlDocument document, XmlNode parent, MethodDefinition [] members)
- : base (document, parent, members)
+ public MethodData (XmlWriter writer, MethodDefinition [] members)
+ : base (writer, members)
{
}
@@ -916,34 +987,59 @@ namespace CorCompare
return ((int)( method.Attributes)).ToString (CultureInfo.InvariantCulture);
}
- protected override void AddExtraData (XmlNode p, MemberReference memberDefenition)
+ protected override ICustomAttributeProvider GetAdditionalCustomAttributeProvider (MemberReference member)
{
- base.AddExtraData (p, memberDefenition);
+ var mbase = (MethodDefinition) member;
+ return mbase.MethodReturnType;
+ }
- if (!(memberDefenition is MethodDefinition))
- return;
+ protected override void AddExtraAttributes (MemberReference memberDefinition)
+ {
+ base.AddExtraAttributes (memberDefinition);
- MethodDefinition mbase = (MethodDefinition) memberDefenition;
+ if (!(memberDefinition is MethodDefinition))
+ return;
- ParameterData parms = new ParameterData (document, p, mbase.Parameters);
- parms.DoOutput ();
+ MethodDefinition mbase = (MethodDefinition) memberDefinition;
if (mbase.IsAbstract)
- AddAttribute (p, "abstract", "true");
+ AddAttribute ("abstract", "true");
if (mbase.IsVirtual)
- AddAttribute (p, "virtual", "true");
+ AddAttribute ("virtual", "true");
if (mbase.IsFinal && mbase.IsVirtual && mbase.IsReuseSlot)
- AddAttribute (p, "sealed", "true");
+ AddAttribute ("sealed", "true");
if (mbase.IsStatic)
- AddAttribute (p, "static", "true");
-
+ AddAttribute ("static", "true");
+ var baseMethod = TypeHelper.GetBaseMethodInTypeHierarchy (mbase);
+ if (baseMethod != null && baseMethod != mbase) {
+ // This indicates whether this method is an override of another method.
+ // This information is not necessarily available in the api info for any
+ // particular assembly, because a method is only overriding another if
+ // there is a base virtual function with the same signature, and that
+ // base method can come from another assembly.
+ AddAttribute ("is-override", "true");
+ }
string rettype = Utils.CleanupTypeName (mbase.MethodReturnType.ReturnType);
if (rettype != "System.Void" || !mbase.IsConstructor)
- AddAttribute (p, "returntype", (rettype));
+ AddAttribute ("returntype", (rettype));
+//
+// if (mbase.MethodReturnType.HasCustomAttributes)
+// AttributeData.OutputAttributes (writer, mbase.MethodReturnType);
+ }
- AttributeData.OutputAttributes (document, p, mbase.MethodReturnType);
+ protected override void AddExtraData (MemberReference memberDefenition)
+ {
+ base.AddExtraData (memberDefenition);
+
+ if (!(memberDefenition is MethodDefinition))
+ return;
- MemberData.OutputGenericParameters (document, p, mbase);
+ MethodDefinition mbase = (MethodDefinition) memberDefenition;
+
+ ParameterData parms = new ParameterData (writer, mbase.Parameters);
+ parms.DoOutput ();
+
+ MemberData.OutputGenericParameters (writer, mbase);
}
public override bool NoMemberAttributes {
@@ -962,8 +1058,8 @@ namespace CorCompare
class ConstructorData : MethodData
{
- public ConstructorData (XmlDocument document, XmlNode parent, MethodDefinition [] members)
- : base (document, parent, members)
+ public ConstructorData (XmlWriter writer, MethodDefinition [] members)
+ : base (writer, members)
{
}
@@ -980,23 +1076,20 @@ namespace CorCompare
{
private IList<ParameterDefinition> parameters;
- public ParameterData (XmlDocument document, XmlNode parent, IList<ParameterDefinition> parameters)
- : base (document, parent)
+ public ParameterData (XmlWriter writer, IList<ParameterDefinition> parameters)
+ : base (writer)
{
this.parameters = parameters;
}
public override void DoOutput ()
{
- XmlNode parametersNode = document.CreateElement ("parameters");
- parent.AppendChild (parametersNode);
-
+ writer.WriteStartElement ("parameters");
foreach (ParameterDefinition parameter in parameters) {
- XmlNode paramNode = document.CreateElement ("parameter");
- parametersNode.AppendChild (paramNode);
- AddAttribute (paramNode, "name", parameter.Name);
- AddAttribute (paramNode, "position", parameter.Method.Parameters.IndexOf(parameter).ToString(CultureInfo.InvariantCulture));
- AddAttribute (paramNode, "attrib", ((int) parameter.Attributes).ToString());
+ writer.WriteStartElement ("parameter");
+ AddAttribute ("name", parameter.Name);
+ AddAttribute ("position", parameter.Method.Parameters.IndexOf(parameter).ToString(CultureInfo.InvariantCulture));
+ AddAttribute ("attrib", ((int) parameter.Attributes).ToString());
string direction = "in";
@@ -1004,102 +1097,111 @@ namespace CorCompare
direction = parameter.IsOut ? "out" : "ref";
TypeReference t = parameter.ParameterType;
- AddAttribute (paramNode, "type", Utils.CleanupTypeName (t));
+ AddAttribute ("type", Utils.CleanupTypeName (t));
if (parameter.IsOptional) {
- AddAttribute (paramNode, "optional", "true");
+ AddAttribute ("optional", "true");
if (parameter.HasConstant)
- AddAttribute (paramNode, "defaultValue", parameter.Constant == null ? "NULL" : parameter.Constant.ToString ());
+ AddAttribute ("defaultValue", parameter.Constant == null ? "NULL" : parameter.Constant.ToString ());
}
if (direction != "in")
- AddAttribute (paramNode, "direction", direction);
+ AddAttribute ("direction", direction);
- AttributeData.OutputAttributes (document, paramNode, parameter);
+ AttributeData.OutputAttributes (writer, parameter);
+ writer.WriteEndElement (); // parameter
}
+ writer.WriteEndElement (); // parameters
}
}
- class AttributeData : BaseData
+ class AttributeData
{
- IList<CustomAttribute> atts;
-
- AttributeData (XmlDocument doc, XmlNode parent, IList<CustomAttribute> attributes)
- : base (doc, parent)
+ public static void DoOutput (XmlWriter writer, IList<ICustomAttributeProvider> providers)
{
- atts = attributes;
- }
-
- public override void DoOutput ()
- {
- if (document == null)
+ if (writer == null)
throw new InvalidOperationException ("Document not set");
- if (atts == null || atts.Count == 0)
+ if (providers == null || providers.Count == 0)
+ return;
+
+ if (!providers.Any ((provider) => provider != null && provider.HasCustomAttributes))
return;
- XmlNode natts = parent.SelectSingleNode("attributes");
- if (natts == null) {
- natts = document.CreateElement ("attributes", null);
- parent.AppendChild (natts);
- }
+ writer.WriteStartElement ("attributes");
- foreach (var att in atts.OrderBy ((a) => a.Constructor.DeclaringType.FullName)) {
- string attName = Utils.CleanupTypeName (att.Constructor.DeclaringType);
- if (SkipAttribute (att))
+ foreach (var provider in providers) {
+ if (provider == null)
+ continue;
+
+ if (!provider.HasCustomAttributes)
continue;
- XmlNode node = document.CreateElement ("attribute");
- AddAttribute (node, "name", attName);
-
- XmlNode properties = null;
-
- Dictionary<string, object> attribute_mapping = CreateAttributeMapping (att);
-
- foreach (string name in attribute_mapping.Keys) {
- if (name == "TypeId")
- continue;
-
- if (properties == null) {
- properties = node.AppendChild (document.CreateElement ("properties"));
- }
-
- object o = attribute_mapping [name];
-
- XmlNode n = properties.AppendChild (document.CreateElement ("property"));
- AddAttribute (n, "name", name);
- if (o == null) {
- AddAttribute (n, "value", "null");
- continue;
+ var ass = provider as AssemblyDefinition;
+ if (ass != null && !Driver.FollowForwarders)
+ TypeForwardedToData.OutputForwarders (writer, ass);
+
+ var attributes = provider.CustomAttributes.
+ Where ((att) => !SkipAttribute (att)).
+ OrderBy ((a) => a.Constructor.DeclaringType.FullName, StringComparer.Ordinal);
+
+ foreach (var att in attributes) {
+ string attName = Utils.CleanupTypeName (att.Constructor.DeclaringType);
+
+ writer.WriteStartElement ("attribute");
+ writer.WriteAttributeString ("name", attName);
+
+ var attribute_mapping = CreateAttributeMapping (att);
+
+ if (attribute_mapping != null) {
+ var mapping = attribute_mapping.Where ((attr) => attr.Key != "TypeId");
+ if (mapping.Any ()) {
+ writer.WriteStartElement ("properties");
+ foreach (var kvp in mapping) {
+ string name = kvp.Key;
+ object o = kvp.Value;
+
+ writer.WriteStartElement ("property");
+ writer.WriteAttributeString ("name", name);
+
+ if (o == null) {
+ writer.WriteAttributeString ("value", "null");
+ } else {
+ string value = o.ToString ();
+ if (attName.EndsWith ("GuidAttribute", StringComparison.Ordinal))
+ value = value.ToUpper ();
+ writer.WriteAttributeString ("value", value);
+ }
+
+ writer.WriteEndElement (); // property
+ }
+ writer.WriteEndElement (); // properties
+ }
}
-
- string value = o.ToString ();
- if (attName.EndsWith ("GuidAttribute"))
- value = value.ToUpper ();
- AddAttribute (n, "value", value);
+ writer.WriteEndElement (); // attribute
}
-
- natts.AppendChild (node);
}
+
+ writer.WriteEndElement (); // attributes
}
static Dictionary<string, object> CreateAttributeMapping (CustomAttribute attribute)
{
- var mapping = new Dictionary<string, object> ();
+ Dictionary<string, object> mapping = null;
- PopulateMapping (mapping, attribute);
+ PopulateMapping (ref mapping, attribute);
var constructor = attribute.Constructor.Resolve ();
if (constructor == null || !constructor.HasParameters)
return mapping;
- PopulateMapping (mapping, constructor, attribute);
+ PopulateMapping (ref mapping, constructor, attribute);
return mapping;
}
- static void PopulateMapping (Dictionary<string, object> mapping, CustomAttribute attribute)
+ static void PopulateMapping (ref Dictionary<string, object> mapping, CustomAttribute attribute)
{
if (!attribute.HasProperties)
return;
@@ -1111,13 +1213,15 @@ namespace CorCompare
if (arg.Value is CustomAttributeArgument)
arg = (CustomAttributeArgument) arg.Value;
+ if (mapping == null)
+ mapping = new Dictionary<string, object> (StringComparer.Ordinal);
mapping.Add (name, GetArgumentValue (arg.Type, arg.Value));
}
}
static Dictionary<FieldReference, int> CreateArgumentFieldMapping (MethodDefinition constructor)
{
- Dictionary<FieldReference, int> field_mapping = new Dictionary<FieldReference, int> ();
+ Dictionary<FieldReference, int> field_mapping = null;
int? argument = null;
@@ -1145,6 +1249,9 @@ namespace CorCompare
if (!argument.HasValue)
break;
+ if (field_mapping == null)
+ field_mapping = new Dictionary<FieldReference, int> ();
+
if (!field_mapping.ContainsKey (field))
field_mapping.Add (field, (int) argument - 1);
@@ -1158,7 +1265,7 @@ namespace CorCompare
static Dictionary<PropertyDefinition, FieldReference> CreatePropertyFieldMapping (TypeDefinition type)
{
- Dictionary<PropertyDefinition, FieldReference> property_mapping = new Dictionary<PropertyDefinition, FieldReference> ();
+ Dictionary<PropertyDefinition, FieldReference> property_mapping = null;
foreach (PropertyDefinition property in type.Properties) {
if (property.GetMethod == null)
@@ -1174,6 +1281,8 @@ namespace CorCompare
if (field.DeclaringType.FullName != type.FullName)
continue;
+ if (property_mapping == null)
+ property_mapping = new Dictionary<PropertyDefinition, FieldReference> ();
property_mapping.Add (property, field);
break;
}
@@ -1182,7 +1291,7 @@ namespace CorCompare
return property_mapping;
}
- static void PopulateMapping (Dictionary<string, object> mapping, MethodDefinition constructor, CustomAttribute attribute)
+ static void PopulateMapping (ref Dictionary<string, object> mapping, MethodDefinition constructor, CustomAttribute attribute)
{
if (!constructor.HasBody)
return;
@@ -1195,6 +1304,8 @@ namespace CorCompare
new DecimalConstantAttribute ((byte) ca[0].Value, (byte) ca[1].Value, (int) ca[2].Value, (int) ca[3].Value, (int) ca[4].Value) :
new DecimalConstantAttribute ((byte) ca[0].Value, (byte) ca[1].Value, (uint) ca[2].Value, (uint) ca[3].Value, (uint) ca[4].Value);
+ if (mapping == null)
+ mapping = new Dictionary<string, object> (StringComparer.Ordinal);
mapping.Add ("Value", dca.Value);
return;
case "System.ComponentModel.BindableAttribute":
@@ -1202,6 +1313,8 @@ namespace CorCompare
break;
if (constructor.Parameters[0].ParameterType == constructor.Module.TypeSystem.Boolean) {
+ if (mapping == null)
+ mapping = new Dictionary<string, object> (StringComparer.Ordinal);
mapping.Add ("Bindable", ca[0].Value);
} else {
throw new NotImplementedException ();
@@ -1211,18 +1324,24 @@ namespace CorCompare
}
var field_mapping = CreateArgumentFieldMapping (constructor);
- var property_mapping = CreatePropertyFieldMapping ((TypeDefinition) constructor.DeclaringType);
-
- foreach (var pair in property_mapping) {
- int argument;
- if (!field_mapping.TryGetValue (pair.Value, out argument))
- continue;
-
- var ca_arg = ca [argument];
- if (ca_arg.Value is CustomAttributeArgument)
- ca_arg = (CustomAttributeArgument) ca_arg.Value;
-
- mapping.Add (pair.Key.Name, GetArgumentValue (ca_arg.Type, ca_arg.Value));
+ if (field_mapping != null) {
+ var property_mapping = CreatePropertyFieldMapping ((TypeDefinition) constructor.DeclaringType);
+
+ if (property_mapping != null) {
+ foreach (var pair in property_mapping) {
+ int argument;
+ if (!field_mapping.TryGetValue (pair.Value, out argument))
+ continue;
+
+ var ca_arg = ca [argument];
+ if (ca_arg.Value is CustomAttributeArgument)
+ ca_arg = (CustomAttributeArgument)ca_arg.Value;
+
+ if (mapping == null)
+ mapping = new Dictionary<string, object> (StringComparer.Ordinal);
+ mapping.Add (pair.Key.Name, GetArgumentValue (ca_arg.Type, ca_arg.Value));
+ }
+ }
}
}
@@ -1330,19 +1449,15 @@ namespace CorCompare
static bool SkipAttribute (CustomAttribute attribute)
{
- var type_name = Utils.CleanupTypeName (attribute.Constructor.DeclaringType);
-
- return !TypeHelper.IsPublic (attribute)
- || type_name.EndsWith ("TODOAttribute");
+ if (!TypeHelper.IsPublic (attribute))
+ return true;
+
+ return attribute.Constructor.DeclaringType.Name.EndsWith ("TODOAttribute", StringComparison.Ordinal);
}
- public static void OutputAttributes (XmlDocument doc, XmlNode parent, ICustomAttributeProvider provider)
+ public static void OutputAttributes (XmlWriter writer, params ICustomAttributeProvider[] providers)
{
- if (!provider.HasCustomAttributes)
- return;
-
- AttributeData ad = new AttributeData (doc, parent, provider.CustomAttributes);
- ad.DoOutput ();
+ AttributeData.DoOutput (writer, providers);
}
}
@@ -1414,7 +1529,7 @@ namespace CorCompare
public int Compare (PropertyDefinition ma, PropertyDefinition mb)
{
- int res = String.Compare (ma.Name, mb.Name);
+ int res = String.Compare (ma.Name, mb.Name, StringComparison.Ordinal);
if (res != 0)
return res;
@@ -1439,7 +1554,7 @@ namespace CorCompare
{
MethodDefinition ma = (MethodDefinition) a;
MethodDefinition mb = (MethodDefinition) b;
- int res = String.Compare (ma.Name, mb.Name);
+ int res = String.Compare (ma.Name, mb.Name, StringComparison.Ordinal);
if (res != 0)
return res;
@@ -1468,7 +1583,7 @@ namespace CorCompare
string siga = Parameters.GetSignature (pia);
string sigb = Parameters.GetSignature (pib);
- return String.Compare (siga, sigb);
+ return String.Compare (siga, sigb, StringComparison.Ordinal);
}
}
}
diff --git a/mcs/tools/nunit-lite/Makefile b/mcs/tools/nunit-lite/Makefile
index 87a82157ae7..078a7ebdc0e 100644
--- a/mcs/tools/nunit-lite/Makefile
+++ b/mcs/tools/nunit-lite/Makefile
@@ -2,3 +2,5 @@ thisdir = tools/nunit-lite
SUBDIRS = NUnitLite nunit-lite-console
include ../../build/rules.make
+all-local-aot:
+
diff --git a/mcs/tools/nunit-lite/nunit-lite-console/Makefile b/mcs/tools/nunit-lite/nunit-lite-console/Makefile
index 5694be3b16d..920f74d29a5 100644
--- a/mcs/tools/nunit-lite/nunit-lite-console/Makefile
+++ b/mcs/tools/nunit-lite/nunit-lite-console/Makefile
@@ -7,7 +7,3 @@ LOCAL_MCS_FLAGS = /r:nunitlite.dll
include ../../../build/executable.make
-all-local-aot:
- $(TEST_RUNTIME) $(AOT_BUILD) ../../class/lib/$(PROFILE)/nunit-lite-console.exe
-
-
diff --git a/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config b/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config
index 352f7249246..2ccc2b9ae68 100644
--- a/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config
+++ b/mcs/tools/nunit-lite/nunit-lite-console/nunit-lite-console.exe.config
@@ -1,6 +1,12 @@
<?xml version="1.0" encoding="Windows-1252"?>
<configuration>
<runtime>
+ <!--
+ This is necessary to prevent the runner from terminating on
+ any unhandled exceptions which occur. We account for unhandled exceptions on
+ other threads with an event handler, but would still be terminated using the
+ new behavior.
+ -->
<legacyUnhandledExceptionPolicy enabled="1" />
</runtime>
</configuration>
diff --git a/mcs/tools/xbuild/frameworks/net_2.0.xml b/mcs/tools/xbuild/frameworks/net_2.0.xml
index 2b8bd9b1dff..4265fcc50ee 100644
--- a/mcs/tools/xbuild/frameworks/net_2.0.xml
+++ b/mcs/tools/xbuild/frameworks/net_2.0.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 2.0" TargetFrameworkDirectory="..\..\..\..\2.0">
+<FileList Name=".NET Framework 2.0" TargetFrameworkDirectory="..\..\..\..\2.0-api">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_3.0.xml b/mcs/tools/xbuild/frameworks/net_3.0.xml
index ae06c8818c1..1a56750d51b 100644
--- a/mcs/tools/xbuild/frameworks/net_3.0.xml
+++ b/mcs/tools/xbuild/frameworks/net_3.0.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 3.0" TargetFrameworkDirectory="..\..\..\..\2.0">
+<FileList Name=".NET Framework 3.0" TargetFrameworkDirectory="..\..\..\..\2.0-api">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_3.5.xml b/mcs/tools/xbuild/frameworks/net_3.5.xml
index 122584299a1..3e711014768 100644
--- a/mcs/tools/xbuild/frameworks/net_3.5.xml
+++ b/mcs/tools/xbuild/frameworks/net_3.5.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 3.5" TargetFrameworkDirectory="..\..\..\..\3.5" IncludeFramework="v3.0">
+<FileList Name=".NET Framework 3.5" TargetFrameworkDirectory="..\..\..\..\3.5-api" IncludeFramework="v3.0">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_4.0.xml b/mcs/tools/xbuild/frameworks/net_4.0.xml
index 701279497fd..841cc536e62 100644
--- a/mcs/tools/xbuild/frameworks/net_4.0.xml
+++ b/mcs/tools/xbuild/frameworks/net_4.0.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 4" TargetFrameworkDirectory="..\..\..\..\4.0">
+<FileList Name=".NET Framework 4" TargetFrameworkDirectory="..\..\..\..\4.0-api">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_4.0_client.xml b/mcs/tools/xbuild/frameworks/net_4.0_client.xml
index 951933a2f9a..d3fd85ccc0b 100644
--- a/mcs/tools/xbuild/frameworks/net_4.0_client.xml
+++ b/mcs/tools/xbuild/frameworks/net_4.0_client.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 4 Client Profile" TargetFrameworkDirectory="..\..\..\..\..\..\4.0">
+<FileList Name=".NET Framework 4 Client Profile" TargetFrameworkDirectory="..\..\..\..\..\..\4.0-api">
<File AssemblyName="System" Version="4.0.0.0" PublicKeyToken="b77a5c561934e089" />
<File AssemblyName="System.Activities" Version="4.0.0.0" PublicKeyToken="31bf3856ad364e35" />
<File AssemblyName="System.Dynamic" Version="4.0.0.0" PublicKeyToken="b03f5f7f11d50a3a" />
diff --git a/mcs/tools/xbuild/frameworks/net_4.5.1.xml b/mcs/tools/xbuild/frameworks/net_4.5.1.xml
index c82a4a69902..d9f2d5ed386 100644
--- a/mcs/tools/xbuild/frameworks/net_4.5.1.xml
+++ b/mcs/tools/xbuild/frameworks/net_4.5.1.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 4.5.1" TargetFrameworkDirectory="..\..\..\..\4.5">
+<FileList Name=".NET Framework 4.5.1" TargetFrameworkDirectory="..\..\..\..\4.5-api">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_4.5.2.xml b/mcs/tools/xbuild/frameworks/net_4.5.2.xml
index ec5a0e96e13..bf92045249c 100644
--- a/mcs/tools/xbuild/frameworks/net_4.5.2.xml
+++ b/mcs/tools/xbuild/frameworks/net_4.5.2.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 4.5.2" TargetFrameworkDirectory="..\..\..\..\4.5">
+<FileList Name=".NET Framework 4.5.2" TargetFrameworkDirectory="..\..\..\..\4.5-api">
</FileList>
diff --git a/mcs/tools/xbuild/frameworks/net_4.5.xml b/mcs/tools/xbuild/frameworks/net_4.5.xml
index 2fa28c496ff..2741a7830e6 100644
--- a/mcs/tools/xbuild/frameworks/net_4.5.xml
+++ b/mcs/tools/xbuild/frameworks/net_4.5.xml
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
-<FileList Name=".NET Framework 4.5" TargetFrameworkDirectory="..\..\..\..\4.5">
+<FileList Name=".NET Framework 4.5" TargetFrameworkDirectory="..\..\..\..\4.5-api">
</FileList>
diff --git a/mono/dis/dump.c b/mono/dis/dump.c
index d54e382434c..a593d26cacb 100755
--- a/mono/dis/dump.c
+++ b/mono/dis/dump.c
@@ -944,6 +944,7 @@ dump_table_customattr (MonoImage *m)
fprintf (output, "Custom Attributes Table (1..%d)\n", t->rows);
for (i = 1; i <= t->rows; i++) {
+ MonoError error;
guint32 cols [MONO_CUSTOM_ATTR_SIZE];
guint32 mtoken;
char * desc;
@@ -966,12 +967,18 @@ dump_table_customattr (MonoImage *m)
break;
}
method = get_method (m, mtoken, NULL);
- meth = mono_get_method (m, mtoken, NULL);
- params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
- fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
+ meth = mono_get_method_checked (m, mtoken, NULL, NULL, &error);
+ if (meth) {
+ params = custom_attr_params (m, mono_method_signature (meth), mono_metadata_blob_heap (m, cols [MONO_CUSTOM_ATTR_VALUE]));
+ fprintf (output, "%d: %s: %s [%s]\n", i, desc, method, params);
+ g_free (params);
+ } else {
+ fprintf (output, "Could not decode method due to %s", mono_error_get_message (&error));
+ mono_error_cleanup (&error);
+ }
+
g_free (desc);
g_free (method);
- g_free (params);
}
}
diff --git a/mono/dis/get.c b/mono/dis/get.c
index de99c35081d..3dbc1f7a79b 100755
--- a/mono/dis/get.c
+++ b/mono/dis/get.c
@@ -20,6 +20,7 @@
#include <mono/utils/mono-compiler.h>
#include <mono/metadata/class.h>
#include <mono/metadata/marshal.h>
+#include <mono/metadata/metadata-internals.h>
extern gboolean substitute_with_mscorlib_p;
@@ -1900,6 +1901,7 @@ get_memberref_parent (MonoImage *m, guint32 mrp_token, MonoGenericContainer *con
static char *
get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericContainer *container)
{
+ MonoError error;
int idx = mono_metadata_token_index (token);
guint32 member_cols [MONO_MEMBERREF_SIZE], method_cols [MONO_METHOD_SIZE];
char *sig = NULL, *esname;
@@ -1908,7 +1910,7 @@ get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericConta
MonoMethod *mh;
MonoGenericContainer *type_container = container;
- mh = mono_get_method_full (m, token, NULL, (MonoGenericContext *) container);
+ mh = mono_get_method_checked (m, token, NULL, (MonoGenericContext *) container, &error);
if (mh) {
if (mono_method_signature (mh)->is_inflated)
container = mono_method_get_generic_container (((MonoMethodInflated *) mh)->declaring);
@@ -1920,8 +1922,10 @@ get_method_core (MonoImage *m, guint32 token, gboolean fullsig, MonoGenericConta
name = g_strdup_printf ("%s%s%s", sig ? sig : "", sig ? "::" : "", esname);
g_free (sig);
g_free (esname);
- } else
+ } else {
name = NULL;
+ mono_error_cleanup (&error);
+ }
switch (mono_metadata_token_code (token)){
case MONO_TOKEN_METHOD_DEF:
@@ -2005,13 +2009,14 @@ get_method (MonoImage *m, guint32 token, MonoGenericContainer *container)
char *
get_methoddef (MonoImage *m, guint32 idx)
{
- guint32 cols [MONO_METHOD_SIZE];
+ MonoError error;
+ guint32 cols [MONO_METHOD_SIZE];
char *sig;
const char *name;
MonoMethod *mh;
- mh = mono_get_method (m, MONO_TOKEN_METHOD_DEF | idx, NULL);
+ mh = mono_get_method_checked (m, MONO_TOKEN_METHOD_DEF | idx, NULL, NULL, &error);
if (mh) {
sig = dis_stringify_type (m, &mh->klass->byval_arg, FALSE);
name = g_strdup_printf ("%s%s%s",
@@ -2019,13 +2024,15 @@ get_methoddef (MonoImage *m, guint32 idx)
sig ? "::" : "",
mh->name);
g_free (sig);
- } else
- name = NULL;
- mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD],
- idx - 1, cols, MONO_METHOD_SIZE);
- sig = get_methodref_signature (m, cols [MONO_METHOD_SIGNATURE], name);
+ } else {
+ name = g_strdup_printf ("!bad-method-name!");
+ mono_error_cleanup (&error);
+ }
+ mono_metadata_decode_row (&m->tables [MONO_TABLE_METHOD],
+ idx - 1, cols, MONO_METHOD_SIZE);
+ sig = get_methodref_signature (m, cols [MONO_METHOD_SIGNATURE], name);
- return sig;
+ return sig;
}
char *
@@ -2068,7 +2075,8 @@ get_method_type_param (MonoImage *m, guint32 blob_signature, MonoGenericContaine
char *
get_methodspec (MonoImage *m, int idx, guint32 token, const char *fancy_name, MonoGenericContainer *type_container)
{
- GString *res = g_string_new ("");
+ MonoError error;
+ GString *res = g_string_new ("");
guint32 member_cols [MONO_MEMBERREF_SIZE], method_cols [MONO_METHOD_SIZE];
char *s, *type_param;
const char *ptr;
@@ -2097,8 +2105,13 @@ get_methodspec (MonoImage *m, int idx, guint32 token, const char *fancy_name, Mo
ptr = mono_metadata_blob_heap (m, sig);
mono_metadata_decode_value (ptr, &ptr);
- mh = mono_get_method_full (m, method_dor_to_token (token), NULL, (MonoGenericContext *) type_container);
- g_assert (mh);
+ mh = mono_get_method_checked (m, method_dor_to_token (token), NULL, (MonoGenericContext *) type_container, &error);
+ if (!mh) {
+ g_string_append_printf (res, "Could not decode method token 0x%x due to %s", token, mono_error_get_message (&error));
+ mono_error_cleanup (&error);
+ return g_string_free (res, FALSE);
+ }
+
container = mono_method_get_generic_container (mh);
if (!container)
container = type_container;
@@ -3098,8 +3111,9 @@ get_method_override (MonoImage *m, guint32 token, MonoGenericContainer *containe
decl = method_dor_to_token (cols [MONO_METHODIMPL_DECLARATION]);
if (token == impl) {
+ MonoError error;
MonoMethod *mh = NULL;
- mh = mono_get_method_full (m, decl, NULL, (MonoGenericContext *) container);
+ mh = mono_get_method_checked (m, decl, NULL, (MonoGenericContext *) container, &error);
if (mh && (mh->klass && (mh->klass->generic_class || mh->klass->generic_container))) {
char *meth_str;
@@ -3110,7 +3124,12 @@ get_method_override (MonoImage *m, guint32 token, MonoGenericContainer *containe
g_free (meth_str);
return ret;
} else {
- return get_method_core (m, decl, FALSE, container);
+ char *meth_str = get_method_core (m, decl, FALSE, container);
+ char *ret = g_strdup_printf ("Could not decode method override %s due to %s", meth_str, mono_error_get_message (&error));
+
+ mono_error_cleanup (&error);
+ g_free (meth_str);
+ return ret;
}
}
}
diff --git a/mono/metadata/attach.c b/mono/metadata/attach.c
index 4f5024a72f0..e41bbf7d02b 100644
--- a/mono/metadata/attach.c
+++ b/mono/metadata/attach.c
@@ -265,6 +265,7 @@ mono_attach_cleanup (void)
static int
mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject **exc)
{
+ MonoError error;
MonoAssembly *agent_assembly;
MonoImage *image;
MonoMethod *method;
@@ -292,9 +293,10 @@ mono_attach_load_agent (MonoDomain *domain, char *agent, char *args, MonoObject
return 1;
}
- method = mono_get_method (image, entry, NULL);
+ method = mono_get_method_checked (image, entry, NULL, NULL, &error);
if (method == NULL){
- g_print ("The entry point method of assembly '%s' could not be loaded\n", agent);
+ g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, mono_error_get_message (&error));
+ mono_error_cleanup (&error);
g_free (agent);
return 1;
}
diff --git a/mono/metadata/cominterop.c b/mono/metadata/cominterop.c
index 162e7436406..15007be0d5b 100644
--- a/mono/metadata/cominterop.c
+++ b/mono/metadata/cominterop.c
@@ -170,6 +170,22 @@ mono_marshal_safearray_set_value (gpointer safearray, gpointer indices, gpointer
static void
mono_marshal_safearray_free_indices (gpointer indices);
+MonoClass*
+mono_class_try_get_com_object_class (void)
+{
+ static MonoClass *tmp_class;
+ static gboolean inited;
+ MonoClass *klass;
+ if (!inited) {
+ klass = mono_class_from_name (mono_defaults.corlib, "System", "__ComObject");
+ mono_memory_barrier ();
+ tmp_class = klass;
+ mono_memory_barrier ();
+ inited = TRUE;
+ }
+ return tmp_class;
+}
+
/**
* cominterop_method_signature:
* @method: a method
diff --git a/mono/metadata/cominterop.h b/mono/metadata/cominterop.h
index 6a15374f16c..1338bd3b5bc 100644
--- a/mono/metadata/cominterop.h
+++ b/mono/metadata/cominterop.h
@@ -53,4 +53,7 @@ mono_string_from_bstr (gpointer bstr);
MONO_API void
mono_free_bstr (gpointer bstr);
+MonoClass*
+mono_class_try_get_com_object_class (void);
+
#endif /* __MONO_COMINTEROP_H__ */
diff --git a/mono/metadata/coree.c b/mono/metadata/coree.c
index d722271ebb7..c2e47b9ca7b 100644
--- a/mono/metadata/coree.c
+++ b/mono/metadata/coree.c
@@ -136,13 +136,14 @@ BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpRes
/* Called by ntdll.dll reagardless of entry point after _CorValidateImage. */
__int32 STDMETHODCALLTYPE _CorExeMain(void)
{
+ MonoError error;
MonoDomain* domain;
MonoAssembly* assembly;
MonoImage* image;
MonoMethod* method;
guint32 entry;
gchar* file_name;
- gchar* error;
+ gchar* corlib_version_error;
int argc;
gunichar2** argvw;
gchar** argv;
@@ -152,9 +153,9 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
init_from_coree = TRUE;
domain = mono_runtime_load (file_name, NULL);
- error = (gchar*) mono_check_corlib_version ();
- if (error) {
- g_free (error);
+ corlib_version_error = (gchar*) mono_check_corlib_version ();
+ if (corlib_version_error) {
+ g_free (corlib_version_error);
g_free (file_name);
MessageBox (NULL, L"Corlib not in sync with this runtime.", NULL, MB_ICONERROR);
mono_runtime_quit ();
@@ -179,9 +180,10 @@ __int32 STDMETHODCALLTYPE _CorExeMain(void)
ExitProcess (1);
}
- method = mono_get_method (image, entry, NULL);
+ method = mono_get_method_checked (image, entry, NULL, NULL, &error);
if (method == NULL) {
g_free (file_name);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
MessageBox (NULL, L"The entry point method could not be loaded.", NULL, MB_ICONERROR);
mono_runtime_quit ();
ExitProcess (1);
diff --git a/mono/metadata/debug-helpers.c b/mono/metadata/debug-helpers.c
index db4b765fbde..27c885bc41b 100644
--- a/mono/metadata/debug-helpers.c
+++ b/mono/metadata/debug-helpers.c
@@ -541,12 +541,17 @@ mono_method_desc_search_in_image (MonoMethodDesc *desc, MonoImage *image)
mono_image_get_table_info (image, MONO_TABLE_TYPEDEF);
methods = mono_image_get_table_info (image, MONO_TABLE_METHOD);
for (i = 0; i < mono_table_info_get_rows (methods); ++i) {
+ MonoError error;
guint32 token = mono_metadata_decode_row_col (methods, i, MONO_METHOD_NAME);
const char *n = mono_metadata_string_heap (image, token);
if (strcmp (n, desc->name))
continue;
- method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+ if (!method) {
+ mono_error_cleanup (&error);
+ continue;
+ }
if (mono_method_desc_full_match (desc, method))
return method;
}
diff --git a/mono/metadata/loader.c b/mono/metadata/loader.c
index 0566fe2d102..142a56e7b18 100644
--- a/mono/metadata/loader.c
+++ b/mono/metadata/loader.c
@@ -534,17 +534,14 @@ field_from_memberref (MonoImage *image, guint32 token, MonoClass **retklass,
/*
* mono_field_from_token:
* @deprecated use the _checked variant
+ * Notes: runtime code MUST not use this function
*/
MonoClassField*
mono_field_from_token (MonoImage *image, guint32 token, MonoClass **retklass, MonoGenericContext *context)
{
MonoError error;
MonoClassField *res = mono_field_from_token_checked (image, token, retklass, context, &error);
- mono_loader_assert_no_error ();
- if (!mono_error_ok (&error)) {
- mono_loader_set_error_from_mono_error (&error);
- mono_error_cleanup (&error);
- }
+ g_assert (mono_error_ok (&error));
return res;
}
@@ -899,20 +896,15 @@ inflate_generic_header (MonoMethodHeader *header, MonoGenericContext *context)
/*
* token is the method_ref/def/spec token used in a call IL instruction.
+ * @deprecated use the _checked variant
+ * Notes: runtime code MUST not use this function
*/
MonoMethodSignature*
mono_method_get_signature_full (MonoMethod *method, MonoImage *image, guint32 token, MonoGenericContext *context)
{
MonoError error;
MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, context, &error);
-
- mono_loader_assert_no_error ();
-
- if (!res) {
- g_assert (!mono_error_ok (&error));
- mono_loader_set_error_from_mono_error (&error);
- mono_error_cleanup (&error); /* FIXME Don't swallow the error */
- }
+ g_assert (mono_error_ok (&error));
return res;
}
@@ -1001,19 +993,17 @@ mono_method_get_signature_checked (MonoMethod *method, MonoImage *image, guint32
return sig;
}
+/*
+ * token is the method_ref/def/spec token used in a call IL instruction.
+ * @deprecated use the _checked variant
+ * Notes: runtime code MUST not use this function
+ */
MonoMethodSignature*
mono_method_get_signature (MonoMethod *method, MonoImage *image, guint32 token)
{
MonoError error;
MonoMethodSignature *res = mono_method_get_signature_checked (method, image, token, NULL, &error);
-
- mono_loader_assert_no_error ();
-
- if (!res) {
- g_assert (!mono_error_ok (&error));
- mono_loader_set_error_from_mono_error (&error);
- mono_error_cleanup (&error); /* FIXME Don't swallow the error */
- }
+ g_assert (mono_error_ok (&error));
return res;
}
@@ -1980,7 +1970,10 @@ mono_get_method_from_token (MonoImage *image, guint32 token, MonoClass *klass,
MonoMethod *
mono_get_method (MonoImage *image, guint32 token, MonoClass *klass)
{
- return mono_get_method_full (image, token, klass, NULL);
+ MonoError error;
+ MonoMethod *result = mono_get_method_checked (image, token, klass, NULL, &error);
+ mono_error_cleanup (&error);
+ return result;
}
MonoMethod *
@@ -1989,11 +1982,7 @@ mono_get_method_full (MonoImage *image, guint32 token, MonoClass *klass,
{
MonoError error;
MonoMethod *result = mono_get_method_checked (image, token, klass, context, &error);
- mono_loader_assert_no_error ();
- if (!mono_error_ok (&error)) {
- mono_loader_set_error_from_mono_error (&error);
- mono_error_cleanup (&error);
- }
+ mono_error_cleanup (&error);
return result;
}
@@ -2136,12 +2125,7 @@ mono_get_method_constrained (MonoImage *image, guint32 token, MonoClass *constra
{
MonoError error;
MonoMethod *result = mono_get_method_constrained_checked (image, token, constrained_class, context, cil_method, &error);
-
- mono_loader_assert_no_error ();
- if (!mono_error_ok (&error)) {
- mono_loader_set_error_from_mono_error (&error);
- mono_error_cleanup (&error);
- }
+ mono_error_cleanup (&error);
return result;
}
diff --git a/mono/metadata/loader.h b/mono/metadata/loader.h
index 74d82817bb8..6999f81961d 100644
--- a/mono/metadata/loader.h
+++ b/mono/metadata/loader.h
@@ -8,14 +8,14 @@ MONO_BEGIN_DECLS
typedef mono_bool (*MonoStackWalk) (MonoMethod *method, int32_t native_offset, int32_t il_offset, mono_bool managed, void* data);
-MONO_API MonoMethod *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method (MonoImage *image, uint32_t token, MonoClass *klass);
-MONO_API MonoMethod *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method_full (MonoImage *image, uint32_t token, MonoClass *klass,
MonoGenericContext *context);
-MONO_API MonoMethod *
+MONO_RT_EXTERNAL_ONLY MONO_API MonoMethod *
mono_get_method_constrained (MonoImage *image, uint32_t token, MonoClass *constrained_class,
MonoGenericContext *context, MonoMethod **cil_method);
diff --git a/mono/metadata/marshal.c b/mono/metadata/marshal.c
index 8ae146eccde..3c6768041b2 100644
--- a/mono/metadata/marshal.c
+++ b/mono/metadata/marshal.c
@@ -8155,6 +8155,7 @@ mono_marshal_get_managed_wrapper (MonoMethod *method, MonoClass *delegate_klass,
gpointer
mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type)
{
+ MonoError error;
MonoMethod *method;
MonoMethodSignature *sig;
MonoMethodBuilder *mb;
@@ -8162,7 +8163,9 @@ mono_marshal_get_vtfixup_ftnptr (MonoImage *image, guint32 token, guint16 type)
g_assert (token);
- method = mono_get_method (image, token, NULL);
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method)
+ g_error ("Could not load vtfixup token 0x%x due to %s", token, mono_error_get_message (&error));
g_assert (method);
if (type & (VTFIXUP_TYPE_FROM_UNMANAGED | VTFIXUP_TYPE_FROM_UNMANAGED_RETAIN_APPDOMAIN)) {
diff --git a/mono/metadata/metadata-verify.c b/mono/metadata/metadata-verify.c
index 65f3bba5686..753e5269e92 100644
--- a/mono/metadata/metadata-verify.c
+++ b/mono/metadata/metadata-verify.c
@@ -2925,6 +2925,7 @@ verify_cattr_table (VerifyContext *ctx)
static void
verify_cattr_table_full (VerifyContext *ctx)
{
+ MonoError error;
MonoTableInfo *table = &ctx->image->tables [MONO_TABLE_CUSTOMATTRIBUTE];
MonoMethod *ctor;
const char *ptr;
@@ -2949,7 +2950,12 @@ verify_cattr_table_full (VerifyContext *ctx)
ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute constructor row %d Token 0x%08x", i, data [MONO_CUSTOM_ATTR_TYPE]));
}
- ctor = mono_get_method (ctx->image, mtoken, NULL);
+ ctor = mono_get_method_checked (ctx->image, mtoken, NULL, NULL, &error);
+
+ if (!ctor) {
+ ADD_ERROR (ctx, g_strdup_printf ("Invalid CustomAttribute content row %d Could not load ctor due to %s", i, mono_error_get_message (&error)));
+ mono_error_cleanup (&error);
+ }
/*This can't fail since this is checked in is_valid_cattr_blob*/
g_assert (decode_signature_header (ctx, data [MONO_CUSTOM_ATTR_VALUE], &size, &ptr));
diff --git a/mono/metadata/object-internals.h b/mono/metadata/object-internals.h
index 3700043213c..d82bf5dc072 100644
--- a/mono/metadata/object-internals.h
+++ b/mono/metadata/object-internals.h
@@ -618,6 +618,8 @@ typedef struct {
gboolean (*debug_log_is_enabled) (void);
gboolean (*tls_key_supported) (MonoTlsKey key);
void (*init_delegate) (MonoDelegate *del);
+ MonoObject* (*runtime_invoke) (MonoMethod *method, void *obj, void **params, MonoError *error, MonoObject **exc);
+ void* (*compile_method) (MonoMethod *method, MonoError *error);
} MonoRuntimeCallbacks;
typedef gboolean (*MonoInternalStackWalk) (MonoStackFrameInfo *frame, MonoContext *ctx, gpointer data);
@@ -632,12 +634,8 @@ typedef struct {
gboolean (*mono_install_handler_block_guard) (MonoThreadUnwindState *unwind_state);
} MonoRuntimeExceptionHandlingCallbacks;
-
/* used to free a dynamic method */
-typedef void (*MonoFreeMethodFunc) (MonoDomain *domain, MonoMethod *method);
-
-/* Used to initialize the method pointers inside vtables */
-typedef gboolean (*MonoInitVTableFunc) (MonoVTable *vtable);
+typedef void (*MonoFreeMethodFunc) (MonoDomain *domain, MonoMethod *method);
MONO_COLD void mono_set_pending_exception (MonoException *exc);
@@ -683,12 +681,6 @@ mono_class_get_allocation_ftn (MonoVTable *vtable, gboolean for_box, gboolean *p
void
mono_runtime_free_method (MonoDomain *domain, MonoMethod *method);
-void
-mono_install_runtime_invoke (MonoInvokeFunc func);
-
-void
-mono_install_compile_method (MonoCompileFunc func);
-
void
mono_install_free_method (MonoFreeMethodFunc func);
diff --git a/mono/metadata/object.c b/mono/metadata/object.c
index bd31aaa2a8b..94c29712f16 100644
--- a/mono/metadata/object.c
+++ b/mono/metadata/object.c
@@ -584,20 +584,6 @@ mono_set_always_build_imt_thunks (gboolean value)
always_build_imt_thunks = value;
}
-static MonoCompileFunc default_mono_compile_method = NULL;
-
-/**
- * mono_install_compile_method:
- * @func: function to install
- *
- * This is a VM internal routine
- */
-void
-mono_install_compile_method (MonoCompileFunc func)
-{
- default_mono_compile_method = func;
-}
-
/**
* mono_compile_method:
* @method: The method to compile.
@@ -608,13 +594,19 @@ mono_install_compile_method (MonoCompileFunc func)
gpointer
mono_compile_method (MonoMethod *method)
{
+ gpointer res;
+ MonoError error;
+
MONO_REQ_GC_NEUTRAL_MODE
- if (!default_mono_compile_method) {
+ if (!callbacks.compile_method) {
g_error ("compile method called on uninitialized runtime");
return NULL;
}
- return default_mono_compile_method (method);
+ res = callbacks.compile_method (method, &error);
+ if (!mono_error_ok (&error))
+ mono_error_raise_exception (&error);
+ return res;
}
gpointer
@@ -2846,13 +2838,24 @@ mono_object_get_virtual_method (MonoObject *obj, MonoMethod *method)
}
static MonoObject*
-dummy_mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc)
+do_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc)
{
- g_error ("runtime invoke called on uninitialized runtime");
- return NULL;
-}
+ MonoObject *result = NULL;
+ MonoError error;
-static MonoInvokeFunc default_mono_runtime_invoke = dummy_mono_runtime_invoke;
+ g_assert (callbacks.runtime_invoke);
+ result = callbacks.runtime_invoke (method, obj, params, &error, exc);
+ if (!mono_error_ok (&error)) {
+ if (exc) {
+ *exc = (MonoObject*)mono_error_convert_to_exception (&error);
+ return NULL;
+ } else {
+ mono_error_raise_exception (&error);
+ }
+ }
+
+ return result;
+}
/**
* mono_runtime_invoke:
@@ -2901,7 +2904,7 @@ mono_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **
if (mono_profiler_get_events () & MONO_PROFILE_METHOD_EVENTS)
mono_profiler_method_start_invoke (method);
- result = default_mono_runtime_invoke (method, obj, params, exc);
+ result = do_runtime_invoke (method, obj, params, exc);
if (mono_profiler_get_events () & MONO_PROFILE_METHOD_EVENTS)
mono_profiler_method_end_invoke (method);
@@ -3473,7 +3476,7 @@ mono_property_set_value (MonoProperty *prop, void *obj, void **params, MonoObjec
{
MONO_REQ_GC_UNSAFE_MODE;
- default_mono_runtime_invoke (prop->set, obj, params, exc);
+ do_runtime_invoke (prop->set, obj, params, exc);
}
/**
@@ -3498,7 +3501,7 @@ mono_property_get_value (MonoProperty *prop, void *obj, void **params, MonoObjec
{
MONO_REQ_GC_UNSAFE_MODE;
- return default_mono_runtime_invoke (prop->get, obj, params, exc);
+ return do_runtime_invoke (prop->get, obj, params, exc);
}
/*
@@ -4254,19 +4257,6 @@ mono_runtime_exec_main (MonoMethod *method, MonoArray *args, MonoObject **exc)
}
/**
- * mono_install_runtime_invoke:
- * @func: Function to install
- *
- * This is a VM internal routine
- */
-void
-mono_install_runtime_invoke (MonoInvokeFunc func)
-{
- default_mono_runtime_invoke = func ? func: dummy_mono_runtime_invoke;
-}
-
-
-/**
* mono_runtime_invoke_array:
* @method: method to invoke
* @obJ: object instance
diff --git a/mono/metadata/reflection.c b/mono/metadata/reflection.c
index 96316adef5b..c564c516788 100644
--- a/mono/metadata/reflection.c
+++ b/mono/metadata/reflection.c
@@ -9155,6 +9155,7 @@ mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
ainfo->num_attrs = len;
ainfo->image = image;
for (i = len, tmp = list; i != 0; --i, tmp = tmp->next) {
+ MonoError error;
mono_metadata_decode_row (ca, GPOINTER_TO_UINT (tmp->data), cols, MONO_CUSTOM_ATTR_SIZE);
mtoken = cols [MONO_CUSTOM_ATTR_TYPE] >> MONO_CUSTOM_ATTR_TYPE_BITS;
switch (cols [MONO_CUSTOM_ATTR_TYPE] & MONO_CUSTOM_ATTR_TYPE_MASK) {
@@ -9169,9 +9170,10 @@ mono_custom_attrs_from_index (MonoImage *image, guint32 idx)
break;
}
attr = &ainfo->attrs [i - 1];
- attr->ctor = mono_get_method (image, mtoken, NULL);
+ attr->ctor = mono_get_method_checked (image, mtoken, NULL, NULL, &error);
if (!attr->ctor) {
- g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x", image->name, mtoken);
+ g_warning ("Can't find custom attr constructor image: %s mtoken: 0x%08x due to %s", image->name, mtoken, mono_error_get_message (&error));
+ mono_loader_set_error_from_mono_error (&error);
g_list_free (list);
g_free (ainfo);
return NULL;
diff --git a/mono/metadata/remoting.c b/mono/metadata/remoting.c
index 8ca8ae62fdb..6e84ab7c0c4 100644
--- a/mono/metadata/remoting.c
+++ b/mono/metadata/remoting.c
@@ -408,7 +408,7 @@ mono_marshal_get_remoting_invoke (MonoMethod *method)
/* 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_class_get_com_object_class ()) {
+ if (mono_class_is_com_object (method->klass) || method->klass == mono_class_try_get_com_object_class ()) {
MonoVTable *vtable = mono_class_vtable (mono_domain_get (), method->klass);
g_assert (vtable); /*FIXME do proper error handling*/
diff --git a/mono/mini/aot-compiler.c b/mono/mini/aot-compiler.c
index 1e994651997..0c02a8e416f 100644
--- a/mono/mini/aot-compiler.c
+++ b/mono/mini/aot-compiler.c
@@ -3695,10 +3695,12 @@ add_wrappers (MonoAotCompile *acfg)
#if 0
/* remoting-invoke wrappers */
for (i = 0; i < acfg->image->tables [MONO_TABLE_METHOD].rows; ++i) {
+ MonoError error;
MonoMethodSignature *sig;
token = MONO_TOKEN_METHOD_DEF | (i + 1);
- method = mono_get_method (acfg->image, token, NULL);
+ method = mono_get_method_checked (acfg->image, token, NULL, NULL, &error);
+ g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
sig = mono_method_signature (method);
diff --git a/mono/mini/aot-runtime.c b/mono/mini/aot-runtime.c
index 850670d0c7b..98c346de4cd 100644
--- a/mono/mini/aot-runtime.c
+++ b/mono/mini/aot-runtime.c
@@ -1218,9 +1218,11 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
if (!image)
return FALSE;
- ref->method = mono_get_method_full (image, ref->token, NULL, NULL);
- if (!ref->method)
+ ref->method = mono_get_method_checked (image, ref->token, NULL, NULL, &error);
+ if (!ref->method) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
return FALSE;
+ }
memset (&ctx, 0, sizeof (ctx));
@@ -1229,7 +1231,8 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
ctx.method_inst = NULL;
ref->method = mono_class_inflate_generic_method_full_checked (ref->method, klass, &ctx, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ if (!ref->method)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
}
memset (&ctx, 0, sizeof (ctx));
@@ -1238,7 +1241,9 @@ decode_method_ref_with_target (MonoAotModule *module, MethodRef *ref, MonoMethod
return FALSE;
ref->method = mono_class_inflate_generic_method_full_checked (ref->method, klass, &ctx, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ if (!ref->method)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+
} else if (image_index == MONO_AOT_METHODREF_ARRAY) {
MonoClass *klass;
int method_type;
@@ -1300,8 +1305,10 @@ decode_method_ref (MonoAotModule *module, MethodRef *ref, guint8 *buf, guint8 **
static MonoMethod*
decode_resolve_method_ref_with_target (MonoAotModule *module, MonoMethod *target, guint8 *buf, guint8 **endbuf)
{
+ MonoError error;
MethodRef ref;
gboolean res;
+ MonoMethod *result;
res = decode_method_ref_with_target (module, &ref, target, buf, endbuf);
if (!res)
@@ -1310,7 +1317,10 @@ decode_resolve_method_ref_with_target (MonoAotModule *module, MonoMethod *target
return ref.method;
if (!ref.image)
return NULL;
- return mono_get_method (ref.image, ref.token, NULL);
+ result = mono_get_method_checked (ref.image, ref.token, NULL, NULL, &error);
+ if (!result)
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ return result;
}
static MonoMethod*
@@ -3313,8 +3323,11 @@ mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr)
/* Happens when a random address is passed in which matches a not-yey called wrapper encoded using its name */
return NULL;
} else {
+ MonoError error;
token = mono_metadata_make_token (MONO_TABLE_METHOD, method_index + 1);
- method = mono_get_method (image, token, NULL);
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
}
}
/* FIXME: */
@@ -3391,10 +3404,14 @@ decode_patch (MonoAotModule *aot_module, MonoMemPool *mp, MonoJumpInfo *ji, guin
ji->type = MONO_PATCH_INFO_ABS;
}
else {
- if (ref.method)
+ if (ref.method) {
ji->data.method = ref.method;
- else
- ji->data.method = mono_get_method (ref.image, ref.token, NULL);
+ }else {
+ MonoError error;
+ ji->data.method = mono_get_method_checked (ref.image, ref.token, NULL, NULL, &error);
+ if (!ji->data.method)
+ g_error ("AOT Runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+ }
g_assert (ji->data.method);
mono_class_init (ji->data.method->klass);
}
@@ -3771,8 +3788,11 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT)) {
char *full_name;
- if (!method)
- method = mono_get_method (image, token, NULL);
+ if (!method) {
+ MonoError error;
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ }
full_name = mono_method_full_name (method, TRUE);
mono_trace (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT, "AOT: NOT FOUND: %s.", full_name);
g_free (full_name);
@@ -3803,8 +3823,12 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
if (mono_jit_stats.methods_aot >= mono_last_aot_method)
return NULL;
else if (mono_jit_stats.methods_aot == mono_last_aot_method - 1) {
- if (!method)
- method = mono_get_method (image, token, NULL);
+ if (!method) {
+ MonoError error;
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method)
+ mono_error_cleanup (&error);/* FIXME don't swallow the error */
+ }
if (method) {
char *name = mono_method_full_name (method, TRUE);
g_print ("LAST AOT METHOD: %s.\n", name);
@@ -3824,8 +3848,12 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
if (mono_trace_is_traced (G_LOG_LEVEL_DEBUG, MONO_TRACE_AOT)) {
char *full_name;
- if (!method)
- method = mono_get_method (image, token, NULL);
+ if (!method) {
+ MonoError error;
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+ }
full_name = mono_method_full_name (method, TRUE);
@@ -3853,8 +3881,10 @@ load_method (MonoDomain *domain, MonoAotModule *amodule, MonoImage *image, MonoM
MonoJitInfo *jinfo;
if (!method) {
- method = mono_get_method (amodule->assembly->image, token, NULL);
- g_assert (method);
+ MonoError error;
+ method = mono_get_method_checked (amodule->assembly->image, token, NULL, NULL, &error);
+ if (!method)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
}
mono_profiler_method_jit (method);
jinfo = mono_jit_info_table_find (domain, (char*)code);
@@ -4329,7 +4359,8 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
ctx.method_inst = mono_metadata_get_generic_inst (1, args);
m = mono_marshal_get_native_wrapper (mono_class_inflate_generic_method_checked (m, &ctx, &error), TRUE, TRUE);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ if (!m)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
/*
* Get the code for the <object> instantiation which should be emitted into
@@ -4363,7 +4394,8 @@ mono_aot_get_method (MonoDomain *domain, MonoMethod *method)
ctx.method_inst = mono_metadata_get_generic_inst (1, args);
m = mono_marshal_get_native_wrapper (mono_class_inflate_generic_method_checked (m, &ctx, &error), TRUE, TRUE);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ if (!m)
+ g_error ("AOT runtime could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
/* Avoid recursion */
if (method == m)
@@ -4575,6 +4607,7 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
MonoAotModule *module = (MonoAotModule*)aot_module;
gboolean res, no_ftnptr = FALSE;
MonoMemPool *mp;
+ MonoError error;
gboolean using_gsharedvt = FALSE;
//printf ("DYN: %p %d\n", aot_module, plt_info_offset);
@@ -4603,7 +4636,9 @@ mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code
*/
if (mono_aot_only && ji.type == MONO_PATCH_INFO_METHOD && !ji.data.method->is_generic && !mono_method_check_context_used (ji.data.method) && !(ji.data.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) &&
!mono_method_needs_static_rgctx_invoke (ji.data.method, FALSE) && !using_gsharedvt) {
- target = (guint8 *)mono_jit_compile_method (ji.data.method);
+ target = (guint8 *)mono_jit_compile_method (ji.data.method, &error);
+ if (!mono_error_ok (&error))
+ mono_error_raise_exception (&error);
no_ftnptr = TRUE;
} else {
target = (guint8 *)mono_resolve_patch_target (NULL, mono_domain_get (), NULL, &ji, TRUE);
diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c
index 62598bbb405..f0b4d4f0201 100644
--- a/mono/mini/debugger-agent.c
+++ b/mono/mini/debugger-agent.c
@@ -7629,7 +7629,10 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
if (token == 0) {
buffer_add_id (buf, 0);
} else {
- m = mono_get_method (ass->image, token, NULL);
+ MonoError error;
+ m = mono_get_method_checked (ass->image, token, NULL, NULL, &error);
+ if (!m)
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
buffer_add_methodid (buf, domain, m);
}
}
diff --git a/mono/mini/decompose.c b/mono/mini/decompose.c
index ea53056e695..a96c6bfd4ac 100644
--- a/mono/mini/decompose.c
+++ b/mono/mini/decompose.c
@@ -439,8 +439,7 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
case OP_FCONV_TO_OVF_U8_UN:
case OP_FCONV_TO_OVF_I_UN:
case OP_FCONV_TO_OVF_U_UN:
- cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
- cfg->exception_message = g_strdup_printf ("float conv.ovf.un opcodes not supported.");
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("float conv.ovf.un opcodes not supported."));
break;
case OP_IDIV:
@@ -472,47 +471,6 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
}
break;
-#if SIZEOF_REGISTER == 8
- case OP_LREM_IMM:
-#endif
- case OP_IREM_IMM: {
- int power = mono_is_power_of_two (ins->inst_imm);
- if (ins->inst_imm == 1) {
- ins->opcode = OP_ICONST;
- MONO_INST_NULLIFY_SREGS (ins);
- ins->inst_c0 = 0;
-#if __s390__
- }
-#else
- } else if ((ins->inst_imm > 0) && (ins->inst_imm < (1LL << 32)) && (power != -1)) {
- gboolean is_long = ins->opcode == OP_LREM_IMM;
- int compensator_reg = alloc_ireg (cfg);
- int intermediate_reg;
-
- /* Based on gcc code */
-
- /* Add compensation for negative numerators */
-
- if (power > 1) {
- intermediate_reg = compensator_reg;
- MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_IMM : OP_ISHR_IMM, intermediate_reg, ins->sreg1, is_long ? 63 : 31);
- } else {
- intermediate_reg = ins->sreg1;
- }
-
- MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_UN_IMM : OP_ISHR_UN_IMM, compensator_reg, intermediate_reg, (is_long ? 64 : 32) - power);
- MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LADD : OP_IADD, ins->dreg, ins->sreg1, compensator_reg);
- /* Compute remainder */
- MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LAND_IMM : OP_AND_IMM, ins->dreg, ins->dreg, (1 << power) - 1);
- /* Remove compensation */
- MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LSUB : OP_ISUB, ins->dreg, ins->dreg, compensator_reg);
-
- NULLIFY_INS (ins);
- }
-#endif
- break;
- }
-
default:
emulate = TRUE;
break;
diff --git a/mono/mini/driver.c b/mono/mini/driver.c
index c801bd9ed21..2bf88c38789 100644
--- a/mono/mini/driver.c
+++ b/mono/mini/driver.c
@@ -382,9 +382,12 @@ mini_regression_step (MonoImage *image, int verbose, int *total_run, int *total,
if (mini_stats_fd)
fprintf (mini_stats_fd, "[");
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
- MonoMethod *method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
- if (!method)
+ MonoError error;
+ MonoMethod *method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+ if (!method) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
continue;
+ }
if (strncmp (method->name, "test_", 5) == 0) {
MonoCompile *cfg;
@@ -475,9 +478,12 @@ mini_regression (MonoImage *image, int verbose, int *total_run)
/* load the metadata */
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
- method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
- if (!method)
+ MonoError error;
+ method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+ if (!method) {
+ mono_error_cleanup (&error);
continue;
+ }
mono_class_init (method->klass);
if (!strncmp (method->name, "test_", 5) && mini_stats_fd) {
@@ -905,15 +911,18 @@ compile_all_methods_thread_main_inner (CompileAllThreadArgs *args)
int i, count = 0, fail_count = 0;
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
+ MonoError error;
guint32 token = MONO_TOKEN_METHOD_DEF | (i + 1);
MonoMethodSignature *sig;
if (mono_metadata_has_generic_params (image, token))
continue;
- method = mono_get_method (image, token, NULL);
- if (!method)
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
continue;
+ }
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL) ||
(method->iflags & METHOD_IMPL_ATTRIBUTE_RUNTIME) ||
@@ -990,6 +999,7 @@ compile_all_methods (MonoAssembly *ass, int verbose, guint32 opts, guint32 recom
int
mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[])
{
+ MonoError error;
MonoImage *image = mono_assembly_get_image (assembly);
MonoMethod *method;
guint32 entry = mono_image_get_entry_point (image);
@@ -1001,9 +1011,10 @@ mono_jit_exec (MonoDomain *domain, MonoAssembly *assembly, int argc, char *argv[
return 1;
}
- method = mono_get_method (image, entry, NULL);
+ method = mono_get_method_checked (image, entry, NULL, NULL, &error);
if (method == NULL){
- g_print ("The entry point method could not be loaded\n");
+ g_print ("The entry point method could not be loaded due to %s\n", mono_error_get_message (&error));
+ mono_error_cleanup (&error);
mono_environment_exitcode_set (1);
return 1;
}
@@ -1074,6 +1085,7 @@ static void main_thread_handler (gpointer user_data)
static int
load_agent (MonoDomain *domain, char *desc)
{
+ MonoError error;
char* col = strchr (desc, ':');
char *agent, *args;
MonoAssembly *agent_assembly;
@@ -1112,9 +1124,10 @@ load_agent (MonoDomain *domain, char *desc)
return 1;
}
- method = mono_get_method (image, entry, NULL);
+ method = mono_get_method_checked (image, entry, NULL, NULL, &error);
if (method == NULL){
- g_print ("The entry point method of assembly '%s' could not be loaded\n", agent);
+ g_print ("The entry point method of assembly '%s' could not be loaded due to %s\n", agent, &error);
+ mono_error_cleanup (&error);
g_free (agent);
return 1;
}
diff --git a/mono/mini/dwarfwriter.c b/mono/mini/dwarfwriter.c
index 771c1be1e7f..f925ccf3f9c 100644
--- a/mono/mini/dwarfwriter.c
+++ b/mono/mini/dwarfwriter.c
@@ -1429,10 +1429,14 @@ token_handler (MonoDisHelper *dh, MonoMethod *method, guint32 token)
case CEE_NEWOBJ:
case CEE_CALL:
case CEE_CALLVIRT:
- if (method->wrapper_type)
+ if (method->wrapper_type) {
cmethod = (MonoMethod *)data;
- else
- cmethod = mono_get_method_full (method->klass->image, token, NULL, NULL);
+ } else {
+ MonoError error;
+ cmethod = mono_get_method_checked (method->klass->image, token, NULL, NULL, &error);
+ if (!cmethod)
+ g_error ("Could not load method due to %s", mono_error_get_message (&error)); /* FIXME don't swallow the error */
+ }
desc = mono_method_full_name (cmethod, TRUE);
res = g_strdup_printf ("<%s>", desc);
g_free (desc);
diff --git a/mono/mini/exceptions-s390x.c b/mono/mini/exceptions-s390x.c
index 83d5f6b1368..18e51bd94ee 100644
--- a/mono/mini/exceptions-s390x.c
+++ b/mono/mini/exceptions-s390x.c
@@ -59,6 +59,7 @@
#include "mini.h"
#include "mini-s390x.h"
+#include "support-s390x.h"
/*========================= End of Includes ========================*/
@@ -306,12 +307,8 @@ mono_arch_get_throw_exception_generic (int size, MonoTrampInfo **info,
s390_stg (code, s390_r14, 0, STK_BASE, 0);
s390_lgr (code, s390_r3, s390_r2);
if (corlib) {
- s390_basr (code, s390_r13, 0);
- s390_j (code, 10);
- s390_llong(code, mono_defaults.exception_class->image);
- s390_llong(code, mono_exception_from_token);
- s390_lg (code, s390_r2, 0, s390_r13, 4);
- s390_lg (code, s390_r1, 0, s390_r13, 12);
+ S390_SET (code, s390_r1, (guint8 *)mono_exception_from_token);
+ S390_SET (code, s390_r2, (guint8 *)mono_defaults.exception_class->image);
s390_basr (code, s390_r14, s390_r1);
}
@@ -354,12 +351,9 @@ mono_arch_get_throw_exception_generic (int size, MonoTrampInfo **info,
s390_la (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_ACCREGS);
s390_stg (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_ACCPRM);
s390_stfpc(code, STK_BASE, S390_THROWSTACK_FPCPRM+4);
+ S390_SET (code, s390_r1, (guint8 *)throw_exception);
s390_lghi (code, s390_r7, rethrow);
s390_stg (code, s390_r7, 0, STK_BASE, S390_THROWSTACK_RETHROW);
- s390_basr (code, s390_r13, 0);
- s390_j (code, 6);
- s390_llong(code, throw_exception);
- s390_lg (code, s390_r1, 0, s390_r13, 4);
s390_basr (code, s390_r14, s390_r1);
/* we should never reach this breakpoint */
s390_break (code);
diff --git a/mono/mini/jit-icalls.c b/mono/mini/jit-icalls.c
index 1f823fccbac..79fb7d74e1b 100644
--- a/mono/mini/jit-icalls.c
+++ b/mono/mini/jit-icalls.c
@@ -1266,11 +1266,13 @@ mono_get_native_calli_wrapper (MonoImage *image, MonoMethodSignature *sig, gpoin
}
static MonoMethod*
-constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gpointer *this_arg)
+constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gpointer *this_arg, MonoError *error)
{
MonoMethod *m;
int vt_slot, iface_offset;
+ mono_error_init (error);
+
if (klass->flags & TYPE_ATTRIBUTE_INTERFACE) {
MonoObject *this_obj;
@@ -1326,11 +1328,17 @@ constrained_gsharedvt_call_setup (gpointer mp, MonoMethod *cmethod, MonoClass *k
MonoObject*
mono_gsharedvt_constrained_call (gpointer mp, MonoMethod *cmethod, MonoClass *klass, gboolean deref_arg, gpointer *args)
{
+ MonoError error;
MonoMethod *m;
gpointer this_arg;
gpointer new_args [16];
- m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg);
+ m = constrained_gsharedvt_call_setup (mp, cmethod, klass, &this_arg, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+
if (!m)
return NULL;
if (args && deref_arg) {
@@ -1364,13 +1372,29 @@ mono_generic_class_init (MonoVTable *vtable)
gpointer
mono_fill_class_rgctx (MonoVTable *vtable, int index)
{
- return mono_class_fill_runtime_generic_context (vtable, index);
+ MonoError error;
+ gpointer res;
+
+ res = mono_class_fill_runtime_generic_context (vtable, index, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+ return res;
}
gpointer
mono_fill_method_rgctx (MonoMethodRuntimeGenericContext *mrgctx, int index)
{
- return mono_method_fill_runtime_generic_context (mrgctx, index);
+ MonoError error;
+ gpointer res;
+
+ res = mono_method_fill_runtime_generic_context (mrgctx, index, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+ return res;
}
/*
@@ -1727,16 +1751,75 @@ mono_llvmonly_set_calling_assembly (MonoImage *image)
jit_tls->calling_image = image;
}
+
+static gboolean
+get_executing (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
+{
+ MonoMethod **dest = (MonoMethod **)data;
+
+ /* skip unmanaged frames */
+ if (!managed)
+ return FALSE;
+
+ if (!(*dest)) {
+ if (!strcmp (m->klass->name_space, "System.Reflection"))
+ return FALSE;
+ *dest = m;
+ return TRUE;
+ }
+ return FALSE;
+}
+
+static gboolean
+get_caller_no_reflection (MonoMethod *m, gint32 no, gint32 ilo, gboolean managed, gpointer data)
+{
+ MonoMethod **dest = (MonoMethod **)data;
+
+ /* skip unmanaged frames */
+ if (!managed)
+ return FALSE;
+
+ if (m->wrapper_type != MONO_WRAPPER_NONE)
+ return FALSE;
+
+ if (m->klass->image == mono_defaults.corlib && !strcmp (m->klass->name_space, "System.Reflection"))
+ return FALSE;
+
+ if (m == *dest) {
+ *dest = NULL;
+ return FALSE;
+ }
+ if (!(*dest)) {
+ *dest = m;
+ return TRUE;
+ }
+ return FALSE;
+}
+
MonoObject*
mono_llvmonly_get_calling_assembly (void)
{
MonoJitTlsData *jit_tls = NULL;
+ MonoMethod *m;
+ MonoMethod *dest;
+ MonoAssembly *assembly;
- jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
- g_assert (jit_tls);
- if (!jit_tls->calling_image) {
- mono_set_pending_exception (mono_get_exception_not_supported ("Stack walks are not supported on this platform."));
- return NULL;
+ dest = NULL;
+ mono_stack_walk_no_il (get_executing, &dest);
+ m = dest;
+ mono_stack_walk_no_il (get_caller_no_reflection, &dest);
+
+ if (!dest) {
+ /* Fall back to TLS */
+ jit_tls = (MonoJitTlsData *)mono_native_tls_get_value (mono_jit_tls_id);
+ g_assert (jit_tls);
+ if (!jit_tls->calling_image) {
+ mono_set_pending_exception (mono_get_exception_not_supported ("Stack walks are not supported on this platform."));
+ return NULL;
+ }
+ assembly = jit_tls->calling_image->assembly;
+ } else {
+ assembly = dest->klass->image->assembly;
}
return (MonoObject*)mono_assembly_get_object (mono_domain_get (), jit_tls->calling_image->assembly);
}
diff --git a/mono/mini/local-propagation.c b/mono/mini/local-propagation.c
index aa2a934f556..eb0749ecc11 100644
--- a/mono/mini/local-propagation.c
+++ b/mono/mini/local-propagation.c
@@ -42,6 +42,154 @@ mono_bitset_mp_new_noinit (MonoMemPool *mp, guint32 max_size)
}
/*
+ * Replaces ins with optimized opcodes.
+ *
+ * We can emit to cbb the equivalent instructions which will be used as
+ * replacement for ins, or simply change the fields of ins. Spec needs to
+ * be updated if we silently change the opcode of ins.
+ *
+ * Returns TRUE if additional vregs were allocated.
+ */
+static gboolean
+mono_strength_reduction_ins (MonoCompile *cfg, MonoInst *ins, const char **spec)
+{
+ gboolean allocated_vregs = FALSE;
+
+ /* FIXME: Add long/float */
+ switch (ins->opcode) {
+ case OP_MOVE:
+ case OP_XMOVE:
+ if (ins->dreg == ins->sreg1) {
+ NULLIFY_INS (ins);
+ }
+ break;
+ case OP_ADD_IMM:
+ case OP_IADD_IMM:
+ case OP_SUB_IMM:
+ case OP_ISUB_IMM:
+#if SIZEOF_REGISTER == 8
+ case OP_LADD_IMM:
+ case OP_LSUB_IMM:
+#endif
+ if (ins->inst_imm == 0) {
+ ins->opcode = OP_MOVE;
+ }
+ break;
+ case OP_MUL_IMM:
+ case OP_IMUL_IMM:
+#if SIZEOF_REGISTER == 8
+ case OP_LMUL_IMM:
+#endif
+ if (ins->inst_imm == 0) {
+ ins->opcode = (ins->opcode == OP_LMUL_IMM) ? OP_I8CONST : OP_ICONST;
+ ins->inst_c0 = 0;
+ ins->sreg1 = -1;
+ } else if (ins->inst_imm == 1) {
+ ins->opcode = OP_MOVE;
+ } else if ((ins->opcode == OP_IMUL_IMM) && (ins->inst_imm == -1)) {
+ ins->opcode = OP_INEG;
+ } else if ((ins->opcode == OP_LMUL_IMM) && (ins->inst_imm == -1)) {
+ ins->opcode = OP_LNEG;
+ } else {
+ int power2 = mono_is_power_of_two (ins->inst_imm);
+ if (power2 >= 0) {
+ ins->opcode = (ins->opcode == OP_MUL_IMM) ? OP_SHL_IMM : ((ins->opcode == OP_LMUL_IMM) ? OP_LSHL_IMM : OP_ISHL_IMM);
+ ins->inst_imm = power2;
+ }
+ }
+ break;
+ case OP_IREM_UN_IMM:
+ case OP_IDIV_UN_IMM: {
+ int c = ins->inst_imm;
+ int power2 = mono_is_power_of_two (c);
+
+ if (power2 >= 0) {
+ if (ins->opcode == OP_IREM_UN_IMM) {
+ ins->opcode = OP_IAND_IMM;
+ ins->sreg2 = -1;
+ ins->inst_imm = (1 << power2) - 1;
+ } else if (ins->opcode == OP_IDIV_UN_IMM) {
+ ins->opcode = OP_ISHR_UN_IMM;
+ ins->sreg2 = -1;
+ ins->inst_imm = power2;
+ }
+ }
+ break;
+ }
+ case OP_IDIV_IMM: {
+ int c = ins->inst_imm;
+ int power2 = mono_is_power_of_two (c);
+
+ if (power2 == 1) {
+ int r1 = mono_alloc_ireg (cfg);
+
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_UN_IMM, r1, ins->sreg1, 31);
+ MONO_EMIT_NEW_BIALU (cfg, OP_IADD, r1, r1, ins->sreg1);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, ins->dreg, r1, 1);
+
+ allocated_vregs = TRUE;
+ } else if (power2 > 0 && power2 < 31) {
+ int r1 = mono_alloc_ireg (cfg);
+
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, r1, ins->sreg1, 31);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_UN_IMM, r1, r1, (32 - power2));
+ MONO_EMIT_NEW_BIALU (cfg, OP_IADD, r1, r1, ins->sreg1);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ISHR_IMM, ins->dreg, r1, power2);
+
+ allocated_vregs = TRUE;
+ }
+ break;
+ }
+#if SIZEOF_REGISTER == 8
+ case OP_LREM_IMM:
+#endif
+ case OP_IREM_IMM: {
+ int power = mono_is_power_of_two (ins->inst_imm);
+ if (ins->inst_imm == 1) {
+ ins->opcode = OP_ICONST;
+ MONO_INST_NULLIFY_SREGS (ins);
+ ins->inst_c0 = 0;
+#if __s390__
+ }
+#else
+ } else if ((ins->inst_imm > 0) && (ins->inst_imm < (1LL << 32)) && (power != -1)) {
+ gboolean is_long = ins->opcode == OP_LREM_IMM;
+ int compensator_reg = alloc_ireg (cfg);
+ int intermediate_reg;
+
+ /* Based on gcc code */
+
+ /* Add compensation for negative numerators */
+
+ if (power > 1) {
+ intermediate_reg = compensator_reg;
+ MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_IMM : OP_ISHR_IMM, intermediate_reg, ins->sreg1, is_long ? 63 : 31);
+ } else {
+ intermediate_reg = ins->sreg1;
+ }
+
+ MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LSHR_UN_IMM : OP_ISHR_UN_IMM, compensator_reg, intermediate_reg, (is_long ? 64 : 32) - power);
+ MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LADD : OP_IADD, ins->dreg, ins->sreg1, compensator_reg);
+ /* Compute remainder */
+ MONO_EMIT_NEW_BIALU_IMM (cfg, is_long ? OP_LAND_IMM : OP_AND_IMM, ins->dreg, ins->dreg, (1 << power) - 1);
+ /* Remove compensation */
+ MONO_EMIT_NEW_BIALU (cfg, is_long ? OP_LSUB : OP_ISUB, ins->dreg, ins->dreg, compensator_reg);
+
+ allocated_vregs = TRUE;
+ }
+#endif
+ break;
+ }
+
+ default:
+ break;
+ }
+
+ *spec = INS_INFO (ins->opcode);
+ return allocated_vregs;
+}
+
+/*
* mono_local_cprop:
*
* A combined local copy and constant propagation pass.
@@ -49,17 +197,17 @@ mono_bitset_mp_new_noinit (MonoMemPool *mp, guint32 max_size)
void
mono_local_cprop (MonoCompile *cfg)
{
- MonoBasicBlock *bb;
+ MonoBasicBlock *bb, *bb_opt;
MonoInst **defs;
gint32 *def_index;
int max;
int filter = FILTER_IL_SEQ_POINT;
-
-restart:
+ int initial_max_vregs = cfg->next_vreg;
max = cfg->next_vreg;
- defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * (cfg->next_vreg + 1));
- def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * (cfg->next_vreg + 1));
+ defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * cfg->next_vreg);
+ def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * cfg->next_vreg);
+ cfg->cbb = bb_opt = mono_mempool_alloc0 ((cfg)->mempool, sizeof (MonoBasicBlock));
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
MonoInst *ins;
@@ -279,113 +427,41 @@ restart:
}
}
+ g_assert (cfg->cbb == bb_opt);
+ g_assert (!bb_opt->code);
/* Do strength reduction here */
- /* FIXME: Add long/float */
- switch (ins->opcode) {
- case OP_MOVE:
- case OP_XMOVE:
- if (ins->dreg == ins->sreg1) {
- MONO_DELETE_INS (bb, ins);
- spec = INS_INFO (ins->opcode);
- }
- break;
- case OP_ADD_IMM:
- case OP_IADD_IMM:
- case OP_SUB_IMM:
- case OP_ISUB_IMM:
-#if SIZEOF_REGISTER == 8
- case OP_LADD_IMM:
- case OP_LSUB_IMM:
-#endif
- if (ins->inst_imm == 0) {
- ins->opcode = OP_MOVE;
- spec = INS_INFO (ins->opcode);
- }
- break;
- case OP_MUL_IMM:
- case OP_IMUL_IMM:
-#if SIZEOF_REGISTER == 8
- case OP_LMUL_IMM:
-#endif
- if (ins->inst_imm == 0) {
- ins->opcode = (ins->opcode == OP_LMUL_IMM) ? OP_I8CONST : OP_ICONST;
- ins->inst_c0 = 0;
- ins->sreg1 = -1;
- } else if (ins->inst_imm == 1) {
- ins->opcode = OP_MOVE;
- } else if ((ins->opcode == OP_IMUL_IMM) && (ins->inst_imm == -1)) {
- ins->opcode = OP_INEG;
- } else if ((ins->opcode == OP_LMUL_IMM) && (ins->inst_imm == -1)) {
- ins->opcode = OP_LNEG;
- } else {
- int power2 = mono_is_power_of_two (ins->inst_imm);
- if (power2 >= 0) {
- ins->opcode = (ins->opcode == OP_MUL_IMM) ? OP_SHL_IMM : ((ins->opcode == OP_LMUL_IMM) ? OP_LSHL_IMM : OP_ISHL_IMM);
- ins->inst_imm = power2;
- }
- }
- spec = INS_INFO (ins->opcode);
- break;
- case OP_IREM_UN_IMM:
- case OP_IDIV_UN_IMM: {
- int c = ins->inst_imm;
- int power2 = mono_is_power_of_two (c);
-
- if (power2 >= 0) {
- if (ins->opcode == OP_IREM_UN_IMM) {
- ins->opcode = OP_IAND_IMM;
- ins->sreg2 = -1;
- ins->inst_imm = (1 << power2) - 1;
- } else if (ins->opcode == OP_IDIV_UN_IMM) {
- ins->opcode = OP_ISHR_UN_IMM;
- ins->sreg2 = -1;
- ins->inst_imm = power2;
- }
- }
- spec = INS_INFO (ins->opcode);
- break;
- }
- case OP_IDIV_IMM: {
- int c = ins->inst_imm;
- int power2 = mono_is_power_of_two (c);
- MonoInst *tmp1, *tmp2, *tmp3, *tmp4;
-
- /* FIXME: Move this elsewhere cause its hard to implement it here */
- if (power2 == 1) {
- int r1 = mono_alloc_ireg (cfg);
-
- NEW_BIALU_IMM (cfg, tmp1, OP_ISHR_UN_IMM, r1, ins->sreg1, 31);
- mono_bblock_insert_after_ins (bb, ins, tmp1);
- NEW_BIALU (cfg, tmp2, OP_IADD, r1, r1, ins->sreg1);
- mono_bblock_insert_after_ins (bb, tmp1, tmp2);
- NEW_BIALU_IMM (cfg, tmp3, OP_ISHR_IMM, ins->dreg, r1, 1);
- mono_bblock_insert_after_ins (bb, tmp2, tmp3);
-
- NULLIFY_INS (ins);
-
- // We allocated a new vreg, so need to restart
- goto restart;
- } else if (power2 > 0 && power2 < 31) {
- int r1 = mono_alloc_ireg (cfg);
-
- NEW_BIALU_IMM (cfg, tmp1, OP_ISHR_IMM, r1, ins->sreg1, 31);
- mono_bblock_insert_after_ins (bb, ins, tmp1);
- NEW_BIALU_IMM (cfg, tmp2, OP_ISHR_UN_IMM, r1, r1, (32 - power2));
- mono_bblock_insert_after_ins (bb, tmp1, tmp2);
- NEW_BIALU (cfg, tmp3, OP_IADD, r1, r1, ins->sreg1);
- mono_bblock_insert_after_ins (bb, tmp2, tmp3);
- NEW_BIALU_IMM (cfg, tmp4, OP_ISHR_IMM, ins->dreg, r1, power2);
- mono_bblock_insert_after_ins (bb, tmp3, tmp4);
-
- NULLIFY_INS (ins);
-
- // We allocated a new vreg, so need to restart
- goto restart;
- }
- break;
+ if (mono_strength_reduction_ins (cfg, ins, &spec) && max < cfg->next_vreg) {
+ MonoInst **defs_prev = defs;
+ gint32 *def_index_prev = def_index;
+ guint32 prev_max = max;
+ guint32 additional_vregs = cfg->next_vreg - initial_max_vregs;
+
+ /* We have more vregs so we need to reallocate defs and def_index arrays */
+ max = initial_max_vregs + additional_vregs * 2;
+ defs = (MonoInst **)mono_mempool_alloc (cfg->mempool, sizeof (MonoInst*) * max);
+ def_index = (gint32 *)mono_mempool_alloc (cfg->mempool, sizeof (guint32) * max);
+
+ /* Keep the entries for the previous vregs, zero the rest */
+ memcpy (defs, defs_prev, sizeof (MonoInst*) * prev_max);
+ memset (defs + prev_max, 0, sizeof (MonoInst*) * (max - prev_max));
+ memcpy (def_index, def_index_prev, sizeof (guint32) * prev_max);
+ memset (def_index + prev_max, 0, sizeof (guint32) * (max - prev_max));
}
+
+ if (cfg->cbb->code || (cfg->cbb != bb_opt)) {
+ MonoInst *saved_prev = ins->prev;
+
+ /* If we have code in cbb, we need to replace ins with the decomposition */
+ mono_replace_ins (cfg, bb, ins, &ins->prev, bb_opt, cfg->cbb);
+ bb_opt->code = bb_opt->last_ins = NULL;
+ bb_opt->in_count = bb_opt->out_count = 0;
+ cfg->cbb = bb_opt;
+
+ /* ins is hanging, continue scanning the emitted code */
+ ins = saved_prev;
+ continue;
}
-
+
if (spec [MONO_INST_DEST] != ' ') {
MonoInst *def = defs [ins->dreg];
diff --git a/mono/mini/method-to-ir.c b/mono/mini/method-to-ir.c
index a202b20cf38..130c62165ba 100644
--- a/mono/mini/method-to-ir.c
+++ b/mono/mini/method-to-ir.c
@@ -108,7 +108,8 @@
} \
} while (0)
#define OUT_OF_MEMORY_FAILURE do { \
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_OUT_OF_MEMORY); \
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR); \
+ mono_error_set_out_of_memory (&cfg->error, ""); \
goto exception_exit; \
} while (0)
#define DISABLE_AOT(cfg) do { \
@@ -373,8 +374,8 @@ method_access_failure (MonoCompile *cfg, MonoMethod *method, MonoMethod *cil_met
{
char *method_fname = mono_method_full_name (method, TRUE);
char *cil_method_fname = mono_method_full_name (cil_method, TRUE);
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_METHOD_ACCESS);
- cfg->exception_message = g_strdup_printf ("Method `%s' is inaccessible from method `%s'\n", cil_method_fname, method_fname);
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_generic_error (&cfg->error, "System", "MethodAccessException", "Method `%s' is inaccessible from method `%s'\n", cil_method_fname, method_fname);
g_free (method_fname);
g_free (cil_method_fname);
}
@@ -384,8 +385,8 @@ field_access_failure (MonoCompile *cfg, MonoMethod *method, MonoClassField *fiel
{
char *method_fname = mono_method_full_name (method, TRUE);
char *field_fname = mono_field_full_name (field);
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_FIELD_ACCESS);
- cfg->exception_message = g_strdup_printf ("Field `%s' is inaccessible from method `%s'\n", field_fname, method_fname);
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_generic_error (&cfg->error, "System", "FieldAccessException", "Field `%s' is inaccessible from method `%s'\n", field_fname, method_fname);
g_free (method_fname);
g_free (field_fname);
}
@@ -7083,12 +7084,12 @@ inline_method (MonoCompile *cfg, MonoMethod *cmethod, MonoMethodSignature *fsig,
cheader = mono_method_get_header (cmethod);
if (cheader == NULL || mono_loader_get_last_error ()) {
- MonoLoaderError *error = mono_loader_get_last_error ();
-
if (cheader)
mono_metadata_free_mh (cheader);
- if (inline_always && error)
- mono_cfg_set_exception (cfg, error->exception_type);
+ if (inline_always && mono_loader_get_last_error ()) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_from_loader_error (&cfg->error);
+ }
mono_loader_clear_error ();
return 0;
@@ -7374,19 +7375,19 @@ exception_exit:
}
static inline MonoMethod *
-mini_get_method_allow_open (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context)
+mini_get_method_allow_open (MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context, MonoError *error)
{
MonoMethod *method;
+ mono_error_init (error);
+
if (m->wrapper_type != MONO_WRAPPER_NONE) {
method = (MonoMethod *)mono_method_get_wrapper_data (m, token);
if (context) {
- MonoError error;
- method = mono_class_inflate_generic_method_checked (method, context, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ method = mono_class_inflate_generic_method_checked (method, context, error);
}
} else {
- method = mono_get_method_full (m->klass->image, token, klass, context);
+ method = mono_get_method_checked (m->klass->image, token, klass, context, error);
}
return method;
@@ -7395,10 +7396,16 @@ mini_get_method_allow_open (MonoMethod *m, guint32 token, MonoClass *klass, Mono
static inline MonoMethod *
mini_get_method (MonoCompile *cfg, MonoMethod *m, guint32 token, MonoClass *klass, MonoGenericContext *context)
{
- MonoMethod *method = mini_get_method_allow_open (m, token, klass, context);
+ MonoError error;
+ MonoMethod *method = mini_get_method_allow_open (m, token, klass, context, cfg ? &cfg->error : &error);
- if (method && cfg && !cfg->gshared && mono_class_is_open_constructed_type (&method->klass->byval_arg))
- return NULL;
+ if (method && cfg && !cfg->gshared && mono_class_is_open_constructed_type (&method->klass->byval_arg)) {
+ mono_error_set_bad_image (&cfg->error, cfg->method->klass->image, "Method with open type while not compiling gshared");
+ method = NULL;
+ }
+
+ if (!method && !cfg)
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
return method;
}
@@ -7595,22 +7602,13 @@ set_exception_type_from_invalid_il (MonoCompile *cfg, MonoMethod *method, unsign
method_code = g_strdup ("method body is empty.");
else
method_code = mono_disasm_code_one (NULL, method, ip, NULL);
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_INVALID_PROGRAM);
- cfg->exception_message = g_strdup_printf ("Invalid IL code in %s: %s\n", method_fname, method_code);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Invalid IL code in %s: %s\n", method_fname, method_code));
g_free (method_fname);
g_free (method_code);
cfg->headers_to_free = g_slist_prepend_mempool (cfg->mempool, cfg->headers_to_free, header);
}
static void
-set_exception_object (MonoCompile *cfg, MonoException *exception)
-{
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_OBJECT_SUPPLIED);
- MONO_GC_REGISTER_ROOT_SINGLE (cfg->exception_ptr, MONO_ROOT_SOURCE_JIT, "jit exception");
- cfg->exception_ptr = exception;
-}
-
-static void
emit_stloc_ir (MonoCompile *cfg, MonoInst **sp, MonoMethodHeader *header, int n)
{
MonoInst *ins;
@@ -8154,13 +8152,11 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
image = method->klass->image;
header = mono_method_get_header (method);
if (!header) {
- MonoLoaderError *error;
-
- if ((error = mono_loader_get_last_error ())) {
- mono_cfg_set_exception (cfg, error->exception_type);
+ if (mono_loader_get_last_error ()) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_from_loader_error (&cfg->error);
} else {
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_INVALID_PROGRAM);
- cfg->exception_message = g_strdup_printf ("Missing or incorrect header for method %s", cfg->method->name);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Missing or incorrect header for method %s", cfg->method->name));
}
goto exception_exit;
}
@@ -8981,9 +8977,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
token = read32 (ip + 1);
/* FIXME: check the signature matches */
cmethod = mini_get_method (cfg, method, token, NULL, generic_context);
-
- if (!cmethod || mono_loader_get_last_error ())
- LOAD_ERROR;
+ CHECK_CFG_ERROR;
if (cfg->gshared && mono_method_check_context_used (cmethod))
GENERIC_SHARING_FAILURE (CEE_JMP);
@@ -9183,6 +9177,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
ins = NULL;
cmethod = mini_get_method (cfg, method, token, NULL, generic_context);
+ CHECK_CFG_ERROR;
+
cil_method = cmethod;
if (constrained_class) {
@@ -9223,12 +9219,20 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
}
}
- if (!cmethod || mono_loader_get_last_error ())
- LOAD_ERROR;
+ if (!cmethod || mono_loader_get_last_error ()) {
+ if (mono_loader_get_last_error ()) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_from_loader_error (&cfg->error);
+ CHECK_CFG_ERROR;
+ } else {
+ LOAD_ERROR;
+ }
+ }
if (!dont_verify && !cfg->skip_visibility) {
MonoMethod *target_method = cil_method;
if (method->is_inflated) {
- target_method = mini_get_method_allow_open (method, token, NULL, &(mono_method_get_generic_container (method_definition)->context));
+ target_method = mini_get_method_allow_open (method, token, NULL, &(mono_method_get_generic_container (method_definition)->context), &cfg->error);
+ CHECK_CFG_ERROR;
}
if (!mono_method_can_access_method (method_definition, target_method) &&
!mono_method_can_access_method (method, cil_method))
@@ -10782,8 +10786,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_OPSIZE (5);
token = read32 (ip + 1);
cmethod = mini_get_method (cfg, method, token, NULL, generic_context);
- if (!cmethod || mono_loader_get_last_error ())
- LOAD_ERROR;
+ CHECK_CFG_ERROR;
+
fsig = mono_method_get_signature_checked (cmethod, image, token, generic_context, &cfg->error);
CHECK_CFG_ERROR;
@@ -11642,7 +11646,9 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
INLINE_FAILURE ("class init");
ex = mono_runtime_class_init_full (vtable, FALSE);
if (ex) {
- set_exception_object (cfg, ex);
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_exception_instance (&cfg->error, ex);
+ g_assert_not_reached ();
goto exception_exit;
}
}
@@ -13045,8 +13051,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_OPSIZE (6);
n = read32 (ip + 2);
cmethod = mini_get_method (cfg, method, n, NULL, generic_context);
- if (!cmethod || mono_loader_get_last_error ())
- LOAD_ERROR;
+ CHECK_CFG_ERROR;
+
mono_class_init (cmethod->klass);
mono_save_token_info (cfg, image, n, cmethod);
@@ -13122,8 +13128,8 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
CHECK_OPSIZE (6);
n = read32 (ip + 2);
cmethod = mini_get_method (cfg, method, n, NULL, generic_context);
- if (!cmethod || mono_loader_get_last_error ())
- LOAD_ERROR;
+ CHECK_CFG_ERROR;
+
mono_class_init (cmethod->klass);
context_used = mini_method_check_context_used (cfg, cmethod);
@@ -13629,8 +13635,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
/* Method is too large */
mname = mono_method_full_name (method, TRUE);
- mono_cfg_set_exception (cfg, MONO_EXCEPTION_INVALID_PROGRAM);
- cfg->exception_message = g_strdup_printf ("Method %s is too complex.", mname);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Method %s is too complex.", mname));
g_free (mname);
}
diff --git a/mono/mini/mini-amd64.c b/mono/mini/mini-amd64.c
index a97493988ce..d37ad6818bf 100644
--- a/mono/mini/mini-amd64.c
+++ b/mono/mini/mini-amd64.c
@@ -1958,8 +1958,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
offsets = mono_allocate_stack_slots (cfg, cfg->arch.omit_fp ? FALSE: TRUE, &locals_stack_size, &locals_stack_align);
if (locals_stack_size > MONO_ARCH_MAX_FRAME_SIZE) {
char *mname = mono_method_full_name (cfg->method, TRUE);
- cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
- cfg->exception_message = g_strdup_printf ("Method %s stack is too big.", mname);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Method %s stack is too big.", mname));
g_free (mname);
return;
}
@@ -2475,8 +2474,7 @@ mono_arch_emit_call (MonoCompile *cfg, MonoCallInst *call)
if (size >= 10000) {
/* Avoid asserts in emit_memcpy () */
- cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
- cfg->exception_message = g_strdup_printf ("Passing an argument of size '%d'.", size);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Passing an argument of size '%d'.", size));
/* Continue normally */
}
diff --git a/mono/mini/mini-generic-sharing.c b/mono/mini/mini-generic-sharing.c
index 94312a18f43..af1c8f5a0b6 100644
--- a/mono/mini/mini-generic-sharing.c
+++ b/mono/mini/mini-generic-sharing.c
@@ -840,13 +840,17 @@ class_get_rgctx_template_oti (MonoClass *klass, int type_argc, guint32 slot, gbo
}
static gpointer
-class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_type)
+class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_type, MonoError *error)
{
+ mono_error_init (error);
+
switch (info_type) {
case MONO_RGCTX_INFO_STATIC_DATA: {
MonoVTable *vtable = mono_class_vtable (domain, klass);
- if (!vtable)
- mono_raise_exception (mono_class_get_exception_for_failure (klass));
+ if (!vtable) {
+ mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+ return NULL;
+ }
return mono_vtable_get_static_field_data (vtable);
}
case MONO_RGCTX_INFO_KLASS:
@@ -855,8 +859,10 @@ class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_ty
return klass->element_class;
case MONO_RGCTX_INFO_VTABLE: {
MonoVTable *vtable = mono_class_vtable (domain, klass);
- if (!vtable)
- mono_raise_exception (mono_class_get_exception_for_failure (klass));
+ if (!vtable) {
+ mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (klass));
+ return NULL;
+ }
return vtable;
}
case MONO_RGCTX_INFO_CAST_CACHE: {
@@ -960,7 +966,9 @@ class_type_info (MonoDomain *domain, MonoClass *klass, MonoRgctxInfoType info_ty
else
method = mono_class_get_method_from_name (klass, "Unbox", 1);
- addr = mono_compile_method (method);
+ addr = mono_jit_compile_method (method, error);
+ if (!mono_error_ok (error))
+ return NULL;
// The caller uses the gsharedvt call signature
@@ -1465,14 +1473,20 @@ mini_get_gsharedvt_wrapper (gboolean gsharedvt_in, gpointer addr, MonoMethodSign
return addr;
}
+/*
+ * instantiate_info:
+ *
+ * Instantiate the info given by OTI for context CONTEXT.
+ */
static gpointer
instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti,
- MonoGenericContext *context, MonoClass *klass)
+ MonoGenericContext *context, MonoClass *klass, MonoError *error)
{
- MonoError error;
gpointer data;
gboolean temporary;
+ mono_error_init (error);
+
if (!oti->data)
return NULL;
@@ -1514,13 +1528,12 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
if (oti->info_type == MONO_RGCTX_INFO_KLASS)
mono_class_compute_gc_descriptor (arg_class);
- return class_type_info (domain, arg_class, oti->info_type);
+ return class_type_info (domain, arg_class, oti->info_type, error);
}
case MONO_RGCTX_INFO_TYPE:
return data;
case MONO_RGCTX_INFO_REFLECTION_TYPE: {
- MonoReflectionType *ret = mono_type_get_object_checked (domain, (MonoType *)data, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ MonoReflectionType *ret = mono_type_get_object_checked (domain, (MonoType *)data, error);
return ret;
}
@@ -1573,7 +1586,6 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
MonoJumpInfoVirtMethod *info = (MonoJumpInfoVirtMethod *)data;
MonoClass *iface_class = info->method->klass;
MonoMethod *method;
- MonoError error;
int ioffset, slot;
gpointer addr;
@@ -1590,8 +1602,9 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
g_assert (info->klass->vtable);
method = info->klass->vtable [ioffset + slot];
- method = mono_class_inflate_generic_method_checked (method, context, &error);
-
+ method = mono_class_inflate_generic_method_checked (method, context, error);
+ if (!mono_error_ok (error))
+ return NULL;
addr = mono_compile_method (method);
return mini_add_method_trampoline (method, addr, mono_method_needs_static_rgctx_invoke (method, FALSE), FALSE);
}
@@ -1648,8 +1661,10 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
g_assert (method->context.method_inst);
vtable = mono_class_vtable (domain, method->method.method.klass);
- if (!vtable)
- mono_raise_exception (mono_class_get_exception_for_failure (method->method.method.klass));
+ if (!vtable) {
+ mono_error_set_exception_instance (error, mono_class_get_exception_for_failure (method->method.method.klass));
+ return NULL;
+ }
return mono_method_lookup_rgctx (vtable, method->context.method_inst);
}
@@ -1860,7 +1875,9 @@ instantiate_info (MonoDomain *domain, MonoRuntimeGenericContextInfoTemplate *oti
offset += size;
break;
default:
- res->entries [i] = instantiate_info (domain, template_, context, klass);
+ res->entries [i] = instantiate_info (domain, template_, context, klass, error);
+ if (!mono_error_ok (error))
+ return NULL;
break;
}
}
@@ -2231,7 +2248,7 @@ alloc_rgctx_array (MonoDomain *domain, int n, gboolean is_mrgctx)
static gpointer
fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContext *rgctx, guint32 slot,
- MonoGenericInst *method_inst)
+ MonoGenericInst *method_inst, MonoError *error)
{
gpointer info;
int i, first_slot, size;
@@ -2243,6 +2260,8 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex
int rgctx_index;
gboolean do_free;
+ mono_error_init (error);
+
g_assert (rgctx);
mono_domain_lock (domain);
@@ -2285,7 +2304,7 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex
oti = class_get_rgctx_template_oti (get_shared_class (klass),
method_inst ? method_inst->type_argc : 0, slot, TRUE, TRUE, &do_free);
/* This might take the loader lock */
- info = instantiate_info (domain, &oti, &context, klass);
+ info = instantiate_info (domain, &oti, &context, klass, error);
g_assert (info);
/*
@@ -2319,7 +2338,7 @@ fill_runtime_generic_context (MonoVTable *class_vtable, MonoRuntimeGenericContex
* Instantiates a slot in the RGCTX, returning its value.
*/
gpointer
-mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot)
+mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot, MonoError *error)
{
static gboolean inited = FALSE;
static int num_alloced = 0;
@@ -2328,6 +2347,8 @@ mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot)
MonoRuntimeGenericContext *rgctx;
gpointer info;
+ mono_error_init (error);
+
mono_domain_lock (domain);
if (!inited) {
@@ -2344,7 +2365,7 @@ mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot)
mono_domain_unlock (domain);
- info = fill_runtime_generic_context (class_vtable, rgctx, slot, 0);
+ info = fill_runtime_generic_context (class_vtable, rgctx, slot, 0, error);
DEBUG (printf ("get rgctx slot: %s %d -> %p\n", mono_type_full_name (&class_vtable->klass->byval_arg), slot, info));
@@ -2359,11 +2380,11 @@ mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot)
* Instantiates a slot in the MRGCTX.
*/
gpointer
-mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot)
+mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot, MonoError *error)
{
gpointer info;
- info = fill_runtime_generic_context (mrgctx->class_vtable, (MonoRuntimeGenericContext*)mrgctx, slot, mrgctx->method_inst);
+ info = fill_runtime_generic_context (mrgctx->class_vtable, (MonoRuntimeGenericContext*)mrgctx, slot, mrgctx->method_inst, error);
return info;
}
diff --git a/mono/mini/mini-runtime.c b/mono/mini/mini-runtime.c
index 514dbbeefaf..4640672dd54 100644
--- a/mono/mini/mini-runtime.c
+++ b/mono/mini/mini-runtime.c
@@ -1846,7 +1846,7 @@ no_gsharedvt_in_wrapper (void)
}
static gpointer
-mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException **ex)
+mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoError *error)
{
MonoDomain *target_domain, *domain = mono_domain_get ();
MonoJitInfo *info;
@@ -1855,6 +1855,8 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
MonoJitICallInfo *callinfo = NULL;
WrapperInfo *winfo = NULL;
+ mono_error_init (error);
+
/*
* ICALL wrappers are handled specially, since there is only one copy of them
* shared by all appdomains.
@@ -1887,9 +1889,8 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
ctx = mono_method_get_context (method);
method = info->d.synchronized_inner.method;
if (ctx) {
- MonoError error;
- method = mono_class_inflate_generic_method_checked (method, ctx, &error);
- g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */
+ method = mono_class_inflate_generic_method_checked (method, ctx, error);
+ g_assert (mono_error_ok (error)); /* FIXME don't swallow the error */
}
}
}
@@ -1904,9 +1905,9 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
mono_jit_stats.methods_lookups++;
vtable = mono_class_vtable (domain, method->klass);
g_assert (vtable);
- tmpEx = mono_runtime_class_init_full (vtable, ex == NULL);
+ tmpEx = mono_runtime_class_init_full (vtable, FALSE);
if (tmpEx) {
- *ex = tmpEx;
+ mono_error_set_exception_instance (error, tmpEx);
return NULL;
}
return mono_create_ftnptr (target_domain, info->code_start);
@@ -1937,7 +1938,9 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
#endif
if (!code)
- code = mono_jit_compile_method_inner (method, target_domain, opt, ex);
+ code = mono_jit_compile_method_inner (method, target_domain, opt, error);
+ if (!mono_error_ok (error))
+ return NULL;
if (!code && mono_llvm_only) {
if (method->wrapper_type == MONO_WRAPPER_UNKNOWN) {
@@ -1988,17 +1991,11 @@ mono_jit_compile_method_with_opt (MonoMethod *method, guint32 opt, MonoException
}
gpointer
-mono_jit_compile_method (MonoMethod *method)
+mono_jit_compile_method (MonoMethod *method, MonoError *error)
{
- MonoException *ex = NULL;
gpointer code;
- code = mono_jit_compile_method_with_opt (method, mono_get_optimizations_for_method (method, default_opt), &ex);
- if (!code) {
- g_assert (ex);
- mono_raise_exception (ex);
- }
-
+ code = mono_jit_compile_method_with_opt (method, mono_get_optimizations_for_method (method, default_opt), error);
return code;
}
@@ -2199,7 +2196,7 @@ typedef struct {
} RuntimeInvokeInfo;
static RuntimeInvokeInfo*
-create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer compiled_method, gboolean callee_gsharedvt)
+create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer compiled_method, gboolean callee_gsharedvt, MonoError *error)
{
MonoMethod *invoke;
RuntimeInvokeInfo *info;
@@ -2302,7 +2299,11 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com
invoke = mono_marshal_get_runtime_invoke_for_sig (wrapper_sig);
g_free (wrapper_sig);
- info->compiled_method = mono_jit_compile_method (wrapper);
+ info->compiled_method = mono_jit_compile_method (wrapper, error);
+ if (!mono_error_ok (error)) {
+ g_free (info);
+ return NULL;
+ }
} else {
/* Gsharedvt methods can be invoked the same way */
/* The out wrapper has the same signature as the compiled gsharedvt method */
@@ -2314,7 +2315,11 @@ create_runtime_invoke_info (MonoDomain *domain, MonoMethod *method, gpointer com
g_free (wrapper_sig);
}
}
- info->runtime_invoke = mono_jit_compile_method (invoke);
+ info->runtime_invoke = mono_jit_compile_method (invoke, error);
+ if (!mono_error_ok (error)) {
+ g_free (info);
+ return NULL;
+ }
}
return info;
@@ -2396,10 +2401,11 @@ mono_llvmonly_runtime_invoke (MonoMethod *method, RuntimeInvokeInfo *info, void
* @method: the method to invoke
* @obj: this pointer
* @params: array of parameter values.
+ * @error: error
* @exc: used to catch exceptions objects
*/
static MonoObject*
-mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObject **exc)
+mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoError *error, MonoObject **exc)
{
MonoMethod *invoke, *callee;
MonoObject *(*runtime_invoke) (MonoObject *this_obj, void **params, MonoObject **exc, void* compiled_method);
@@ -2409,6 +2415,8 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
MonoJitInfo *ji = NULL;
gboolean callee_gsharedvt = FALSE;
+ mono_error_init (error);
+
if (obj == NULL && !(method->flags & METHOD_ATTRIBUTE_STATIC) && !method->string_ctor && (method->wrapper_type == 0)) {
g_warning ("Ignoring invocation of an instance method on a NULL instance.\n");
return NULL;
@@ -2458,18 +2466,10 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
}
if (callee) {
- MonoException *jit_ex = NULL;
-
- compiled_method = mono_jit_compile_method_with_opt (callee, mono_get_optimizations_for_method (callee, default_opt), &jit_ex);
+ compiled_method = mono_jit_compile_method_with_opt (callee, mono_get_optimizations_for_method (callee, default_opt), error);
if (!compiled_method) {
- g_assert (jit_ex);
- if (exc) {
- *exc = (MonoObject*)jit_ex;
- return NULL;
- } else {
- mono_raise_exception (jit_ex);
- /* coverity[unreachable] */
- }
+ g_assert (!mono_error_ok (error));
+ return NULL;
}
if (mono_llvm_only) {
@@ -2485,7 +2485,9 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
compiled_method = NULL;
}
- info = create_runtime_invoke_info (domain, method, compiled_method, callee_gsharedvt);
+ info = create_runtime_invoke_info (domain, method, compiled_method, callee_gsharedvt, error);
+ if (!mono_error_ok (error))
+ return NULL;
mono_domain_lock (domain);
info2 = (RuntimeInvokeInfo *)mono_conc_hashtable_insert (domain_info->runtime_invoke_hash, method, info);
@@ -2523,7 +2525,9 @@ mono_jit_runtime_invoke (MonoMethod *method, void *obj, void **params, MonoObjec
if (!dyn_runtime_invoke) {
invoke = mono_marshal_get_runtime_invoke_dynamic ();
- dyn_runtime_invoke = (RuntimeInvokeDynamicFunction)mono_jit_compile_method (invoke);
+ dyn_runtime_invoke = (RuntimeInvokeDynamicFunction)mono_jit_compile_method (invoke, error);
+ if (!mono_error_ok (error))
+ return NULL;
}
/* Convert the arguments to the format expected by start_dyn_call () */
@@ -3491,6 +3495,14 @@ mini_init (const char *filename, const char *runtime_version)
callbacks.get_imt_trampoline = mini_get_imt_trampoline;
callbacks.imt_entry_inited = mini_imt_entry_inited;
callbacks.init_delegate = mini_init_delegate;
+#define JIT_INVOKE_WORKS
+#ifdef JIT_INVOKE_WORKS
+ callbacks.runtime_invoke = mono_jit_runtime_invoke;
+#endif
+#define JIT_TRAMPOLINES_WORK
+#ifdef JIT_TRAMPOLINES_WORK
+ callbacks.compile_method = mono_jit_compile_method;
+#endif
mono_install_callbacks (&callbacks);
@@ -3560,9 +3572,7 @@ mini_init (const char *filename, const char *runtime_version)
#endif
mono_threads_install_cleanup (mini_thread_cleanup);
-#define JIT_TRAMPOLINES_WORK
#ifdef JIT_TRAMPOLINES_WORK
- mono_install_compile_method (mono_jit_compile_method);
mono_install_free_method (mono_jit_free_method);
mono_install_trampoline (mono_create_jit_trampoline);
mono_install_jump_trampoline (mono_create_jump_trampoline);
@@ -3573,10 +3583,6 @@ mini_init (const char *filename, const char *runtime_version)
mono_install_create_domain_hook (mini_create_jit_domain_info);
mono_install_free_domain_hook (mini_free_jit_domain_info);
#endif
-#define JIT_INVOKE_WORKS
-#ifdef JIT_INVOKE_WORKS
- mono_install_runtime_invoke (mono_jit_runtime_invoke);
-#endif
mono_install_get_cached_class_info (mono_aot_get_cached_class_info);
mono_install_get_class_from_name (mono_aot_get_class_from_name);
mono_install_jit_info_find_in_aot (mono_aot_find_jit_info);
@@ -4118,7 +4124,13 @@ mono_precompile_assembly (MonoAssembly *ass, void *user_data)
printf ("PRECOMPILE: %s.\n", mono_image_get_filename (image));
for (i = 0; i < mono_image_get_table_rows (image, MONO_TABLE_METHOD); ++i) {
- method = mono_get_method (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL);
+ MonoError error;
+
+ method = mono_get_method_checked (image, MONO_TOKEN_METHOD_DEF | (i + 1), NULL, NULL, &error);
+ if (!method) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ continue;
+ }
if (method->flags & METHOD_ATTRIBUTE_ABSTRACT)
continue;
if (method->is_generic || method->klass->generic_container)
diff --git a/mono/mini/mini-s390x.c b/mono/mini/mini-s390x.c
index 8c27ecee488..368c3bc9882 100644
--- a/mono/mini/mini-s390x.c
+++ b/mono/mini/mini-s390x.c
@@ -275,6 +275,7 @@ if (ins->inst_target_bb->native_offset) { \
#include "jit-icalls.h"
#include "ir-emit.h"
#include "trace.h"
+#include "mini-gc.h"
/*========================= End of Includes ========================*/
@@ -577,6 +578,7 @@ emit_unwind_regs(MonoCompile *cfg, guint8 *code, int start, int end, long offset
for (i = start; i < end; i++) {
mono_emit_unwind_op_offset (cfg, code, i, offset);
+ mini_gc_set_slot_type_from_cfa (cfg, offset, SLOT_NOREF);
offset += sizeof(gulong);
}
}
@@ -1310,6 +1312,7 @@ mono_arch_init (void)
{
guint8 *code;
+ mono_set_partial_sharing_supported (FALSE);
mono_os_mutex_init_recursive (&mini_arch_mutex);
ss_trigger_page = mono_valloc (NULL, mono_pagesize (), MONO_MMAP_READ);
@@ -5573,7 +5576,8 @@ mono_arch_emit_prolog (MonoCompile *cfg)
CallInfo *cinfo;
int tracing = 0,
argsClobbered = 0,
- lmfOffset;
+ lmfOffset,
+ fpOffset;
cfg->code_size = 512;
@@ -5592,6 +5596,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
emit_unwind_regs(cfg, code, s390_r6, s390_r14, S390_REG_SAVE_OFFSET);
s390_stmg (code, s390_r6, s390_r14, STK_BASE, S390_REG_SAVE_OFFSET);
mono_emit_unwind_op_offset (cfg, code, s390_r14, S390_RET_ADDR_OFFSET);
+ mini_gc_set_slot_type_from_cfa (cfg, S390_RET_ADDR_OFFSET, SLOT_NOREF);
if (cfg->arch.bkchain_reg != -1)
s390_lgr (code, cfg->arch.bkchain_reg, STK_BASE);
@@ -5778,6 +5783,12 @@ mono_arch_emit_prolog (MonoCompile *cfg)
s390_stmg (code, s390_r2, s390_r6, s390_r13,
G_STRUCT_OFFSET(MonoLMF, pregs[0]));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[0]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[1]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[2]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[3]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, pregs[4]), SLOT_NOREF);
+
/*---------------------------------------------------------------*/
/* On return from this call r2 have the address of the &lmf */
/*---------------------------------------------------------------*/
@@ -5801,6 +5812,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
/*---------------------------------------------------------------*/
s390_stg (code, s390_r2, 0, s390_r13,
G_STRUCT_OFFSET(MonoLMF, lmf_addr));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, lmf_addr), SLOT_NOREF);
/*---------------------------------------------------------------*/
/* Get current lmf */
@@ -5817,6 +5829,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
/*---------------------------------------------------------------*/
s390_stg (code, s390_r0, 0, s390_r13,
G_STRUCT_OFFSET(MonoLMF, previous_lmf));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, previous_lmf), SLOT_NOREF);
/*---------------------------------------------------------------*/
/* save method info */
@@ -5824,6 +5837,7 @@ mono_arch_emit_prolog (MonoCompile *cfg)
S390_SET (code, s390_r1, method);
s390_stg (code, s390_r1, 0, s390_r13,
G_STRUCT_OFFSET(MonoLMF, method));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, method), SLOT_NOREF);
/*---------------------------------------------------------------*/
/* save the current IP */
@@ -5831,15 +5845,32 @@ mono_arch_emit_prolog (MonoCompile *cfg)
s390_stg (code, STK_BASE, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, ebp));
s390_basr (code, s390_r1, 0);
s390_stg (code, s390_r1, 0, s390_r13, G_STRUCT_OFFSET(MonoLMF, eip));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, ebp), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, eip), SLOT_NOREF);
/*---------------------------------------------------------------*/
/* Save general and floating point registers */
/*---------------------------------------------------------------*/
s390_stmg (code, s390_r2, s390_r12, s390_r13,
G_STRUCT_OFFSET(MonoLMF, gregs[2]));
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[0]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[1]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[2]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[3]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[4]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[5]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[6]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[7]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[8]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[9]), SLOT_NOREF);
+ mini_gc_set_slot_type_from_fp (cfg, lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, gregs[10]), SLOT_NOREF);
+
+ fpOffset = lmfOffset + MONO_STRUCT_OFFSET (MonoLMF, fregs[0]);
for (i = 0; i < 16; i++) {
s390_std (code, i, 0, s390_r13,
G_STRUCT_OFFSET(MonoLMF, fregs[i]));
+ mini_gc_set_slot_type_from_fp (cfg, fpOffset, SLOT_NOREF);
+ fpOffset += sizeof(double);
}
/*---------------------------------------------------------------*/
diff --git a/mono/mini/mini-trampolines.c b/mono/mini/mini-trampolines.c
index d40ace4cd3e..a28fd9168d3 100644
--- a/mono/mini/mini-trampolines.c
+++ b/mono/mini/mini-trampolines.c
@@ -501,13 +501,13 @@ mini_add_method_wrappers_llvmonly (MonoMethod *m, gpointer compiled_method, gboo
}
/**
- * common_call_trampoline:
+ * common_call_trampoline_inner:
*
* The code to handle normal, virtual, and interface method calls and jumps, both
* from JITted and LLVM compiled code.
*/
static gpointer
-common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot)
+common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error)
{
gpointer addr, compiled_method;
gboolean generic_shared = FALSE;
@@ -520,6 +520,8 @@ common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVT
gpointer *orig_vtable_slot, *vtable_slot_to_patch = NULL;
MonoJitInfo *ji = NULL;
+ mono_error_init (error);
+
virtual_ = vt && (gpointer)vtable_slot > (gpointer)vt;
imt_call = vt && (gpointer)vtable_slot < (gpointer)vt;
@@ -691,8 +693,9 @@ common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVT
if (!code && mono_method_needs_static_rgctx_invoke (m, FALSE))
need_rgctx_tramp = TRUE;
- addr = compiled_method = mono_compile_method (m);
- g_assert (addr);
+ addr = compiled_method = mono_jit_compile_method (m, error);
+ if (!addr)
+ return NULL;
if (generic_virtual || variant_iface) {
if (vt->klass->valuetype) /*FIXME is this required variant iface?*/
@@ -801,11 +804,11 @@ common_call_trampoline_inner (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVT
}
static gpointer
-common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot)
+common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *vt, gpointer *vtable_slot, MonoError *error)
{
gpointer res;
MONO_PREPARE_RESET_BLOCKING;
- res = common_call_trampoline_inner (regs, code, m, vt, vtable_slot);
+ res = common_call_trampoline_inner (regs, code, m, vt, vtable_slot, error);
MONO_FINISH_RESET_BLOCKING;
return res;
}
@@ -818,9 +821,17 @@ common_call_trampoline (mgreg_t *regs, guint8 *code, MonoMethod *m, MonoVTable *
gpointer
mono_magic_trampoline (mgreg_t *regs, guint8 *code, gpointer arg, guint8* tramp)
{
+ MonoError error;
+ gpointer res;
+
trampoline_calls ++;
- return common_call_trampoline (regs, code, (MonoMethod *)arg, NULL, NULL);
+ res = common_call_trampoline (regs, code, (MonoMethod *)arg, NULL, NULL, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+ return res;
}
/**
@@ -835,7 +846,8 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
MonoVTable *vt;
gpointer *vtable_slot;
MonoMethod *m;
- gpointer addr;
+ MonoError error;
+ gpointer addr, res;
trampoline_calls ++;
@@ -889,7 +901,12 @@ mono_vcall_trampoline (mgreg_t *regs, guint8 *code, int slot, guint8 *tramp)
m = NULL;
}
- return common_call_trampoline (regs, code, m, vt, vtable_slot);
+ res = common_call_trampoline (regs, code, m, vt, vtable_slot, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+ return res;
}
#ifndef DISABLE_REMOTING
@@ -922,7 +939,11 @@ mono_generic_virtual_remoting_trampoline (mgreg_t *regs, guint8 *code, MonoMetho
g_assert (mono_error_ok (&error)); /* FIXME don't swallow the error */;
m = mono_marshal_get_remoting_invoke_with_check (m);
- addr = mono_compile_method (m);
+ addr = mono_jit_compile_method (m, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
g_assert (addr);
return addr;
@@ -954,8 +975,10 @@ mono_aot_trampoline (mgreg_t *regs, guint8 *code, guint8 *token_info,
addr = mono_aot_get_method_from_token (mono_domain_get (), image, token);
if (!addr) {
- method = mono_get_method (image, token, NULL);
- g_assert (method);
+ MonoError error;
+ method = mono_get_method_checked (image, token, NULL, NULL, &error);
+ if (!method)
+ g_error ("Could not load AOT trampoline due to %s", mono_error_get_message (&error));
/* Use the generic code */
return mono_magic_trampoline (regs, code, method, tramp);
@@ -988,8 +1011,14 @@ mono_aot_plt_trampoline (mgreg_t *regs, guint8 *code, guint8 *aot_module,
res = mono_aot_plt_resolve (aot_module, plt_info_offset, code);
if (!res) {
- if (mono_loader_get_last_error ())
- mono_raise_exception (mono_loader_error_prepare_exception (mono_loader_get_last_error ()));
+ if (mono_loader_get_last_error ()) {
+ MonoError error;
+
+ mono_error_init (&error);
+ mono_error_set_from_loader_error (&error);
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
// FIXME: Error handling (how ?)
g_assert (res);
}
@@ -1008,6 +1037,8 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu
gpointer arg = (gpointer)(gssize)r [MONO_ARCH_VTABLE_REG];
guint32 index = MONO_RGCTX_SLOT_INDEX (slot);
gboolean mrgctx = MONO_RGCTX_SLOT_IS_MRGCTX (slot);
+ MonoError error;
+ gpointer res;
trampoline_calls ++;
@@ -1019,9 +1050,14 @@ mono_rgctx_lazy_fetch_trampoline (mgreg_t *regs, guint8 *code, gpointer data, gu
num_lookups++;
if (mrgctx)
- return mono_method_fill_runtime_generic_context ((MonoMethodRuntimeGenericContext *)arg, index);
+ res = mono_method_fill_runtime_generic_context ((MonoMethodRuntimeGenericContext *)arg, index, &error);
else
- return mono_class_fill_runtime_generic_context ((MonoVTable *)arg, index);
+ res = mono_class_fill_runtime_generic_context ((MonoVTable *)arg, index, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
+ return res;
}
/*
@@ -1068,6 +1104,7 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
MonoJitInfo *ji;
MonoMethod *m;
MonoMethod *method = NULL;
+ MonoError error;
gboolean multicast, callvirt = FALSE, closed_over_null = FALSE;
gboolean need_rgctx_tramp = FALSE;
gboolean need_unbox_tramp = FALSE;
@@ -1112,8 +1149,10 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
if (!(sig && method == tramp_info->method)) {
mono_error_init (&err);
sig = mono_method_signature_checked (method, &err);
- if (!sig)
- mono_error_raise_exception (&err);
+ if (!sig) {
+ mono_error_set_pending_exception (&err);
+ return NULL;
+ }
}
if (sig->hasthis && method->klass->valuetype) {
@@ -1144,8 +1183,10 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
if (!(sig && method == tramp_info->method)) {
mono_error_init (&err);
sig = mono_method_signature_checked (method, &err);
- if (!sig)
- mono_error_raise_exception (&err);
+ if (!sig) {
+ mono_error_set_pending_exception (&err);
+ return NULL;
+ }
}
callvirt = !delegate->target && sig->hasthis;
@@ -1194,7 +1235,11 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
if (enable_caching && delegate->method_code && *delegate->method_code) {
delegate->method_ptr = *delegate->method_code;
} else {
- compiled_method = addr = mono_compile_method (method);
+ compiled_method = addr = mono_jit_compile_method (method, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
addr = mini_add_method_trampoline (method, compiled_method, need_rgctx_tramp, need_unbox_tramp);
delegate->method_ptr = addr;
if (enable_caching && delegate->method_code)
@@ -1220,7 +1265,11 @@ mono_delegate_trampoline (mgreg_t *regs, guint8 *code, gpointer *arg, guint8* tr
if (!code) {
/* The general, unoptimized case */
m = mono_marshal_get_delegate_invoke (invoke, delegate);
- code = (guint8 *)mono_compile_method (m);
+ code = (guint8 *)mono_jit_compile_method (m, &error);
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
code = (guint8 *)mini_add_method_trampoline (m, code, mono_method_needs_static_rgctx_invoke (m, FALSE), FALSE);
}
@@ -1405,6 +1454,7 @@ mono_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, M
gpointer
mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean add_sync_wrapper)
{
+ MonoError error;
MonoJitInfo *ji;
gpointer code;
guint32 code_size = 0;
@@ -1419,8 +1469,12 @@ mono_create_jump_trampoline (MonoDomain *domain, MonoMethod *method, gboolean ad
if (code && !ji->has_generic_jit_info && !(method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED))
return code;
- if (mono_llvm_only)
- return mono_jit_compile_method (method);
+ if (mono_llvm_only) {
+ code = mono_jit_compile_method (method, &error);
+ if (!mono_error_ok (&error))
+ mono_error_raise_exception (&error);
+ return code;
+ }
mono_domain_lock (domain);
code = g_hash_table_lookup (domain_jit_info (domain)->jump_trampoline_hash, method);
@@ -1459,6 +1513,7 @@ method_not_found (void)
gpointer
mono_create_jit_trampoline_in_domain (MonoDomain *domain, MonoMethod *method)
{
+ MonoError error;
gpointer tramp;
if (mono_aot_only) {
@@ -1473,7 +1528,10 @@ mono_create_jit_trampoline_in_domain (MonoDomain *domain, MonoMethod *method)
/* These wrappers are not generated */
return method_not_found;
/* Methods are lazily initialized on first call, so this can't lead recursion */
- return mono_compile_method (method);
+ code = mono_jit_compile_method (method, &error);
+ if (!mono_error_ok (&error))
+ mono_error_raise_exception (&error);
+ return code;
}
}
diff --git a/mono/mini/mini-x86.c b/mono/mini/mini-x86.c
index dfea009165d..03e2eca5272 100644
--- a/mono/mini/mini-x86.c
+++ b/mono/mini/mini-x86.c
@@ -1096,8 +1096,7 @@ mono_arch_allocate_vars (MonoCompile *cfg)
offsets = mono_allocate_stack_slots (cfg, TRUE, &locals_stack_size, &locals_stack_align);
if (locals_stack_size > MONO_ARCH_MAX_FRAME_SIZE) {
char *mname = mono_method_full_name (cfg->method, TRUE);
- cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
- cfg->exception_message = g_strdup_printf ("Method %s stack is too big.", mname);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Method %s stack is too big.", mname));
g_free (mname);
return;
}
diff --git a/mono/mini/mini.c b/mono/mini/mini.c
index 7a490f01304..c7306b08998 100644
--- a/mono/mini/mini.c
+++ b/mono/mini/mini.c
@@ -1208,7 +1208,7 @@ mini_assembly_can_skip_verification (MonoDomain *domain, MonoMethod *method)
/*
* mini_method_verify:
*
- * Verify the method using the new verfier.
+ * Verify the method using the verfier.
*
* Returns true if the method is invalid.
*/
@@ -1217,7 +1217,6 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile)
{
GSList *tmp, *res;
gboolean is_fulltrust;
- MonoLoaderError *error;
if (method->verification_success)
return FALSE;
@@ -1230,11 +1229,13 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile)
res = mono_method_verify_with_current_settings (method, cfg->skip_visibility, is_fulltrust);
- if ((error = mono_loader_get_last_error ())) {
- if (fail_compile)
- cfg->exception_type = error->exception_type;
- else
+ if (mono_loader_get_last_error ()) {
+ if (fail_compile) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_from_loader_error (&cfg->error);
+ } else {
mono_loader_clear_error ();
+ }
if (res)
mono_free_verify_list (res);
return TRUE;
@@ -1256,8 +1257,21 @@ mini_method_verify (MonoCompile *cfg, MonoMethod *method, gboolean fail_compile)
if (info->info.status == MONO_VERIFY_NOT_VERIFIABLE && (!is_fulltrust || info->exception_type == MONO_EXCEPTION_METHOD_ACCESS || info->exception_type == MONO_EXCEPTION_FIELD_ACCESS)) {
if (fail_compile) {
char *method_name = mono_method_full_name (method, TRUE);
- cfg->exception_type = info->exception_type;
- cfg->exception_message = g_strdup_printf ("Error verifying %s: %s", method_name, info->info.message);
+ char *msg = g_strdup_printf ("Error verifying %s: %s", method_name, info->info.message);
+
+ if (info->exception_type == MONO_EXCEPTION_METHOD_ACCESS)
+ mono_error_set_generic_error (&cfg->error, "System", "MethodAccessException", "%s", msg);
+ else if (info->exception_type == info->exception_type == MONO_EXCEPTION_FIELD_ACCESS)
+ mono_error_set_generic_error (&cfg->error, "System", "FieldAccessException", "%s", msg);
+ else if (info->exception_type == MONO_EXCEPTION_UNVERIFIABLE_IL)
+ mono_error_set_generic_error (&cfg->error, "System.Security", "VerificationException", msg);
+ if (!mono_error_ok (&cfg->error)) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ g_free (msg);
+ } else {
+ cfg->exception_type = info->exception_type;
+ cfg->exception_message = msg;
+ }
g_free (method_name);
}
mono_free_verify_list (res);
@@ -3472,13 +3486,11 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
header = cfg->header;
if (!header) {
- MonoLoaderError *error;
-
- if ((error = mono_loader_get_last_error ())) {
- cfg->exception_type = error->exception_type;
+ if (mono_loader_get_last_error ()) {
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_from_loader_error (&cfg->error);
} else {
- cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
- cfg->exception_message = g_strdup_printf ("Missing or incorrect header for method %s", cfg->method->name);
+ mono_cfg_set_exception_invalid_program (cfg, g_strdup_printf ("Missing or incorrect header for method %s", cfg->method->name));
}
if (MONO_METHOD_COMPILE_END_ENABLED ())
MONO_PROBE_METHOD_COMPILE_END (method, FALSE);
@@ -4135,6 +4147,14 @@ mono_cfg_set_exception (MonoCompile *cfg, int type)
cfg->exception_type = type;
}
+/* Assumes ownership of the MSG argument */
+void
+mono_cfg_set_exception_invalid_program (MonoCompile *cfg, char *msg)
+{
+ mono_cfg_set_exception (cfg, MONO_EXCEPTION_MONO_ERROR);
+ mono_error_set_generic_error (&cfg->error, "System", "InvalidProgramException", msg);
+}
+
#endif /* DISABLE_JIT */
static MonoJitInfo*
@@ -4170,7 +4190,7 @@ create_jit_info_for_trampoline (MonoMethod *wrapper, MonoTrampInfo *info)
* Main entry point for the JIT.
*/
gpointer
-mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex)
+mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoError *error)
{
MonoCompile *cfg;
gpointer code = NULL;
@@ -4181,6 +4201,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
GTimer *jit_timer;
MonoMethod *prof_method, *shared;
+ mono_error_init (error);
+
if ((method->iflags & METHOD_IMPL_ATTRIBUTE_INTERNAL_CALL) ||
(method->flags & METHOD_ATTRIBUTE_PINVOKE_IMPL)) {
MonoMethod *nm;
@@ -4243,7 +4265,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
full_name = mono_method_full_name (method, TRUE);
msg = g_strdup_printf ("Unrecognizable runtime implemented method '%s'", full_name);
- *jit_ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", msg);
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", msg);
+ mono_error_set_exception_instance (error, ex);
g_free (full_name);
g_free (msg);
return NULL;
@@ -4286,7 +4309,8 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
char *fullname = mono_method_full_name (method, TRUE);
char *msg = g_strdup_printf ("Attempting to JIT compile method '%s' while running with --aot-only. See http://docs.xamarin.com/ios/about/limitations for more information.\n", fullname);
- *jit_ex = mono_get_exception_execution_engine (msg);
+ ex = mono_get_exception_execution_engine (msg);
+ mono_error_set_exception_instance (error, ex);
g_free (fullname);
g_free (msg);
@@ -4311,53 +4335,26 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
case MONO_EXCEPTION_FILE_NOT_FOUND:
case MONO_EXCEPTION_BAD_IMAGE: {
/* Throw a type load exception if needed */
- MonoLoaderError *error = mono_loader_get_last_error ();
-
- if (error) {
- ex = mono_loader_error_prepare_exception (error);
+ if (cfg->exception_ptr) {
+ ex = mono_class_get_exception_for_failure ((MonoClass *)cfg->exception_ptr);
} else {
- if (cfg->exception_ptr) {
- ex = mono_class_get_exception_for_failure ((MonoClass *)cfg->exception_ptr);
- } else {
- if (cfg->exception_type == MONO_EXCEPTION_MISSING_FIELD)
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MissingFieldException", cfg->exception_message);
- else if (cfg->exception_type == MONO_EXCEPTION_MISSING_METHOD)
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MissingMethodException", cfg->exception_message);
- else if (cfg->exception_type == MONO_EXCEPTION_TYPE_LOAD)
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "TypeLoadException", cfg->exception_message);
- else if (cfg->exception_type == MONO_EXCEPTION_FILE_NOT_FOUND)
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System.IO", "FileNotFoundException", cfg->exception_message);
- else if (cfg->exception_type == MONO_EXCEPTION_BAD_IMAGE)
- ex = mono_get_exception_bad_image_format (cfg->exception_message);
- else
- g_assert_not_reached ();
- }
+ if (cfg->exception_type == MONO_EXCEPTION_MISSING_FIELD)
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MissingFieldException", cfg->exception_message);
+ else if (cfg->exception_type == MONO_EXCEPTION_MISSING_METHOD)
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MissingMethodException", cfg->exception_message);
+ else if (cfg->exception_type == MONO_EXCEPTION_TYPE_LOAD)
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "TypeLoadException", cfg->exception_message);
+ else if (cfg->exception_type == MONO_EXCEPTION_FILE_NOT_FOUND)
+ ex = mono_exception_from_name_msg (mono_defaults.corlib, "System.IO", "FileNotFoundException", cfg->exception_message);
+ else if (cfg->exception_type == MONO_EXCEPTION_BAD_IMAGE)
+ ex = mono_get_exception_bad_image_format (cfg->exception_message);
+ else
+ g_assert_not_reached ();
}
break;
}
- case MONO_EXCEPTION_INVALID_PROGRAM:
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "InvalidProgramException", cfg->exception_message);
- break;
- case MONO_EXCEPTION_UNVERIFIABLE_IL:
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System.Security", "VerificationException", cfg->exception_message);
- break;
- case MONO_EXCEPTION_METHOD_ACCESS:
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "MethodAccessException", cfg->exception_message);
- break;
- case MONO_EXCEPTION_FIELD_ACCESS:
- ex = mono_exception_from_name_msg (mono_defaults.corlib, "System", "FieldAccessException", cfg->exception_message);
- break;
- case MONO_EXCEPTION_OBJECT_SUPPLIED: {
- MonoException *exp = (MonoException *)cfg->exception_ptr;
- MONO_GC_UNREGISTER_ROOT (cfg->exception_ptr);
-
- ex = exp;
- break;
- }
- case MONO_EXCEPTION_OUT_OF_MEMORY:
- ex = mono_domain_get ()->out_of_memory_ex;
- break;
case MONO_EXCEPTION_MONO_ERROR:
+ // FIXME: MonoError has no copy ctor
g_assert (!mono_error_ok (&cfg->error));
ex = mono_error_convert_to_exception (&cfg->error);
break;
@@ -4370,7 +4367,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
mono_profiler_method_end_jit (method, NULL, MONO_PROFILE_FAILED);
mono_destroy_compile (cfg);
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
@@ -4467,7 +4464,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
if (!vtable) {
ex = mono_class_get_exception_for_failure (method->klass);
g_assert (ex);
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
@@ -4487,7 +4484,7 @@ mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, in
ex = mono_runtime_class_init_full (vtable, FALSE);
if (ex) {
- *jit_ex = ex;
+ mono_error_set_exception_instance (error, ex);
return NULL;
}
return code;
diff --git a/mono/mini/mini.h b/mono/mini/mini.h
index 5cf8fb55038..db5c133266f 100644
--- a/mono/mini/mini.h
+++ b/mono/mini/mini.h
@@ -2325,8 +2325,8 @@ MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJum
gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors) MONO_LLVM_INTERNAL;
gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method);
-gpointer mono_jit_compile_method (MonoMethod *method);
-gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoException **jit_ex);
+gpointer mono_jit_compile_method (MonoMethod *method, MonoError *error);
+gpointer mono_jit_compile_method_inner (MonoMethod *method, MonoDomain *target_domain, int opt, MonoError *error);
MonoLMF * mono_get_lmf (void);
MonoLMF** mono_get_lmf_addr (void);
void mono_set_lmf (MonoLMF *lmf);
@@ -2913,10 +2913,10 @@ gboolean
mono_class_generic_sharing_enabled (MonoClass *klass);
gpointer
-mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot);
+mono_class_fill_runtime_generic_context (MonoVTable *class_vtable, guint32 slot, MonoError *error);
gpointer
-mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot);
+mono_method_fill_runtime_generic_context (MonoMethodRuntimeGenericContext *mrgctx, guint32 slot, MonoError *error);
MonoMethodRuntimeGenericContext*
mono_method_lookup_rgctx (MonoVTable *class_vtable, MonoGenericInst *method_inst);
@@ -3005,6 +3005,7 @@ guint mono_type_to_regmove (MonoCompile *cfg, MonoType *type) MONO_LLVM_INTERNAL
void mono_cfg_add_try_hole (MonoCompile *cfg, MonoExceptionClause *clause, guint8 *start, MonoBasicBlock *bb);
void mono_cfg_set_exception (MonoCompile *cfg, int type);
+void mono_cfg_set_exception_invalid_program (MonoCompile *cfg, char *msg);
gboolean mini_type_is_reference (MonoType *type);
gboolean mini_type_is_vtype (MonoType *t) MONO_LLVM_INTERNAL;
diff --git a/mono/mini/seq-points.c b/mono/mini/seq-points.c
index 9afb2ed7993..ac22ca41f07 100644
--- a/mono/mini/seq-points.c
+++ b/mono/mini/seq-points.c
@@ -11,45 +11,29 @@
#include "seq-points.h"
static void
-insert_pred_seq_point (MonoBasicBlock *in_bb, MonoInst *ins, GSList **next)
+collect_pred_seq_points (MonoBasicBlock *bb, MonoInst *ins, GSList **next, int depth)
{
+ int i;
+ MonoBasicBlock *in_bb;
GSList *l;
- int src_index = in_bb->last_seq_point->backend.size;
- int dst_index = ins->backend.size;
-
- /* bb->in_bb might contain duplicates */
- for (l = next [src_index]; l; l = l->next)
- if (GPOINTER_TO_UINT (l->data) == dst_index)
- break;
- if (!l)
- next [src_index] = g_slist_append (next [src_index], GUINT_TO_POINTER (dst_index));
-}
-static void
-collect_pred_seq_points (MonoBasicBlock *bb, MonoInst *ins, GSList **next, GHashTable *memoize)
-{
- const gpointer MONO_SEQ_SEEN_LOOP = GINT_TO_POINTER(-1);
+ for (i = 0; i < bb->in_count; ++i) {
+ in_bb = bb->in_bb [i];
- for (int i = 0; i < bb->in_count; ++i) {
- MonoBasicBlock *in_bb = bb->in_bb [i];
- gpointer result = g_hash_table_lookup (memoize, in_bb);
+ if (in_bb->last_seq_point) {
+ int src_index = in_bb->last_seq_point->backend.size;
+ int dst_index = ins->backend.size;
- if (result == MONO_SEQ_SEEN_LOOP) {
- // We've looped or handled this before, exit early.
- // No last sequence points to find.
- continue;
- } else if (in_bb->last_seq_point) {
- // if last seq point, insert into next
- insert_pred_seq_point (in_bb, ins, next);
+ /* bb->in_bb might contain duplicates */
+ for (l = next [src_index]; l; l = l->next)
+ if (GPOINTER_TO_UINT (l->data) == dst_index)
+ break;
+ if (!l)
+ next [src_index] = g_slist_append (next [src_index], GUINT_TO_POINTER (dst_index));
} else {
- // Compute predecessors of in_bb
-
- // Insert/remove sentinel into the memoize table to detect loops containing in_bb
- // This works to ensure that we only have a basic block on the stack once
- // at any given time
- g_hash_table_insert (memoize, in_bb, MONO_SEQ_SEEN_LOOP);
- collect_pred_seq_points (in_bb, ins, next, memoize);
- g_hash_table_remove (memoize, in_bb);
+ /* Have to look at its predecessors */
+ if (depth < 5)
+ collect_pred_seq_points (in_bb, ins, next, depth + 1);
}
}
}
@@ -91,7 +75,6 @@ mono_save_seq_point_info (MonoCompile *cfg)
* following it, this is needed to implement 'step over' in the debugger agent.
*/
next = g_new0 (GSList*, cfg->seq_points->len);
- GHashTable *memoize = g_hash_table_new (NULL, NULL);
for (bb = cfg->bb_entry; bb; bb = bb->next_bb) {
bb_seq_points = g_slist_reverse (bb->seq_points);
last = NULL;
@@ -109,7 +92,7 @@ mono_save_seq_point_info (MonoCompile *cfg)
next [last->backend.size] = g_slist_append (next [last->backend.size], GUINT_TO_POINTER (ins->backend.size));
} else {
/* Link with the last bb in the previous bblocks */
- collect_pred_seq_points (bb, ins, next, memoize);
+ collect_pred_seq_points (bb, ins, next, 0);
}
last = ins;
@@ -140,7 +123,6 @@ mono_save_seq_point_info (MonoCompile *cfg)
}
}
}
- g_hash_table_destroy (memoize);
if (cfg->verbose_level > 2) {
printf ("\nSEQ POINT MAP: \n");
diff --git a/mono/mini/tramp-s390x.c b/mono/mini/tramp-s390x.c
index 4a604f97e16..eb61dc05cd4 100644
--- a/mono/mini/tramp-s390x.c
+++ b/mono/mini/tramp-s390x.c
@@ -48,6 +48,7 @@
#include "mini.h"
#include "mini-s390x.h"
#include "support-s390x.h"
+#include "jit-icalls.h"
/*========================= End of Includes ========================*/
@@ -57,6 +58,7 @@
typedef struct {
guint8 stk[S390_MINIMAL_STACK_SIZE]; /* Standard s390x stack */
+ guint64 saveFn; /* Call address */
struct MonoLMF LMF; /* LMF */
} trampStack_t;
@@ -308,15 +310,22 @@ mono_arch_create_generic_trampoline (MonoTrampolineType tramp_type, MonoTrampInf
S390_SET (buf, s390_r1, tramp);
s390_basr (buf, s390_r14, s390_r1);
- /* OK, code address is now on r2. Move it to r1, so that we
- can restore r2 and use it from r1 later */
- s390_lgr (buf, s390_r1, s390_r2);
+ /* OK, code address is now on r2. Save it, so that we
+ can restore r2 and use it later */
+ s390_stg (buf, s390_r2, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn));
+
+ /* Check for thread interruption */
+ S390_SET (buf, s390_r1, (guint8 *)mono_interruption_checkpoint_from_trampoline);
+ s390_basr (buf, s390_r14, s390_r1);
/*----------------------------------------------------------
STEP 3: Restore the LMF
----------------------------------------------------------*/
restoreLMF(buf, STK_BASE, sizeof(trampStack_t));
+ /* Reload result */
+ s390_lg (buf, s390_r1, 0, STK_BASE, G_STRUCT_OFFSET(trampStack_t, saveFn));
+
/*----------------------------------------------------------
STEP 4: call the compiled method
----------------------------------------------------------*/
diff --git a/mono/profiler/ptestrunner.pl b/mono/profiler/ptestrunner.pl
index fc29b43b260..2113c25135f 100755
--- a/mono/profiler/ptestrunner.pl
+++ b/mono/profiler/ptestrunner.pl
@@ -6,7 +6,8 @@ use strict;
my $builddir = shift || die "Usage: ptestrunner.pl mono_build_dir\n";
my @errors = ();
-my $total_errors = 0;
+my $total_errors = 0; # this is reset before each test
+my $global_errors = 0;
my $report;
my $profbuilddir = $builddir . "/mono/profiler";
@@ -106,7 +107,7 @@ report_errors ();
emit_nunit_report();
-exit ($total_errors? 1: 0);
+exit ($global_errors ? 1 : 0);
# utility functions
sub append_path {
@@ -156,6 +157,7 @@ sub report_errors
foreach my $e (@errors) {
print "Error: $e\n";
$total_errors++;
+ $global_errors++;
}
print "Total errors: $total_errors\n" if $total_errors;
#print $report;
@@ -168,7 +170,7 @@ sub emit_nunit_report
use Net::Domain qw(hostname hostfqdn);
use locale;
- my $failed = $total_errors ? 1 : 0;
+ my $failed = $global_errors ? 1 : 0;
my $successbool;
my $total = 1;
my $mylocale = setlocale (LC_CTYPE);
diff --git a/mono/utils/mono-error-internals.h b/mono/utils/mono-error-internals.h
index 926e76c9bbd..d16f9ef6602 100644
--- a/mono/utils/mono-error-internals.h
+++ b/mono/utils/mono-error-internals.h
@@ -40,7 +40,9 @@ typedef struct {
#define is_ok(error) ((error)->error_code == MONO_ERROR_NONE)
void
-mono_error_assert_ok (MonoError *error);
+mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno);
+
+#define mono_error_assert_ok(e) mono_error_assert_ok_pos (e, __FILE__, __LINE__);
void
mono_error_dup_strings (MonoError *error, gboolean dup_strings);
diff --git a/mono/utils/mono-error.c b/mono/utils/mono-error.c
index ca3350c5fd4..5673719059b 100644
--- a/mono/utils/mono-error.c
+++ b/mono/utils/mono-error.c
@@ -119,12 +119,12 @@ mono_error_ok (MonoError *error)
}
void
-mono_error_assert_ok (MonoError *error)
+mono_error_assert_ok_pos (MonoError *error, const char* filename, int lineno)
{
if (mono_error_ok (error))
return;
- g_error ("%s\n", mono_error_get_message (error));
+ g_error ("%s:%d: %s\n", filename, lineno, mono_error_get_message (error));
}
unsigned short
@@ -347,6 +347,7 @@ mono_error_set_exception_instance (MonoError *oerror, MonoException *exc)
{
MonoErrorInternal *error = (MonoErrorInternal*)oerror;
+ mono_error_prepare (error);
error->error_code = MONO_ERROR_EXCEPTION_INSTANCE;
error->exn.instance_handle = mono_gchandle_new (exc ? &exc->object : NULL, FALSE);
}
diff --git a/mono/utils/mono-publib.h b/mono/utils/mono-publib.h
index c9becb2bf5e..30c80704399 100644
--- a/mono/utils/mono-publib.h
+++ b/mono/utils/mono-publib.h
@@ -73,6 +73,22 @@ MONO_API void mono_free (void *);
#define MONO_CONST_RETURN const
+
+#if defined (MONO_INSIDE_RUNTIME)
+
+#if defined (__clang__)
+#define MONO_RT_EXTERNAL_ONLY __attribute__ ((unavailable("The mono runtime must not call this function")))
+#elif defined (__GNUC__)
+#define MONO_RT_EXTERNAL_ONLY __attribute__ ((error("The mono runtime must not call this function")))
+#else
+#define MONO_RT_EXTERNAL_ONLY
+#endif /* __clang__ */
+
+#else
+#define MONO_RT_EXTERNAL_ONLY
+#endif /* MONO_INSIDE_RUNTIME */
+
+
MONO_END_DECLS
#endif /* __MONO_PUBLIB_H__ */